Closed ruudk closed 3 months ago
Interesting approach of Symfony. Typically, packages declare files with function declarations to autoload.files section so that it get required during composer init. Then, such functions are available during runtime. I dont know the reason why those functions are not there, but I'd probably solve that just by requiring it manually in the PHP config:
<?php
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
require __DIR__ . '/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php'; // function declarations inside
$config = new Configuration();
return $config->ignoreErrorsOnPath(...);
Implementing importUnknownFunctionsFromFile
without actually requiring the file would be non-trivial. And implementing that the way that it would just require the file feels useless.
@janedbal Why didn't I think of this. So simple and pragmatic. It works, thanks! 💙
While using Symfony's PHP configuration, you can use their special functions that are automatically loaded.
These functions are defined in the ContainerConfigurator.
But when running the analyzer, it complains that these functions are unknown:
So I have to do this:
In order to ignore this. It works.
It would be great if I could say something like this:
That way, any new function that Symfony will provide, will automatically work too.