Coding-standard: @dataProvider, @throws, @test etc. are useful annotations

Created on 11 Apr 2019  路  6Comments  路  Source: slevomat/coding-standard

I would like a way to whitelist useful annotations in the TypeHintDeclaration rule, like we had in version 4.*.

It is quite standard to use @dataProvider annotations in tests, @throws annotations in business logic, etc.

This is essentially reopening:
https://github.com/slevomat/coding-standard/issues/299
https://github.com/slevomat/coding-standard/issues/204
https://github.com/slevomat/coding-standard/issues/108

usefulAnnotations was removed in v5, and I believe we should have a way to bring back this functionality. Why was it removed in the first place? If it was removed due to complexity, perhaps useless docblock sniff should be split away from TypeHintDeclaration

Question

Most helpful comment

@kukulich I think a lot of us have the same question. It's not clear from the readme as functionality is now different but the same requirement applies --- not allowing all annotations -- only some specific ones. Can you explicitly clarify here to avoid future issues from being created regarding this?

All 6 comments

See README.

Is the solution really to add allAnnotationsAreUseful to every docblock containing a dataProvider, etc?

There is no desire to allow whitelisting?

Read the README again :)

@kukulich I think a lot of us have the same question. It's not clear from the readme as functionality is now different but the same requirement applies --- not allowing all annotations -- only some specific ones. Can you explicitly clarify here to avoid future issues from being created regarding this?

@kukulich I have been reading the readme, over and over again. And it's still not clear to me what the new approach should be now that 'usefulAnnotations` is removed as a config option. Every time i run the checker, many of my important @Route annotations are being removed from my symfony app.
How can i stop this from happening please ?

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings