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

View on GitHub

Showing 397 of 397 total issues

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

        bool $reset = false,
Severity: Minor
Found in src/Model/Property/Property.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 getAttribute has a boolean flag argument $variableName, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getAttribute(bool $variableName = false): string;

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 getTypeHint has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string
Severity: Minor
Found in src/Model/Property/PropertyProxy.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 decorate has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function decorate(string $input, bool $outputType = false): string

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 decorate has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function decorate(string $input, bool $outputType = false): string

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

Remove error control operator '@' on line 173.
Open

    protected function addPatternPropertiesValidator(JsonSchema $propertySchema): void
    {
        $json = $propertySchema->getJson();

        if (!isset($json['patternProperties'])) {

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

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

    public function decorate(string $input, bool $outputType = false): string

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 decorate has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function decorate(string $input, bool $outputType = false): string

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 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 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

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 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 decorate has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function decorate(string $input, bool $outputType = false): string

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 decorate has a boolean flag argument $outputType, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function decorate(string $input, bool $outputType = false): string;

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

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

    public function addAdditionalPropertiesCollectionProperty(Schema $schema): void
    {
        $validationProperty = null;
        foreach ($schema->getBaseValidators() as $validator) {
            if (is_a($validator, AdditionalPropertiesValidator::class)) {

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 generateValidators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
    {
        parent::generateValidators($property, $propertySchema);

        $this->addLengthValidation($property, $propertySchema);
Severity: Minor
Found in src/PropertyProcessor/Property/ArrayProcessor.php - About 25 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 hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function hash(array $array, array $relevantFields = []): string
    {
        if ($relevantFields) {
            foreach ($array as $key => $_) {
                if (!in_array($key, $relevantFields)) {
Severity: Minor
Found in src/Utils/ArrayHash.php - About 25 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 redirectMergedProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function redirectMergedProperty(array $compositionProperties)
    {
        $redirectToProperty = null;
        foreach ($compositionProperties as $property) {
            if ($property->getNestedSchema()) {
Severity: Minor
Found in src/SchemaProcessor/SchemaProcessor.php - About 25 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 addEnumValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addEnumValidator(PropertyInterface $property, array $allowedValues): void
    {
        if (empty($allowedValues)) {
            throw new SchemaException(
                sprintf(
Severity: Minor
Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.php - About 25 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 generateValidators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
    {
        $json = $propertySchema->getJson()['propertySchema']->getJson();

        if (!isset($json['then']) && !isset($json['else'])) {
Severity: Minor
Found in src/PropertyProcessor/ComposedValue/IfProcessor.php - About 25 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

Severity
Category
Status
Source
Language