Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
44 | private function setCustomRepositoryClass(ClassMetadata $metadata) |
||
45 | { |
||
46 | try { |
||
47 | $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName()); |
||
48 | } catch (\InvalidArgumentException $exception) { |
||
49 | return; |
||
50 | } |
||
51 | |||
52 | if ($resourceMetadata->hasClass('repository')) { |
||
53 | $metadata->setCustomRepositoryClass($resourceMetadata->getClass('repository')); |
||
54 | } |
||
55 | } |
||
56 | } |
||
57 |
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.