Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DI config in PHP file format #303

Open
Wirone opened this issue Aug 23, 2022 · 1 comment
Open

Support for DI config in PHP file format #303

Wirone opened this issue Aug 23, 2022 · 1 comment

Comments

@Wirone
Copy link
Contributor

Wirone commented Aug 23, 2022

Symfony supports PHP format for configuration (it's even default one now), so it would be great if this plugin could help with verifying DI configs. Assume we have:

class Foo
{
    public function __construct(Bar $bar, Baz $baz)
    {
    }
}
return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(Foo::class)
        ->public()
        ->args([Bar::class]);
});

Plugin should warn that Baz $baz argument is missing in the Foo service definition.

Similarly it should support:

  • factories like ->factory([service(FooFactory::class), 'create'])
    • if factory's service exists
    • if factory's class has such method
  • fetching parameters (like ->args(['%foo%']))
  • named args (like ->arg('$bar', service(Bar::class))
  • expressions (using expr())

That would really help with keeping quality in DI definitions with PHP format 🙂

@alexis78-sym
Copy link

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants