Page MenuHomePhabricator

Investigate making MediaWiki\ServiceContainer compatible with PSR-11
Closed, ResolvedPublic

Description

PSR-11 specifies a standard interface for service containers and related classes. It has been accepted in February 2017.

Since it's generally a good idea to be compatible with light weight standards, we should investigate whether we can make ServiceContainer and friends compatible with PSR-11.

There are essentially two contradictory ways to do this:

  • calling code should bing to PSR-11, which we implement according to our needs. We'd have controls over internals of the service container, but MediaWiki could also use a different service container implementation.
  • calling code binds to our own interfaces, and we implement them on top of PSR-11. (framework isolation). We can then decide to use our own PSR-11 implementation or a standard one, or override bits and pieces of the standard. Calling code would keep using interfaces tailored specifically for MediaWiki.

This needs more investigation to come up with a concrete proposal that could then be turned into an RFC and implemented.

Event Timeline

calling code should bing to PSR-11, which we implement according to our needs. We'd have controls over internals of the service container, but MediaWiki could also use a different service container implementation.

That would mean giving up dedicated methods (and with that IDE autocompletion and type hinting) just to tick the PSR compatibility box - not a great deal.

The other direction is easy: pretty much just rename getService to get, and use composition instead of inheritance.

That would mean giving up dedicated methods (and with that IDE autocompletion and type hinting) just to tick the PSR compatibility box - not a great deal.

Yes, I also prefer to keep MediaWikiServices::getRevisionStore(), etc.

For history purposes, today's TechCom radar email said about this proposal: "discussed and decided not to continue discussion within TechCom, because the standard is not currently relevant".

Vvjjkkii renamed this task from Investigate making MediaWiki\ServiceContainer compatible with PSR-11 to 5pdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
AfroThundr3007730 renamed this task from 5pdaaaaaaa to Investigate making MediaWiki\ServiceContainer compatible with PSR-11.Jul 1 2018, 6:21 AM
AfroThundr3007730 raised the priority of this task from High to Needs Triage.
AfroThundr3007730 updated the task description. (Show Details)
AfroThundr3007730 added a subscriber: Aklapper.