Skip to content

Commit

Permalink
Merge branch '2.10.x' into 2.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Jul 6, 2020
2 parents 034ed25 + 61a0113 commit cedf3a2
Show file tree
Hide file tree
Showing 43 changed files with 169 additions and 253 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"doctrine/event-manager": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"nikic/php-parser": "^4.4",
"phpstan/phpstan": "^0.12.31",
Expand Down
32 changes: 16 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/AbstractDB2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Doctrine\DBAL\Schema\DB2SchemaManager;

/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for IBM DB2 based drivers.
* Abstract base implementation of the {@link Driver} interface for IBM DB2 based drivers.
*/
abstract class AbstractDB2Driver implements Driver
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use function version_compare;

/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
* Abstract base implementation of the {@link Driver} interface for Microsoft SQL Server based drivers.
*/
abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use function strpos;

/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SQLite based drivers.
* Abstract base implementation of the {@link Driver} interface for SQLite based drivers.
*/
abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
{
Expand Down
20 changes: 0 additions & 20 deletions lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\ParameterType;

use function is_string;
use function strpos;
use function substr;

/**
* Sqlsrv Connection implementation.
Expand Down Expand Up @@ -46,19 +41,4 @@ public function lastInsertId($name = null)

return $stmt->fetchColumn();
}

/**
* {@inheritDoc}
*/
public function quote($value, $type = ParameterType::STRING)
{
$val = parent::quote($value, $type);

// Fix for a driver version terminating all values with null byte
if (is_string($val) && strpos($val, "\0") !== false) {
$val = substr($val, 0, -1);
}

return $val;
}
}
20 changes: 10 additions & 10 deletions lib/Doctrine/DBAL/Driver/ResultStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function columnCount();
*
* @deprecated Use one of the fetch- or iterate-related methods.
*
* @param int $fetchMode The fetch mode must be one of the {@link \Doctrine\DBAL\FetchMode} constants.
* @param int $fetchMode The fetch mode must be one of the {@link FetchMode} constants.
* @param mixed $arg2
* @param mixed $arg3
*
Expand All @@ -47,8 +47,8 @@ public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
* @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead.
*
* @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
* @param int $cursorOrientation For a ResultStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller.
* This value must be one of the \PDO::FETCH_ORI_* constants,
Expand Down Expand Up @@ -76,19 +76,19 @@ public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEX
* @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead.
*
* @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
* @param int|null $fetchArgument This argument has a different meaning depending on the value of the $fetchMode parameter:
* * {@link \Doctrine\DBAL\FetchMode::COLUMN}:
* * {@link FetchMode::COLUMN}:
* Returns the indicated 0-indexed column.
* * {@link \Doctrine\DBAL\FetchMode::CUSTOM_OBJECT}:
* * {@link FetchMode::CUSTOM_OBJECT}:
* Returns instances of the specified class, mapping the columns of each row
* to named properties in the class.
* * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's
* * {@link PDO::FETCH_FUNC}: Returns the results of calling the specified function, using each row's
* columns as parameters in the call.
* @param mixed[]|null $ctorArgs Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
*
* @return mixed[]
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Statement extends ResultStatement
* this will be a parameter name of the form :name. For a prepared statement
* using question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $value The value to bind to the parameter.
* @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType}
* @param int $type Explicit data type for the parameter using the {@link ParameterType}
* constants.
*
* @return bool TRUE on success or FALSE on failure.
Expand All @@ -48,7 +48,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING);
* this will be a parameter name of the form :name. For a prepared statement using
* question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
* @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType}
* @param int $type Explicit data type for the parameter using the {@link ParameterType}
* constants. To return an INOUT parameter from a stored procedure, use the bitwise
* OR operator to set the PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
* @param int|null $length You must specify maxlength when using an OUT bind
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -3234,8 +3234,7 @@ public function supportsSchemas()
* Whether this platform can emulate schemas.
*
* Platforms that either support or emulate schemas don't automatically
* filter a schema for the namespaced elements in {@link
* AbstractManager#createSchema}.
* filter a schema for the namespaced elements in {@link AbstractManager::createSchema()}.
*
* @return bool
*/
Expand Down
20 changes: 18 additions & 2 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,22 @@ private function normalizeIdentifier($name)
return $identifier->isQuoted() ? $identifier : new Identifier(strtoupper($name));
}

/**
* Adds suffix to identifier,
*
* if the new string exceeds max identifier length,
* keeps $suffix, cuts from $identifier as much as the part exceeding.
*/
private function addSuffix(string $identifier, string $suffix): string
{
$maxPossibleLengthWithoutSuffix = $this->getMaxIdentifierLength() - strlen($suffix);
if (strlen($identifier) > $maxPossibleLengthWithoutSuffix) {
$identifier = substr($identifier, 0, $maxPossibleLengthWithoutSuffix);
}

return $identifier . $suffix;
}

/**
* Returns the autoincrement primary key identifier name for the given table identifier.
*
Expand All @@ -601,7 +617,7 @@ private function normalizeIdentifier($name)
*/
private function getAutoincrementIdentifierName(Identifier $table)
{
$identifierName = $table->getName() . '_AI_PK';
$identifierName = $this->addSuffix($table->getName(), '_AI_PK');

return $table->isQuoted()
? $this->quoteSingleIdentifier($identifierName)
Expand Down Expand Up @@ -970,7 +986,7 @@ public function getIdentitySequenceName($tableName, $columnName)
$table = new Identifier($tableName);

// No usage of column name to preserve BC compatibility with <2.5
$identitySequenceName = $table->getName() . '_SEQ';
$identitySequenceName = $this->addSuffix($table->getName(), '_SEQ');

if ($table->isQuoted()) {
$identitySequenceName = '"' . $identitySequenceName . '"';
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,8 @@ public function getAlterTableSQL(TableDiff $diff)
* Checks whether a given column diff is a logically unchanged binary type column.
*
* Used to determine whether a column alteration for a binary type column can be skipped.
* Doctrine's {@link \Doctrine\DBAL\Types\BinaryType} and {@link \Doctrine\DBAL\Types\BlobType}
* are mapped to the same database column type on this platform as this platform
* does not have a native VARBINARY/BINARY column type. Therefore the {@link \Doctrine\DBAL\Schema\Comparator}
* Doctrine's {@link BinaryType} and {@link BlobType} are mapped to the same database column type on this platform
* as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator
* might detect differences for binary type columns which do not have to be propagated
* to database as there actually is no difference at database level.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function getSQL()
*
* @param string|int $key The parameter position or name.
* @param mixed $value The parameter value.
* @param string|int|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
* @param string|int|null $type One of the {@link ParameterType} constants.
*
* @return $this This QueryBuilder instance.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/SQLParserUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static function expandListParameters($query, $params, $types)
array_slice($types, 0, $needle),
$count ?
// array needles are at {@link \Doctrine\DBAL\ParameterType} constants
// + {@link Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
// + {@link \Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) :
[],
array_slice($types, $needle + 1)
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Sharding/ShardManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getShards();
* Queries all shards in undefined order and return the results appended to
* each other. Restore the previous distribution value after execution.
*
* Using {@link \Doctrine\DBAL\Connection::fetchAll} to retrieve rows internally.
* Using {@link Connection::fetchAll()} to retrieve rows internally.
*
* @param string $sql
* @param mixed[] $params
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public static function overrideType($name, $className)
* Gets the (preferred) binding type for values of this type that
* can be used when binding parameters to prepared statements.
*
* This method should return one of the {@link \Doctrine\DBAL\ParameterType} constants.
* This method should return one of the {@link ParameterType} constants.
*
* @return int
*/
Expand Down
9 changes: 3 additions & 6 deletions tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;

use function extension_loaded;

/**
* @requires extension ibm_db2
*/
class DB2ConnectionTest extends DbalTestCase
{
/**
Expand All @@ -19,10 +20,6 @@ class DB2ConnectionTest extends DbalTestCase

protected function setUp(): void
{
if (! extension_loaded('ibm_db2')) {
$this->markTestSkipped('ibm_db2 is not installed.');
}

parent::setUp();

$this->connectionMock = $this->getMockBuilder(DB2Connection::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\MockObject\MockObject;

use function extension_loaded;
use function restore_error_handler;
use function set_error_handler;

/**
* @requires extension mysqli
*/
class MysqliConnectionTest extends DbalFunctionalTestCase
{
/**
Expand All @@ -23,10 +25,6 @@ class MysqliConnectionTest extends DbalFunctionalTestCase

protected function setUp(): void
{
if (! extension_loaded('mysqli')) {
$this->markTestSkipped('mysqli is not installed.');
}

parent::setUp();

if (! $this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
Expand Down
9 changes: 3 additions & 6 deletions tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;

use function extension_loaded;

/**
* @requires extension oci8
*/
class OCI8ConnectionTest extends DbalTestCase
{
/**
Expand All @@ -19,10 +20,6 @@ class OCI8ConnectionTest extends DbalTestCase

protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}

parent::setUp();

$this->connectionMock = $this->getMockBuilder(OCI8Connection::class)
Expand Down
Loading

0 comments on commit cedf3a2

Please sign in to comment.