Skip to content

[RFC] [DI] Abstract arguments #31769

@alexander-schranz

Description

@alexander-schranz

Description

As run into an issue #31745 I come with an idea of adding a new type for arguments called abstract. The idea is to have a better error message when a compilerpass need to replace an argument and it did not happened.

Example

For example the translator.default service:

<service id="translator.default" class="Symfony\Bundle\FrameworkBundle\Translation\Translator">
<argument /> <!-- translation loaders locator -->
<argument type="service" id="translator.formatter" />
<argument>%kernel.default_locale%</argument>

has a argument which need to be replaced. So service definition would look like the following:

 <service id="translator.default" class="Symfony\Bundle\FrameworkBundle\Translation\Translator"> 
     <argument type="abstract">Should be defined by TranslatorPass</argument>
     <!-- ... -->

So when there exist an abstract argument it should error with e.g. Argument "0" is not replaced for service "translator.default" yet: Should be defined by TranslatorPass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependencyInjectionFeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.RFCRFC = 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