Commit 0306cc6f authored by Benjamin Morel's avatar Benjamin Morel

Fix phpstan errors

parent 51fa9459
......@@ -558,9 +558,9 @@ class Connection implements DriverConnection
*
* 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<string, mixed> $identifier The deletion criteria. An associative array containing column-value pairs.
* @param array<int, int|string>|array<string, int|string> $types The query parameter types.
* @param string $table The SQL expression of the table on which to delete.
* @param array<string, mixed> $identifier The deletion criteria. An associative array containing column-value pairs.
* @param array<int|string, int|string> $types The query parameter types.
*
* @return int The number of affected rows.
*
......@@ -696,8 +696,8 @@ class Connection implements DriverConnection
/**
* Extract ordered type list from an ordered column list and type map.
*
* @param array<int, string> $columnList
* @param array<int, int|string> $types The query parameter types.
* @param array<int, string> $columnList
* @param array<int|string, int|string> $types The query parameter types.
*
* @return array<int, int>|array<int, string>
*/
......@@ -1358,8 +1358,8 @@ class Connection implements DriverConnection
/**
* 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<int, mixed> [0] => the (escaped) value, [1] => the binding type.
*/
......@@ -1384,8 +1384,8 @@ class Connection implements DriverConnection
* @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<int, mixed>|array<string, mixed> $params
* @param array<int, int|string>|array<string, int|string> $types The query parameter types.
* @param array<int, mixed>|array<string, mixed> $params
* @param array<int, int|string|Type>|array<string, int|string|Type> $types The query parameter types.
*
* @return array<int, mixed>|array<string, mixed>
*/
......
......@@ -4,6 +4,8 @@ declare(strict_types=1);
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;
......
......@@ -954,7 +954,7 @@ class QueryBuilder
* );
* </code>
*
* @param array<int, mixed> $values The values to specify for the insert query indexed by column names.
* @param array<string, mixed> $values The values to specify for the insert query indexed by column names.
*
* @return $this This QueryBuilder instance.
*/
......
......@@ -840,9 +840,9 @@ class Table extends AbstractAsset
}
/**
* @param array<string|int, string> $columns
* @param array<int, string> $flags
* @param array<string, mixed> $options
* @param array<int, string> $columns
* @param array<int, string> $flags
* @param array<string, mixed> $options
*
* @throws SchemaException
*/
......@@ -852,13 +852,7 @@ class Table extends AbstractAsset
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);
}
......
......@@ -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<string>, array<int, int|string> given\.\z~'
# https://github.com/phpstan/phpstan/issues/2857
- '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\Exception\\NonUniqueAlias::new\(\) expects array<string>, array<int, int\|string> given\.\z~'
# legacy remnants from doctrine/common
- '~^Class Doctrine\\Common\\(Collections\\Collection|Persistence\\Proxy) not found\.\z~'
......
......@@ -617,20 +617,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
));
}
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(
......
......@@ -66,7 +66,7 @@ class MySqlInheritCharsetTest extends TestCase
}
/**
* @param string[] $overrideOptions
* @param array<string, mixed> $overrideOptions
*
* @return string[]
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment