Closed staabm closed 7 months ago
the tools analyzes source code by calling is_a on found class names.
is_a
since is_a is a runtime-concept it kicks in autoloading and currently there is no way to define a autoloader.
this means when code is found which declares classes which cannot be found the analysis results in something like
$ vendor/bin/class-leak check application/ library/ 0/2296 [>---------------------------] 0% 2296/2296 [============================] 100%PHP Fatal error: Uncaught Error: Class "ApplicationController" not found in C:\dvl\Workspace\daiber\library\clxProductNet\application\Rocket\Controllers\AccountController.php:11 Stack trace: #0 C:\dvl\Workspace\daiber\vendor\composer\ClassLoader.php(576): include() Stack trace: #0 C:\dvl\Workspace\daiber\vendor\composer\ClassLoader.php(576): include() #1 C:\dvl\Workspace\daiber\vendor\composer\ClassLoader.php(427): Composer\Autoload\{closure}() #2 [internal function]: Composer\Autoload\ClassLoader->loadClass() #3 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\app\Filtering\PossiblyUnusedClassesFilter.php(71): is_a() #4 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\app\Filtering\PossiblyUnusedClassesFilter.php(60): TomasVotruba\ClassLeak\Filtering\PossiblyUnusedClassesFilter->isClassSkipped() #5 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\app\Console\Commands\CheckCommand.php(80): TomasVotruba\ClassLeak\Filtering\PossiblyUnusedClassesFilter->filter() #6 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\vendor\symfony\console\Command\Command.php(325): TomasVotruba\ClassLeak\Console\Commands\CheckCommand->execute() #7 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\vendor\symfony\console\Application.php(944): ClassLeak202307\Symfony\Component\Console\Command\Command->run() #8 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\vendor\symfony\console\Application.php(326): ClassLeak202307\Symfony\Component\Console\Application->doRunCommand() #9 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\vendor\symfony\console\Application.php(212): ClassLeak202307\Symfony\Component\Console\Application->doRun() #10 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\bin\class-leak.php(25): ClassLeak202307\Symfony\Component\Console\Application->run() #11 C:\dvl\Workspace\daiber\vendor\tomasvotruba\class-leak\bin\class-leak(5): require('...') #12 C:\dvl\Workspace\daiber\vendor\bin\class-leak(119): include('...') #13 {main} thrown in C:\dvl\Workspace\daiber\library\clxProductNet\application\Rocket\Controllers\AccountController.php on line 11
The autoload is the requirement here to keep concept simple and fast. Also this makes sure composer can be relied on :+1:
the tools analyzes source code by calling
is_a
on found class names.since
is_a
is a runtime-concept it kicks in autoloading and currently there is no way to define a autoloader.this means when code is found which declares classes which cannot be found the analysis results in something like