-
-
Notifications
You must be signed in to change notification settings - Fork 324
Compile wildcard definitions? #547
Copy link
Copy link
Open
Labels
Description
Wildcard definitions are the only thing left that PHP-DI doesn't compile.
Compiling those would allow for better performances but would also solve the problem of compiling all autowireable classes.
At the moment users need to add SomeClass::class => autowire() in the config for every class in their codebase if they want it to be compiled. This can be tedious.
We could use composer.json to find all the classes that match the wildcard pattern? That would mean that all classes would be considered by PHP-DI, even for example model classes (which isn't really the goal). That means:
- we should ignore errors for classes that are not autowireable (in the case of wildcards)
- we should check that the container doesn't become too big if we compile a lot of useless classes
FYI that's very close to what Symfony is doing with autowiring, maybe there are some ideas to grab there.
Reactions are currently unavailable