diff --git a/UPGRADE.md b/UPGRADE.md index eb92850dc1f..7fb4012a4dc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,9 @@ # Upgrade to 3.0 +## BC BREAK `Doctrine\DBAL\Abstraction\Result` removed + +The `Doctrine\DBAL\Abstraction\Result` interface is removed. Use the `Doctrine\DBAL\Result` class instead. + ## BC BREAK: `Doctrine\DBAL\Types\Type::getDefaultLength()` removed The `Doctrine\DBAL\Types\Type::getDefaultLength()` method has been removed as it served no purpose. diff --git a/src/Abstraction/Result.php b/src/Abstraction/Result.php deleted file mode 100644 index 88c7bfb5207..00000000000 --- a/src/Abstraction/Result.php +++ /dev/null @@ -1,45 +0,0 @@ -> - * - * @throws Exception - */ - public function iterateNumeric(): Traversable; - - /** - * Returns an iterator over the result set rows represented as associative arrays. - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociative(): Traversable; - - /** - * Returns an iterator over the values of the first column of the result set. - * - * @return Traversable - * - * @throws Exception - */ - public function iterateColumn(): Traversable; -} diff --git a/src/Cache/CachingResult.php b/src/Cache/CachingResult.php index b634afa4f2d..84b2f96457c 100644 --- a/src/Cache/CachingResult.php +++ b/src/Cache/CachingResult.php @@ -5,7 +5,8 @@ use Doctrine\Common\Cache\Cache; use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\FetchUtils; -use Doctrine\DBAL\Driver\Result; +use Doctrine\DBAL\Driver\Result as DriverResult; +use Doctrine\DBAL\Result; use function array_map; use function array_values; @@ -23,7 +24,7 @@ * * @internal The class is internal to the caching layer implementation. */ -class CachingResult implements Result +class CachingResult implements DriverResult { /** @var Cache */ private $cache; diff --git a/src/Connection.php b/src/Connection.php index 715ab0f694c..52941cefea1 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -4,7 +4,6 @@ use Closure; use Doctrine\Common\EventManager; -use Doctrine\DBAL\Abstraction\Result as AbstractionResult; use Doctrine\DBAL\Cache\ArrayResult; use Doctrine\DBAL\Cache\CacheException; use Doctrine\DBAL\Cache\CachingResult; @@ -940,7 +939,7 @@ public function executeQuery( array $params = [], $types = [], ?QueryCacheProfile $qcp = null - ): AbstractionResult { + ): Result { if ($qcp !== null) { return $this->executeCacheQuery($sql, $params, $types, $qcp); } diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php index 3ec6d5557a6..cdf50e1c6e5 100644 --- a/src/Query/QueryBuilder.php +++ b/src/Query/QueryBuilder.php @@ -3,11 +3,11 @@ namespace Doctrine\DBAL\Query; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Exception; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\Expression\CompositeExpression; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; +use Doctrine\DBAL\Result; use Doctrine\DBAL\Statement; use function array_key_exists; diff --git a/src/Result.php b/src/Result.php index fca81846b58..bf0e53fbc7e 100644 --- a/src/Result.php +++ b/src/Result.php @@ -4,12 +4,11 @@ namespace Doctrine\DBAL; -use Doctrine\DBAL\Abstraction\Result as ResultInterface; use Doctrine\DBAL\Driver\Exception as DriverException; use Doctrine\DBAL\Driver\Result as DriverResult; use Traversable; -final class Result implements ResultInterface +class Result { /** @var DriverResult */ private $result; @@ -27,7 +26,9 @@ public function __construct(DriverResult $result, Connection $connection) } /** - * {@inheritDoc} + * Returns the next row of the result as a numeric array or FALSE if there are no more rows. + * + * @return array|false * * @throws Exception */ @@ -41,7 +42,9 @@ public function fetchNumeric() } /** - * {@inheritDoc} + * Returns the next row of the result as an associative array or FALSE if there are no more rows. + * + * @return array|false * * @throws Exception */ @@ -55,7 +58,9 @@ public function fetchAssociative() } /** - * {@inheritDoc} + * Returns the first value of the next row of the result or FALSE if there are no more rows. + * + * @return mixed|false * * @throws Exception */ @@ -69,7 +74,9 @@ public function fetchOne() } /** - * {@inheritDoc} + * Returns an array containing all of the result rows represented as numeric arrays. + * + * @return array> * * @throws Exception */ @@ -83,7 +90,9 @@ public function fetchAllNumeric(): array } /** - * {@inheritDoc} + * Returns an array containing all of the result rows represented as associative arrays. + * + * @return array> * * @throws Exception */ @@ -97,7 +106,9 @@ public function fetchAllAssociative(): array } /** - * {@inheritDoc} + * Returns an array containing the values of the first column of the result. + * + * @return array * * @throws Exception */ diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index 4802d3e1011..462590d4dd4 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -4,7 +4,6 @@ use Doctrine\Common\Cache\Cache; use Doctrine\Common\EventManager; -use Doctrine\DBAL\Abstraction\Result; use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Connection; @@ -19,6 +18,7 @@ use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Result; use Doctrine\DBAL\VersionAwarePlatformDriver; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; diff --git a/tests/Functional/ResultCacheTest.php b/tests/Functional/ResultCacheTest.php index e0ddf392d3c..c780377d68e 100644 --- a/tests/Functional/ResultCacheTest.php +++ b/tests/Functional/ResultCacheTest.php @@ -4,8 +4,8 @@ use Doctrine\Common\Cache\ArrayCache; use Doctrine\DBAL\Cache\QueryCacheProfile; -use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Logging\DebugStack; +use Doctrine\DBAL\Result; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Tests\FunctionalTestCase; diff --git a/tests/Functional/StatementTest.php b/tests/Functional/StatementTest.php index 19bd319fa33..5292064d515 100644 --- a/tests/Functional/StatementTest.php +++ b/tests/Functional/StatementTest.php @@ -4,8 +4,8 @@ use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\PDO; -use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\ParameterType; +use Doctrine\DBAL\Result; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Types\Type;