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

View on GitHub

Showing 387 of 387 total issues

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ) {

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ) {
Severity: Critical
Found in src/Model/Validator/PropertyValidator.php by phan

syntax error, unexpected ')'
Open

        );
Severity: Critical
Found in src/ModelGenerator.php by phan

syntax error, unexpected ')'
Open

                )

syntax error, unexpected ')'
Open

                )

Possibly zero references to use statement for classlike/namespace JsonSchema (\PHPModelGenerator\Model\SchemaDefinition\JsonSchema)
Open

use PHPModelGenerator\Model\SchemaDefinition\JsonSchema;

Possibly zero references to use statement for classlike/namespace SchemaProcessor (\PHPModelGenerator\SchemaProcessor\SchemaProcessor)
Open

use PHPModelGenerator\SchemaProcessor\SchemaProcessor;

syntax error, unexpected ')'
Open

            );

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ) {

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ): PropertyInterface {
Severity: Critical
Found in src/PropertyProcessor/PropertyFactory.php by phan

Rename "$attribute" which has the same name as the field declared at line 25.
Open

        $attribute = !$this->isInternal() && $variableName && preg_match('/^\d/', $this->attribute) === 1

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

syntax error, unexpected ')'
Open

            );
Severity: Critical
Found in src/Model/GeneratorConfiguration.php by phan

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ): PropertyInterface;
Severity: Critical
Found in src/Model/Property/PropertyInterface.php by phan

Possibly zero references to use statement for classlike/namespace SchemaException (\PHPModelGenerator\Exception\SchemaException)
Open

use PHPModelGenerator\Exception\SchemaException;

syntax error, unexpected ')'
Open

        );
Severity: Critical
Found in src/Model/Validator/EnumValidator.php by phan

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ): void {

syntax error, unexpected ')', expecting variable (T_VARIABLE)
Open

    ) {

Define a constant instead of duplicating this literal "schemas" 3 times.
Open

        if (!isset($this->openAPIv3Spec['components']['schemas']) ||

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

syntax error, unexpected ')'
Open

        );

syntax error, unexpected ')'
Open

                )
Severity
Category
Status
Source
Language