Feature summary (what you would like to be able to do and where):
If it's in scope for LibUp mediawiki-tools-codesniffer, consider adding a feature that mass replaces something like use Message; with use MediaWiki\Message\Message;. This would be in support of the work at T278278. We could feed it a map of unnamespaced classes => namespaced classes.
Example patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/SecurePoll/+/1037849
Each MW version, we namespace a dozen or so more classes, and leave an alias behind for backwards compatibility. But it should be really easy to automate converting from the alias to the actual namespace.
I think phan will Verified-1 anything that we get wrong, so this should be a really safe refactor.
Should also add code to read and increase the version number in extension.json/skin.json, if needed.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Benefits (why should this be implemented?):
- reduce technical debt
- save developer time
reduce IDE linter warnings- fix broken IDE type hinting
Notes
- algorithm 1 - as described above. fix existing use statements
- algorithm 2 - detect when there is no use statement at all and a namespaced class is used. the autofix will be to add the use statement. old extensions may not have any use statements at all because everything used to be globally namespaced, so use statements were not mandatory. example: CollaborationKit