acquia / coding-standards-php

PHP_CodeSniffer rules (sniffs) for Acquia coding standards
GNU General Public License v2.0
19 stars 13 forks source link

PhpStorm profile: disable throws inspection #65

Open danepowell opened 1 year ago

danepowell commented 1 year ago

Our code standards forbid throws tags since they quickly become stale.

Additionally, I'm testing whether it's better to import the PhpStorm inspections profile as a separate profile rather than clobbering the default one, which might not be nice if folks do more than just Acquia / Drupal development.

TravisCarden commented 1 year ago

Our code standards forbid throws tags since they quickly become stale.

Where is this, @danepowell?

I support making our example PhpStorm profile match our standards, though in the long term I think we should permit @throws tags and encourage the use of PHPStan's exception features to prevent them from getting stale. Particularly these:

parameters:
    exceptions:
        check:
            missingCheckedExceptionInThrows: true
            tooWideThrowType: true

(Someday when we're feeling ambitious, we might consider an Acquia PHPStan extension--and a meta package to tie all of our standards and recommendations together.)

danepowell commented 1 year ago

Oops! This is a slevomat rule in the ACLI standard. I intended to contribute it (along with several others) back to the Acquia Edge standard but it looks like I never did. https://github.com/acquia/cli/blob/9f165fe786a8d20b4dab4adc57ce6cbfa80bec37/phpcs.xml.dist#L40

Anyway... I just think comments, especially function comments, have become way too verbose with so many annotations. When the same info can be communicated by the IDE or native features (e.g., type hints), I prefer to trim the fat.

TravisCarden commented 1 year ago

Ah, I see. Well, I personally would allow @package and @throws (though I would hardly make a fuss of them), but I can definitely support the others. We'll definitely want to check with product teams, though, to make sure they don't depend on any of them.