| Conditions | 5 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public function apply(AbstractNode $node) |
||
| 22 | { |
||
| 23 | if (true === $this->isTest($node)) { |
||
|
|
|||
| 24 | return; |
||
| 25 | } |
||
| 26 | |||
| 27 | $maxChainCount = $this->getIntProperty('maxChainCount'); |
||
| 28 | |||
| 29 | foreach ($node->getMethods() as $method) { |
||
| 30 | foreach ($method->findChildrenOfType('MemberPrimaryPrefix') as $memberPrimaryPrefix) { |
||
| 31 | if (null !== $this->getMemberPrimaryPrefixWithChainCount($memberPrimaryPrefix, $maxChainCount)) { |
||
| 32 | $this->addViolation($memberPrimaryPrefix, [$maxChainCount]); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 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.