[Deprecation] Legacy nullable
jaapio opened this issue · 2 comments
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.
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 ?
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.