Skip to content

Commit 1e8be38

Browse files
committed
fix
1 parent f6ebc1e commit 1e8be38

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/NodeAnalyzer/PropertyFetchAnalyzer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use PhpParser\Node\Stmt\Trait_;
2121
use PHPStan\Reflection\ClassReflection;
2222
use PHPStan\Type\ObjectType;
23+
use PHPStan\Type\StaticType;
2324
use PHPStan\Type\ThisType;
2425
use Rector\Enum\ObjectReference;
2526
use Rector\NodeNameResolver\NodeNameResolver;
@@ -61,6 +62,13 @@ public function isLocalPropertyFetch(Node $node): bool
6162
? $this->nodeTypeResolver->getType($node->class)
6263
: $this->nodeTypeResolver->getType($node->var);
6364

65+
// patch clone usage
66+
// @see https://github.com/phpstan/phpstan-src/commit/020adb548011c098cdb2e061019346b0a838c6a4
67+
// @see https://github.com/rectorphp/rector-src/pull/7622
68+
if ($variableType instanceof StaticType && ! $variableType instanceof ThisType) {
69+
$variableType = $variableType->getStaticObjectType();
70+
}
71+
6472
if ($variableType instanceof ObjectType) {
6573
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
6674
if ($classReflection instanceof ClassReflection) {

0 commit comments

Comments
 (0)