Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make classes final where applicable. #3590

Merged
merged 2 commits into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,39 @@ If you are using any of the legacy versions, you have to upgrade to newer MariaD

Table columns are no longer indexed by column name. Use the `name` attribute of the column instead.

## BC BREAK: Classes made final

- Class constant `SQLSrvStatement::LAST_INSERT_ID_SQL` was changed from public to private.
- Class `Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser` was made final.
- Class `Doctrine\DBAL\Sharding\SQLAzure\Schema\MultiTenantVisitor` was made final.
- Class `Doctrine\DBAL\Sharding\SQLAzure\SQLAzureFederationsSynchronizer` was made final.
- Class `Doctrine\DBAL\Sharding\PoolingShardManager` was made final.
- Class `Doctrine\DBAL\Id\TableGeneratorSchemaVisitor` was made final.
- Class `Doctrine\DBAL\Driver\OCI8\Driver` was made final.
- Class `Doctrine\DBAL\Driver\Mysqli\Driver` was made final.
- Class `Doctrine\DBAL\Driver\Mysqli\MysqliStatement` was made final.
- Class `Doctrine\DBAL\Driver\PDOSqlsrv\Driver` was made final.
- Class `Doctrine\DBAL\Driver\PDOSqlsrv\Statement` was made final.
- Class `Doctrine\DBAL\Driver\PDOMySql\Driver` was made final.
- Class `Doctrine\DBAL\Driver\IBMDB2\DB2Connection` was made final.
- Class `Doctrine\DBAL\Driver\IBMDB2\DB2Statement` was made final.
- Class `Doctrine\DBAL\Driver\IBMDB2\DB2Driver` was made final.
- Class `Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement` was made final.
- Class `Doctrine\DBAL\Driver\SQLSrv\Driver` was made final.
- Class `Doctrine\DBAL\Driver\SQLSrv\SQLSrvConnection` was made final.
- Class `Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereConnection` was made final.
- Class `Doctrine\DBAL\Driver\SQLAnywhere\Driver` was made final.
- Class `Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereStatement` was made final.
- Class `Doctrine\DBAL\Driver\PDOPgSql\Driver` was made final.
- Class `Doctrine\DBAL\Driver\PDOOracle\Driver` was made final.
- Class `Doctrine\DBAL\Driver\PDOSqlite\Driver` was made final.
- Class `Doctrine\DBAL\Driver\StatementIterator` was made final.
- Class `Doctrine\DBAL\Cache\ResultCacheStatement` was made final.
- Class `Doctrine\DBAL\Cache\ArrayStatement` was made final.
- Class `Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer` was made final.
- Class `Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets` was made final.
- Class `Doctrine\DBAL\Portability\Statement` was made final.

## BC BREAK: Changes in the `Doctrine\DBAL\Schema` API

- Column precision no longer defaults to 10. The default value is NULL.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Cache/ArrayStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use function reset;
use function sprintf;

class ArrayStatement implements IteratorAggregate, ResultStatement
final class ArrayStatement implements IteratorAggregate, ResultStatement
{
/** @var mixed[] */
private $data;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Also you have to realize that the cache will load the whole result into memory at once to ensure 2.
* This means that the memory usage for cached results might increase by using this feature.
*/
class ResultCacheStatement implements IteratorAggregate, ResultStatement
final class ResultCacheStatement implements IteratorAggregate, ResultStatement
{
/** @var Cache */
private $resultCache;
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
use function db2_rollback;
use function db2_server_info;

class DB2Connection implements ServerInfoAwareConnection
final class DB2Connection implements ServerInfoAwareConnection
{
/** @var resource */
private $conn = null;
private $conn;

/**
* @param array<string, mixed> $params
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* IBM DB2 Driver.
*/
class DB2Driver extends AbstractDB2Driver
final class DB2Driver extends AbstractDB2Driver
{
/**
* {@inheritdoc}
Expand Down
32 changes: 16 additions & 16 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
use function strtolower;
use function tmpfile;

class DB2Statement implements IteratorAggregate, Statement
final class DB2Statement implements IteratorAggregate, Statement
{
/** @var resource */
private $stmt;
Expand Down Expand Up @@ -128,21 +128,6 @@ public function bindParam($param, &$variable, int $type = ParameterType::STRING,
}
}

/**
* @param int $position Parameter position
* @param mixed $variable
*
* @throws DB2Exception
*/
private function bind(int $position, &$variable, int $parameterType, int $dataType) : void
{
$this->bindParam[$position] =& $variable;

if (! db2_bind_param($this->stmt, $position, 'variable', $parameterType, $dataType)) {
throw DB2Exception::fromStatementError($this->stmt);
}
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -336,6 +321,21 @@ public function rowCount() : int
return @db2_num_rows($this->stmt) ? : 0;
}

/**
* @param int $position Parameter position
* @param mixed $variable
*
* @throws DB2Exception
*/
private function bind(int $position, &$variable, int $parameterType, int $dataType) : void
{
$this->bindParam[$position] =& $variable;

if (! db2_bind_param($this->stmt, $position, 'variable', $parameterType, $dataType)) {
throw DB2Exception::fromStatementError($this->stmt);
}
}

/**
* Casts a stdClass object to the given class name mapping its' properties.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/Mysqli/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\Connection;

class Driver extends AbstractMySQLDriver
final class Driver extends AbstractMySQLDriver
{
/**
* {@inheritdoc}
Expand Down
Loading