File tree Expand file tree Collapse file tree
src/Reflection/BetterReflection/Reflector Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88final class MemoizingClassReflector extends ClassReflector
99{
1010
11- /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionClass|\Throwable > */
11+ /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionClass> */
1212 private array $ reflections = [];
1313
1414 /**
@@ -22,18 +22,10 @@ public function reflect(string $className): Reflection
2222 {
2323 $ lowerClassName = strtolower ($ className );
2424 if (isset ($ this ->reflections [$ lowerClassName ])) {
25- if ($ this ->reflections [$ lowerClassName ] instanceof \Throwable) {
26- throw $ this ->reflections [$ lowerClassName ];
27- }
2825 return $ this ->reflections [$ lowerClassName ];
2926 }
3027
31- try {
32- return $ this ->reflections [$ lowerClassName ] = parent ::reflect ($ className );
33- } catch (\Throwable $ e ) {
34- $ this ->reflections [$ lowerClassName ] = $ e ;
35- throw $ e ;
36- }
28+ return $ this ->reflections [$ lowerClassName ] = parent ::reflect ($ className );
3729 }
3830
3931}
Original file line number Diff line number Diff line change 88final class MemoizingConstantReflector extends ConstantReflector
99{
1010
11- /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionConstant|\Throwable > */
11+ /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionConstant> */
1212 private array $ reflections = [];
1313
1414 /**
@@ -21,18 +21,10 @@ final class MemoizingConstantReflector extends ConstantReflector
2121 public function reflect (string $ constantName ): Reflection
2222 {
2323 if (isset ($ this ->reflections [$ constantName ])) {
24- if ($ this ->reflections [$ constantName ] instanceof \Throwable) {
25- throw $ this ->reflections [$ constantName ];
26- }
2724 return $ this ->reflections [$ constantName ];
2825 }
2926
30- try {
31- return $ this ->reflections [$ constantName ] = parent ::reflect ($ constantName );
32- } catch (\Throwable $ e ) {
33- $ this ->reflections [$ constantName ] = $ e ;
34- throw $ e ;
35- }
27+ return $ this ->reflections [$ constantName ] = parent ::reflect ($ constantName );
3628 }
3729
3830}
Original file line number Diff line number Diff line change 88final class MemoizingFunctionReflector extends FunctionReflector
99{
1010
11- /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionFunction|\Throwable > */
11+ /** @var array<string, \PHPStan\BetterReflection\Reflection\ReflectionFunction> */
1212 private array $ reflections = [];
1313
1414 /**
@@ -22,18 +22,10 @@ public function reflect(string $functionName): Reflection
2222 {
2323 $ lowerFunctionName = strtolower ($ functionName );
2424 if (isset ($ this ->reflections [$ lowerFunctionName ])) {
25- if ($ this ->reflections [$ lowerFunctionName ] instanceof \Throwable) {
26- throw $ this ->reflections [$ lowerFunctionName ];
27- }
2825 return $ this ->reflections [$ lowerFunctionName ];
2926 }
3027
31- try {
32- return $ this ->reflections [$ lowerFunctionName ] = parent ::reflect ($ functionName );
33- } catch (\Throwable $ e ) {
34- $ this ->reflections [$ lowerFunctionName ] = $ e ;
35- throw $ e ;
36- }
28+ return $ this ->reflections [$ lowerFunctionName ] = parent ::reflect ($ functionName );
3729 }
3830
3931}
You can’t perform that action at this time.
0 commit comments