bkdotcom/PHPDebugConsole

View on GitHub
src/Debug/Collector/Pdo.php

Summary

Maintainability
A
0 mins
Test Coverage
B
89%

Remove this unused private "currentDatabase" method.
Open

    private function currentDatabase()
Severity: Major
Found in src/Debug/Collector/Pdo.php by sonar-php

private methods that are never executed are dead code: unnecessary, inoperative code that should be removed. Cleaning out dead code decreases the size of the maintained codebase, making it easier to understand the program and preventing bugs from being introduced.

Noncompliant Code Example

public class Foo
{
  private function Foo() {}   // Compliant, private empty constructor intentionally used to prevent any direct instantiation of a class.

  public static function doSomething()
  {
    $foo = new Foo();
    ...
  }

  private function unusedPrivateFunction() {  // Noncompliant
  }
}

Compliant Solution

public class Foo
{
  private function Foo(){}   // Compliant, private empty constructor intentionally used to prevent any direct instantiation of a class.

  public static function doSomething()
  {
    $foo = new Foo();
  }
}

See

Rename "$debug" which has the same name as the field declared at line 32.
Open

        $debug = $this->debug;
Severity: Major
Found in src/Debug/Collector/Pdo.php by sonar-php

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

There are no issues that match your filters.

Category
Status