Using generics when implementing custom interface #5392
-
The existing error is reproduced here: https://phpstan.org/r/c35cb5b9-cfd6-4a90-bec7-5352d6e978be . |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You've bumped into an unfortunate case where "scalar" is already understood by PHPDoc as int|float|string|bool: https://github.com/phpstan/phpstan-src/blob/efd31cec14e60db82949a878c59e979501a92751/src/PhpDoc/TypeNodeResolver.php#L158-L159 We could fix that by also calling "tryResolvePseudoTypeClassType" for that one. You can see that's the problem because if you rename your class, it works: https://phpstan.org/r/1b48c460-5be0-4757-b4bd-595cd9b0725b Please open an issue (bug report) or send a PR, thanks. |
Beta Was this translation helpful? Give feedback.
You've bumped into an unfortunate case where "scalar" is already understood by PHPDoc as int|float|string|bool: https://github.com/phpstan/phpstan-src/blob/efd31cec14e60db82949a878c59e979501a92751/src/PhpDoc/TypeNodeResolver.php#L158-L159
We could fix that by also calling "tryResolvePseudoTypeClassType" for that one.
You can see that's the problem because if you rename your class, it works: https://phpstan.org/r/1b48c460-5be0-4757-b4bd-595cd9b0725b
Please open an issue (bug report) or send a PR, thanks.