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

[Deprecation] Legacy nullable #184

Open
jaapio opened this issue Mar 12, 2023 · 2 comments
Open

[Deprecation] Legacy nullable #184

jaapio opened this issue Mar 12, 2023 · 2 comments
Milestone

Comments

@jaapio
Copy link
Member

jaapio commented Mar 12, 2023

In early versions of this library, we did support the native nullable types of PHP. (e.g ?string).

The new version of our parser based on phpstan/phpdoc-parser does not support this properly. The main reason is because it might lead to non-obvious notations in situations where union types are used. ?string|int is equal to null|string|int. There is no difference between a null for a string or int.

It is easy to overlook the ?. And since PHP does have native union type support that also errors with this legacy notation it's better to move away from this format.

Dropping this support will help us to remove some complex parsing form our code.

@williamdes
Copy link
Contributor

About the use of ? I already commented on libraries to say it's non standard to use it in phpdoc.
But nobody cares, is phpdoc standard defined somewhere?
The answers where that phpstan and other tools supported ? so we can use it.
For me it looks like a deviation of the spec.
What do you think ?

@jaapio
Copy link
Member Author

jaapio commented Mar 12, 2023

We are working on a standard, but progress is really slow... It used to be psr-5, for clearity is has been split into psr-5 and psr-19.

I think when searching for issues I think you can find an issue created by me on phpstan.

@jaapio jaapio added this to the version 2 milestone Mar 17, 2023
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

2 participants