mheinzerling/php-databaseutils

View on GitHub

Showing 115 of 115 total issues

Missing class import via use statement (line '88', column '31').
Open

                    throw new \Exception("Found lazy index/unique that should have been resolved already");
Severity: Minor
Found in src/structure/Table.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

Missing class import via use statement (line '59', column '23').
Open

            throw new \Exception("Tried to merge unrelated lazy foreign keys");

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

Missing class import via use statement (line '168', column '47').
Open

        else if (count($autos) > 1) throw new \Exception("Unsupported");
Severity: Minor
Found in src/structure/Table.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 autoincrement has a boolean flag argument $autoincrement, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function autoincrement(bool $autoincrement = true): FieldBuilder

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

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

        throw new \Exception("Unknown sql type: " . $type);
Severity: Minor
Found in src/structure/type/Type.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

Avoid too many return statements within this method.
Open

        if ($result != null) return $result;
Severity: Major
Found in src/structure/type/Type.php - About 30 mins to fix

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

        public function __construct(bool $dropDatabaseAtShutdown = true)
    Severity: Minor
    Found in src/TestDatabaseConnection.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

    Missing class import via use statement (line '92', column '31').
    Open

                        throw new \Exception("Found unknown lazy index that should have been resolved already or need to be added here");
    Severity: Minor
    Found in src/structure/Table.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

    Avoid too many return statements within this method.
    Open

            if ($result != null) return $result;
    Severity: Major
    Found in src/structure/type/Type.php - About 30 mins to fix

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

          public function primary(bool $primary = true): FieldBuilder

      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 fromSql has a boolean flag argument $isBoolean, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function fromSql(string $type, string $collation = null, bool $isBoolean = false): Type
      Severity: Minor
      Found in src/structure/type/Type.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 null has a boolean flag argument $null, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function null(bool $null = true): FieldBuilder

      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 unused local variables such as '$key'.
      Open

              foreach ($data as $key => &$value) {
      Severity: Minor
      Found in src/DatabaseUtils.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

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

      The method fromSql() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
      Open

          public static function fromSql(string $type, string $collation = null, bool $isBoolean = false): Type
          {
              //TODO register parser
              $result = BoolType::parseBool($type);
              if ($result != null) return $result;
      Severity: Minor
      Found in src/structure/type/Type.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 unused parameters such as '$_'.
      Open

                  $updateAssignment = StringUtils::implode(", ", $keys, function ($_, $key) {
      Severity: Minor
      Found in src/DatabaseUtils.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

      Avoid unused parameters such as '$renames'.
      Open

          public function migrate(Database $before, SqlSetting $setting, array $renames = null /*TODO*/): Migration
      Severity: Minor
      Found in src/structure/Database.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

      Avoid unused parameters such as '$_'.
      Open

              return StringUtils::implode("_", $fields, function ($_, $field) {
      Severity: Minor
      Found in src/structure/index/Index.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

      Avoid unused parameters such as '$setting'.
      Open

          public function toCreateSql(SqlSetting $setting): string
      Severity: Minor
      Found in src/structure/Database.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 toCreateSql() has an NPath complexity of 5376. The configured NPath complexity threshold is 200.
      Open

          public function toCreateSql(SqlSetting $setting): string
          {
              $delimiter = $setting->singleLine ? " " : "\n";
              $sql = 'CREATE TABLE ';
              if ($setting->createTableIfNotExists) $sql .= 'IF NOT EXISTS ';
      Severity: Minor
      Found in src/structure/Table.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 unused local variables such as '$name'.
      Open

              foreach ($this->indexes as $name => &$index) {

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

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

      Severity
      Category
      Status
      Source
      Language