Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
20 | 19 | public function apply(AbstractNode $node) |
|
21 | { |
||
22 | 19 | $forbiddenChildTypes = explode( |
|
23 | 19 | $this->getStringProperty('delimiter'), |
|
24 | 19 | $this->getStringProperty('forbiddenChildren') |
|
25 | ); |
||
26 | |||
27 | 19 | /** @var AbstractNode|ASTReturnStatement $returnStatement */ |
|
28 | 9 | foreach ($node->findChildrenOfType('ReturnStatement') as $returnStatement) { |
|
29 | 9 | foreach ($forbiddenChildTypes as $forbiddenChildType) { |
|
30 | $child = $returnStatement->getFirstChildOfType($forbiddenChildType); |
||
31 | 9 | ||
32 | 3 | if (null === $child) { |
|
33 | 3 | continue; |
|
34 | 9 | } |
|
35 | 19 | ||
36 | 19 | $reflectChild = new \ReflectionClass($child->getNode()); |
|
37 | |||
38 | if ('AST' . $forbiddenChildType === $reflectChild->getShortName()) { |
||
39 | $this->addViolation($returnStatement, [$forbiddenChildType]); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | 19 | } |
|
44 | } |
||
46 |