Page MenuHomePhabricator

PHPCS should allow implementing interfaces over multiple lines
Closed, ResolvedPublic

Description

If I use

class MediaWikiLoggerPHPUnitHook implements
	BeforeTestHook,
	AfterRiskyTestHook,
	...

I get

Expected 4 spaces before interface name, 1 found

if I replace the tabs with 4 spaces, I obviously get

Tabs must be used to indent lines

and, of course, I cannot put all interface names on the same line as that would end up in a 300 characters line.

IMHO, the code above is formatted correctly, and PHPCS should know that we use tabs, not spaces. I believe (but I'm not 100% sure) that this is an upstream bug.

Upstream bug report: https://github.com/squizlabs/PHP_CodeSniffer/issues/2836

Event Timeline

Working as intended, closing in favour of T243598.

Change 570981 had a related patch set uploaded (by Aaron Schulz; owner: Aaron Schulz):
[mediawiki/core@master] Disable PSR2.Classes.ClassDeclaration.InterfaceWrongIndent

https://gerrit.wikimedia.org/r/570981

Krinkle renamed this task from PHPCS forbids all attempts to implement interfaces over multiple lines to PHPCS should allow implementing interfaces over multiple lines.Feb 8 2020, 8:48 PM
Krinkle reopened this task as Open.
Krinkle moved this task from Untriaged to Accepted rule changes on the MediaWiki-Codesniffer board.

Change 570981 merged by jenkins-bot:
[mediawiki/core@master] Disable PSR2.Classes.ClassDeclaration.InterfaceWrongIndent

https://gerrit.wikimedia.org/r/570981

When reading the upstream bug report it is about the tabwidth, so may fixed with fix of T243598

Change 595325 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/core@master] Revert "Disable PSR2.Classes.ClassDeclaration.InterfaceWrongIndent"

https://gerrit.wikimedia.org/r/595325

When reading the upstream bug report it is about the tabwidth, so may fixed with fix of T243598

Ah, yes, I forgot to close this task. I've created a revert of the patch above and tagged this task for clarity. However, I think this task can be closed as resolved even without merging my revert.

Daimona claimed this task.
Daimona removed a project: Patch-For-Review.

Change 595325 merged by jenkins-bot:
[mediawiki/core@master] phpcs: Enable PSR2.Classes.ClassDeclaration.InterfaceWrongIndent

https://gerrit.wikimedia.org/r/595325