Skip to content

[DI] PSR4 loader suggestions #22016

Closed
Closed
@theofidry

Description

@theofidry
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 3.3.0 (master)

After playing a bit with #21289 I would like to make a few suggestions :)

The first suggestion would be to allow the usage of parameters to define the path of the resource. If I take the following example:

# app/config/services.yml

services:
    App\:
        resource: '../../src/Bundle/{Action,Console}'

Instead of that, I would prefer:

# app/config/services.yml

services:
    App\:
        resource: '%kernel.root_dir%/../src/Bundle/{Action,Console}'

I personally find it better, as it makes it easier to follow even if you are deeper in a hierarchy (I have an example where I have ../../../../src/blabla... it's not very readable).

Second suggestion (nitpicking) is about the syntax. The following doesn't work:

# app/config/services.yml

services:
    App\:
        resource: '../../src/Bundle/{Action, Console}'

Because of the extra space. I find that "stupid". I think if it doesn't cost much to do so, users should be free to add an extra space to make things more readable if they find it more readable that way.

Third suggestion (minor), let's take the following example:

# app/config/services.yml

services:
    App\:
        resource: '../../src/Bundle/{Action}'

why the brackets? You shouldn't IMO.

/cc @nicolas-grekas @dunglas (I remember requesting something similar with in dunglas/DunglasActionBundle#52, but maybe you have a different opinion for this one).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions