aaronbullard/php-schema

View on GitHub

Showing 35 of 43 total issues

Avoid variables with short names like $fn. Configured minimum length is 3.
Open

    public function map(Closure $fn)
Severity: Minor
Found in src/Observers/ArrayObserver.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $fn. Configured minimum length is 3.
Open

    public function filter(Closure $fn)
Severity: Minor
Found in src/Observers/ArrayObserver.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $fn. Configured minimum length is 3.
Open

    public function reduce(Closure $fn, $initial = null)
Severity: Minor
Found in src/Observers/ArrayObserver.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

The parameter $street_1 is not named in camelCase.
Open

    public function __construct(string $street_1, string $street_2 = null, string $city, string $state, string $zipcode)
    {
        parent::__construct(compact('street_1', 'street_2', 'city', 'state', 'zipcode'));
    }
Severity: Minor
Found in demo/Entity/Address.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $street_2 is not named in camelCase.
Open

    public function __construct(string $street_1, string $street_2 = null, string $city, string $state, string $zipcode)
    {
        parent::__construct(compact('street_1', 'street_2', 'city', 'state', 'zipcode'));
    }
Severity: Minor
Found in demo/Entity/Address.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

There must be one USE keyword per declaration
Open

use ArrayAccess, Countable, Closure, Iterator;

There must be one blank line after the last USE statement; 2 found;
Open

use JsonSchema\Validator as JsonSchemaValidator;
Severity: Minor
Found in src/Models/Validator.php by phpcodesniffer

The closing brace for the trait must go on the next line after the body
Open

}

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

    public function __construct($input = [], $observe = TRUE)
Severity: Minor
Found in src/Models/SchemaModel.php by phpcodesniffer

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

    public function __construct($input = [], $observe = TRUE)
Severity: Minor
Found in src/Models/Model.php by phpcodesniffer

Missing class import via use statement (line '26', column '19').
Open

        throw new \InvalidArgumentException("$value is not observable");
Severity: Minor
Found in src/Observers/ObserverFactory.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    public function __construct($input = [], $observe = TRUE)
Severity: Minor
Found in src/Models/Model.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 __construct has a boolean flag argument $observe, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function __construct($input = [], $observe = TRUE)
Severity: Minor
Found in src/Models/SchemaModel.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 static access to class '\PhpSchema\Models\Validator' in method '__construct'.
Open

        $this->validator = Validator::create();
Severity: Minor
Found in src/Models/SchemaModel.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

Inline control structures are not allowed
Open

        if (array() === $this->container) return false;
Severity: Minor
Found in src/Models/Model.php by phpcodesniffer

Arguments with default values must be at the end of the argument list
Open

    public function __construct($input = [], Observable $subscriber)
Severity: Minor
Found in src/Observers/Observer.php by phpcodesniffer

Expected 1 space after IF keyword; 0 found
Open

        if($isAssoc === false){
Severity: Minor
Found in src/Models/Model.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in demo/Entity/Person.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

        if($isAssoc === false){
Severity: Minor
Found in src/Models/Model.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

        if($this->isAssociative()){
Severity: Minor
Found in src/Models/Model.php by phpcodesniffer
Severity
Category
Status
Source
Language