Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add ServiceProviderInterface #25686

Copy link
Copy link
Closed
Closed
Copy link
@nicolas-grekas

Description

@nicolas-grekas
Issue body actions
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 4.1

Would be sibling to ServiceSubscriberInterface.
Could be added to ServiceLocator, to provide reflection on the inner of the locator.

ServiceProviderInterface::getProvidedService() would return an array, keyed by service names, and valued by service types. Special value "?" would mean "mixed" == "dunno" (or null? but this'd mean isset() wouldn't work on the array.)
The implementation on ServiceLocator would just use reflection on the closures and return their return-type hint.

The benefit of using ? for unknown types is that if one want to know if such a type can be null, then the logic is invariably '?' === $type[0]. Any other convention would require more code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependencyInjectionFeatureRFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.