Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
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 |
||
75 | protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void |
||
|
|||
76 | { |
||
77 | $containerBuilder->register('templating')->setSynthetic(true); |
||
78 | $containerBuilder->register('templating.locator')->setSynthetic(true); |
||
79 | $containerBuilder->register('templating.name_parser')->setSynthetic(true); |
||
80 | $containerBuilder->register('mailer')->setSynthetic(true); |
||
81 | |||
82 | $containerBuilder->loadFromExtension('framework', [ |
||
83 | 'secret' => '50n474.U53r', |
||
84 | 'session' => [ |
||
85 | 'handler_id' => 'session.handler.native_file', |
||
86 | 'storage_id' => 'session.storage.mock_file', |
||
87 | 'name' => 'MOCKSESSID', |
||
88 | ], |
||
89 | 'translator' => null, |
||
90 | 'validation' => [ |
||
91 | 'enabled' => true, |
||
92 | ], |
||
93 | 'form' => [ |
||
94 | 'enabled' => true, |
||
95 | ], |
||
96 | 'assets' => null, |
||
97 | 'test' => true, |
||
98 | 'profiler' => [ |
||
99 | 'enabled' => true, |
||
100 | 'collect' => false, |
||
101 | ], |
||
102 | ]); |
||
103 | |||
104 | $containerBuilder->loadFromExtension('security', [ |
||
105 | 'firewalls' => ['api' => ['anonymous' => true]], |
||
106 | 'providers' => ['in_memory' => ['memory' => null]], |
||
107 | ]); |
||
108 | |||
109 | $containerBuilder->loadFromExtension('twig', [ |
||
110 | 'strict_variables' => '%kernel.debug%', |
||
111 | 'exception_controller' => null, |
||
112 | ]); |
||
113 | |||
114 | $containerBuilder->loadFromExtension('doctrine', [ |
||
115 | 'dbal' => [ |
||
116 | 'connections' => [ |
||
117 | 'default' => [ |
||
118 | 'driver' => 'pdo_sqlite', |
||
119 | ], |
||
120 | ], |
||
121 | ], |
||
122 | 'orm' => [ |
||
123 | 'default_entity_manager' => 'default', |
||
124 | ], |
||
125 | ]); |
||
126 | |||
127 | $containerBuilder->loadFromExtension('fos_rest', [ |
||
128 | 'param_fetcher_listener' => true, |
||
129 | ]); |
||
130 | } |
||
131 | |||
137 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.