Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function __construct(ManagerRegistry $registry, $entityClass) |
||
29 | { |
||
30 | $manager = $registry->getManagerForClass($entityClass); |
||
31 | |||
32 | if ($manager === null) { |
||
33 | throw new LogicException(sprintf( |
||
34 | 'Could not find the entity manager for class "%s". Check your Doctrine configuration to make sure it is configured to load this entity’s metadata.', |
||
35 | $entityClass |
||
36 | )); |
||
37 | } |
||
38 | |||
39 | parent::__construct($manager, $manager->getClassMetadata($entityClass)); |
||
40 | } |
||
41 | } |
||
42 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.