robotdance/php-json-schema

View on GitHub

Showing 177 of 177 total issues

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

    protected function checkUndefined($value, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    public function check($value = null, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    public function check($element, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    public function check($element, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    protected function checkObject($value, $schema = null, $path = null, $i = null, $patternProperties = null)

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 $i. Configured minimum length is 3.
Open

    protected function validateCommonProperties($value, $schema = null, $path = null, $i = "")

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 $i. Configured minimum length is 3.
Open

    protected function validateItems($value, $schema = null, $path = null, $i = null)

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 $dt. Configured minimum length is 3.
Open

        $dt = \DateTime::createFromFormat($format, $datetime);

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 $i. Configured minimum length is 3.
Open

    public function check($element, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    protected function checkEnum($value, $schema = null, $path = null, $i = null)

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 $i. Configured minimum length is 3.
Open

    protected function validateDependencies($value, $dependencies, $path, $i = "")

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 $i. Configured minimum length is 3.
Open

    public function check($value, $schema = null, $path = null, $i = null)
Severity: Minor
Found in src/JsonSchema/Validator.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 $ch. Configured minimum length is 3.
Open

        $ch = curl_init();

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

Method check has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function check($element, $definition = null, $path = null, $additionalProp = null, $patternProperties = null)
Severity: Minor
Found in src/JsonSchema/Constraints/ObjectConstraint.php - About 35 mins to fix

    Method checkObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function checkObject($value, $schema = null, $path = null, $i = null, $patternProperties = null)
    Severity: Minor
    Found in src/JsonSchema/Constraints/Constraint.php - About 35 mins to fix

      Method validateElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function validateElement($element, $matches, $objectDefinition = null, $path = null, $additionalProp = null)
      Severity: Minor
      Found in src/JsonSchema/Constraints/ObjectConstraint.php - About 35 mins to fix

        Function validateMinMaxConstraint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function validateMinMaxConstraint($element, $objectDefinition, $path) {
                // Verify minimum number of properties
                if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
                    if (count(get_object_vars($element)) < $objectDefinition->minProperties) {
                        $errorMsg = I18n::t("constraints.object.min_properties", ['count' => $objectDefinition->minProperties]);
        Severity: Minor
        Found in src/JsonSchema/Constraints/ObjectConstraint.php - About 35 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 unionSchemas has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private function unionSchemas($refSchema, $schema, $fileName, array $paths)
            {
                if (property_exists($refSchema, '$ref')) {
                    $jsonPointer = new JsonPointer($this->uriResolver->resolve($refSchema->{'$ref'}, $fileName));
                    $newSchema = $this->resolveCached((string) $jsonPointer, $paths);
        Severity: Minor
        Found in src/JsonSchema/RefResolver.php - About 35 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

        Avoid too many return statements within this method.
        Open

                    return is_string($value);
        Severity: Major
        Found in src/JsonSchema/Constraints/TypeConstraint.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return true;
          Severity: Major
          Found in src/JsonSchema/Constraints/TypeConstraint.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language