Conditions | 7 |
Paths | 8 |
Total Lines | 27 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function processNode(Node $node, Scope $scope): array |
||
33 | { |
||
34 | if ($node->isAnonymous()) { |
||
|
|||
35 | return []; |
||
36 | } |
||
37 | |||
38 | $classReflection = $scope->getClassReflection(); |
||
39 | if (!$classReflection instanceof ClassReflection) { |
||
40 | return []; |
||
41 | } |
||
42 | |||
43 | $className = $classReflection->getName(); |
||
44 | $pos = strrpos($className, '\\'); |
||
45 | $shortName = $pos === false ? $className : substr($className, $pos + 1); |
||
46 | |||
47 | if (substr($shortName, -strlen($this->suffix)) !== $this->suffix) { |
||
48 | return []; |
||
49 | } |
||
50 | |||
51 | if ( |
||
52 | $className !== $this->expectedParent && |
||
53 | !$classReflection->isSubclassOf($this->expectedParent) |
||
54 | ) { |
||
55 | return [sprintf('Class %s should extend %s', $className, $this->expectedParent)]; |
||
56 | } |
||
57 | |||
58 | return []; |
||
59 | } |
||
61 |