-
-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Rector to commit 0bdace5619d44c2ab3b30254f3ef06fe5e90e6fa
rectorphp/rector-src@0bdace5 [Php80] Handle crash Property ReflectionEnum::$betterReflectionClass does not exist on AddParamBasedOnParentClassMethodRector on Enum usage (#4758)
- Loading branch information
1 parent
77447fc
commit fb1f63e
Showing
9 changed files
with
63 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare (strict_types=1); | ||
namespace Rector\Core\Reflection; | ||
|
||
use ReflectionEnum; | ||
use PHPStan\Reflection\ClassReflection; | ||
use Rector\Core\Util\Reflection\PrivatesAccessor; | ||
use PHPStan\BetterReflection\Reflection\ReflectionClass; | ||
final class ClassReflectionAnalyzer | ||
{ | ||
/** | ||
* @readonly | ||
* @var \Rector\Core\Util\Reflection\PrivatesAccessor | ||
*/ | ||
private $privatesAccessor; | ||
public function __construct(PrivatesAccessor $privatesAccessor) | ||
{ | ||
$this->privatesAccessor = $privatesAccessor; | ||
} | ||
public function resolveParentClassName(ClassReflection $classReflection) : ?string | ||
{ | ||
$nativeReflection = $classReflection->getNativeReflection(); | ||
if ($nativeReflection instanceof ReflectionEnum) { | ||
return null; | ||
} | ||
$betterReflectionClass = $this->privatesAccessor->getPrivateProperty($nativeReflection, 'betterReflectionClass'); | ||
/** @var ReflectionClass $betterReflectionClass */ | ||
return $betterReflectionClass->getParentClassName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters