File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -608,9 +608,12 @@ public function isTrait(): bool
608
608
return $ this ->reflection ->isTrait ();
609
609
}
610
610
611
+ /**
612
+ * @phpstan-assert-if-true ReflectionEnum $this->reflection
613
+ */
611
614
public function isEnum (): bool
612
615
{
613
- return $ this ->reflection ->isEnum ();
616
+ return $ this ->reflection ->isEnum () && $ this -> reflection instanceof ReflectionEnum ;
614
617
}
615
618
616
619
public function isReadOnly (): bool
@@ -651,10 +654,6 @@ public function hasEnumCase(string $name): bool
651
654
return false ;
652
655
}
653
656
654
- if (!$ this ->reflection instanceof ReflectionEnum) {
655
- return false ;
656
- }
657
-
658
657
return $ this ->reflection ->hasCase ($ name );
659
658
}
660
659
@@ -663,7 +662,7 @@ public function hasEnumCase(string $name): bool
663
662
*/
664
663
public function getEnumCases (): array
665
664
{
666
- if (!$ this ->reflection instanceof ReflectionEnum ) {
665
+ if (!$ this ->isEnum () ) {
667
666
throw new ShouldNotHappenException ();
668
667
}
669
668
You can’t perform that action at this time.
0 commit comments