Closed VincentLanglet closed 6 months ago
I disagree. Libs should follow what's already supported in the world, not invent new syntax and hope for the best.
I disagree. Libs should follow what's already supported in the world, not invent new syntax and hope for the best.
I understand the point of view and agree with it but I made search and I think the syntax is valid, according to Phpdocumentor, https://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_tags.property.pkg.html
It says
phpDocumentor will display the optional description unmodified, and defaults to "mixed" if the datatype is not present.
So it seems allowed that the "datatype is not present".
I don't think that something written 17 years ago is relevant here.
I don't think that something written 17 years ago is relevant here.
Sure.
So I just
downloaded the latest phpDocumentor phar https://github.com/phpDocumentor/phpDocumentor
Run this latest version on the following code
And it's correctly parsed by PhpDocumentor
So the syntax still seems to be a valid one in 2024.
The syntax is also supported by PHPStorm
Libs should follow what's already supported in the world, not invent new syntax and hope for the best.
My point is that it's not easy to ask a lib to change his syntax when the "only" tools (phpdocumentor/phpstorm) there are using are supporting the syntax. And it would be helpful to not having to write stubs for every classes of this lib. I'm ok doing all the PR needed for this support.
Sorry, I'm not going to add this and I'm locking this thread. phpdoc-parser has been introduced to PHPStan 6.5 years ago and no one up until now asked for this which means this isn't really an issue.
@property
without a type makes the code worse. I want to make the PHP ecosysytem better not by allowing @property
without a type, but by forcing people to add the type instead.
Hi @ondrejmirtes,
Currently the parser correctly parse
but fail on
for instance https://phpstan.org/r/2534dcd1-fb4e-47af-80f2-1d2f896ec6aa
This is a syntax used by at least the following lib https://github.com/gocardless/gocardless-pro-php/blob/882efd66430b6dec9baeceb2ea6bb7078c3ef908/lib/Resources/Block.php#L14.
And I would say that since we can write
or to define a property without a type
it could make sens to allow
Would you open to support such syntax and allowing type to be nullable in PropertyTagValueNode ?