Page MenuHomePhabricator

PHPCS incorrectly autofixing array key access over multiple lines
Closed, ResolvedPublicBUG REPORT

Event Timeline

Regression from https://gerrit.wikimedia.org/r/c/mediawiki/tools/codesniffer/+/591486

the newline part seems not to work, because it is triggered for

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/SecurePoll/+/refs/heads/master/includes/Pages/CreatePage.php#320

				$formItems['election_type']['options-messages']
				["securepoll-create-option-election_type-$type"] = $type;
which is not a good break for the statement, but autofix only removes the indent, not the newline, but removing the newline seems not better and can produce a LineLength warning

Tabs are replaced from codesniffer and 'content' does not longer contains tabs and that could be the reason why the condition with the rtrim does not work here. There is no test for that part. The newline whitespace is a own token to track the correct line number inside the token stack.
DannyS712 triaged this task as Medium priority.Jan 29 2021, 7:01 PM
DannyS712 changed the subtype of this task from "Task" to "Bug Report".
DannyS712 moved this task from Untriaged to Accepted rule changes on the MediaWiki-Codesniffer board.

Change 659885 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/tools/codesniffer@master] SpaceBeforeBracketSniff: fix newline handling

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

Would this warrant releasing a new 35.1.0?

Change 659885 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] SpaceBeforeBracketSniff: fix newline handling

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

Umherirrender assigned this task to DannyS712.

Now part of 36.0.0