From 6be3a3123ad799f2aebb0c848b6b1ddb795ef157 Mon Sep 17 00:00:00 2001 From: Martin Herndl Date: Mon, 24 Mar 2025 10:19:24 +0100 Subject: [PATCH] Adapt for recent PHPStan --- composer.json | 2 +- .../DBAL/RowCountMethodDynamicReturnTypeExtension.php | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 8bd0d8f0..5c9b02bb 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12.12" + "phpstan/phpstan": "^1.12.23" }, "conflict": { "doctrine/collections": "<1.0", diff --git a/src/Type/Doctrine/DBAL/RowCountMethodDynamicReturnTypeExtension.php b/src/Type/Doctrine/DBAL/RowCountMethodDynamicReturnTypeExtension.php index 8fe17348..c754a41b 100644 --- a/src/Type/Doctrine/DBAL/RowCountMethodDynamicReturnTypeExtension.php +++ b/src/Type/Doctrine/DBAL/RowCountMethodDynamicReturnTypeExtension.php @@ -66,9 +66,6 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method } $resultClass = $this->getResultClass($driver); - if ($resultClass === null) { - return null; - } if (!$this->reflectionProvider->hasClass($resultClass)) { return null; @@ -87,9 +84,9 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method /** * @param DriverDetector::* $driver - * @return class-string|null + * @return class-string */ - private function getResultClass(string $driver): ?string + private function getResultClass(string $driver): string { switch ($driver) { case DriverDetector::IBM_DB2: @@ -111,8 +108,6 @@ private function getResultClass(string $driver): ?string case DriverDetector::SQLSRV: return 'Doctrine\DBAL\Driver\SQLSrv\Result'; } - - return null; } }