diff --git a/composer.json b/composer.json
index 3dc6c103192..61bfa92f5dc 100644
--- a/composer.json
+++ b/composer.json
@@ -49,7 +49,7 @@
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^5.4|^6.0",
"symfony/console": "^4.4|^5.4|^6.0",
- "vimeo/psalm": "4.30.0"
+ "vimeo/psalm": "5.4.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 1486596ca31..16a85d2bb04 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -602,6 +602,9 @@
+
+
+
@@ -766,6 +769,7 @@
This issue should be fixed in 4.0
-->
+
@@ -778,6 +782,7 @@
This issue should be fixed in 4.0
-->
+
@@ -793,10 +798,26 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php b/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php
index 231c9d47316..2587bf70ebd 100644
--- a/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php
+++ b/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php
@@ -13,7 +13,7 @@
*/
final class CannotCopyStreamToStream extends AbstractException
{
- /** @psalm-param array{message: string}|null $error */
+ /** @psalm-param array{message: string, ...mixed}|null $error */
public static function new(?array $error): self
{
$message = 'Could not copy source stream to temporary file';
diff --git a/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php b/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php
index 63f7ca1e26f..6b271784a3e 100644
--- a/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php
+++ b/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php
@@ -13,7 +13,7 @@
*/
final class CannotCreateTemporaryFile extends AbstractException
{
- /** @psalm-param array{message: string}|null $error */
+ /** @psalm-param array{message: string, ...mixed}|null $error */
public static function new(?array $error): self
{
$message = 'Could not create temporary file';
diff --git a/src/Driver/IBMDB2/Exception/PrepareFailed.php b/src/Driver/IBMDB2/Exception/PrepareFailed.php
index 42df5e15c85..8b384dcf3fd 100644
--- a/src/Driver/IBMDB2/Exception/PrepareFailed.php
+++ b/src/Driver/IBMDB2/Exception/PrepareFailed.php
@@ -13,7 +13,7 @@
*/
final class PrepareFailed extends AbstractException
{
- /** @psalm-param array{message: string}|null $error */
+ /** @psalm-param array{message: string, ...mixed}|null $error */
public static function new(?array $error): self
{
if ($error === null) {
diff --git a/src/Driver/Mysqli/Exception/ConnectionError.php b/src/Driver/Mysqli/Exception/ConnectionError.php
index ef5b980170e..5cebd6d0ce8 100644
--- a/src/Driver/Mysqli/Exception/ConnectionError.php
+++ b/src/Driver/Mysqli/Exception/ConnectionError.php
@@ -26,6 +26,6 @@ public static function upcast(mysqli_sql_exception $exception): self
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);
- return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
+ return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception);
}
}
diff --git a/src/Driver/Mysqli/Exception/ConnectionFailed.php b/src/Driver/Mysqli/Exception/ConnectionFailed.php
index 44a8cab9995..70d2499215e 100644
--- a/src/Driver/Mysqli/Exception/ConnectionFailed.php
+++ b/src/Driver/Mysqli/Exception/ConnectionFailed.php
@@ -31,6 +31,6 @@ public static function upcast(mysqli_sql_exception $exception): self
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);
- return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
+ return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception);
}
}
diff --git a/src/Driver/Mysqli/Exception/InvalidCharset.php b/src/Driver/Mysqli/Exception/InvalidCharset.php
index 8c6bbb476e3..cc13c88fcfa 100644
--- a/src/Driver/Mysqli/Exception/InvalidCharset.php
+++ b/src/Driver/Mysqli/Exception/InvalidCharset.php
@@ -35,7 +35,7 @@ public static function upcast(mysqli_sql_exception $exception, string $charset):
return new self(
sprintf('Failed to set charset "%s": %s', $charset, $exception->getMessage()),
$p->getValue($exception),
- (int) $exception->getCode(),
+ $exception->getCode(),
$exception,
);
}
diff --git a/src/Driver/Mysqli/Exception/StatementError.php b/src/Driver/Mysqli/Exception/StatementError.php
index 78dc8556b20..d91509ebe1b 100644
--- a/src/Driver/Mysqli/Exception/StatementError.php
+++ b/src/Driver/Mysqli/Exception/StatementError.php
@@ -26,6 +26,6 @@ public static function upcast(mysqli_sql_exception $exception): self
$p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate');
$p->setAccessible(true);
- return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception);
+ return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception);
}
}
diff --git a/src/DriverManager.php b/src/DriverManager.php
index a5f44783260..ebd91de0898 100644
--- a/src/DriverManager.php
+++ b/src/DriverManager.php
@@ -154,32 +154,9 @@ private function __construct()
*
* @param Configuration|null $config The configuration to use.
* @param EventManager|null $eventManager The event manager to use.
- * @psalm-param array{
- * charset?: string,
- * dbname?: string,
- * default_dbname?: string,
- * driver?: key-of,
- * driverClass?: class-string,
- * driverOptions?: array,
- * host?: string,
- * keepSlave?: bool,
- * keepReplica?: bool,
- * master?: OverrideParams,
- * memory?: bool,
- * password?: string,
- * path?: string,
- * pdo?: \PDO,
- * platform?: Platforms\AbstractPlatform,
- * port?: int,
- * primary?: OverrideParams,
- * replica?: array,
- * sharding?: array,
- * slaves?: array,
- * user?: string,
- * wrapperClass?: class-string,
- * } $params
- *
- * @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection)
+ * @psalm-param Params $params
+ *
+ * @psalm-return ($params is array{wrapperClass: class-string} ? T : Connection)
*
* @throws Exception
*
diff --git a/src/Schema/TableDiff.php b/src/Schema/TableDiff.php
index 58128d75b3e..d7fd301ef0c 100644
--- a/src/Schema/TableDiff.php
+++ b/src/Schema/TableDiff.php
@@ -105,7 +105,7 @@ class TableDiff
*
* @internal Use {@see getAddedForeignKeys()} instead.
*
- * @var ForeignKeyConstraint[]
+ * @var list
*/
public $addedForeignKeys = [];
@@ -114,7 +114,7 @@ class TableDiff
*
* @internal Use {@see getModifiedForeignKeys()} instead.
*
- * @var ForeignKeyConstraint[]
+ * @var list
*/
public $changedForeignKeys = [];
@@ -123,7 +123,7 @@ class TableDiff
*
* @internal Use {@see getDroppedForeignKeys()} instead.
*
- * @var (ForeignKeyConstraint|string)[]
+ * @var list
*/
public $removedForeignKeys = [];
@@ -333,12 +333,10 @@ public function getDroppedForeignKeys(): array
*/
public function unsetDroppedForeignKey($foreignKey): void
{
- $this->removedForeignKeys = array_filter(
+ $this->removedForeignKeys = array_values(array_filter(
$this->removedForeignKeys,
- static function ($removedForeignKey) use ($foreignKey): bool {
- return $removedForeignKey !== $foreignKey;
- },
- );
+ static fn ($removedForeignKey): bool => $removedForeignKey !== $foreignKey,
+ ));
}
/**
diff --git a/tests/Functional/BlobTest.php b/tests/Functional/BlobTest.php
index ec346406561..722d3156513 100644
--- a/tests/Functional/BlobTest.php
+++ b/tests/Functional/BlobTest.php
@@ -59,10 +59,7 @@ public function testInsertNull(): void
]);
self::assertEquals(1, $ret);
-
- [$clobValue, $blobValue] = $this->fetchRow();
- self::assertNull($clobValue);
- self::assertNull($blobValue);
+ self::assertSame([null, null], $this->fetchRow());
}
public function testInsertProcessesStream(): void
diff --git a/tests/Functional/Platform/LengthExpressionTest.php b/tests/Functional/Platform/LengthExpressionTest.php
index 1c15f5a1e8b..fc468f0eabe 100644
--- a/tests/Functional/Platform/LengthExpressionTest.php
+++ b/tests/Functional/Platform/LengthExpressionTest.php
@@ -32,7 +32,7 @@ public function testLengthExpression(string $value, int $expected, bool $isMulti
self::assertEquals($expected, $this->connection->fetchOne($query, [$value]));
}
- /** @return iterable */
+ /** @return iterable */
public static function expressionProvider(): iterable
{
yield '1-byte' => ['Hello, world!', 13, false];
diff --git a/tests/Functional/Platform/RenameColumnTest.php b/tests/Functional/Platform/RenameColumnTest.php
index 6afa20d56f5..af226981caa 100644
--- a/tests/Functional/Platform/RenameColumnTest.php
+++ b/tests/Functional/Platform/RenameColumnTest.php
@@ -34,7 +34,7 @@ public function testColumnPositionRetainedAfterRenaming(string $columnName, stri
self::assertSame([strtolower($newColumnName), 'c2'], array_keys($table->getColumns()));
}
- /** @return iterable */
+ /** @return iterable */
public static function columnNameProvider(): iterable
{
yield ['c1', 'c1_x'];
diff --git a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
index 4cfe1e9d832..90e44d43958 100644
--- a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
+++ b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
@@ -251,14 +251,14 @@ public function testListForeignKeys(): void
$fkOptions = ['SET NULL', 'SET DEFAULT', 'NO ACTION', 'CASCADE', 'RESTRICT'];
$foreignKeys = [];
$fkTable = $this->getTestTable('test_create_fk1');
- for ($i = 0; $i < count($fkOptions); $i++) {
+ foreach ($fkOptions as $i => $currentOption) {
$fkTable->addColumn('foreign_key_test' . $i, 'integer');
$foreignKeys[] = new ForeignKeyConstraint(
['foreign_key_test' . $i],
'test_create_fk2',
['id'],
'foreign_key_test' . $i . '_fk',
- ['onDelete' => $fkOptions[$i]],
+ ['onDelete' => $currentOption],
);
}
diff --git a/tests/Query/Expression/ExpressionBuilderTest.php b/tests/Query/Expression/ExpressionBuilderTest.php
index 4ecfeb9fa08..c70ff6276e1 100644
--- a/tests/Query/Expression/ExpressionBuilderTest.php
+++ b/tests/Query/Expression/ExpressionBuilderTest.php
@@ -227,7 +227,7 @@ public function testIsNotNull(): void
public function testIn(): void
{
- self::assertEquals('u.groups IN (1, 3, 4, 7)', $this->expr->in('u.groups', [1, 3, 4, 7]));
+ self::assertEquals('u.groups IN (1, 3, 4, 7)', $this->expr->in('u.groups', ['1', '3', '4', '7']));
}
public function testInWithPlaceholder(): void
@@ -237,7 +237,7 @@ public function testInWithPlaceholder(): void
public function testNotIn(): void
{
- self::assertEquals('u.groups NOT IN (1, 3, 4, 7)', $this->expr->notIn('u.groups', [1, 3, 4, 7]));
+ self::assertEquals('u.groups NOT IN (1, 3, 4, 7)', $this->expr->notIn('u.groups', ['1', '3', '4', '7']));
}
public function testNotInWithPlaceholder(): void