1 | <?php |
||
2 | |||
3 | /* Find bootstrap path */ |
||
4 | $rootPath = realpath(dirname(__FILE__)); |
||
5 | while (!file_exists($rootPath . '/app/bootstrap.php') && $rootPath !== '/') { |
||
6 | $rootPath = realpath(dirname($rootPath)); |
||
7 | } |
||
8 | |||
9 | /* Include Magento bootstrap file */ |
||
10 | require_once $rootPath . '/app/bootstrap.php'; |
||
11 | |||
12 | /* Create git hook class autoloader */ |
||
13 | $_git_hook_loaded_class = []; |
||
14 | function phpstan_magento2_autoloader($class) |
||
15 | { |
||
16 | global $_git_hook_loaded_class; |
||
17 | if (isset($_git_hook_loaded_class[$class])) { |
||
18 | return $_git_hook_loaded_class[$class]; |
||
19 | } |
||
20 | |||
21 | try { |
||
22 | /* Get Magento ObjectManager */ |
||
23 | $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); |
||
0 ignored issues
–
show
|
|||
24 | $objectManager = $bootstrap->getObjectManager(); |
||
25 | |||
26 | $objectManager->get($class); |
||
27 | $_git_hook_loaded_class[$class] = true; |
||
28 | } catch (\Exception $e) { |
||
29 | $_git_hook_loaded_class[$class] = false; |
||
30 | } |
||
31 | |||
32 | return $_git_hook_loaded_class[$class]; |
||
33 | } |
||
34 | |||
35 | spl_autoload_register('phpstan_magento2_autoloader'); |
||
36 | |||
37 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths