Unable to narrow down return type of an inherited method using stubs #11007
-
Hello, and thank you all for the great work! I'm at the very beginning of being familiar with phpstan. I have a pretty straightforward piece of code here, fighting with which i've spent quite some time. https://phpstan.org/r/79430b02-de77-4af5-84b1-81e272c2d58b It's Yii2.
and
It did not work. And it did not matter whether i extended Then i changed child Controller to be
And it did work. What am i missing about stubs, inheritance and return types? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Method |
Beta Was this translation helpful? Give feedback.
Method
yii\web\Controller::getView()
does not actually exist (https://github.com/yiisoft/yii2/blob/master/framework/web/Controller.php) so that's why this stub in PHPStan does not have any effect.