shrink0r/php-schema

View on GitHub

Showing 38 of 38 total issues

Avoid using static access to class '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return in_array($value, $this->choices) ? Ok::unit() : Error::unit([ Error::INVALID_CHOICE ]);
Severity: Minor
Found in src/Property/ChoiceProperty.php by phpmd

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 '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        $result = Ok::unit();
Severity: Minor
Found in src/Property/EnumProperty.php by phpmd

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 'Shrink0r\PhpSchema\Ok' in method 'build'.
Open

            return Ok::unit($builtConfig);
Severity: Minor
Found in src/Builder.php by phpmd

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 'Shrink0r\PhpSchema\Error' in method 'validateMappedValues'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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

The method validateAnyValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $errors[$key] = [ Error::UNEXPECTED_KEY ];
            }
Severity: Minor
Found in src/Schema.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'Shrink0r\PhpSchema\Error' in method 'selectValue'.
Open

        return empty($errors) ? Ok::unit($value) : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 '\Shrink0r\PhpSchema\Error' in method 'validate'.
Open

        return is_int($value) ? Ok::unit() : Error::unit([ Error::NON_INT ]);
Severity: Minor
Found in src/Property/IntProperty.php by phpmd

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 'Shrink0r\PhpSchema\Error' in method 'validate'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return Ok::unit();
Severity: Minor
Found in src/Property/Property.php by phpmd

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 '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return is_scalar($value) ? Ok::unit() : Error::unit([ Error::NON_SCALAR ]);
Severity: Minor
Found in src/Property/ScalarProperty.php by phpmd

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 'Shrink0r\PhpSchema\Ok' in method 'validateAnyValues'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 'Shrink0r\PhpSchema\Error' in method 'validateAnyValues'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 '\Shrink0r\PhpSchema\Error' in method 'validate'.
Open

        return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]);
Severity: Minor
Found in src/Property/BoolProperty.php by phpmd

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 '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return class_exists($value) || interface_exists($value) ? Ok::unit() : Error::unit([ Error::CLASS_NOT_EXISTS ]);
Severity: Minor
Found in src/Property/FqcnProperty.php by phpmd

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 '\Shrink0r\PhpSchema\Error' in method 'validate'.
Open

            return Error::unit([ Error::NON_ARRAY ]);
Severity: Minor
Found in src/Property/SequenceProperty.php by phpmd

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 'Shrink0r\PhpSchema\Ok' in method 'selectValue'.
Open

        return empty($errors) ? Ok::unit($value) : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 'Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Schema.php by phpmd

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 '\Shrink0r\PhpSchema\Ok' in method 'validate'.
Open

        return empty($errors) ? Ok::unit() : Error::unit($errors);
Severity: Minor
Found in src/Property/SequenceProperty.php by phpmd

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

Severity
Category
Status
Source
Language