Conditions | 25 |
Paths | 138 |
Total Lines | 94 |
Code Lines | 61 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php declare(strict_types = 1); |
||
17 | final public static function loadClass(string $class): void { |
||
18 | if (!extension_loaded('phar') || defined('__PHPSTAN_RUNNING__')) { |
||
19 | return; |
||
20 | } |
||
21 | |||
22 | if (strpos($class, '_PHPStan_') === 0) { |
||
23 | if (!in_array('phar', stream_get_wrappers(), true)) { |
||
24 | throw new \Exception('Phar wrapper is not registered. Please review your php.ini settings.'); |
||
25 | } |
||
26 | |||
27 | if (self::$composerAutoloader === null) { |
||
28 | self::$composerAutoloader = require 'phar://' . __DIR__ . '/phpstan.phar/vendor/autoload.php'; |
||
29 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php'; |
||
30 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/react/async/src/functions_include.php'; |
||
31 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/react/promise/src/functions_include.php'; |
||
32 | } |
||
33 | self::$composerAutoloader->loadClass($class); |
||
34 | |||
35 | return; |
||
36 | } |
||
37 | if (strpos($class, 'PHPStan\\') !== 0 || strpos($class, 'PHPStan\\PhpDocParser\\') === 0) { |
||
38 | return; |
||
39 | } |
||
40 | |||
41 | if (!in_array('phar', stream_get_wrappers(), true)) { |
||
42 | throw new \Exception('Phar wrapper is not registered. Please review your php.ini settings.'); |
||
43 | } |
||
44 | |||
45 | if (!self::$polyfillsLoaded) { |
||
46 | self::$polyfillsLoaded = true; |
||
47 | |||
48 | if ( |
||
49 | PHP_VERSION_ID < 80000 |
||
50 | && empty($GLOBALS['__composer_autoload_files']['a4a119a56e50fbb293281d9a48007e0e']) |
||
51 | && !class_exists(\Symfony\Polyfill\Php80\Php80::class, false) |
||
|
|||
52 | ) { |
||
53 | $GLOBALS['__composer_autoload_files']['a4a119a56e50fbb293281d9a48007e0e'] = true; |
||
54 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php80/Php80.php'; |
||
55 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php80/bootstrap.php'; |
||
56 | } |
||
57 | |||
58 | if ( |
||
59 | empty($GLOBALS['__composer_autoload_files']['0e6d7bf4a5811bfa5cf40c5ccd6fae6a']) |
||
60 | && !class_exists(\Symfony\Polyfill\Mbstring\Mbstring::class, false) |
||
61 | ) { |
||
62 | $GLOBALS['__composer_autoload_files']['0e6d7bf4a5811bfa5cf40c5ccd6fae6a'] = true; |
||
63 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-mbstring/Mbstring.php'; |
||
64 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-mbstring/bootstrap.php'; |
||
65 | } |
||
66 | |||
67 | if ( |
||
68 | empty($GLOBALS['__composer_autoload_files']['e69f7f6ee287b969198c3c9d6777bd38']) |
||
69 | && !class_exists(\Symfony\Polyfill\Intl\Normalizer\Normalizer::class, false) |
||
70 | ) { |
||
71 | $GLOBALS['__composer_autoload_files']['e69f7f6ee287b969198c3c9d6777bd38'] = true; |
||
72 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-intl-normalizer/Normalizer.php'; |
||
73 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-intl-normalizer/bootstrap.php'; |
||
74 | } |
||
75 | |||
76 | if ( |
||
77 | !extension_loaded('intl') |
||
78 | && empty($GLOBALS['__composer_autoload_files']['8825ede83f2f289127722d4e842cf7e8']) |
||
79 | && !class_exists(\Symfony\Polyfill\Intl\Grapheme\Grapheme::class, false) |
||
80 | ) { |
||
81 | $GLOBALS['__composer_autoload_files']['8825ede83f2f289127722d4e842cf7e8'] = true; |
||
82 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-intl-grapheme/Grapheme.php'; |
||
83 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-intl-grapheme/bootstrap.php'; |
||
84 | } |
||
85 | |||
86 | if ( |
||
87 | PHP_VERSION_ID < 80100 |
||
88 | && empty ($GLOBALS['__composer_autoload_files']['23c18046f52bef3eea034657bafda50f']) |
||
89 | && !class_exists(\Symfony\Polyfill\Php81\Php81::class, false) |
||
90 | ) { |
||
91 | $GLOBALS['__composer_autoload_files']['23c18046f52bef3eea034657bafda50f'] = true; |
||
92 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/Php81.php'; |
||
93 | require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/bootstrap.php'; |
||
94 | } |
||
95 | } |
||
96 | |||
97 | $filename = str_replace('\\', DIRECTORY_SEPARATOR, $class); |
||
98 | if (strpos($class, 'PHPStan\\BetterReflection\\') === 0) { |
||
99 | $filename = substr($filename, strlen('PHPStan\\BetterReflection\\')); |
||
100 | $filepath = 'phar://' . __DIR__ . '/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/' . $filename . '.php'; |
||
101 | } else { |
||
102 | $filename = substr($filename, strlen('PHPStan\\')); |
||
103 | $filepath = 'phar://' . __DIR__ . '/phpstan.phar/src/' . $filename . '.php'; |
||
104 | } |
||
105 | |||
106 | if (!file_exists($filepath)) { |
||
107 | return; |
||
108 | } |
||
109 | |||
110 | require $filepath; |
||
111 | } |
||
115 |
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