Page MenuHomePhabricator

phpcs is unable to sort class constant keys properly
Closed, ResolvedPublic8 Estimated Story Points

Description

Steps to replicate the issue (include links if applicable):

  • Add /** @phpcs-require-sorted-array */ at the beginning of an array that contains PHP class consts as keys. e.g. The EXPECTED_CONTEXT_KEYS array in github link
  • Run mw dev mw composer phpcs-modified

What happens?:
We get the following warning: Found duplicate key "self" on array required sorting (MediaWiki.Arrays.AlphabeticArraySort.Duplicate).

What should have happened instead?:
sort the consts alphabetically

Event Timeline

WMDE-leszek set the point value for this task to 8.Nov 21 2024, 11:36 AM

Change #1098138 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Muhammad Jaziraly):

[mediawiki/tools/codesniffer@master] Support sorting PHP constants in arrays

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

Change #1098136 had a related patch set uploaded (by Muhammad Jaziraly; author: Muhammad Jaziraly):

[mediawiki/extensions/Wikibase@master] REST: Add PHP constant sorting support via temporary fork

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

Change #1099193 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/tools/codesniffer@master] HISTORY: Tag as v45.0.0

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

Change #1098138 merged by jenkins-bot:

[mediawiki/tools/codesniffer@master] Support sorting PHP symbols in arrays

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

Change #1099193 abandoned by Jakob:

[mediawiki/tools/codesniffer@master] HISTORY: Tag as v46.0.0

Reason:

Will wait for the regular release.

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

Change #1098136 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Add PHP constant sorting support

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