Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function createService(ServiceLocatorInterface $serviceLocator) |
||
29 | { |
||
30 | $appServiceLocator = $serviceLocator; |
||
31 | if ($appServiceLocator instanceof AbstractPluginManager) { |
||
32 | $appServiceLocator->getServiceLocator(); |
||
|
|||
33 | } |
||
34 | |||
35 | /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */ |
||
36 | $objectManagerAutoDetector = $appServiceLocator->get(ObjectManagerAutoDetectorInterface::class); |
||
37 | |||
38 | /** @var DoctrineObjectManagerInterface $objectManager */ |
||
39 | $objectManager = $appServiceLocator->get(DoctrineObjectManagerInterface::class); |
||
40 | |||
41 | |||
42 | return new DoctrineObjectHydratorLocator($objectManagerAutoDetector, $objectManager); |
||
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: