| Conditions | 2 |
| Paths | 2 |
| Total Lines | 66 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 44 | public function registerBundles(): array |
||
| 45 | { |
||
| 46 | $bundles = [ |
||
| 47 | new \Sylius\Bundle\OrderBundle\SyliusOrderBundle(), |
||
| 48 | new \Sylius\Bundle\MoneyBundle\SyliusMoneyBundle(), |
||
| 49 | new \Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle(), |
||
| 50 | new \Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(), |
||
| 51 | new \Sylius\Bundle\ProductBundle\SyliusProductBundle(), |
||
| 52 | new \Sylius\Bundle\ChannelBundle\SyliusChannelBundle(), |
||
| 53 | new \Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(), |
||
| 54 | new \Sylius\Bundle\TaxationBundle\SyliusTaxationBundle(), |
||
| 55 | new \Sylius\Bundle\ShippingBundle\SyliusShippingBundle(), |
||
| 56 | new \Sylius\Bundle\PaymentBundle\SyliusPaymentBundle(), |
||
| 57 | new \Sylius\Bundle\MailerBundle\SyliusMailerBundle(), |
||
| 58 | new \Sylius\Bundle\PromotionBundle\SyliusPromotionBundle(), |
||
| 59 | new \Sylius\Bundle\AddressingBundle\SyliusAddressingBundle(), |
||
| 60 | new \Sylius\Bundle\InventoryBundle\SyliusInventoryBundle(), |
||
| 61 | new \Sylius\Bundle\TaxonomyBundle\SyliusTaxonomyBundle(), |
||
| 62 | new \Sylius\Bundle\UserBundle\SyliusUserBundle(), |
||
| 63 | new \Sylius\Bundle\CustomerBundle\SyliusCustomerBundle(), |
||
| 64 | new \Sylius\Bundle\UiBundle\SyliusUiBundle(), |
||
| 65 | new \Sylius\Bundle\ReviewBundle\SyliusReviewBundle(), |
||
| 66 | new \Sylius\Bundle\CoreBundle\SyliusCoreBundle(), |
||
| 67 | new \Sylius\Bundle\ResourceBundle\SyliusResourceBundle(), |
||
| 68 | new \Sylius\Bundle\GridBundle\SyliusGridBundle(), |
||
| 69 | new \winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(), |
||
| 70 | |||
| 71 | new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
||
| 72 | new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), |
||
| 73 | new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
||
| 74 | new \Symfony\Bundle\MonologBundle\MonologBundle(), |
||
| 75 | new \Symfony\Bundle\SecurityBundle\SecurityBundle(), |
||
| 76 | new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), |
||
| 77 | new \Symfony\Bundle\TwigBundle\TwigBundle(), |
||
| 78 | |||
| 79 | new \Sonata\CoreBundle\SonataCoreBundle(), |
||
| 80 | new \Sonata\BlockBundle\SonataBlockBundle(), |
||
| 81 | new \Sonata\IntlBundle\SonataIntlBundle(), |
||
| 82 | new \Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(), |
||
| 83 | new \JMS\SerializerBundle\JMSSerializerBundle(), |
||
| 84 | new \FOS\RestBundle\FOSRestBundle(), |
||
| 85 | |||
| 86 | new \Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), |
||
| 87 | new \Knp\Bundle\MenuBundle\KnpMenuBundle(), |
||
| 88 | new \Liip\ImagineBundle\LiipImagineBundle(), |
||
| 89 | new \Payum\Bundle\PayumBundle\PayumBundle(), |
||
| 90 | new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), |
||
| 91 | new \WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), |
||
| 92 | |||
| 93 | new \Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), |
||
| 94 | new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), |
||
| 95 | new \Sylius\Bundle\FixturesBundle\SyliusFixturesBundle(), |
||
| 96 | new \Sylius\Bundle\PayumBundle\SyliusPayumBundle(), // must be added after PayumBundle. |
||
| 97 | new \Sylius\Bundle\ThemeBundle\SyliusThemeBundle(), // must be added after FrameworkBundle |
||
| 98 | |||
| 99 | new \Symfony\Bundle\WebServerBundle\WebServerBundle(), // allows to run build in web server. Not recommended for prod environment |
||
| 100 | ]; |
||
| 101 | |||
| 102 | if (in_array($this->getEnvironment(), ['dev', 'test', 'test_cached'], true)) { |
||
| 103 | $bundles[] = new \Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); |
||
| 104 | $bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle(); |
||
| 105 | $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); |
||
| 106 | } |
||
| 107 | |||
| 108 | return $bundles; |
||
| 109 | } |
||
| 110 | |||
| 189 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.