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

View on GitHub
src/PropertyProcessor/Property/ConstProcessor.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Avoid using static access to class '\PHPModelGenerator\Utils\RenderHelper' in method 'process'.
Open

                => '!in_array($value, ' . RenderHelper::varExportArray([$json['const'], null]) . ', true)',

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\PHPModelGenerator\Utils\TypeConverter' in method 'process'.
Open

            new PropertyType(TypeConverter::gettypeToInternal(gettype($json['const']))),

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

syntax error, unexpected ')'
Open

        );

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 26 and the first side effect is on line 21.
Open

<?php

Possible parse error: class missing opening or closing brace
Open

class ConstProcessor extends AbstractPropertyProcessor

Possible parse error: class missing opening or closing brace
Open

class ConstProcessor extends AbstractPropertyProcessor

Line exceeds 120 characters; contains 128 characters
Open

                => "array_key_exists('{$property->getName()}', \$modelData) && \$value !== " . var_export($json['const'], true),

Closing brace indented incorrectly; expected 4 spaces, found 0
Open

}

Line indented incorrectly; expected 0 spaces, found 4
Open

    public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface

Line indented incorrectly; expected 4 spaces, found 12
Open

            default

There are no issues that match your filters.

Category
Status