Function buildTokenClasses
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected static function buildTokenClasses(string $namespace, string $class, array $classes, int $index, array $tokens): array
{
// Skip usage of ::class constant
$isClassConstant = false;
for ($j = $index - 1; $j > 0; --$j) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function buildTokenNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected static function buildTokenNamespace(int $index, array $tokens): string
{
$namespace = '';
// If there is a namespace, extract it (PHP 8 test)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createClassMap
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected static function createClassMap(string $dir): array
{
$dirIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
$map = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function findClasses
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function findClasses(string $path): array
{
$contents = file_get_contents($path);
$tokens = token_get_all($contents);
$classes = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method buildTokenClasses
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected static function buildTokenClasses(string $namespace, string $class, array $classes, int $index, array $tokens): array