Skip to content

Commit 8977d45

Browse files
author
Florian Krämer
committed
Fixing a bug observed in a project, but could not reproduce it in a test within a reasonable time. Not sure how to reproduce the problem there.
1 parent 374c570 commit 8977d45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ControlStructureNestingRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private function nodeIsAControlStructure(Node $node): bool
6464
private function getNestingLevel(Node $node, int $currentLevel = 1): int
6565
{
6666
$parent = $node->getAttribute('parent');
67-
if ($this->nodeIsAControlStructure($parent)) {
67+
if ($parent !== null && $this->nodeIsAControlStructure($parent)) {
6868
return $this->getNestingLevel($parent, $currentLevel + 1);
6969
}
7070

0 commit comments

Comments
 (0)