Skip to content

Commit 475547d

Browse files
Merge branch '10.0'
2 parents d888fc3 + 842834f commit 475547d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/StaticAnalysis/ExecutableLinesFindingVisitor.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,19 @@ public function enterNode(Node $node): void
8181
return;
8282
}
8383

84+
if ($node instanceof Node\Stmt\Interface_) {
85+
foreach (range($node->getStartLine(), $node->getEndLine()) as $line) {
86+
$this->unsets[$line] = true;
87+
}
88+
89+
return;
90+
}
91+
8492
if ($node instanceof Node\Stmt\Declare_ ||
8593
$node instanceof Node\Stmt\DeclareDeclare ||
8694
$node instanceof Node\Stmt\Else_ ||
8795
$node instanceof Node\Stmt\EnumCase ||
8896
$node instanceof Node\Stmt\Finally_ ||
89-
$node instanceof Node\Stmt\Interface_ ||
9097
$node instanceof Node\Stmt\Label ||
9198
$node instanceof Node\Stmt\Namespace_ ||
9299
$node instanceof Node\Stmt\Nop ||

tests/_files/source_for_branched_exec_lines.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,18 @@ public function withMultilineStrings()
562562

563563
interface MyInterface
564564
{
565+
public const MY_INTERFACE_CONST = 1;
566+
public const MY_INTERFACE_COMPLEX_CONST = [
567+
1,
568+
'string',
569+
];
565570
public function myMethod();
566571
}
567572

568573
trait MyTrait
569574
{
570575
public function myTrait()
571-
{} // +1
576+
{} // +3
572577
}
573578

574579
abstract class MyAbstractClass implements MyInterface

tests/_files/source_for_branched_exec_lines_php82.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ public function bar((A&B)|null $entity)
88
return $entity; // +1
99
}
1010
}
11+
12+
// Const in traits
13+
trait MyConstInTrait
14+
{
15+
public const MY_TRAIT_CONST = 1;
16+
}

0 commit comments

Comments
 (0)