Skip to content

Commit

Permalink
Make classes final where applicable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwage committed Jun 4, 2019
1 parent 0c4aa7e commit 3e142e4
Show file tree
Hide file tree
Showing 30 changed files with 222 additions and 247 deletions.
33 changes: 33 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@

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 @@ -23,10 +23,10 @@
use function db2_rollback;
use function db2_server_info;

class DB2Connection implements Connection, ServerInfoAwareConnection
final class DB2Connection implements Connection, 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
Loading

0 comments on commit 3e142e4

Please sign in to comment.