Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for php stan types (for example non-empty-string) #2152

Closed
AlexKratky opened this issue Feb 22, 2022 · 2 comments
Closed

Support for php stan types (for example non-empty-string) #2152

AlexKratky opened this issue Feb 22, 2022 · 2 comments
Milestone

Comments

@AlexKratky
Copy link

AlexKratky commented Feb 22, 2022

PHPStan has several advanced types (https://phpstan.org/writing-php-code/phpdoc-types#other-advanced-string-types), for example non-empty-string, numeric-string etc., but intelephense does not convert them to string, so I see an error even that I should not:

image

Please, can you add support for this?

@Aneurin
Copy link

Aneurin commented Mar 15, 2022

More generally, it would be helpful if we could declare one type to be an alias for another, which would be able to solve this by declaring non-empty-string to be an alias for string.

It would solve a broader set of problems as well though, for example: while I'm waiting for #1144, I have some automated stub generation to create imaginary specialised types like FooCollection, BarCollection, etc. This is workable but it breaks whenever intelephense encounters a docblock with a more accurate method return declaration like Collection<Foo>. If I could alias Collection<Foo> to FooCollection then I could effectively tell intelephence to use my stubs for these and the problem would go away.

@PapsOu
Copy link

PapsOu commented Aug 3, 2022

I'm affected by this missing feature too, like this issue : #1118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants