Page MenuHomePhabricator

PHPCS: Allow long lines for phan annotations
Open, Needs TriagePublic

Description

As seen e.g. in https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/533566/8/includes/api/ApiAuthManagerHelper.php. Phan can take very detailed info about the shape of arrays, and it cannot be split across multiple lines. PHPCS should not emit a long-line issue for lines containing such annotations.

Event Timeline

Nikerabbit renamed this task from PHPCS: Alllow long lines for phan annotations to PHPCS: Allow long lines for phan annotations.Sep 3 2019, 5:35 PM
Krinkle triaged this task as Medium priority.Sep 8 2019, 1:23 AM
Krinkle raised the priority of this task from Medium to Needs Triage.
Krinkle moved this task from Untriaged to Accepted rule changes on the MediaWiki-Codesniffer board.

@Daimona @Krinkle so I figured out a way to do this, but I'm not sure its the best:

  • Disable Generic.Files.LineLength in MediaWiki`s ruleset
  • Create a copy of it at MediaWiki.Files.LineEndings
  • Add a couple lines to skip long lines that include @phan-param

Thoughts?

Would be nice if this can work for:

'@phan-var array{...very long...} $options';

and not only @phan-* on doc comments