@@ -688,7 +688,7 @@ public function isTrait(): bool
688688 */
689689 public function isEnum (): bool
690690 {
691- return $ this ->reflection -> isEnum () && $ this ->reflection instanceof ReflectionEnum ;
691+ return $ this ->reflection instanceof ReflectionEnum && $ this ->reflection -> isEnum () ;
692692 }
693693
694694 public function isReadOnly (): bool
@@ -737,10 +737,11 @@ public function getEnumCases(): array
737737 }
738738
739739 $ cases = [];
740+ $ initializerExprContext = InitializerExprContext::fromClassReflection ($ this );
740741 foreach ($ this ->reflection ->getCases () as $ case ) {
741742 $ valueType = null ;
742743 if ($ case instanceof ReflectionEnumBackedCase) {
743- $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), InitializerExprContext:: fromClassReflection ( $ this ) );
744+ $ valueType = $ this ->initializerExprTypeResolver ->getType ($ case ->getValueExpression (), $ initializerExprContext );
744745 }
745746 /** @var string $caseName */
746747 $ caseName = $ case ->getName ();
@@ -982,10 +983,10 @@ public function getTraits(bool $recursive = false): array
982983 public function getParentClassesNames (): array
983984 {
984985 $ parentNames = [];
985- $ currentClassReflection = $ this ;
986- while ($ currentClassReflection -> getParentClass () !== null ) {
987- $ parentNames [] = $ currentClassReflection -> getParentClass () ->getName ();
988- $ currentClassReflection = $ currentClassReflection ->getParentClass ();
986+ $ parentClass = $ this -> getParentClass () ;
987+ while ($ parentClass !== null ) {
988+ $ parentNames [] = $ parentClass ->getName ();
989+ $ parentClass = $ parentClass ->getParentClass ();
989990 }
990991
991992 return $ parentNames ;
0 commit comments