wol-soft/php-json-schema-model-generator

View on GitHub
src/Utils/RenderHelper.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

The method getType has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getType(PropertyInterface $property, bool $outputType = false): string
Severity: Minor
Found in src/Utils/RenderHelper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method isPropertyNullable has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function isPropertyNullable(PropertyInterface $property, bool $outputType = false): bool
Severity: Minor
Found in src/Utils/RenderHelper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method getTypeHintAnnotation has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getTypeHintAnnotation(PropertyInterface $property, bool $outputType = false): string
Severity: Minor
Found in src/Utils/RenderHelper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method resolvePropertyDecorator has a boolean flag argument $nestedProperty, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function resolvePropertyDecorator(PropertyInterface $property, bool $nestedProperty = false): string
Severity: Minor
Found in src/Utils/RenderHelper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using PHPModelGenerator\Utils\count() function in for loops.
Open

        for ($i = 0; $i < count($schema->getMethods()); $i++) {
            $renderedMethods .= $schema->getMethods()[array_keys($schema->getMethods())[$i]]->getCode() . "\n\n";
        }
Severity: Minor
Found in src/Utils/RenderHelper.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

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

syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE)
Open

    public function __construct(protected GeneratorConfiguration $generatorConfiguration) {}
Severity: Critical
Found in src/Utils/RenderHelper.php by phan

Opening brace should be on a new line
Open

    public function __construct(protected GeneratorConfiguration $generatorConfiguration) {}
Severity: Minor
Found in src/Utils/RenderHelper.php by phpcodesniffer

Closing brace must be on a line by itself
Open

    public function __construct(protected GeneratorConfiguration $generatorConfiguration) {}
Severity: Minor
Found in src/Utils/RenderHelper.php by phpcodesniffer

There are no issues that match your filters.

Category
Status