diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5d53a9ac..e00f4195 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -36,6 +36,12 @@ parameters: count: 1 path: src/DatabaseDriver.php + - + message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: src/DatabaseDriver.php + - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -72,6 +78,12 @@ parameters: count: 1 path: src/DatabaseDriver.php + - + message: '#^Result of \|\| is always false\.$#' + identifier: booleanOr.alwaysFalse + count: 1 + path: src/DatabaseDriver.php + - message: '#^Strict comparison using \=\=\= between ''resource''\|''resource \(closed\)'' and ''object'' will always evaluate to false\.$#' identifier: identical.alwaysFalse @@ -84,6 +96,12 @@ parameters: count: 1 path: src/DatabaseDriver.php + - + message: '#^Strict comparison using \=\=\= between string and null will always evaluate to false\.$#' + identifier: identical.alwaysFalse + count: 1 + path: src/DatabaseDriver.php + - message: '#^Unreachable statement \- code above always terminates\.$#' identifier: deadCode.unreachable diff --git a/src/DatabaseDriver.php b/src/DatabaseDriver.php index b56d9229..81885d02 100644 --- a/src/DatabaseDriver.php +++ b/src/DatabaseDriver.php @@ -504,8 +504,12 @@ public function __destruct() * * @since 2.0.0 */ - public function alterDbCharacterSet(string $dbName) + public function alterDbCharacterSet($dbName) { + if ($dbName === null || !is_string($dbName) || $dbName === '') { + throw new \RuntimeException('Database name must not be null and a non empty string.'); + } + $this->setQuery($this->getAlterDbCharacterSet($dbName)); return $this->execute();