| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | private function setupServices(Container $app): void |
||
| 31 | { |
||
| 32 | $app['searcher'] = static function ($app) { |
||
| 33 | $saver = $app['config']['save.handler']; |
||
| 34 | |||
| 35 | return $app["searcher.$saver"]; |
||
| 36 | }; |
||
| 37 | |||
| 38 | $app['saver'] = static function ($app) { |
||
| 39 | $saver = $app['config']['save.handler']; |
||
| 40 | |||
| 41 | return new NormalizingSaver($app["saver.$saver"]); |
||
| 42 | }; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: