martin-helmich/typo3-typoscript-parser

View on GitHub

Showing 149 of 149 total issues

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

private function tokenizeObjectOperation(
TokenStreamBuilder $tokens,
MultilineTokenBuilder $state,
ScannerLine $line
): bool {
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

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

private function tokenizeSimpleStatements(TokenStreamBuilder $tokens, ScannerLine $line): bool
{
$simpleTokens = [
self::TOKEN_COMMENT_ONELINE => TokenInterface::TYPE_COMMENT_ONELINE,
self::TOKEN_NESTING_END => TokenInterface::TYPE_BRACE_CLOSE,
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

The method tokenizeString() has an NPath complexity of 258. The configured NPath complexity threshold is 200.
Open

public function tokenizeString(string $inputString): array
{
$inputString = $this->preprocessor->preprocess($inputString);
 
$tokens = new TokenStreamBuilder();
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

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

public function tokenizeString(string $inputString): array
{
$inputString = $this->preprocessor->preprocess($inputString);
 
$tokens = new TokenStreamBuilder();
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

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

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

The method tokenizeBinaryObjectOperation() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
Open

private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
{
$tokens->append(
$this->getTokenTypeForBinaryOperator($matches[3]),
$matches[3],
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

Avoid using static access to class 'Helmich\TypoScriptParser\Parser\Printer\PrettyPrinterConfiguration' in method '__construct'.
Open

$this->prettyPrinterConfiguration = $prettyPrinterConfiguration ?? PrettyPrinterConfiguration::create();
Severity: Minor
Found in src/Parser/Printer/PrettyPrinter.php by phpmd

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

private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
{
$tokens->append(
$this->getTokenTypeForBinaryOperator($matches[3]),
$matches[3],
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

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

public function tokenizeString(string $inputString): array
{
$inputString = $this->preprocessor->preprocess($inputString);
 
$tokens = new TokenStreamBuilder();
Severity: Minor
Found in src/Tokenizer/Tokenizer.php by phpmd

Avoid using Helmich\TypoScriptParser\Parser\Printer\count() function in while loops.
Open

while (count($out) && $out[count($out) - 1] instanceof NopStatement) {
array_pop($out);
}
Severity: Minor
Found in src/Parser/Printer/PrettyPrinter.php by phpmd

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

private function parseToken(ParserState $state): void
{
switch ($state->token()->getType()) {
case TokenInterface::TYPE_OBJECT_IDENTIFIER:
$objectPath = $state->context()->append($state->token()->getValue());
Severity: Minor
Found in src/Parser/Parser.php by phpmd

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

private function printStatementList(array $statements, OutputInterface $output, int $nesting = 0): void
{
if ($nesting === 0) {
$statements = $this->trimTrailingNoops($statements);
}
Severity: Minor
Found in src/Parser/Printer/PrettyPrinter.php by phpmd

Avoid using Helmich\TypoScriptParser\Parser\Printer\count() function in while loops.
Open

while (count($out) && $out[count($out) - 1] instanceof NopStatement) {
array_pop($out);
}
Severity: Minor
Found in src/Parser/Printer/PrettyPrinter.php by phpmd

Avoid using Helmich\TypoScriptParser\Parser\count() function in for loops.
Open

for ($i = 0; $i < count($matches[0]); $i++) {
$key = $matches['key'][$i];
$value = $matches['value'][$i];
 
switch ($key) {
Severity: Minor
Found in src/Parser/Parser.php by phpmd

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

private function parseCondition(ParserState $state): void
{
if ($state->context()->depth() !== 0) {
throw new ParseError(
'Found condition statement inside nested assignment.',
Severity: Minor
Found in src/Parser/Parser.php by phpmd

Line indented incorrectly; expected 0 spaces, found 4
Open

case End;

Line indented incorrectly; expected 4 spaces, found 8
Open

if ($nesting === 0) {

Line indented incorrectly; expected 8 spaces, found 12
Open

} elseif ($statement instanceof MultilineComment) {

Line indented incorrectly; expected 0 spaces, found 4
Open

}

Line indented incorrectly; expected 0 spaces, found 4
Open

private function getIndent(int $nesting): string
Severity
Category
Status
Source
Language