Skip to content

Commit

Permalink
Merge pull request #4139 from morozov/driver-iternals
Browse files Browse the repository at this point in the history
Mark connection constructors internal
  • Loading branch information
morozov authored Jul 3, 2020
2 parents 1527d70 + f5714c5 commit 0a4630a
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 2 deletions.
8 changes: 6 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ The method is not used anywhere except for tests.

The `ServerInfoAwareConnection::requiresQueryForServerVersion()` method has been deprecated as an implementation detail which is the same for almost all supported drivers.

## Statement constructors are marked internal
## Connection and Statement constructors are marked internal

The driver and wrapper statement objects can be only created by the corresponding connection objects.
1. Driver connection objects can be only created by the corresponding drivers.
2. Wrapper connection objects can be only created by the driver manager.
3. The driver and wrapper connection objects can be only created by the corresponding connection objects.

Additionally, the `SQLSrv\LastInsertId` class has been marked internal.

## The `PingableConnection` interface is deprecated

Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class Connection implements DriverConnection
/**
* Initializes a new instance of the Connection class.
*
* @internal The connection can be only instantiated by the driver manager.
*
* @param mixed[] $params The connection parameters.
* @param Driver $driver The driver to use.
* @param Configuration|null $config The configuration, optional.
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class MasterSlaveConnection extends PrimaryReadReplicaConnection
/**
* Creates Primary Replica Connection.
*
* @internal The connection can be only instantiated by the driver manager.
*
* @param mixed[] $params
*
* @throws InvalidArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class PrimaryReadReplicaConnection extends Connection
/**
* Creates Primary Replica Connection.
*
* @internal The connection can be only instantiated by the driver manager.
*
* @param mixed[] $params
*
* @throws InvalidArgumentException
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class DB2Connection implements ConnectionInterface, ServerInfoAwareConnection
private $conn = null;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param mixed[] $params
* @param string $username
* @param string $password
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class MysqliConnection implements ConnectionInterface, PingableConnection, Serve
private $conn;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param mixed[] $params
* @param string $username
* @param string $password
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
/**
* Creates a Connection to an Oracle Database using oci8 extension.
*
* @internal The connection can be only instantiated by its driver.
*
* @param string $username
* @param string $password
* @param string $db
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
class PDOConnection extends PDO implements ConnectionInterface, ServerInfoAwareConnection
{
/**
* @internal The connection can be only instantiated by its driver.
*
* @param string $dsn
* @param string|null $user
* @param string|null $password
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
class Connection extends BaseConnection
{
/**
* @internal The connection can be only instantiated by its driver.
*
* {@inheritdoc}
*/
public function __construct($dsn, $user = null, $password = null, ?array $options = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class SQLAnywhereConnection implements Connection, ServerInfoAwareConnection
/**
* Connects to database with given connection string.
*
* @internal The connection can be only instantiated by its driver.
*
* @param string $dsn The connection string.
* @param bool $persistent Whether or not to establish a persistent connection.
*
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Last Id Data Container.
*
* @internal
*/
class LastInsertId
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class SQLSrvConnection implements ConnectionInterface, ServerInfoAwareConnection
protected $lastInsertId;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param string $serverName
* @param mixed[] $connectionOptions
*
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class PoolingShardConnection extends Connection
/**
* {@inheritDoc}
*
* @internal The connection can be only instantiated by the driver manager.
*
* @throws InvalidArgumentException
*/
public function __construct(array $params, Driver $driver, ?Configuration $config = null, ?EventManager $eventManager = null)
Expand Down

0 comments on commit 0a4630a

Please sign in to comment.