gdbots/pbjc-php

View on GitHub

Showing 579 of 579 total issues

Avoid using static access to class '\Gdbots\Pbjc\SchemaId' in method 'xxtestValidateException'.
Open

            SchemaId::fromString('pbj:vendor2:package2:category2:message2:1-0-1'),

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 '\Gdbots\Pbjc\SchemaStore' in method 'testValidateSame'.
Open

        SchemaStore::addSchema(
            SchemaId::fromString('pbj:vendor2:package2:category2:message2:1-0-0'),
            new SchemaDescriptor('pbj:vendor2:package2:category2:message2:1-0-0')
        );

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 '\Gdbots\Pbjc\SchemaId' in method 'testValidateAddon'.
Open

            SchemaId::fromString('pbj:vendor3:package3:category3:message3:1-0-0'),

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 '\Gdbots\Common\Util\NumberUtils' in method 'applyStringOptions'.
Open

            $this->minLength = NumberUtils::bound($this->minLength, 0, $this->type->getMaxBytes());
Severity: Minor
Found in src/FieldDescriptor.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 '\Gdbots\Pbjc\SchemaId' in method 'testValidateAddon'.
Open

            SchemaId::fromString('pbj:vendor2:package2:category2:message2:1-0-0'),

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 '\Gdbots\Pbjc\SchemaId' in method 'testValidateSame'.
Open

            SchemaId::fromString('pbj:vendor2:package2:category2:message2:1-0-0'),

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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $schemas[] = $file->getPathName();
                }
Severity: Minor
Found in src/Compiler.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 '\Gdbots\Pbjc\Enum\FieldRule' in method '__construct'.
Open

                        if (null !== $value && in_array($value, FieldRule::values())) {
Severity: Minor
Found in src/FieldDescriptor.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 generateManifest() has 112 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function generateManifest(array $schemas)
    {
        $response = new GeneratorResponse();
        $manifests = ['all' => []];

Severity: Minor
Found in src/Generator/Generator.php by phpmd

Avoid using static access to class '\Gdbots\Pbjc\Util\XmlUtils' in method 'fromFile'.
Open

        if (!$xmlData = XmlUtils::convertDomElementToArray($xmlDomDocument->firstChild)) {
Severity: Minor
Found in src/EnumParser.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 '\Gdbots\Pbjc\SchemaStore' in method 'generateManifest'.
Open

            foreach (SchemaStore::getOtherSchemaMajorRev($schema->getId()) as $s) {
Severity: Minor
Found in src/Generator/Generator.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 generateSchema uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->generateMessage($schema, $response);
            $this->generateMessageInterface($schema, $response);
        }
Severity: Minor
Found in src/Generator/Generator.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 unused parameters such as '$enum'.
Open

    public function generateEnum(EnumDescriptor $enum)
Severity: Minor
Found in src/Generator/Generator.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

The method run() has an NPath complexity of 1728. The configured NPath complexity threshold is 200.
Open

    public function run($language, CompileOptions $options)
    {
        $namespaces = $options->getNamespaces();

        if (!$namespaces || count($namespaces) === 0) {
Severity: Minor
Found in src/Compiler.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class '\Gdbots\Common\Util\StringUtils' in method '__construct'.
Open

            $classProperty = lcfirst(StringUtils::toCamelFromSlug($key));
Severity: Minor
Found in src/FieldDescriptor.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 '\Gdbots\Pbjc\Enum\FieldRule' in method 'applyFieldRule'.
Open

        $this->rule = $this->rule ?: FieldRule::A_SINGLE_VALUE();
Severity: Minor
Found in src/FieldDescriptor.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 'getIncludeAll()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getIncludeAll()
    {
        return $this->include_all;
    }
Severity: Minor
Found in src/CompileOptions.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

Avoid using static access to class 'Gdbots\Pbjc\SchemaStore' in method 'run'.
Open

        foreach (SchemaStore::getSchemas() as $schema) {
Severity: Minor
Found in src/Compiler.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 '\Gdbots\Common\Util\StringUtils' in method '__construct'.
Open

                            StringUtils::toCamelFromSlug($parameters['type'])
Severity: Minor
Found in src/FieldDescriptor.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 '\Gdbots\Pbjc\Enum\FieldRule' in method '__construct'.
Open

                            $value = FieldRule::create($value);
Severity: Minor
Found in src/FieldDescriptor.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