File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 17
17
use PhpParser \Node \Stmt \ClassMethod ;
18
18
use PhpParser \Node \Stmt \Function_ ;
19
19
use PhpParser \Node \Stmt \Trait_ ;
20
+ use PhpParser \NodeTraverser ;
20
21
use PhpParser \NodeVisitorAbstract ;
21
22
22
23
final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
@@ -36,19 +37,19 @@ public function __construct(bool $ignoreDeprecated)
36
37
$ this ->ignoreDeprecated = $ ignoreDeprecated ;
37
38
}
38
39
39
- public function enterNode (Node $ node ): void
40
+ public function enterNode (Node $ node ): ? int
40
41
{
41
42
if (!$ node instanceof Class_ &&
42
43
!$ node instanceof Trait_ &&
43
44
!$ node instanceof ClassMethod &&
44
45
!$ node instanceof Function_) {
45
- return ;
46
+ return null ;
46
47
}
47
48
48
49
$ docComment = $ node ->getDocComment ();
49
50
50
51
if ($ docComment === null ) {
51
- return ;
52
+ return null ;
52
53
}
53
54
54
55
if (strpos ($ docComment ->getText (), '@codeCoverageIgnore ' ) !== false ) {
@@ -64,6 +65,12 @@ public function enterNode(Node $node): void
64
65
range ($ node ->getStartLine (), $ node ->getEndLine ())
65
66
);
66
67
}
68
+
69
+ if ($ node instanceof ClassMethod || $ node instanceof Function_) {
70
+ return NodeTraverser::DONT_TRAVERSE_CHILDREN ;
71
+ }
72
+
73
+ return null ;
67
74
}
68
75
69
76
/**
You can’t perform that action at this time.
0 commit comments