Page MenuHomePhabricator

Add phan annotations to ObjectFactory
Closed, ResolvedPublic

Description

With the increasing usage of ObjectFactory for dependency injection, and given the nature of the class, I think we should add some annotations to ease static analysis. Notably:

  • Spec arrays can be documented using a @phan-param with explicit array types (see examples)
  • The method that instantiates the class can be annotated with @phan-template to give phan a chance to understand what class is being created (example). It should be possible to use the template type from within a @phan-param with explicit array type.

Event Timeline

It should be possible to use the template type from within a @phan-param with explicit array type.

Update: it works!

Change 632798 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/libs/ObjectFactory@master] Add phan annotations for better analysis

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

Change 632798 merged by jenkins-bot:
[mediawiki/libs/ObjectFactory@master] Add phan annotations for better analysis

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