phplrt/phplrt

View on GitHub
libs/compiler/src/Grammar/PP2Grammar.php

Summary

Maintainability
B
5 hrs
Test Coverage

Method reducers has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function reducers(): array
    {
        return [
            20 => static function (array $delegates): Node {
                if ($delegates === []) {
Severity: Major
Found in libs/compiler/src/Grammar/PP2Grammar.php - About 3 hrs to fix

    Method grammar has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function grammar(): array
        {
            return [
                0  => new Repetition(11, 0),
                1  => new Concatenation([30, 2]),
    Severity: Major
    Found in libs/compiler/src/Grammar/PP2Grammar.php - About 2 hrs to fix

      The method reducers() has 109 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          private function reducers(): array
          {
              return [
                  20 => static function (array $delegates): Node {
                      if ($delegates === []) {

      The class PP2Grammar has a coupling between objects value of 28. Consider to reduce the number of dependencies under 13.
      Open

      class PP2Grammar implements GrammarInterface, BuilderInterface
      {
          private Parser $runtime;
      
          /**

      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

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

                      [$from, $to] = [$value[0]->getValue(), $value[1]->getValue()];

      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 $q. Configured minimum length is 3.
      Open

                      [$stmt, $q] = $payload;

      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