Skip to content

Using generics when implementing custom interface #5392

Discussion options

You must be logged in to vote

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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MaxGoryunov
Comment options

@ondrejmirtes
Comment options

@ondrejmirtes
Comment options

Answer selected by MaxGoryunov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants