Page MenuHomePhabricator

Change mediawiki-phan-config to let phan read class alias
Closed, ResolvedPublic

Description

The most wmf deployed extensions now how phan active. Phan is looking amongst other things for undeclared classes. This can happen when a use statement is missing or a typo is in the name.

On refactoring into namespaced classes the phan build can break for extensions using core classes or classes from a dependency extensions, which is changed. One example is shown in T224704

Should we set the phan config enable_class_alias_support to reduce the impact of namespacing classes?
Some extensions needs to use the alias to keep compatibility for older releases.

The option is there since 0.9.3 - https://github.com/phan/phan/issues/974

I have not tested it, if the place of class_alias is correct.

// If true, Phan will read `class_alias` calls in the global scope,
// then (1) create aliases from the *parsed* files if no class definition was found,
// and (2) emit issues in the global scope if the source or target class is invalid.
// (If there are multiple possible valid original classes for an aliased class name,
//  the one which will be created is unspecified.)
// NOTE: THIS IS EXPERIMENTAL, and the implementation may change.
'enable_class_alias_support' => true,

That would also means that alias like IDatabase can be used again and not reported by phan, but that is not a big deal when seeing the impact which a class using cross all repositories

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 31 2019, 9:55 PM

Change 513541 had a related patch set uploaded (by Jforrester; owner: MaxSem):
[mediawiki/tools/phan@master] Enable enable_class_alias_support

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

Change 513541 merged by jenkins-bot:
[mediawiki/tools/phan@master] Enable enable_class_alias_support

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

Daimona closed this task as Resolved.Jun 4 2019, 12:54 PM
Daimona removed a project: Patch-For-Review.
Daimona added a subscriber: Daimona.

Patch merged, 0.6.1 released, calling resolved.