Skip to content

Commit

Permalink
Remove Abstraction\Result
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Sep 26, 2020
1 parent 5b9a194 commit 5b38026
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 61 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
45 changes: 0 additions & 45 deletions src/Abstraction/Result.php

This file was deleted.

5 changes: 3 additions & 2 deletions src/Cache/CachingResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 19 additions & 8 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<int,mixed>|false
*
* @throws Exception
*/
Expand All @@ -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<string,mixed>|false
*
* @throws Exception
*/
Expand All @@ -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
*/
Expand All @@ -69,7 +74,9 @@ public function fetchOne()
}

/**
* {@inheritDoc}
* Returns an array containing all of the result rows represented as numeric arrays.
*
* @return array<int,array<int,mixed>>
*
* @throws Exception
*/
Expand All @@ -83,7 +90,9 @@ public function fetchAllNumeric(): array
}

/**
* {@inheritDoc}
* Returns an array containing all of the result rows represented as associative arrays.
*
* @return array<int,array<string,mixed>>
*
* @throws Exception
*/
Expand All @@ -97,7 +106,9 @@ public function fetchAllAssociative(): array
}

/**
* {@inheritDoc}
* Returns an array containing the values of the first column of the result.
*
* @return array<int,mixed>
*
* @throws Exception
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/ResultCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5b38026

Please sign in to comment.