Open Stadly opened 6 years ago
Your suggestion leads to make a CompilerExtension
https://doc.nette.org/en/2.4/di-extensions which can validate the configuration before DI compilation. But it is not a common solution in phpstan ecosystem. I'd like to know current opinion of @ondrejMirtes, because I've talked with him about this some time ago and he didn't like the idea to depend on concrete DI implementation (Nette DI).
See: https://github.com/phpstan/phpstan/issues/1459
BTW feel free to write your own validation. I just think that CompilerExtension
is not especially suitable because you wouldn't have available all the functionality PHPStan can offer (like the Broker instance) during DIC compilation.
I think the best hack how to solve this is to define a service that accepts %exceptionRules%
and does just this validation. I'm not sure how to make it instantiated every time though.
It would be easier to configure PHPStan exception rules correctly if warnings were emitted for potential misconfigurantions. Consider the following configuration file:
A warning should be shown when