GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

phpstan_magento2_autoloader()   A
last analyzed

Complexity

Conditions 3
Paths 6

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 11
nc 6
nop 1
dl 0
loc 19
rs 9.9
c 1
b 0
f 0
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
Bug introduced by
The type Magento\Framework\App\Bootstrap was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The constant BP was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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