- Issue created by @cmlara
- π¦πΊAustralia dpi Perth, Australia
@cmlara I'd recommend using normal @var blocks in Drupal code, I dont think theres a legitimate reason for our ecosystem to use @phpstan-var for inlines.
I think I've only used them on class properties.
My opinion its not worth the exception, however if maintainer decides otherwise I'd suggest also adding the Psalm equivalent also.
- πΊπΈUnited States cmlara
My opinion is it's not worth the exception, however if maintainer decides otherwise I'd suggest also adding the Psalm equivalent also.
Realistically the Drupal sniffs should not interfere with any other external systems that have a defined standard, so I would contend that is an argument on its own to do these changes. If were going to have sniffs they need to work in all situations otherwise developers will just not use them.
I dont think theres a legitimate reason for our ecosystem to use @phpstan-var for inlines.Even if they can be done with @var its always possible other software in a developers stack does not handle these enhanced types, this is part of the reason the @phpstan-* tags exist.
Looks like our support has become a lot better in the latest release, I'm not 100% sure what version I was on a few weeks back, but phpcs was throwing a fit left and right over a number of the enriched formats so I was taking advantage of the @phpstan-* tags extensively. Looks like most (maybe all) are now handled in 8.3.20 so that I can roll back to the non phpstan specific version.
- π¦πΊAustralia dpi Perth, Australia
Realistically the Drupal sniffs should not interfere with any other external systems that have a defined standard
We'll I think its reasonable for the Drupal standard to reject all /**/ comments, with a single whitelisted @var. It doesnt make sense to continuously add exceptions, unless for example we allow /** @anythingUntilEndOfLine */
Happy to continue to provide advice and anecdotes in dslack#phpstan.
- π¦πΉAustria klausi π¦πΉ Vienna
I think your idea that we allow /** @anythingUntilEndOfLine */ for any doc comment tag is good. There is a trend in PHP to annotate types and variables inline in code, I think Coder can ignore that and let developers use any tag they want. I agree that @var is probably the best choice in most cases, but I'm not sure that we should enforce that as standard (at least not yet).
Pull requests welcome to relax this check for any doc tag!
Marking this as feature request.