8000 [CodeQuality] Skip late static binding use on CompleteDynamicProperti… · rectorphp/rector-src@8028130 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8028130

Browse files
[CodeQuality] Skip late static binding use on CompleteDynamicPropertiesRector (#6938)
* [CodeQuality] Skip late static binding use on CompleteDynamicPropertiesRector * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
1 parent a099fd5 commit 8028130

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Rector\Tests\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector\Fixture;
4+
5+
abstract class SkipLateStaticBinding
6+
{
7+
public const PRIMARY_KEY = 'id';
8+
9+
public function insert(): void
10+
{
11+
$this->{static::PRIMARY_KEY} = 1;
12+
}
13+
}

rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use PhpParser\Node\Expr\MethodCall;
1212
use PhpParser\Node\Expr\PropertyFetch;
1313
use PhpParser\Node\Expr\StaticCall;
14-
use PhpParser\Node\Expr\Variable;
14+
use PhpParser\Node\Identifier;
1515
use PhpParser\Node\Stmt\Class_;
1616
use PhpParser\Node\Stmt\Function_;
1717
use PhpParser\NodeVisitor;
@@ -135,7 +135,7 @@ private function shouldSkipPropertyFetch(PropertyFetch $propertyFetch): bool
135135
return true;
136136
}
137137

138-
return $propertyFetch->name instanceof Variable;
138+
return ! $propertyFetch->name instanceof Identifier;
139139
}
140140

141141
/**

0 commit comments

Comments
 (0)
0