src/Phan/Analysis/ReferenceCountsAnalyzer.php

Summary

Maintainability
F
1 wk
Test Coverage

Function getElementsFromElementListForDeferredAnalysis has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getElementsFromElementListForDeferredAnalysis(
        CodeBase $code_base,
        iterable $element_list,
        int $total_count,
        int &$i
Severity: Minor
Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 day 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 analyzeElementReferenceCounts has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    private static function analyzeElementReferenceCounts(
        CodeBase $code_base,
        AddressableElement $element,
        string $issue_type
    ): void {
Severity: Minor
Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 day 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

File ReferenceCountsAnalyzer.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan\Analysis;
Severity: Minor
Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 5 hrs to fix

    Function findAlternateReferencedElementDeclaration has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function findAlternateReferencedElementDeclaration(
            CodeBase $code_base,
            AddressableElement $element
        ): ?AddressableElement {
            $old_fqsen = $element->getFQSEN();
    Severity: Minor
    Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 4 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 ReferenceCountsAnalyzer has an overall complexity of 105 which is very high. The configured complexity threshold is 50.
    Open

    class ReferenceCountsAnalyzer
    {
        /**
         * Take a look at all globally accessible elements and see if
         * we can find any dead code that is never referenced

    Method analyzeElementReferenceCounts has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function analyzeElementReferenceCounts(
            CodeBase $code_base,
            AddressableElement $element,
            string $issue_type
        ): void {
    Severity: Major
    Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 3 hrs to fix

      Method getElementsFromElementListForDeferredAnalysis has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function getElementsFromElementListForDeferredAnalysis(
              CodeBase $code_base,
              iterable $element_list,
              int $total_count,
              int &$i
      Severity: Major
      Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 2 hrs to fix

        Method analyzeReferenceCounts has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function analyzeReferenceCounts(CodeBase $code_base): void
            {
                // Check to see if dead code detection is enabled. Keep
                // in mind that the results here are just a guess and
                // we can't tell with certainty that anything is
        Severity: Minor
        Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 hr to fix

          Method findAlternateReferencedElementDeclaration has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function findAlternateReferencedElementDeclaration(
                  CodeBase $code_base,
                  AddressableElement $element
              ): ?AddressableElement {
                  $old_fqsen = $element->getFQSEN();
          Severity: Minor
          Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 hr to fix

            Method maybeWarnWriteOnlyProperty has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function maybeWarnWriteOnlyProperty(CodeBase $code_base, Property $property): void
                {
                    if ($property->isWriteOnly()) {
                        // Handle annotations such as property-write and phan-write-only
                        return;
            Severity: Minor
            Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 hr to fix

              Method maybeWarnReadOnlyProperty has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function maybeWarnReadOnlyProperty(CodeBase $code_base, Property $property): void
                  {
                      if ($property->isReadOnly()) {
                          // Handle annotations such as property-read and phan-read-only.
                          return;
              Severity: Minor
              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 1 hr to fix

                Function maybeWarnWriteOnlyProperty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function maybeWarnWriteOnlyProperty(CodeBase $code_base, Property $property): void
                    {
                        if ($property->isWriteOnly()) {
                            // Handle annotations such as property-write and phan-write-only
                            return;
                Severity: Minor
                Found in src/Phan/Analysis/ReferenceCountsAnalyzer.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 maybeWarnReadOnlyProperty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function maybeWarnReadOnlyProperty(CodeBase $code_base, Property $property): void
                    {
                        if ($property->isReadOnly()) {
                            // Handle annotations such as property-read and phan-read-only.
                            return;
                Severity: Minor
                Found in src/Phan/Analysis/ReferenceCountsAnalyzer.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

                Method analyzeGlobalElementListReferenceCounts has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        CodeBase $code_base,
                        iterable $element_list,
                        string $issue_type,
                        int $total_count,
                        int &$i
                Severity: Minor
                Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return $code_base->getMethodByFQSEN($fqsen);
                  Severity: Major
                  Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return null;
                    Severity: Major
                    Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return;
                      Severity: Major
                      Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return;
                        Severity: Major
                        Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return null;
                          Severity: Major
                          Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return $code_base->getGlobalConstantByFQSEN($fqsen);
                            Severity: Major
                            Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return null;  // $old_fqsen was not an alternative
                              Severity: Major
                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return null;
                                Severity: Major
                                Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return;
                                  Severity: Major
                                  Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                        return $code_base->getClassConstantByFQSEN($fqsen);
                                    Severity: Major
                                    Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return null;
                                      Severity: Major
                                      Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                            return $code_base->getPropertyByFQSEN($fqsen);
                                        Severity: Major
                                        Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return null;
                                          Severity: Major
                                          Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                            return null;
                                            Severity: Major
                                            Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 30 mins to fix

                                              The method getElementsFromElementListForDeferredAnalysis() has an NPath complexity of 58321. The configured NPath complexity threshold is 200.
                                              Open

                                                  private static function getElementsFromElementListForDeferredAnalysis(
                                                      CodeBase $code_base,
                                                      iterable $element_list,
                                                      int $total_count,
                                                      int &$i

                                              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 analyzeElementReferenceCounts() has 111 lines of code. Current threshold is set to 100. Avoid really long methods.
                                              Open

                                                  private static function analyzeElementReferenceCounts(
                                                      CodeBase $code_base,
                                                      AddressableElement $element,
                                                      string $issue_type
                                                  ): void {

                                              The method analyzeElementReferenceCounts() has an NPath complexity of 2200. The configured NPath complexity threshold is 200.
                                              Open

                                                  private static function analyzeElementReferenceCounts(
                                                      CodeBase $code_base,
                                                      AddressableElement $element,
                                                      string $issue_type
                                                  ): void {

                                              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 analyzeElementReferenceCounts() has a Cyclomatic Complexity of 29. The configured cyclomatic complexity threshold is 10.
                                              Open

                                                  private static function analyzeElementReferenceCounts(
                                                      CodeBase $code_base,
                                                      AddressableElement $element,
                                                      string $issue_type
                                                  ): void {

                                              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 findAlternateReferencedElementDeclaration() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                              Open

                                                  public static function findAlternateReferencedElementDeclaration(
                                                      CodeBase $code_base,
                                                      AddressableElement $element
                                                  ): ?AddressableElement {
                                                      $old_fqsen = $element->getFQSEN();

                                              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 getElementsFromElementListForDeferredAnalysis() has a Cyclomatic Complexity of 32. The configured cyclomatic complexity threshold is 10.
                                              Open

                                                  private static function getElementsFromElementListForDeferredAnalysis(
                                                      CodeBase $code_base,
                                                      iterable $element_list,
                                                      int $total_count,
                                                      int &$i

                                              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 class ReferenceCountsAnalyzer has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
                                              Open

                                              class ReferenceCountsAnalyzer
                                              {
                                                  /**
                                                   * Take a look at all globally accessible elements and see if
                                                   * we can find any dead code that is never referenced

                                              CouplingBetweenObjects

                                              Since: 1.1.0

                                              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                              Example

                                              class Foo {
                                                  /**
                                                   * @var \foo\bar\X
                                                   */
                                                  private $x = null;
                                              
                                                  /**
                                                   * @var \foo\bar\Y
                                                   */
                                                  private $y = null;
                                              
                                                  /**
                                                   * @var \foo\bar\Z
                                                   */
                                                  private $z = null;
                                              
                                                  public function setFoo(\Foo $foo) {}
                                                  public function setBar(\Bar $bar) {}
                                                  public function setBaz(\Baz $baz) {}
                                              
                                                  /**
                                                   * @return \SplObjectStorage
                                                   * @throws \OutOfRangeException
                                                   * @throws \InvalidArgumentException
                                                   * @throws \ErrorException
                                                   */
                                                  public function process(\Iterator $it) {}
                                              
                                                  // ...
                                              }

                                              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  private static function maybeWarnWriteOnlyProperty(CodeBase $code_base, Property $property): void
                                                  {
                                                      if ($property->isWriteOnly()) {
                                                          // Handle annotations such as property-write and phan-write-only
                                                          return;
                                              Severity: Major
                                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php and 1 other location - About 4 hrs to fix
                                              src/Phan/Analysis/ReferenceCountsAnalyzer.php on lines 432..464

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 174.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  private static function maybeWarnReadOnlyProperty(CodeBase $code_base, Property $property): void
                                                  {
                                                      if ($property->isReadOnly()) {
                                                          // Handle annotations such as property-read and phan-read-only.
                                                          return;
                                              Severity: Major
                                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php and 1 other location - About 4 hrs to fix
                                              src/Phan/Analysis/ReferenceCountsAnalyzer.php on lines 399..430

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 174.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      if ($old_fqsen instanceof FullyQualifiedGlobalStructuralElement) {
                                                          $fqsen = $old_fqsen->getCanonicalFQSEN();
                                                          if ($fqsen === $old_fqsen) {
                                                              return null;  // $old_fqsen was not an alternative
                                                          }
                                              Severity: Major
                                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php and 1 other location - About 2 hrs to fix
                                              src/Phan/Analysis/ReferenceCountsAnalyzer.php on lines 497..521

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 133.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                      } elseif ($old_fqsen instanceof FullyQualifiedClassElement) {
                                                          // If this needed to be more thorough,
                                                          // the code adding references could treat uses from within the classes differently from outside.
                                                          $fqsen = $old_fqsen->getCanonicalFQSEN();
                                                          if ($fqsen === $old_fqsen) {
                                              Severity: Major
                                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php and 1 other location - About 2 hrs to fix
                                              src/Phan/Analysis/ReferenceCountsAnalyzer.php on lines 476..521

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 133.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Avoid variables with short names like $i. Configured minimum length is 3.
                                              Open

                                                      int &$i

                                              ShortVariable

                                              Since: 0.2

                                              Detects when a field, local, or parameter has a very short name.

                                              Example

                                              class Something {
                                                  private $q = 15; // VIOLATION - Field
                                                  public static function main( array $as ) { // VIOLATION - Formal
                                                      $r = 20 + $this->q; // VIOLATION - Local
                                                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                          $r += $this->q;
                                                      }
                                                  }
                                              }

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

                                              Avoid variables with short names like $i. Configured minimum length is 3.
                                              Open

                                                      $i = 0;

                                              ShortVariable

                                              Since: 0.2

                                              Detects when a field, local, or parameter has a very short name.

                                              Example

                                              class Something {
                                                  private $q = 15; // VIOLATION - Field
                                                  public static function main( array $as ) { // VIOLATION - Formal
                                                      $r = 20 + $this->q; // VIOLATION - Local
                                                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                          $r += $this->q;
                                                      }
                                                  }
                                              }

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

                                              Avoid variables with short names like $i. Configured minimum length is 3.
                                              Open

                                                      int &$i

                                              ShortVariable

                                              Since: 0.2

                                              Detects when a field, local, or parameter has a very short name.

                                              Example

                                              class Something {
                                                  private $q = 15; // VIOLATION - Field
                                                  public static function main( array $as ) { // VIOLATION - Formal
                                                      $r = 20 + $this->q; // VIOLATION - Local
                                                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                          $r += $this->q;
                                                      }
                                                  }
                                              }

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

                                              Avoid variables with short names like $i. Configured minimum length is 3.
                                              Open

                                                      int &$i

                                              ShortVariable

                                              Since: 0.2

                                              Detects when a field, local, or parameter has a very short name.

                                              Example

                                              class Something {
                                                  private $q = 15; // VIOLATION - Field
                                                  public static function main( array $as ) { // VIOLATION - Formal
                                                      $r = 20 + $this->q; // VIOLATION - Local
                                                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                          $r += $this->q;
                                                      }
                                                  }
                                              }

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

                                              There are no issues that match your filters.

                                              Category
                                              Status