martin-helmich/typo3-typoscript-parser

View on GitHub

Showing 149 of 149 total issues

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

class PrettyPrinter implements ASTPrinterInterface
{
private PrettyPrinterConfiguration $prettyPrinterConfiguration;
 
public function __construct(?PrettyPrinterConfiguration $prettyPrinterConfiguration = null)
Severity: Minor
Found in src/Parser/Printer/PrettyPrinter.php by phpmd

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

public function __construct(string $condition, array $ifStatements, array $elseStatements, int $sourceLine, ConditionalStatementTerminator $terminator = ConditionalStatementTerminator::Global)
Severity: Minor
Found in src/Parser/AST/ConditionalStatement.php - About 35 mins to fix

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

    public function __construct(string $type, string $value, int $line, int $column = 1, array $patternMatches = [])
    Severity: Minor
    Found in src/Tokenizer/Token.php - About 35 mins to fix

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

      public function condition(string $condition, array $if, array $else, int $line, ConditionalStatementTerminator $terminator = ConditionalStatementTerminator::Global): ConditionalStatement
      Severity: Minor
      Found in src/Parser/AST/Builder.php - About 35 mins to fix

        Possible parse error: class missing opening or closing brace
        Open

        class PrettyPrinter implements ASTPrinterInterface

        Function normalized has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        public function normalized(): TokenStream
        {
        $filteredTokens = [];
         
        $maxLine = 0;
        Severity: Minor
        Found in src/Parser/TokenStream.php - About 35 mins to fix

        Function tokenizeObjectOperation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        private function tokenizeObjectOperation(
        TokenStreamBuilder $tokens,
        MultilineTokenBuilder $state,
        ScannerLine $line
        ): bool {
        Severity: Minor
        Found in src/Tokenizer/Tokenizer.php - About 35 mins to fix

        There must be one blank line after the namespace declaration
        Open

        namespace Helmich\TypoScriptParser\Parser\AST;

        DEFAULT statements must be defined using a colon
        Open

        default => "[end]",

        Function parseIncludeOptionals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        private function parseIncludeOptionals(string $optional, TokenInterface $token): array
        {
        if (!(preg_match_all('/((?<key>[a-z]+)="(?<value>[^"]*)\s*)+"/', $optional, $matches) > 0)) {
        return [null, null];
        }
        Severity: Minor
        Found in src/Parser/Parser.php - About 35 mins to fix

        PHP keywords must be lowercase; expected "global" but found "Global"
        Open

        case Global;

        Possible parse error: class missing opening or closing brace
        Open

        class PrettyPrinter implements ASTPrinterInterface

        Missing class import via use statement (line '45', column '23').
        Open

        throw new \InvalidArgumentException("could not open file '$stream'");
        Severity: Minor
        Found in src/Parser/Parser.php by phpmd

        Missing class import via use statement (line '143', column '23').
        Open

        throw new \InvalidArgumentException("could not open file '$inputStream'");
        Severity: Minor
        Found in src/Tokenizer/Tokenizer.php by phpmd

        Avoid too many return statements within this method.
        Open

        return TokenInterface::TYPE_OPERATOR_DELETE;
        Severity: Major
        Found in src/Tokenizer/Tokenizer.php - About 30 mins to fix

          Missing class import via use statement (line '26', column '23').
          Open

          throw new \InvalidArgumentException(
          Severity: Minor
          Found in src/Parser/AST/Statement.php by phpmd

          Avoid too many return statements within this method.
          Open

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

            Function parseValueOperation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            private function parseValueOperation(ParserState $state): void
            {
            switch ($state->token(1)->getType()) {
            case TokenInterface::TYPE_OPERATOR_ASSIGNMENT:
            $this->parseAssignment($state);
            Severity: Minor
            Found in src/Parser/Parser.php - About 25 mins to fix

            Function parseTokens has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            public function parseTokens(array $tokens): array
            {
            $stream = (new TokenStream($tokens))->normalized();
            $state = new ParserState($stream);
             
             
            Severity: Minor
            Found in src/Parser/Parser.php - About 25 mins to fix

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

            private function tokenizeMultilineComment(
            TokenStreamBuilder $tokens,
            MultilineTokenBuilder $state,
            ScannerLine $line
            ): void {
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd
            Severity
            Category
            Status
            Source
            Language