Closed tomasnorre closed 4 months ago
That PHP Warning is definitelly a bug when no composer autoloader is found (fixed in #150).
But since you have regular composer autoload sections, it should not happen (composer autoloader should be present). Few questions to verify the state:
No composer class loader detected!
(to stderr) ?I assume you are mentioning this repository, right?
Looks like you are using custom classloader instead of composer's one, which currently is not supported. I'll try to add support, but I'm currently getting some class not found failures, so I need to check even that.
PHP Fatal error: Uncaught Error: Class "AcceptanceTester" not found in /home/honza/Development/tmp-typo3/Tests/Acceptance/Support/Step/Acceptance/Admin.php:23
Stack trace:
#0 /home/honza/Development/tmp-typo3/.Build/vendor/composer/ClassLoader.php(571): include()
#1 /home/honza/Development/tmp-typo3/.Build/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#2 /home/honza/Development/tmp-typo3/.Build/vendor/typo3/class-alias-loader/src/ClassAliasLoader.php(137): Composer\Autoload\ClassLoader->loadClass()
#3 /home/honza/Development/tmp-typo3/.Build/vendor/typo3/class-alias-loader/src/ClassAliasLoader.php(125): TYPO3\ClassAliasLoader\ClassAliasLoader->loadClass()
#4 [internal function]: TYPO3\ClassAliasLoader\ClassAliasLoader->loadClassWithAlias()
#5 /home/honza/Development/tmp-typo3/.Build/vendor/shipmonk/composer-dependency-analyser/src/Analyser.php(424): ReflectionClass->__construct()
#6 /home/honza/Development/tmp-typo3/.Build/vendor/shipmonk/composer-dependency-analyser/src/Analyser.php(396): ShipMonk\ComposerDependencyAnalyser\Analyser->detectFileByReflection()
#7 /home/honza/Development/tmp-typo3/.Build/vendor/shipmonk/composer-dependency-analyser/src/Analyser.php(149): ShipMonk\ComposerDependencyAnalyser\Analyser->getSymbolPath()
#8 /home/honza/Development/tmp-typo3/.Build/vendor/shipmonk/composer-dependency-analyser/bin/composer-dependency-analyser(43): ShipMonk\ComposerDependencyAnalyser\Analyser->run()
#9 /home/honza/Development/tmp-typo3/.Build/bin/composer-dependency-analyser(117): include('...')
Can you test #151? With that, I was able to make the tool work over your repository, but I'm not certain if autoloading is working correctly there. I'll check that more deeply tomorrow.
The main problem is that the autoloader the package uses (ClassAliasLoader
) is broken and is unable to load classes referenced in the codebase (failing on Fatal Error).
You can exclude paths that references those broken symbols to make it work, but it will definitelly affect the results:
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
$config = new Configuration();
return $config->addPathsToExclude([
__DIR__ . '/.Build/vendor/typo3/cms-core/Tests',
__DIR__ . '/Tests/Acceptance',
]);
Another idea is to enable composer's classloader for the analysis (which seems to work):
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
/** @var \Composer\Autoload\ClassLoader $classLoader */
$classLoader = require __DIR__ . '/.Build/vendor/autoload.php';
$classLoader->register();
return new Configuration();
Thanks for all you information. Will try to set it up according to your advice.
Closing as stale.
Hi,
I'm the maintainer of the TYPO3 Crawler, which used non-standard vendor-dir. Everything is in a
.Build
directory.When running the tool. I get
Which indicates from code, that no class loading is found https://github.com/shipmonk-rnd/composer-dependency-analyser/blob/master/src/Analyser.php#L410
My composer.json looks like this for the autload part.
Can it be that this tool have problems with projects with non-standard directory structure?