You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$model = $this->getModelClassName();
$object = app()->make($model);
\PHPStan\dumpType($object);
if (! $object instanceof Model) {
thrownewReflectionException("$model is not an instance of " . Model::class);
}
where $this->getModelClassName() has a PHPDoc return type of class-name<Model>, and then the dumpType shows me: Dumped type: *NEVER*.
I guess, it's related to #1451 since it only happens since I upgraded from 2.3.0 -> 2.3.4.
The actual false positive error triggered in this section is by the way Unreachable statement - code above always terminates. for the code below the instanceof / throw section.
The text was updated successfully, but these errors were encountered:
When I dump the type of $model I get Dumped type: class-string<Illuminate\Database\Eloquent\Model>.
The code you linked looks to me like the only way it returns NeverType is by $expr instanceof String_ evaluating to false. I don't know anything really about the PHPStan internals, so I have no clue how to fix that best, but from my understanding, class-string is a special case of string, so this should evaluate to true, not false.
--level
used: 8Description
I have in my code this section:
where
$this->getModelClassName()
has a PHPDoc return type ofclass-name<Model>
, and then thedumpType
shows me:Dumped type: *NEVER*
.I guess, it's related to #1451 since it only happens since I upgraded from 2.3.0 -> 2.3.4.
The actual false positive error triggered in this section is by the way
Unreachable statement - code above always terminates.
for the code below the instanceof / throw section.The text was updated successfully, but these errors were encountered: