Marius Pantea

Maravel Framework 10.63 avoids runtime reflection on DI

by

Because I dislike runtime reflection, I improved the autowiring:cache command to include also constructors, not just methods.

If the concrete has contextual bindings (and constructor parameters) the old reflection is still used.

If the parameters are sent as array list, concrete will be instantiated directly with them. On failure, it will default to the old reflection but at the cost of building an Exception.

If the first parameters are sent as list and the last one(s) need to be auto-resolved, the above exception scenario will happen, which is slow. Always send all parameters as list, in the right order.

The method autowiring (so non __construct) does not support parameters as list!

2 views

Add a comment

Replies

Be the first to comment