kristuff/mishell

View on GitHub
vendor/composer/ClassLoader.php

Summary

Maintainability
D
2 days
Test Coverage

Function findFileWithExtension has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    private function findFileWithExtension($class, $ext)
    {
        // PSR-4 lookup
        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

Severity: Minor
Found in vendor/composer/ClassLoader.php - About 6 hrs to fix

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

The class ClassLoader has an overall complexity of 69 which is very high. The configured complexity threshold is 50.
Open

class ClassLoader
{
    /** @var ?string */
    private $vendorDir;

Severity: Minor
Found in vendor/composer/ClassLoader.php by phpmd

File ClassLoader.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of Composer.
 *
Severity: Minor
Found in vendor/composer/ClassLoader.php - About 2 hrs to fix

    ClassLoader has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ClassLoader
    {
        /** @var ?string */
        private $vendorDir;
    
    
    Severity: Minor
    Found in vendor/composer/ClassLoader.php - About 2 hrs to fix

      Method findFileWithExtension has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function findFileWithExtension($class, $ext)
          {
              // PSR-4 lookup
              $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
      
      
      Severity: Minor
      Found in vendor/composer/ClassLoader.php - About 1 hr to fix

        Method add has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function add($prefix, $paths, $prepend = false)
            {
                if (!$prefix) {
                    if ($prepend) {
                        $this->fallbackDirsPsr0 = array_merge(
        Severity: Minor
        Found in vendor/composer/ClassLoader.php - About 1 hr to fix

          Method addPsr4 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function addPsr4($prefix, $paths, $prepend = false)
              {
                  if (!$prefix) {
                      // Register directories for the root namespace.
                      if ($prepend) {
          Severity: Minor
          Found in vendor/composer/ClassLoader.php - About 1 hr to fix

            Function findFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function findFile($class)
                {
                    // class map lookup
                    if (isset($this->classMap[$class])) {
                        return $this->classMap[$class];
            Severity: Minor
            Found in vendor/composer/ClassLoader.php - About 1 hr to fix

            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 addPsr4 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addPsr4($prefix, $paths, $prepend = false)
                {
                    if (!$prefix) {
                        // Register directories for the root namespace.
                        if ($prepend) {
            Severity: Minor
            Found in vendor/composer/ClassLoader.php - About 55 mins to fix

            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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function add($prefix, $paths, $prepend = false)
                {
                    if (!$prefix) {
                        if ($prepend) {
                            $this->fallbackDirsPsr0 = array_merge(
            Severity: Minor
            Found in vendor/composer/ClassLoader.php - About 35 mins to fix

            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

            Avoid too many return statements within this method.
            Open

                        return $file;
            Severity: Major
            Found in vendor/composer/ClassLoader.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return false;
              Severity: Major
              Found in vendor/composer/ClassLoader.php - About 30 mins to fix

                The method findFileWithExtension() has an NPath complexity of 1944. The configured NPath complexity threshold is 200.
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                NPathComplexity

                Since: 0.1

                The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                Example

                class Foo {
                    function bar() {
                        // lots of complicated code
                    }
                }

                Source https://phpmd.org/rules/codesize.html#npathcomplexity

                The method findFile() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
                Open

                    public function findFile($class)
                    {
                        // class map lookup
                        if (isset($this->classMap[$class])) {
                            return $this->classMap[$class];
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                NPathComplexity

                Since: 0.1

                The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                Example

                class Foo {
                    function bar() {
                        // lots of complicated code
                    }
                }

                Source https://phpmd.org/rules/codesize.html#npathcomplexity

                The method findFile() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                Open

                    public function findFile($class)
                    {
                        // class map lookup
                        if (isset($this->classMap[$class])) {
                            return $this->classMap[$class];
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                CyclomaticComplexity

                Since: 0.1

                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                Example

                // Cyclomatic Complexity = 11
                class Foo {
                1   public function example() {
                2       if ($a == $b) {
                3           if ($a1 == $b1) {
                                fiddle();
                4           } elseif ($a2 == $b2) {
                                fiddle();
                            } else {
                                fiddle();
                            }
                5       } elseif ($c == $d) {
                6           while ($c == $d) {
                                fiddle();
                            }
                7        } elseif ($e == $f) {
                8           for ($n = 0; $n < $h; $n++) {
                                fiddle();
                            }
                        } else {
                            switch ($z) {
                9               case 1:
                                    fiddle();
                                    break;
                10              case 2:
                                    fiddle();
                                    break;
                11              case 3:
                                    fiddle();
                                    break;
                                default:
                                    fiddle();
                                    break;
                            }
                        }
                    }
                }

                Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                The method findFileWithExtension() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                CyclomaticComplexity

                Since: 0.1

                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                Example

                // Cyclomatic Complexity = 11
                class Foo {
                1   public function example() {
                2       if ($a == $b) {
                3           if ($a1 == $b1) {
                                fiddle();
                4           } elseif ($a2 == $b2) {
                                fiddle();
                            } else {
                                fiddle();
                            }
                5       } elseif ($c == $d) {
                6           while ($c == $d) {
                                fiddle();
                            }
                7        } elseif ($e == $f) {
                8           for ($n = 0; $n < $h; $n++) {
                                fiddle();
                            }
                        } else {
                            switch ($z) {
                9               case 1:
                                    fiddle();
                                    break;
                10              case 2:
                                    fiddle();
                                    break;
                11              case 3:
                                    fiddle();
                                    break;
                                default:
                                    fiddle();
                                    break;
                            }
                        }
                    }
                }

                Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                Avoid using undefined variables such as '$hit' which will lead to PHP notices.
                Open

                            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                UndefinedVariable

                Since: 2.8.0

                Detects when a variable is used that has not been defined before.

                Example

                class Foo
                {
                    private function bar()
                    {
                        // $message is undefined
                        echo $message;
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                Avoid using undefined variables such as '$hit' which will lead to PHP notices.
                Open

                            if ($hit) {
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                UndefinedVariable

                Since: 2.8.0

                Detects when a variable is used that has not been defined before.

                Example

                class Foo
                {
                    private function bar()
                    {
                        // $message is undefined
                        echo $message;
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                Missing class import via use statement (line '307', column '27').
                Open

                                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                MissingImport

                Since: 2.7.0

                Importing all external classes in a file through use statements makes them clearly visible.

                Example

                function make() {
                    return new \stdClass();
                }

                Source http://phpmd.org/rules/cleancode.html#MissingImport

                The method register has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public function register($prepend = false)
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                The method add has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public function add($prefix, $paths, $prepend = false)
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                The method addPsr4 has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public function addPsr4($prefix, $paths, $prepend = false)
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                Missing class import via use statement (line '252', column '27').
                Open

                                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                MissingImport

                Since: 2.7.0

                Importing all external classes in a file through use statements makes them clearly visible.

                Example

                function make() {
                    return new \stdClass();
                }

                Source http://phpmd.org/rules/cleancode.html#MissingImport

                The method register uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            unset(self::$registeredLoaders[$this->vendorDir]);
                            self::$registeredLoaders[$this->vendorDir] = $this;
                        }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                The method set uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
                        }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                Avoid assigning values to variables in if clauses and the like (line '507', column '41').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                The method setPsr4 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $length = strlen($prefix);
                            if ('\\' !== $prefix[$length - 1]) {
                                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
                            }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                Avoid assigning values to variables in if clauses and the like (line '517', column '29').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                Avoid assigning values to variables in if clauses and the like (line '552', column '38').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                The method addPsr4 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                            } else {
                                $this->fallbackDirsPsr4 = array_merge(
                                    $this->fallbackDirsPsr4,
                                    (array) $paths
                                );
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                The method findFileWithExtension uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            // PEAR-like class name
                            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
                        }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                The method addClassMap uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $this->classMap = $classMap;
                        }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                            } else {
                                $this->fallbackDirsPsr0 = array_merge(
                                    $this->fallbackDirsPsr0,
                                    (array) $paths
                                );
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                The method addPsr4 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            // Append directories for an already registered namespace.
                            $this->prefixDirsPsr4[$prefix] = array_merge(
                                $this->prefixDirsPsr4[$prefix],
                                (array) $paths
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                Avoid assigning values to variables in if clauses and the like (line '546', column '29').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $this->prefixesPsr0[$first][$prefix] = array_merge(
                                $this->prefixesPsr0[$first][$prefix],
                                (array) $paths
                            );
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                ElseExpression

                Since: 1.4.0

                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($flag) {
                            // one branch
                        } else {
                            // another branch
                        }
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#elseexpression

                Avoid assigning values to variables in if clauses and the like (line '523', column '23').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                Avoid assigning values to variables in if clauses and the like (line '536', column '41').
                Open

                    private function findFileWithExtension($class, $ext)
                    {
                        // PSR-4 lookup
                        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                Avoid assigning values to variables in if clauses and the like (line '427', column '13').
                Open

                    public function loadClass($class)
                    {
                        if ($file = $this->findFile($class)) {
                            includeFile($file);
                
                
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                IfStatementAssignment

                Since: 2.7.0

                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                Example

                class Foo
                {
                    public function bar($flag)
                    {
                        if ($foo = 'bar') { // possible typo
                            // ...
                        }
                        if ($baz = 0) { // always false
                            // ...
                        }
                    }
                }

                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                Avoid excessively long variable names like $classMapAuthoritative. Keep variable name length under 20.
                Open

                    private $classMapAuthoritative = false;
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                LongVariable

                Since: 0.2

                Detects when a field, formal or local variable is declared with a long name.

                Example

                class Something {
                    protected $reallyLongIntName = -3; // VIOLATION - Field
                    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                        $otherReallyLongName = -5; // VIOLATION - Local
                        for ($interestingIntIndex = 0; // VIOLATION - For
                             $interestingIntIndex < 10;
                             $interestingIntIndex++ ) {
                        }
                    }
                }

                Source https://phpmd.org/rules/naming.html#longvariable

                Avoid excessively long variable names like $classMapAuthoritative. Keep variable name length under 20.
                Open

                    public function setClassMapAuthoritative($classMapAuthoritative)
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                LongVariable

                Since: 0.2

                Detects when a field, formal or local variable is declared with a long name.

                Example

                class Something {
                    protected $reallyLongIntName = -3; // VIOLATION - Field
                    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                        $otherReallyLongName = -5; // VIOLATION - Local
                        for ($interestingIntIndex = 0; // VIOLATION - For
                             $interestingIntIndex < 10;
                             $interestingIntIndex++ ) {
                        }
                    }
                }

                Source https://phpmd.org/rules/naming.html#longvariable

                The 'getUseIncludePath()' method which returns a boolean should be named 'is...()' or 'has...()'
                Open

                    public function getUseIncludePath()
                    {
                        return $this->useIncludePath;
                    }
                Severity: Minor
                Found in vendor/composer/ClassLoader.php by phpmd

                BooleanGetMethodName

                Since: 0.2

                Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                Example

                class Foo {
                    /**
                     * @return boolean
                     */
                    public function getFoo() {} // bad
                    /**
                     * @return bool
                     */
                    public function isFoo(); // ok
                    /**
                     * @return boolean
                     */
                    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                }

                Source https://phpmd.org/rules/naming.html#booleangetmethodname

                There are no issues that match your filters.

                Category
                Status