We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 113a97a commit 7b250dbCopy full SHA for 7b250db
src/Rules/Cast/InvalidCastRule.php
@@ -9,6 +9,7 @@
9
use PHPStan\Rules\Rule;
10
use PHPStan\Rules\RuleErrorBuilder;
11
use PHPStan\Rules\RuleLevelHelper;
12
+use PHPStan\ShouldNotHappenException;
13
use PHPStan\Type\ErrorType;
14
use PHPStan\Type\Type;
15
use PHPStan\Type\VerbosityLevel;
@@ -82,6 +83,10 @@ static function (Type $type) use ($castTypeCallback): bool {
82
83
if ($castType instanceof ErrorType) {
84
$classReflection = $this->reflectionProvider->getClass(get_class($node));
85
$shortName = $classReflection->getNativeReflection()->getShortName();
86
+ if ($shortName === '') {
87
+ throw new ShouldNotHappenException();
88
+ }
89
+
90
$shortName = strtolower($shortName);
91
if ($shortName === 'double') {
92
$shortName = 'float';
0 commit comments