diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index 67578a70cfc..91a969c75f6 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -558,9 +558,9 @@ private function addIdentifierCondition( * * Table expression and columns are not escaped and are not safe for user-input. * - * @param string $table The SQL expression of the table on which to delete. - * @param array $identifier The deletion criteria. An associative array containing column-value pairs. - * @param array|array $types The query parameter types. + * @param string $table The SQL expression of the table on which to delete. + * @param array $identifier The deletion criteria. An associative array containing column-value pairs. + * @param array $types The query parameter types. * * @return int The number of affected rows. * @@ -696,8 +696,8 @@ public function insert(string $table, array $data, array $types = []) : int /** * Extract ordered type list from an ordered column list and type map. * - * @param array $columnList - * @param array $types The query parameter types. + * @param array $columnList + * @param array $types The query parameter types. * * @return array|array */ @@ -1358,8 +1358,8 @@ private function _bindTypedValues(DriverStatement $stmt, array $params, array $t /** * Gets the binding type of a given type. The given type can be a PDO or DBAL mapping type. * - * @param mixed $value The value to bind. - * @param int|string|null $type The type to bind (PDO or DBAL). + * @param mixed $value The value to bind. + * @param int|string|Type|null $type The type to bind (PDO or DBAL). * * @return array [0] => the (escaped) value, [1] => the binding type. */ @@ -1384,8 +1384,8 @@ private function getBindingInfo($value, $type) : array * @internal This is a purely internal method. If you rely on this method, you are advised to * copy/paste the code as this method may change, or be removed without prior notice. * - * @param array|array $params - * @param array|array $types The query parameter types. + * @param array|array $params + * @param array|array $types The query parameter types. * * @return array|array */ diff --git a/lib/Doctrine/DBAL/Logging/SQLLogger.php b/lib/Doctrine/DBAL/Logging/SQLLogger.php index 10d5b35823c..75cd27b1ec4 100644 --- a/lib/Doctrine/DBAL/Logging/SQLLogger.php +++ b/lib/Doctrine/DBAL/Logging/SQLLogger.php @@ -4,6 +4,8 @@ namespace Doctrine\DBAL\Logging; +use Doctrine\DBAL\Types\Type; + /** * Interface for SQL loggers. */ @@ -12,9 +14,9 @@ interface SQLLogger /** * Logs a SQL statement somewhere. * - * @param string $sql The SQL to be executed. - * @param mixed[] $params The SQL parameters. - * @param int[]|string[] $types The SQL parameter types. + * @param string $sql The SQL to be executed. + * @param mixed[] $params The SQL parameters. + * @param int[]|string[]|Type[] $types The SQL parameter types. */ public function startQuery(string $sql, array $params = [], array $types = []) : void; diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 6115073a68f..c6e55ea824f 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -954,7 +954,7 @@ public function setValue(string $column, string $value) : self * ); * * - * @param array $values The values to specify for the insert query indexed by column names. + * @param array $values The values to specify for the insert query indexed by column names. * * @return $this This QueryBuilder instance. */ diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php index 589a068b80f..1ea20563538 100644 --- a/lib/Doctrine/DBAL/Schema/Table.php +++ b/lib/Doctrine/DBAL/Schema/Table.php @@ -840,9 +840,9 @@ private function _createUniqueConstraint(array $columns, string $indexName, arra } /** - * @param array $columns - * @param array $flags - * @param array $options + * @param array $columns + * @param array $flags + * @param array $options * * @throws SchemaException */ @@ -852,13 +852,7 @@ private function _createIndex(array $columns, string $indexName, bool $isUnique, throw IndexNameInvalid::new($indexName); } - foreach ($columns as $index => $value) { - if (is_string($index)) { - $columnName = $index; - } else { - $columnName = $value; - } - + foreach ($columns as $columnName) { if (! $this->hasColumn($columnName)) { throw ColumnDoesNotExist::new($columnName, $this->_name); } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a47e2c48f91..e387eb25652 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -16,8 +16,8 @@ parameters: # https://bugs.php.net/bug.php?id=78126 - '~^Call to an undefined method PDO::sqliteCreateFunction\(\)\.\z~' - # https://github.com/phpstan/phpstan/issues/1847 - - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array, array given\.\z~' + # https://github.com/phpstan/phpstan/issues/2857 + - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\Exception\\NonUniqueAlias::new\(\) expects array, array given\.\z~' # legacy remnants from doctrine/common - '~^Class Doctrine\\Common\\(Collections\\Collection|Persistence\\Proxy) not found\.\z~' diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php index b82dc833a18..882081d04e5 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php @@ -617,20 +617,6 @@ public function testGeneratesDropIndexSQL() : void )); } - public function testCannotGenerateDropIndexSQLWithInvalidIndexParameter() : void - { - $this->expectException(InvalidArgumentException::class); - - $this->platform->getDropIndexSQL(['index'], 'table'); - } - - public function testCannotGenerateDropIndexSQLWithInvalidTableParameter() : void - { - $this->expectException(InvalidArgumentException::class); - - $this->platform->getDropIndexSQL('index', ['table']); - } - public function testGeneratesSQLSnippets() : void { self::assertEquals('STRING(column1, "string1", column2, "string2")', $this->platform->getConcatExpression( diff --git a/tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php b/tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php index e65507b7826..94b50b6870d 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php @@ -66,7 +66,7 @@ public function testTableOptions() : void } /** - * @param string[] $overrideOptions + * @param array $overrideOptions * * @return string[] */