Skip to content

Commit f270792

Browse files
authored
Fix ThisType on DowngradePhpTokenRector (#240)
1 parent bb0c6c5 commit f270792

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PhpParser\Node\Name;
1616
use PhpParser\Node\Scalar\Int_;
1717
use PHPStan\Type\ObjectType;
18+
use PHPStan\Type\ThisType;
1819
use PHPStan\Type\Type;
1920
use Rector\Rector\AbstractRector;
2021
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -144,6 +145,10 @@ private function refactorPropertyFetch(PropertyFetch $propertyFetch): ?Ternary
144145

145146
private function skipPhpParserInternalToken(Type $type): bool
146147
{
148+
if ($type instanceof ThisType) {
149+
$type = $type->getStaticObjectType();
150+
}
151+
147152
if ($type instanceof ObjectType) {
148153
return $type->isInstanceOf('PhpParser\Internal\TokenPolyfill')
149154
->yes();

0 commit comments

Comments
 (0)