Open thomasvargiu opened 6 years ago
Thanks for your ideas. This is an interesting feature. I guess we could achieve this by utilizing the dependency resolver and a recursive iterator.
@tux-rampage I think we need get rid of zend-code scanner as these are going to be removed, see: https://github.com/zendframework/zend-code/issues/124
I've noticed it works wrong with configuration files, like:
<?php
return [
'factories' => [
'service' => ClassName::class,
],
];
it doesn't break zend-di, but we get wrong class names (as reported in closed issue linked above).
@webimpress thanks for pointing this out. I removed the zend-code bits for 3.1 and I am not planning to re-introduce it. I thought about roave's better reflection instead since they offer support for composer.json autoloaders. If you have any other suggestions, they'll be welcome.
This repository has been closed and moved to laminas/laminas-di; a new issue has been opened at https://github.com/laminas/laminas-di/issues/3.
In order to improve AoT compiler, on my project I've done some changes.
The problem is that with AoT, dependency factories are not created. To accomplish my goal I've made a simple DependencyScanner that try to fetch every dependency classes:
And changed my
di-generate-aot.sh
to use it, getting everypsr-4
namespace directory (does not support dir arrays yet), and using the previous class to fetch every dependency class.It's just an example, but I think we can include something like that in
zend-code
and/or here, and improve the documentation in order to provide a better AoT compiler compared to others compiled containers.P.S. It does not resolve aliases yet.