From 51441c14bf47130abb825decb866f8c3cf6821dc Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Sun, 1 Jan 2023 09:18:01 +0100 Subject: [PATCH] Fix ConstFecth on Interface --- src/StaticAnalysis/ExecutableLinesFindingVisitor.php | 1 + tests/_files/source_for_branched_exec_lines.php | 5 ++++- tests/_files/source_for_branched_exec_lines_php80.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/StaticAnalysis/ExecutableLinesFindingVisitor.php b/src/StaticAnalysis/ExecutableLinesFindingVisitor.php index 9f9a27b0e..506f27524 100644 --- a/src/StaticAnalysis/ExecutableLinesFindingVisitor.php +++ b/src/StaticAnalysis/ExecutableLinesFindingVisitor.php @@ -101,6 +101,7 @@ public function enterNode(Node $node): void $node instanceof Node\Stmt\TryCatch || $node instanceof Node\Stmt\Use_ || $node instanceof Node\Stmt\UseUse || + $node instanceof Node\Expr\ConstFetch || $node instanceof Node\Expr\Match_ || $node instanceof Node\Expr\Variable || $node instanceof Node\ComplexType || diff --git a/tests/_files/source_for_branched_exec_lines.php b/tests/_files/source_for_branched_exec_lines.php index b2e4c9e84..e269d22b5 100644 --- a/tests/_files/source_for_branched_exec_lines.php +++ b/tests/_files/source_for_branched_exec_lines.php @@ -422,7 +422,10 @@ function // 0 ( // 0 $var2 // 0 = // 0 - 2 // 0 + 2, // 0 + $var3 // 0 + = // 0 + null // 0 ) // 0 use // 0 ( // 0 diff --git a/tests/_files/source_for_branched_exec_lines_php80.php b/tests/_files/source_for_branched_exec_lines_php80.php index 1ba01dcec..4a977c3a6 100644 --- a/tests/_files/source_for_branched_exec_lines_php80.php +++ b/tests/_files/source_for_branched_exec_lines_php80.php @@ -39,4 +39,5 @@ interface MyUnion { public function getNameIdentifier(): ?string; public function hasClaim(bool|string $type, mixed $value): bool; + public function getClaims($type1 = null): array; }