Skip to content

Commit 700aa82

Browse files
Slamdunksebastianbergmann
authored andcommitted
Fix Const in Interface tracking
1 parent 850b746 commit 700aa82

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/StaticAnalysis/ExecutableLinesFindingVisitor.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,19 @@ public function enterNode(Node $node): void
8888
return;
8989
}
9090

91+
if ($node instanceof Node\Stmt\Interface_) {
92+
foreach (range($node->getStartLine(), $node->getEndLine()) as $line) {
93+
$this->unsets[$line] = true;
94+
}
95+
96+
return;
97+
}
98+
9199
if ($node instanceof Node\Stmt\Declare_ ||
92100
$node instanceof Node\Stmt\DeclareDeclare ||
93101
$node instanceof Node\Stmt\Else_ ||
94102
$node instanceof Node\Stmt\EnumCase ||
95103
$node instanceof Node\Stmt\Finally_ ||
96-
$node instanceof Node\Stmt\Interface_ ||
97104
$node instanceof Node\Stmt\Label ||
98105
$node instanceof Node\Stmt\Namespace_ ||
99106
$node instanceof Node\Stmt\Nop ||

tests/_files/source_for_branched_exec_lines.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,17 @@ public function withMultilineStrings()
563563
interface MyInterface
564564
{
565565
public const MY_INTERFACE_CONST = 1;
566+
public const MY_INTERFACE_COMPLEX_CONST = [
567+
1,
568+
'string',
569+
];
566570
public function myMethod();
567571
}
568572

569573
trait MyTrait
570574
{
571575
public function myTrait()
572-
{} // +1
576+
{} // +3
573577
}
574578

575579
abstract class MyAbstractClass implements MyInterface

0 commit comments

Comments
 (0)