Skip to content

Commit 5b054ea

Browse files
authored
[Php81] Handle crash Class parent was not found on MyCLabsMethodCallToEnumConstRector (#6741)
* [Php81] Handle crash Class parent was not found on MyCLabsMethodCallToEnumConstRector * Fix
1 parent 061176d commit 5b054ea

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Rector\Tests\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector\Fixture;
4+
5+
final class SkipParentName extends \MyCLabs\Enum\Enum
6+
{
7+
public function run($value)
8+
{
9+
$compare = parent::someCall();
10+
}
11+
}

rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ public function provideMinPhpVersion(): int
105105

106106
private function isEnumConstant(string $className, string $constant): bool
107107
{
108+
if (! $this->reflectionProvider->hasClass($className)) {
109+
return false;
110+
}
111+
108112
$classReflection = $this->reflectionProvider->getClass($className);
109113

110114
return $classReflection->hasConstant($constant);

0 commit comments

Comments
 (0)