Showing 839 of 839 total issues

Avoid using short method names like Lexer::is(). The configured minimum method name length is 3.
Open

    public function is($symbol)
    {
        return $this->peek === $symbol;
    }
Severity: Minor
Found in src/lexer/Lexer.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

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

Method __construct has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($input)
    {
        $this->size = strlen($input);

        if ($this->size === 0) {
Severity: Minor
Found in src/lexer/Lexer.php - About 1 hr to fix

    Method parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse($grammar, Token $token)
        {
            $parameters = [];
            $kind = null;
            $body = null;
    Severity: Minor
    Found in src/parselets/expr/LambdaParselet.php - About 1 hr to fix

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

                  throw new TypeError(Localization::message('TYP310', [$callee_type]));
      Severity: Minor
      Found in src/ast/expr/CallExpr.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 '$buffer' which will lead to PHP notices.
      Open

              $atom = implode($buffer);
      Severity: Minor
      Found in src/lexer/Tokenizer.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 '$buffer' which will lead to PHP notices.
      Open

                  $buffer[] = $this->readChar();
      Severity: Minor
      Found in src/lexer/Tokenizer.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

      Method injectScope has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function injectScope($parent_scope)
          {
              $this->scope = $parent_scope;
              $this->left->injectScope($parent_scope);
      
      
      Severity: Minor
      Found in src/ast/expr/OperatorExpr.php - About 1 hr to fix

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

            private function handleListDefinitions()
            {
                $renderer = new CliColorizer();
                $context = $this->state('scope')->child;
        
        
        Severity: Minor
        Found in src/cli/Repl.php - About 1 hr to fix

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

              private function regex()
              {
                  $buffer = [];
                  $buffer[] = $this->readChar();
                  $buffer[] = $this->readChar();
          Severity: Minor
          Found in src/lexer/Tokenizer.php - About 1 hr to fix

            Method render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function render()
                {
                    $line = implode('', $this->state('line'));
                    $column = $this->state('column');
            
            
            Severity: Minor
            Found in src/cli/Repl.php - About 1 hr to fix

              Method getPartialOperators has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function & getPartialOperators()
                  {
                      static $op_table = [
                          '+',
                          '-',
              Severity: Minor
              Found in src/lexer/Tag.php - About 1 hr to fix

                Method format has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function format(Parser $parser)
                    {
                        $first = true;
                        $size = count($this->clauses);
                        $processed = 0;
                Severity: Minor
                Found in src/ast/expr/WhereExpr.php - About 1 hr to fix

                  Method __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(Tokenizer $input)
                      {
                          parent::__construct($input);
                          $name_parser = new NameParser($this);
                          $type_parser = new TypeParser($this);
                  Severity: Minor
                  Found in src/parser/TokenReader.php - About 1 hr to fix

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

                        public function format(Parser $parser)
                        {
                            $source = '&';
                    
                            switch (count($this->parameters)) {
                    Severity: Minor
                    Found in src/ast/expr/LambdaExpr.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 getType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getType()
                        {
                            $left_type = $this->left->getType();
                            $index_type = $this->index->getType();
                    
                    
                    Severity: Minor
                    Found in src/ast/expr/AccessExpr.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 compile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function compile($source, $silent = false)
                        {
                            if ('' === $source) {
                                $this->resetState();
                                return;
                    Severity: Minor
                    Found in src/cli/Repl.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

                    The property $scope_level is not named in camelCase.
                    Open

                    abstract class Parser
                    {
                        use Parselet;
                    
                        public $input;
                    Severity: Minor
                    Found in src/parser/Parser.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $is_generic is not named in camelCase.
                    Open

                    class NameTypeParselet implements PrefixParselet
                    {
                        private $is_generic;
                    
                        public function __construct($is_generic = false)

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The parameter $is_generic is not named in camelCase.
                    Open

                        public function __construct($is_generic = false)
                        {
                            $this->is_generic = $is_generic;
                        }

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $parent_scope is not named in camelCase.
                    Open

                        public function injectScope($parent_scope)
                        {
                            $this->left->injectScope($parent_scope);
                            $this->index->injectScope($parent_scope);
                        }
                    Severity: Minor
                    Found in src/ast/expr/AccessExpr.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    Severity
                    Category
                    Status
                    Source
                    Language