diff --git a/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php b/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php index bff597af..72f39313 100644 --- a/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php +++ b/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php @@ -15,6 +15,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Scalar\Int_; use PHPStan\Type\ObjectType; +use PHPStan\Type\ThisType; use PHPStan\Type\Type; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -144,6 +145,10 @@ private function refactorPropertyFetch(PropertyFetch $propertyFetch): ?Ternary private function skipPhpParserInternalToken(Type $type): bool { + if ($type instanceof ThisType) { + $type = $type->getStaticObjectType(); + } + if ($type instanceof ObjectType) { return $type->isInstanceOf('PhpParser\Internal\TokenPolyfill') ->yes();