Page MenuHomePhabricator

maintenance/generateLocalAutoload.php ignores aliases for PSR4
Closed, ResolvedPublic


PSR4 doesn't specify how to handle class aliases, as might be used for backwards compatibility when a class is renamed.

After much discussion in T166010: The Great Namespaceization and Reorg, we concluded that the best solution is to put the class_alias() call into the same file as the target class, to ensure that all aliases are known whenever the target class is loaded.

However, rMW036f5b47efc9: Enable using PSR-4 autoloader for MediaWiki core and extensions which added support for skipping listing of PSR4-compliant classes did not consider the possibility of aliases, nor did it consider the possibility that a directory might contain a mixture of PSR4-compliant and old non-compliant classes.

Instead of skipping all files in directories intended for PSR4-compliant classes, AutoloadGenerator should process the files and filter out only those classes that are actually PSR4 compliant.

Event Timeline

Anomie created this task.Sep 20 2018, 5:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 20 2018, 5:43 PM

Change 461696 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] AutoloadGenerator: Filter PSR4-compliant classes instead of ignoring directories

Change 461696 merged by jenkins-bot:
[mediawiki/core@master] AutoloadGenerator: Filter PSR4-compliant classes instead of ignoring directories

Anomie closed this task as Resolved.Oct 3 2018, 3:26 PM
Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:38 PM