From 69696727584014296792a571b0948f4b2bc59cf1 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 3 Nov 2019 08:58:14 -0800 Subject: [PATCH 01/64] Bump version to 2.10.1-DEV --- lib/Doctrine/DBAL/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Version.php b/lib/Doctrine/DBAL/Version.php index 2b1c0f23b79..736bba5b7a0 100644 --- a/lib/Doctrine/DBAL/Version.php +++ b/lib/Doctrine/DBAL/Version.php @@ -14,7 +14,7 @@ class Version /** * Current Doctrine Version. */ - public const VERSION = '2.10.0'; + public const VERSION = '2.10.1-DEV'; /** * Compares a Doctrine version with the current one. From 80b42517af14e9cdc67505e27ffadb2089e9d7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Fri, 8 Nov 2019 11:01:50 +0100 Subject: [PATCH 02/64] Fix annotations --- lib/Doctrine/DBAL/Types/Type.php | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/Doctrine/DBAL/Types/Type.php b/lib/Doctrine/DBAL/Types/Type.php index ac7ab7bec13..d39ac2bd300 100644 --- a/lib/Doctrine/DBAL/Types/Type.php +++ b/lib/Doctrine/DBAL/Types/Type.php @@ -18,79 +18,79 @@ */ abstract class Type { - /** @deprecated Use {@see DefaultTypes::BIGINT} instead. */ + /** @deprecated Use {@see Types::BIGINT} instead. */ public const BIGINT = Types::BIGINT; - /** @deprecated Use {@see DefaultTypes::BINARY} instead. */ + /** @deprecated Use {@see Types::BINARY} instead. */ public const BINARY = Types::BINARY; - /** @deprecated Use {@see DefaultTypes::BLOB} instead. */ + /** @deprecated Use {@see Types::BLOB} instead. */ public const BLOB = Types::BLOB; - /** @deprecated Use {@see DefaultTypes::BOOLEAN} instead. */ + /** @deprecated Use {@see Types::BOOLEAN} instead. */ public const BOOLEAN = Types::BOOLEAN; - /** @deprecated Use {@see DefaultTypes::DATE_MUTABLE} instead. */ + /** @deprecated Use {@see Types::DATE_MUTABLE} instead. */ public const DATE = Types::DATE_MUTABLE; - /** @deprecated Use {@see DefaultTypes::DATE_IMMUTABLE} instead. */ + /** @deprecated Use {@see Types::DATE_IMMUTABLE} instead. */ public const DATE_IMMUTABLE = Types::DATE_IMMUTABLE; - /** @deprecated Use {@see DefaultTypes::DATEINTERVAL} instead. */ + /** @deprecated Use {@see Types::DATEINTERVAL} instead. */ public const DATEINTERVAL = Types::DATEINTERVAL; - /** @deprecated Use {@see DefaultTypes::DATETIME_MUTABLE} instead. */ + /** @deprecated Use {@see Types::DATETIME_MUTABLE} instead. */ public const DATETIME = Types::DATETIME_MUTABLE; - /** @deprecated Use {@see DefaultTypes::DATETIME_IMMUTABLE} instead. */ + /** @deprecated Use {@see Types::DATETIME_IMMUTABLE} instead. */ public const DATETIME_IMMUTABLE = Types::DATETIME_IMMUTABLE; - /** @deprecated Use {@see DefaultTypes::DATETIMETZ_MUTABLE} instead. */ + /** @deprecated Use {@see Types::DATETIMETZ_MUTABLE} instead. */ public const DATETIMETZ = Types::DATETIMETZ_MUTABLE; - /** @deprecated Use {@see DefaultTypes::DATETIMETZ_IMMUTABLE} instead. */ + /** @deprecated Use {@see Types::DATETIMETZ_IMMUTABLE} instead. */ public const DATETIMETZ_IMMUTABLE = Types::DATETIMETZ_IMMUTABLE; - /** @deprecated Use {@see DefaultTypes::DECIMAL} instead. */ + /** @deprecated Use {@see Types::DECIMAL} instead. */ public const DECIMAL = Types::DECIMAL; - /** @deprecated Use {@see DefaultTypes::FLOAT} instead. */ + /** @deprecated Use {@see Types::FLOAT} instead. */ public const FLOAT = Types::FLOAT; - /** @deprecated Use {@see DefaultTypes::GUID} instead. */ + /** @deprecated Use {@see Types::GUID} instead. */ public const GUID = Types::GUID; - /** @deprecated Use {@see DefaultTypes::INTEGER} instead. */ + /** @deprecated Use {@see Types::INTEGER} instead. */ public const INTEGER = Types::INTEGER; - /** @deprecated Use {@see DefaultTypes::JSON} instead. */ + /** @deprecated Use {@see Types::JSON} instead. */ public const JSON = Types::JSON; - /** @deprecated Use {@see DefaultTypes::JSON_ARRAY} instead. */ + /** @deprecated Use {@see Types::JSON_ARRAY} instead. */ public const JSON_ARRAY = Types::JSON_ARRAY; - /** @deprecated Use {@see DefaultTypes::OBJECT} instead. */ + /** @deprecated Use {@see Types::OBJECT} instead. */ public const OBJECT = Types::OBJECT; - /** @deprecated Use {@see DefaultTypes::SIMPLE_ARRAY} instead. */ + /** @deprecated Use {@see Types::SIMPLE_ARRAY} instead. */ public const SIMPLE_ARRAY = Types::SIMPLE_ARRAY; - /** @deprecated Use {@see DefaultTypes::SMALLINT} instead. */ + /** @deprecated Use {@see Types::SMALLINT} instead. */ public const SMALLINT = Types::SMALLINT; - /** @deprecated Use {@see DefaultTypes::STRING} instead. */ + /** @deprecated Use {@see Types::STRING} instead. */ public const STRING = Types::STRING; - /** @deprecated Use {@see DefaultTypes::ARRAY} instead. */ + /** @deprecated Use {@see Types::ARRAY} instead. */ public const TARRAY = Types::ARRAY; - /** @deprecated Use {@see DefaultTypes::TEXT} instead. */ + /** @deprecated Use {@see Types::TEXT} instead. */ public const TEXT = Types::TEXT; - /** @deprecated Use {@see DefaultTypes::TIME_MUTABLE} instead. */ + /** @deprecated Use {@see Types::TIME_MUTABLE} instead. */ public const TIME = Types::TIME_MUTABLE; - /** @deprecated Use {@see DefaultTypes::TIME_IMMUTABLE} instead. */ + /** @deprecated Use {@see Types::TIME_IMMUTABLE} instead. */ public const TIME_IMMUTABLE = Types::TIME_IMMUTABLE; /** From 5ea72334ff725ae37d786ead5f94204ef18f0507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Fri, 8 Nov 2019 11:31:12 +0100 Subject: [PATCH 03/64] Fix annotation --- lib/Doctrine/DBAL/Types/Types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Types/Types.php b/lib/Doctrine/DBAL/Types/Types.php index f8d0cf913c3..2ffd1061f62 100644 --- a/lib/Doctrine/DBAL/Types/Types.php +++ b/lib/Doctrine/DBAL/Types/Types.php @@ -34,7 +34,7 @@ final class Types public const TIME_MUTABLE = 'time'; public const TIME_IMMUTABLE = 'time_immutable'; - /** @deprecated json_array type is deprecated, use {@see DefaultTypes::JSON} instead. */ + /** @deprecated json_array type is deprecated, use {@see self::JSON} instead. */ public const JSON_ARRAY = 'json_array'; private function __construct() From 738f01e5bb41afdae3f25096216705b91d86036b Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 20 Nov 2019 07:18:18 +0100 Subject: [PATCH 04/64] Update deprecation messages to refer to DBAL --- lib/Doctrine/DBAL/Driver/PDOStatement.php | 4 ++-- lib/Doctrine/DBAL/Schema/Column.php | 2 +- tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php | 2 +- tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/PDOStatement.php b/lib/Doctrine/DBAL/Driver/PDOStatement.php index 5be4f2c046d..6e61d22555a 100644 --- a/lib/Doctrine/DBAL/Driver/PDOStatement.php +++ b/lib/Doctrine/DBAL/Driver/PDOStatement.php @@ -195,7 +195,7 @@ private function convertParamType(int $type) : int if (! isset(self::PARAM_TYPE_MAP[$type])) { // TODO: next major: throw an exception @trigger_error(sprintf( - 'Using a PDO parameter type (%d given) is deprecated and will cause an error in Doctrine 3.0', + 'Using a PDO parameter type (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0', $type ), E_USER_DEPRECATED); @@ -216,7 +216,7 @@ private function convertFetchMode(int $fetchMode) : int // TODO: next major: throw an exception @trigger_error(sprintf( 'Using a PDO fetch mode or their combination (%d given)' . - ' is deprecated and will cause an error in Doctrine 3.0', + ' is deprecated and will cause an error in Doctrine DBAL 3.0', $fetchMode ), E_USER_DEPRECATED); diff --git a/lib/Doctrine/DBAL/Schema/Column.php b/lib/Doctrine/DBAL/Schema/Column.php index 56c39c14994..50724fda77e 100644 --- a/lib/Doctrine/DBAL/Schema/Column.php +++ b/lib/Doctrine/DBAL/Schema/Column.php @@ -80,7 +80,7 @@ public function setOptions(array $options) // next major: throw an exception @trigger_error(sprintf( 'The "%s" column option is not supported,' . - ' setting it is deprecated and will cause an error in Doctrine 3.0', + ' setting it is deprecated and will cause an error in Doctrine DBAL 3.0', $name ), E_USER_DEPRECATED); diff --git a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php index 42b8104a9e7..2ea5fa49284 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php @@ -30,7 +30,7 @@ protected function setUp() : void /** * @group legacy - * @expectedDeprecation Using a PDO fetch mode or their combination (%d given) is deprecated and will cause an error in Doctrine 3.0 + * @expectedDeprecation Using a PDO fetch mode or their combination (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0 */ public function testPDOSpecificModeIsAccepted() : void { diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php index 32e4568ed03..269df62de32 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php @@ -62,7 +62,7 @@ public function testToArray() : void /** * @group legacy - * @expectedDeprecation The "unknown_option" column option is not supported, setting it is deprecated and will cause an error in Doctrine 3.0 + * @expectedDeprecation The "unknown_option" column option is not supported, setting it is deprecated and will cause an error in Doctrine DBAL 3.0 */ public function testSettingUnknownOptionIsStillSupported() : void { @@ -73,7 +73,7 @@ public function testSettingUnknownOptionIsStillSupported() : void /** * @group legacy - * @expectedDeprecation The "unknown_option" column option is not supported, setting it is deprecated and will cause an error in Doctrine 3.0 + * @expectedDeprecation The "unknown_option" column option is not supported, setting it is deprecated and will cause an error in Doctrine DBAL 3.0 */ public function testOptionsShouldNotBeIgnored() : void { From adeaac533cf80a90033779cb387f5f267a194027 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 23 Nov 2019 16:25:46 -0800 Subject: [PATCH 05/64] Remove temporary DB file on teardown --- tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index f9b067ad4a4..655b5897c72 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -15,7 +15,9 @@ use PDO; use RuntimeException; use Throwable; +use function file_exists; use function in_array; +use function unlink; class ConnectionTest extends DbalFunctionalTestCase { @@ -27,6 +29,10 @@ protected function setUp() : void protected function tearDown() : void { + if (file_exists('/tmp/test_nesting.sqlite')) { + unlink('/tmp/test_nesting.sqlite'); + } + parent::tearDown(); $this->resetSharedConn(); } From 8388ebc3faf140bf6af18e419bee10a4ed1871e1 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 6 Nov 2019 14:34:38 -0800 Subject: [PATCH 06/64] Switched from PHPBrew-based configuration to the Docker-based As per the support response, continuousphp switched to building their containers based on the official images from PHP. --- tests/continuousphp/install-pdo-oci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/continuousphp/install-pdo-oci.sh b/tests/continuousphp/install-pdo-oci.sh index 00d105ff531..7db42f31f83 100755 --- a/tests/continuousphp/install-pdo-oci.sh +++ b/tests/continuousphp/install-pdo-oci.sh @@ -2,4 +2,5 @@ set -euo pipefail -phpbrew ext install pdo_oci -- --with-pdo-oci=instantclient,/usr/local/instantclient +docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr/local/instantclient +sudo -E env PHP_INI_DIR=/usr/local/etc/php docker-php-ext-install pdo_oci From 93ca6e2546ff5008f6c7fd842c9db76fd4fc53fd Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 27 Nov 2019 16:45:09 -0800 Subject: [PATCH 07/64] Allow build failures for unstable dependencies --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index cc516636cda..6a6520c74f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -336,3 +336,6 @@ jobs: install: - composer config minimum-stability dev - travis_retry composer update --prefer-dist + + allow_failures: + - env: DEPENDENCIES=dev From 090014e1781b1d9ccd52302707c187ce5c3b88d2 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Dec 2019 01:24:03 +0100 Subject: [PATCH 08/64] [GH-3777] Keep using dependencies that were stable during 2.10 branch off. --- .appveyor.yml | 1 - .travis.yml | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a7fe2f1cb06..a61ba24ef67 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -117,7 +117,6 @@ install: } # install composer dependencies - cd C:\projects\dbal - - rm composer.lock - appveyor-retry composer self-update - appveyor-retry composer install --no-progress --prefer-dist diff --git a/.travis.yml b/.travis.yml index 6a6520c74f5..cac4d984d59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,7 @@ before_script: - if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; install: - - rm composer.lock - - travis_retry composer -n update --prefer-dist + - travis_retry composer -n install --prefer-dist script: - | From e359383f71379d533fba584c9f701a90e40d7795 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Dec 2019 15:53:28 +0100 Subject: [PATCH 09/64] [GH-3777] Also need to fix .appveyor.yml based on eb3b1b3 --- .appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a61ba24ef67..352719e2617 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -49,7 +49,7 @@ install: - ps: | # Check if installation is cached if (!(Test-Path c:\tools\php)) { - appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version 7.3.12 # install sqlite appveyor-retry cinst -y sqlite Get-ChildItem -Path c:\tools\php @@ -68,7 +68,8 @@ install: Add-Content php.ini "`n extension=php_curl.dll" Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem" - $DLLVersion = "5.5.0preview" + # Get and install the latest stable sqlsrv DLL's + $DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/sqlsrv/stable.txt").Content cd c:\tools\php\ext $source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip" $destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip" From 9f4d9a5b59fbc00a9b37a4d26dbc6829e82d31bd Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Tue, 19 Nov 2019 21:11:36 +0300 Subject: [PATCH 10/64] Fix breaks named parameters in OCI8Statement --- .../DBAL/Driver/OCI8/OCI8Statement.php | 14 +++++++--- .../Functional/Driver/OCI8/StatementTest.php | 26 ++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php index c974bf8fc7f..2f8b9323817 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php @@ -276,9 +276,15 @@ public function bindValue($param, $value, $type = ParameterType::STRING) /** * {@inheritdoc} */ - public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) { - $column = $this->_paramMap[$column]; + if (is_int($param)) { + if (! isset($this->_paramMap[$param])) { + throw new OCI8Exception(sprintf('Could not find variable mapping with index %d, in the SQL statement', $param)); + } + + $param = $this->_paramMap[$param]; + } if ($type === ParameterType::LARGE_OBJECT) { $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); @@ -291,11 +297,11 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l $variable =& $lob; } - $this->boundValues[$column] =& $variable; + $this->boundValues[$param] =& $variable; return oci_bind_by_name( $this->_sth, - $column, + $param, $variable, $length ?? -1, $this->convertParameterType($type) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php index 8ecbed68082..70f829e7b71 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php @@ -37,17 +37,41 @@ public function testQueryConversion(string $query, array $params, array $expecte ); } + /** + * Low-level approach to working with parameter binding + * + * @param mixed[] $params + * @param mixed[] $expected + * + * @dataProvider queryConversionProvider + */ + public function testStatementBindParameters(string $query, array $params, array $expected) : void + { + $stmt = $this->connection->prepare($query); + $stmt->execute($params); + + self::assertEquals( + $expected, + $stmt->fetch() + ); + } + /** * @return array> */ public static function queryConversionProvider() : iterable { return [ - 'simple' => [ + 'positional' => [ 'SELECT ? COL1 FROM DUAL', [1], ['COL1' => 1], ], + 'named' => [ + 'SELECT :COL COL1 FROM DUAL', + [':COL' => 1], + ['COL1' => 1], + ], 'literal-with-placeholder' => [ "SELECT '?' COL1, ? COL2 FROM DUAL", [2], From b5a71d178fb242756d6d4b0fc33c57ab6c09fc85 Mon Sep 17 00:00:00 2001 From: Marius Ghita Date: Mon, 23 Dec 2019 01:42:23 +0200 Subject: [PATCH 11/64] Remove superfluous Configuration instance A configuration instance is not strictly required by [DriverManager::getConnection](https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/DriverManager.php#L139). As an upside, it doesn't add an extra warning for people that use Psalm/PHPmd when starting off from the documentation example. As the Configuration class has an `@internal` block those tools threat it as the other meaning for `@internal`, as in class that is [internal to the library and not for public use](https://docs.phpdoc.org/references/phpdoc/tags/internal.html). --- docs/en/reference/configuration.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/en/reference/configuration.rst b/docs/en/reference/configuration.rst index 4fa8991ec33..5607c4b32f0 100644 --- a/docs/en/reference/configuration.rst +++ b/docs/en/reference/configuration.rst @@ -10,7 +10,6 @@ You can get a DBAL Connection through the .. code-block:: php 'mydb', @@ -19,19 +18,18 @@ You can get a DBAL Connection through the 'host' => 'localhost', 'driver' => 'pdo_mysql', ); - $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); Or, using the simpler URL form: .. code-block:: php 'mysql://user:secret@localhost/mydb', ); - $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); + $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); The ``DriverManager`` returns an instance of ``Doctrine\DBAL\Connection`` which is a wrapper around the From c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 4 Jan 2020 04:56:21 -0800 Subject: [PATCH 12/64] Release v2.10.1 --- lib/Doctrine/DBAL/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Version.php b/lib/Doctrine/DBAL/Version.php index 736bba5b7a0..e5e4b9566f6 100644 --- a/lib/Doctrine/DBAL/Version.php +++ b/lib/Doctrine/DBAL/Version.php @@ -14,7 +14,7 @@ class Version /** * Current Doctrine Version. */ - public const VERSION = '2.10.1-DEV'; + public const VERSION = '2.10.1'; /** * Compares a Doctrine version with the current one. From 96cda301be1253608c3ab3c286b6d72ebcee510c Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 4 Jan 2020 05:19:58 -0800 Subject: [PATCH 13/64] Bump version to 2.10.2-DEV --- lib/Doctrine/DBAL/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Version.php b/lib/Doctrine/DBAL/Version.php index e5e4b9566f6..011646b60c4 100644 --- a/lib/Doctrine/DBAL/Version.php +++ b/lib/Doctrine/DBAL/Version.php @@ -14,7 +14,7 @@ class Version /** * Current Doctrine Version. */ - public const VERSION = '2.10.1'; + public const VERSION = '2.10.2-DEV'; /** * Compares a Doctrine version with the current one. From 77a394d6f078c68f72689d436fe4de84003f70a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Sun, 5 Jan 2020 15:54:58 +0100 Subject: [PATCH 14/64] Fix DebugStack#queries docblock type --- lib/Doctrine/DBAL/Logging/DebugStack.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Logging/DebugStack.php b/lib/Doctrine/DBAL/Logging/DebugStack.php index e1ccaad6ba0..1895dde5381 100644 --- a/lib/Doctrine/DBAL/Logging/DebugStack.php +++ b/lib/Doctrine/DBAL/Logging/DebugStack.php @@ -12,7 +12,7 @@ class DebugStack implements SQLLogger /** * Executed SQL queries. * - * @var mixed[][] + * @var array> */ public $queries = []; From a5256109396d33ed9e357a57b977399ae63111f8 Mon Sep 17 00:00:00 2001 From: S38151 Date: Fri, 20 Dec 2019 14:54:30 +0100 Subject: [PATCH 15/64] fixed unqualified table name of fk constraints when using schemas --- .../DBAL/Schema/ForeignKeyConstraint.php | 2 +- .../DBAL/Schema/ForeignKeyConstraintTest.php | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php index 3c6585e4600..270f3dda312 100644 --- a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php +++ b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php @@ -233,7 +233,7 @@ public function getUnqualifiedForeignTableName() $position = strrpos($name, '.'); if ($position !== false) { - $name = substr($name, $position); + $name = substr($name, $position + 1); } return strtolower($name); diff --git a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php index f0b115ddc4f..5a59088e42a 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php @@ -4,6 +4,7 @@ use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; +use Doctrine\DBAL\Schema\Table; use PHPUnit\Framework\TestCase; class ForeignKeyConstraintTest extends TestCase @@ -56,4 +57,30 @@ public static function getIntersectsIndexColumnsData() : iterable [['FOO'], true], ]; } + + /** + * @param string|Table $foreignTableName + * + * @group DBAL-1062 + * @dataProvider getUnqualifiedForeignTableNameData + */ + public function testGetUnqualifiedForeignTableName($foreignTableName, string $expectedUnqualifiedTableName) : void + { + $foreignKey = new ForeignKeyConstraint(['foo', 'bar'], $foreignTableName, ['fk_foo', 'fk_bar']); + + self::assertSame($expectedUnqualifiedTableName, $foreignKey->getUnqualifiedForeignTableName()); + } + + /** + * @return mixed[][] + */ + public static function getUnqualifiedForeignTableNameData() : iterable + { + return [ + ['schema.foreign_table', 'foreign_table'], + ['foreign_table', 'foreign_table'], + [new Table('schema.foreign_table'), 'foreign_table'], + [new Table('foreign_table'), 'foreign_table'], + ]; + } } From eff166f5c743592f126587f8d93ed6ef15b67959 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 14 Jan 2020 22:07:10 +0300 Subject: [PATCH 16/64] [pg] fix getting table information if search_path contains escaped schema name (eg "812pp") also simplifies the code and now exactly matches postgresql search rules --- lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php | 2 +- .../Schema/PostgreSqlSchemaManagerTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index e570dc04ab0..dd90f2cb6b3 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -367,7 +367,7 @@ private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias [$schema, $table] = explode('.', $table); $schema = $this->quoteStringLiteral($schema); } else { - $schema = "ANY(string_to_array((select replace(replace(setting,'\"\$user\"',user),' ','') from pg_catalog.pg_settings where name = 'search_path'),','))"; + $schema = 'ANY(current_schemas(false))'; } $table = new Identifier($table); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php index 35326968798..b8a26af3c65 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php @@ -335,6 +335,18 @@ public function testListQuotedTable() : void self::assertFalse($comparator->diffTable($offlineTable, $onlineTable)); } + public function testListTableDetailsWhenCurrentSchemaNameQuoted() : void + { + $this->connection->exec('CREATE SCHEMA "001_test"'); + $this->connection->exec('SET search_path TO "001_test"'); + + try { + $this->testListQuotedTable(); + } finally { + $this->connection->close(); + } + } + public function testListTablesExcludesViews() : void { $this->createTestTable('list_tables_excludes_views'); From 22b5494fb9065cebe7198a9c7ffae6863f83ae0a Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Sun, 19 Jan 2020 11:22:14 +0100 Subject: [PATCH 17/64] Fix JOIN with no condition bug --- lib/Doctrine/DBAL/Query/QueryBuilder.php | 8 +++++--- .../Doctrine/Tests/DBAL/Query/QueryBuilderTest.php | 13 ++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 587e26656ab..3ad7ebdc3cd 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -1327,9 +1327,11 @@ private function getSQLForJoins($fromAlias, array &$knownAliases) if (array_key_exists($join['joinAlias'], $knownAliases)) { throw QueryException::nonUniqueAlias($join['joinAlias'], array_keys($knownAliases)); } - $sql .= ' ' . strtoupper($join['joinType']) - . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias'] - . ' ON ' . ((string) $join['joinCondition']); + $sql .= ' ' . strtoupper($join['joinType']) + . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias']; + if ($join['joinCondition'] !== null) { + $sql .= ' ON ' . $join['joinCondition']; + } $knownAliases[$join['joinAlias']] = true; } diff --git a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php index a210ef2fe73..7ac89b5ae79 100644 --- a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php @@ -92,11 +92,22 @@ public function testSelectWithJoin() : void $qb->select('u.*', 'p.*') ->from('users', 'u') - ->Join('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); + ->join('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb); } + public function testSelectWithJoinNoCondition() : void + { + $qb = new QueryBuilder($this->conn); + + $qb->select('u.*', 'p.*') + ->from('users', 'u') + ->join('u', 'phones', 'p'); + + self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p', (string) $qb); + } + public function testSelectWithInnerJoin() : void { $qb = new QueryBuilder($this->conn); From 9b7246a8a1d807323429b3a1705080e7eac17fe4 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Tue, 21 Jan 2020 16:42:22 -0800 Subject: [PATCH 18/64] Fixed the QueryBuilder::setMaxResults() signature to accept NULL --- lib/Doctrine/DBAL/Query/QueryBuilder.php | 9 ++++----- .../Tests/DBAL/Query/QueryBuilderTest.php | 20 ++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 587e26656ab..92ee95cbc58 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -118,9 +118,9 @@ class QueryBuilder private $firstResult = null; /** - * The maximum number of results to retrieve. + * The maximum number of results to retrieve or NULL to retrieve all results. * - * @var int + * @var int|null */ private $maxResults = null; @@ -367,7 +367,6 @@ public function setFirstResult($firstResult) /** * Gets the position of the first result the query object was set to retrieve (the "offset"). - * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder. * * @return int The position of the first result. */ @@ -379,7 +378,7 @@ public function getFirstResult() /** * Sets the maximum number of results to retrieve (the "limit"). * - * @param int $maxResults The maximum number of results to retrieve. + * @param int|null $maxResults The maximum number of results to retrieve or NULL to retrieve all results. * * @return $this This QueryBuilder instance. */ @@ -393,7 +392,7 @@ public function setMaxResults($maxResults) /** * Gets the maximum number of results the query object was set to retrieve (the "limit"). - * Returns NULL if {@link setMaxResults} was not applied to this query builder. + * Returns NULL if all results will be returned. * * @return int The maximum number of results. */ diff --git a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php index a210ef2fe73..371a1e2970f 100644 --- a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php @@ -569,13 +569,27 @@ public function testGetState() : void self::assertEquals($sql1, $qb->getSQL()); } - public function testSetMaxResults() : void + /** + * @dataProvider maxResultsProvider + */ + public function testSetMaxResults(?int $maxResults) : void { $qb = new QueryBuilder($this->conn); - $qb->setMaxResults(10); + $qb->setMaxResults($maxResults); self::assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); - self::assertEquals(10, $qb->getMaxResults()); + self::assertEquals($maxResults, $qb->getMaxResults()); + } + + /** + * @return mixed[][] + */ + public static function maxResultsProvider() : iterable + { + return [ + 'non-null' => [10], + 'null' => [null], + ]; } public function testSetFirstResult() : void From b253361ef761e0791c83729e636ed3827b724abc Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 2 Aug 2019 10:37:21 +0200 Subject: [PATCH 19/64] A test case for issue #3640 Signed-off-by: Roeland Jago Douma --- tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php index ea8d4dc0752..ba087eaa28d 100644 --- a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php +++ b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php @@ -89,7 +89,7 @@ public static function dataGetPlaceholderPositions() : iterable ['SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE "\\\\") AND (data.description LIKE :condition_1 ESCAPE \'\\\\\') ORDER BY id ASC', false, [121 => 'condition_0', 174 => 'condition_1']], ['SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE `\\\\`) AND (data.description LIKE :condition_1 ESCAPE `\\\\`) ORDER BY id ASC', false, [121 => 'condition_0', 174 => 'condition_1']], ['SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE \'\\\\\') AND (data.description LIKE :condition_1 ESCAPE `\\\\`) ORDER BY id ASC', false, [121 => 'condition_0', 174 => 'condition_1']], - + ["SELECT * FROM Foo WHERE (foo.bar LIKE :condition_0 ESCAPE '\') AND (foo.baz = :condition_1) AND (foo.bak LIKE :condition_2 ESCAPE '\')", false, [38 => 'condition_0', 78 => 'condition_1', 110 => 'condition_2']], ]; } From bcf78d5ea262e18510c944c5983ae1218c4f1800 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 5 Dec 2019 15:28:46 +0100 Subject: [PATCH 20/64] Fix regex for escaped literals Signed-off-by: Christoph Wurst --- lib/Doctrine/DBAL/SQLParserUtils.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/DBAL/SQLParserUtils.php b/lib/Doctrine/DBAL/SQLParserUtils.php index 9768883846e..0807308ad59 100644 --- a/lib/Doctrine/DBAL/SQLParserUtils.php +++ b/lib/Doctrine/DBAL/SQLParserUtils.php @@ -31,9 +31,9 @@ class SQLParserUtils public const POSITIONAL_TOKEN = '\?'; public const NAMED_TOKEN = '(? Date: Sun, 19 Jan 2020 21:43:57 +0100 Subject: [PATCH 21/64] Fix the documentation of the driver option --- lib/Doctrine/DBAL/DriverManager.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/Doctrine/DBAL/DriverManager.php b/lib/Doctrine/DBAL/DriverManager.php index 6888d73b0c4..31fc8ea12f9 100644 --- a/lib/Doctrine/DBAL/DriverManager.php +++ b/lib/Doctrine/DBAL/DriverManager.php @@ -88,20 +88,7 @@ private function __construct() * * $params must contain at least one of the following. * - * Either 'driver' with one of the following values: - * - * pdo_mysql - * pdo_sqlite - * pdo_pgsql - * pdo_oci (unstable) - * pdo_sqlsrv - * pdo_sqlsrv - * mysqli - * sqlanywhere - * sqlsrv - * ibm_db2 (unstable) - * drizzle_pdo_mysql - * + * Either 'driver' with one of the array keys of {@link $_driverMap}, * OR 'driverClass' that contains the full class name (with namespace) of the * driver class to instantiate. * From 9a214ffb4974216800d49733c56127f662868807 Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Mon, 3 Feb 2020 16:23:45 +0300 Subject: [PATCH 22/64] Allow add previous exception in ConversionException --- .../DBAL/Types/ConversionException.php | 16 ++++++++----- .../DBAL/Types/ConversionExceptionTest.php | 24 +++++++++++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/DBAL/Types/ConversionException.php b/lib/Doctrine/DBAL/Types/ConversionException.php index b9f8a82e7ec..87f79a91cdc 100644 --- a/lib/Doctrine/DBAL/Types/ConversionException.php +++ b/lib/Doctrine/DBAL/Types/ConversionException.php @@ -26,11 +26,11 @@ class ConversionException extends DBALException * * @return \Doctrine\DBAL\Types\ConversionException */ - public static function conversionFailed($value, $toType) + public static function conversionFailed($value, $toType, ?Throwable $previous = null) { $value = strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value; - return new self('Could not convert database value "' . $value . '" to Doctrine Type ' . $toType); + return new self('Could not convert database value "' . $value . '" to Doctrine Type ' . $toType, 0, $previous); } /** @@ -64,8 +64,12 @@ public static function conversionFailedFormat($value, $toType, $expectedFormat, * * @return \Doctrine\DBAL\Types\ConversionException */ - public static function conversionFailedInvalidType($value, $toType, array $possibleTypes) - { + public static function conversionFailedInvalidType( + $value, + $toType, + array $possibleTypes, + ?Throwable $previous = null + ) { $actualType = is_object($value) ? get_class($value) : gettype($value); if (is_scalar($value)) { @@ -75,7 +79,7 @@ public static function conversionFailedInvalidType($value, $toType, array $possi $actualType, $toType, implode(', ', $possibleTypes) - )); + ), 0, $previous); } return new self(sprintf( @@ -83,7 +87,7 @@ public static function conversionFailedInvalidType($value, $toType, array $possi $actualType, $toType, implode(', ', $possibleTypes) - )); + ), 0, $previous); } public static function conversionFailedSerialization($value, $format, $error) diff --git a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php index e7fa8a4be03..f8003c5c617 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php @@ -3,13 +3,23 @@ namespace Doctrine\Tests\DBAL\Types; use Doctrine\DBAL\Types\ConversionException; -use Exception; use PHPUnit\Framework\TestCase; use stdClass; +use Throwable; use function tmpfile; class ConversionExceptionTest extends TestCase { + public function testConversionFailedPreviousException() : void + { + $previous = $this->createMock(Throwable::class); + + $exception = ConversionException::conversionFailed('foo', 'foo', $previous); + + self::assertInstanceOf(ConversionException::class, $exception); + self::assertSame($previous, $exception->getPrevious()); + } + /** * @param mixed $scalarValue * @@ -44,9 +54,19 @@ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar) : void ); } + public function testConversionFailedInvalidTypePreviousException() : void + { + $previous = $this->createMock(Throwable::class); + + $exception = ConversionException::conversionFailedInvalidType('foo', 'foo', ['bar', 'baz'], $previous); + + self::assertInstanceOf(ConversionException::class, $exception); + self::assertSame($previous, $exception->getPrevious()); + } + public function testConversionFailedFormatPreservesPreviousException() : void { - $previous = new Exception(); + $previous = $this->createMock(Throwable::class); $exception = ConversionException::conversionFailedFormat('foo', 'bar', 'baz', $previous); From c3286d8021464e0219618f0a6c6a0bfc339e4255 Mon Sep 17 00:00:00 2001 From: Andrii Dembitskyi Date: Fri, 21 Feb 2020 14:26:13 +0200 Subject: [PATCH 23/64] Add missed end of comment --- docs/en/reference/sharding.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/reference/sharding.rst b/docs/en/reference/sharding.rst index dcdd7d8f660..2b2f804da53 100644 --- a/docs/en/reference/sharding.rst +++ b/docs/en/reference/sharding.rst @@ -160,7 +160,7 @@ following code in Doctrine: use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Id\TableGenerator; - $conn = DriverManager::getConnection(/**..**); // connection 1 + $conn = DriverManager::getConnection(/**..**/); // connection 1 // creating the TableGenerator automatically opens a second connection. $tableGenerator = new TableGenerator($conn, "sequences_tbl_name"); From 354524f919e0c8cc3b146bb83ce152b13fb2d9b9 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 22 Apr 2019 18:48:35 -0700 Subject: [PATCH 24/64] Switching Travis CI builds to Ubuntu Xenial Xerus --- .travis.yml | 33 +++++++------- tests/travis/create-mysql-schema.sql | 3 ++ tests/travis/install-mariadb.sh | 13 ++++++ tests/travis/install-sqlsrv-dependencies.sh | 2 +- tests/travis/mariadb.docker.travis.xml | 45 +++++++++++++++++++ tests/travis/mariadb.mysqli.docker.travis.xml | 45 +++++++++++++++++++ tests/travis/mariadb.mysqli.travis.xml | 2 - 7 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 tests/travis/install-mariadb.sh create mode 100644 tests/travis/mariadb.docker.travis.xml create mode 100644 tests/travis/mariadb.mysqli.docker.travis.xml diff --git a/.travis.yml b/.travis.yml index cac4d984d59..5223ed3c39e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php -sudo: false -dist: trusty +dist: xenial cache: directories: @@ -112,6 +111,8 @@ jobs: - stage: Test php: 7.3 env: DB=mysql COVERAGE=yes + services: + - mysql - stage: Test php: 7.3 env: DB=mysql.docker MYSQL_VERSION=5.7 COVERAGE=yes @@ -129,6 +130,8 @@ jobs: - stage: Test php: 7.3 env: DB=mysqli COVERAGE=yes + services: + - mysql - stage: Test php: 7.3 env: DB=mysqli.docker MYSQL_VERSION=5.7 COVERAGE=yes @@ -150,9 +153,11 @@ jobs: mariadb: 10.0 - stage: Test php: 7.3 - env: DB=mariadb MARIADB_VERSION=10.1 COVERAGE=yes - addons: - mariadb: 10.1 + env: DB=mariadb.docker MARIADB_VERSION=10.1 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=mariadb MARIADB_VERSION=10.2 COVERAGE=yes @@ -170,9 +175,11 @@ jobs: mariadb: 10.0 - stage: Test php: 7.3 - env: DB=mariadb.mysqli MARIADB_VERSION=10.1 COVERAGE=yes - addons: - mariadb: 10.1 + env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=mariadb.mysqli MARIADB_VERSION=10.2 COVERAGE=yes @@ -200,32 +207,24 @@ jobs: - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes - services: - - postgresql addons: postgresql: "9.4" - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.5 COVERAGE=yes - services: - - postgresql addons: postgresql: "9.5" - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.6 COVERAGE=yes - services: - - postgresql addons: postgresql: "9.6" - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=10.0 COVERAGE=yes sudo: required - services: - - postgresql addons: - postgresql: "9.6" + postgresql: "10" before_script: - bash ./tests/travis/install-postgres-10.sh - stage: Test diff --git a/tests/travis/create-mysql-schema.sql b/tests/travis/create-mysql-schema.sql index 4e331838cfd..78a32358065 100644 --- a/tests/travis/create-mysql-schema.sql +++ b/tests/travis/create-mysql-schema.sql @@ -1,3 +1,6 @@ +DROP USER IF EXISTS 'travis'@'%'; +CREATE USER 'travis'@'%'; + CREATE SCHEMA doctrine_tests; CREATE SCHEMA test_create_database; CREATE SCHEMA test_drop_database; diff --git a/tests/travis/install-mariadb.sh b/tests/travis/install-mariadb.sh new file mode 100644 index 00000000000..cda81e9bcba --- /dev/null +++ b/tests/travis/install-mariadb.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -ex + +sudo docker run \ + -d \ + -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ + -e MYSQL_DATABASE=doctrine_tests \ + -p 33306:3306 \ + --name mariadb \ + mariadb:${MARIADB_VERSION} + +sudo docker exec -i mariadb bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' diff --git a/tests/travis/install-sqlsrv-dependencies.sh b/tests/travis/install-sqlsrv-dependencies.sh index 137b2a95705..ff91bfdfaf0 100644 --- a/tests/travis/install-sqlsrv-dependencies.sh +++ b/tests/travis/install-sqlsrv-dependencies.sh @@ -5,6 +5,6 @@ set -ex echo Installing driver dependencies curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - -curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list +curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list sudo apt-get update ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 unixodbc unixodbc-dev libssl1.0.0 diff --git a/tests/travis/mariadb.docker.travis.xml b/tests/travis/mariadb.docker.travis.xml new file mode 100644 index 00000000000..fa6617c0948 --- /dev/null +++ b/tests/travis/mariadb.docker.travis.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + ../Doctrine/Tests/DBAL + + + + + + ../../lib/Doctrine + + + + + + performance + locking_functional + + + diff --git a/tests/travis/mariadb.mysqli.docker.travis.xml b/tests/travis/mariadb.mysqli.docker.travis.xml new file mode 100644 index 00000000000..679415d7a18 --- /dev/null +++ b/tests/travis/mariadb.mysqli.docker.travis.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + ../Doctrine/Tests/DBAL + + + + + + ../../lib/Doctrine + + + + + + performance + locking_functional + + + diff --git a/tests/travis/mariadb.mysqli.travis.xml b/tests/travis/mariadb.mysqli.travis.xml index dfc62d307c5..b8bd9be01cd 100644 --- a/tests/travis/mariadb.mysqli.travis.xml +++ b/tests/travis/mariadb.mysqli.travis.xml @@ -2,7 +2,6 @@ - From 5c858c48fc8d5cbc7451c5b3cbac6064a2339be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 27 Feb 2020 21:23:56 +0100 Subject: [PATCH 25/64] Stop testing unsupported versions See https://www.postgresql.org/support/versioning/ See https://mariadb.com/kb/en/mariadb-server/ --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5223ed3c39e..8048a7be510 100644 --- a/.travis.yml +++ b/.travis.yml @@ -146,11 +146,6 @@ jobs: - docker before_script: - bash ./tests/travis/install-mysql-8.0.sh - - stage: Test - php: 7.3 - env: DB=mariadb MARIADB_VERSION=10.0 COVERAGE=yes - addons: - mariadb: 10.0 - stage: Test php: 7.3 env: DB=mariadb.docker MARIADB_VERSION=10.1 COVERAGE=yes @@ -168,11 +163,6 @@ jobs: env: DB=mariadb MARIADB_VERSION=10.3 COVERAGE=yes addons: mariadb: 10.3 - - stage: Test - php: 7.3 - env: DB=mariadb.mysqli MARIADB_VERSION=10.0 COVERAGE=yes - addons: - mariadb: 10.0 - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes @@ -190,20 +180,6 @@ jobs: env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes addons: mariadb: 10.3 - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes - services: - - postgresql - addons: - postgresql: "9.2" - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes - services: - - postgresql - addons: - postgresql: "9.3" - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes From 8ed87e16dc90d074a8670ec689b25807c4ab9ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 28 Feb 2020 22:01:51 +0100 Subject: [PATCH 26/64] Use Docker consistently When a Docker version of the build is available, use it. --- .travis.yml | 74 ++++++++++++++------------ tests/travis/mariadb.mysqli.travis.xml | 45 ---------------- tests/travis/mariadb.travis.xml | 45 ---------------- tests/travis/mysql.travis.xml | 45 ---------------- tests/travis/mysqli.travis.xml | 45 ---------------- 5 files changed, 40 insertions(+), 214 deletions(-) delete mode 100644 tests/travis/mariadb.mysqli.travis.xml delete mode 100644 tests/travis/mariadb.travis.xml delete mode 100644 tests/travis/mysql.travis.xml delete mode 100644 tests/travis/mysqli.travis.xml diff --git a/.travis.yml b/.travis.yml index 8048a7be510..c679c005ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,14 +69,18 @@ jobs: - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.2 - env: DB=mariadb MARIADB_VERSION=10.3 - addons: - mariadb: 10.3 + env: DB=mariadb.docker MARIADB_VERSION=10.3 + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.2 - env: DB=mariadb.mysqli MARIADB_VERSION=10.3 - addons: - mariadb: 10.3 + env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.2 env: DB=pgsql POSTGRESQL_VERSION=11.0 @@ -108,11 +112,6 @@ jobs: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh - bash ./tests/travis/install-mssql.sh - - stage: Test - php: 7.3 - env: DB=mysql COVERAGE=yes - services: - - mysql - stage: Test php: 7.3 env: DB=mysql.docker MYSQL_VERSION=5.7 COVERAGE=yes @@ -127,11 +126,6 @@ jobs: - docker before_script: - bash ./tests/travis/install-mysql-8.0.sh - - stage: Test - php: 7.3 - env: DB=mysqli COVERAGE=yes - services: - - mysql - stage: Test php: 7.3 env: DB=mysqli.docker MYSQL_VERSION=5.7 COVERAGE=yes @@ -155,14 +149,18 @@ jobs: - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb MARIADB_VERSION=10.2 COVERAGE=yes - addons: - mariadb: 10.2 + env: DB=mariadb.docker MARIADB_VERSION=10.2 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb MARIADB_VERSION=10.3 COVERAGE=yes - addons: - mariadb: 10.3 + env: DB=mariadb.docker MARIADB_VERSION=10.3 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes @@ -172,14 +170,18 @@ jobs: - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli MARIADB_VERSION=10.2 COVERAGE=yes - addons: - mariadb: 10.2 + env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.2 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes - addons: - mariadb: 10.3 + env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 COVERAGE=yes + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes @@ -263,14 +265,18 @@ jobs: - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.4snapshot - env: DB=mariadb MARIADB_VERSION=10.3 - addons: - mariadb: 10.3 + env: DB=mariadb.docker MARIADB_VERSION=10.3 + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.4snapshot - env: DB=mariadb.mysqli MARIADB_VERSION=10.3 - addons: - mariadb: 10.3 + env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + services: + - docker + before_script: + - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.4snapshot env: DB=pgsql POSTGRESQL_VERSION=11.0 diff --git a/tests/travis/mariadb.mysqli.travis.xml b/tests/travis/mariadb.mysqli.travis.xml deleted file mode 100644 index b8bd9be01cd..00000000000 --- a/tests/travis/mariadb.mysqli.travis.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ../Doctrine/Tests/DBAL - - - - - - ../../lib/Doctrine - - - - - - performance - locking_functional - - - diff --git a/tests/travis/mariadb.travis.xml b/tests/travis/mariadb.travis.xml deleted file mode 100644 index 0d4e2c43c9e..00000000000 --- a/tests/travis/mariadb.travis.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ../Doctrine/Tests/DBAL - - - - - - ../../lib/Doctrine - - - - - - performance - locking_functional - - - diff --git a/tests/travis/mysql.travis.xml b/tests/travis/mysql.travis.xml deleted file mode 100644 index 0d4e2c43c9e..00000000000 --- a/tests/travis/mysql.travis.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ../Doctrine/Tests/DBAL - - - - - - ../../lib/Doctrine - - - - - - performance - locking_functional - - - diff --git a/tests/travis/mysqli.travis.xml b/tests/travis/mysqli.travis.xml deleted file mode 100644 index b8bd9be01cd..00000000000 --- a/tests/travis/mysqli.travis.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - ../Doctrine/Tests/DBAL - - - - - - ../../lib/Doctrine - - - - - - performance - locking_functional - - - From 7475993061a92e72131bc680429411cfb76566a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 28 Feb 2020 22:15:22 +0100 Subject: [PATCH 27/64] Stop using snapshot image PHP 7.4 has stable versions now. --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c679c005ccf..df61d4a44eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -248,7 +248,7 @@ jobs: install: - travis_retry composer update --prefer-dist --prefer-lowest - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=mysql.docker MYSQL_VERSION=8.0 sudo: required services: @@ -256,7 +256,7 @@ jobs: before_script: - bash ./tests/travis/install-mysql-8.0.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=mysqli.docker MYSQL_VERSION=8.0 sudo: required services: @@ -264,21 +264,21 @@ jobs: before_script: - bash ./tests/travis/install-mysql-8.0.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=mariadb.docker MARIADB_VERSION=10.3 services: - docker before_script: - bash ./tests/travis/install-mariadb.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 services: - docker before_script: - bash ./tests/travis/install-mariadb.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=pgsql POSTGRESQL_VERSION=11.0 sudo: required services: @@ -286,10 +286,10 @@ jobs: before_script: - bash ./tests/travis/install-postgres-11.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=sqlite - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=sqlsrv sudo: required services: @@ -299,7 +299,7 @@ jobs: - bash ./tests/travis/install-mssql-sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test - php: 7.4snapshot + php: 7.4 env: DB=pdo_sqlsrv sudo: required services: From 765432ad6c3db13433572b1166a9a80f919b0906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 28 Feb 2020 23:01:23 +0100 Subject: [PATCH 28/64] Replace external health check with native one Hopefully it will work more reliably. --- tests/travis/install-mariadb.sh | 7 ++++++- tests/travis/install-mysql-5.7.sh | 7 ++++++- tests/travis/install-mysql-8.0.sh | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/travis/install-mariadb.sh b/tests/travis/install-mariadb.sh index cda81e9bcba..b089c3b25fb 100644 --- a/tests/travis/install-mariadb.sh +++ b/tests/travis/install-mariadb.sh @@ -3,6 +3,7 @@ set -ex sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -10,4 +11,8 @@ sudo docker run \ --name mariadb \ mariadb:${MARIADB_VERSION} -sudo docker exec -i mariadb bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mariadb)" == "\"healthy\"" ] +do + echo "Waiting for MariaDB to become ready…" + sleep 1 +done diff --git a/tests/travis/install-mysql-5.7.sh b/tests/travis/install-mysql-5.7.sh index 25459382c6f..8967166635a 100644 --- a/tests/travis/install-mysql-5.7.sh +++ b/tests/travis/install-mysql-5.7.sh @@ -5,6 +5,7 @@ set -ex echo "Starting MySQL 5.7..." sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -12,4 +13,8 @@ sudo docker run \ --name mysql57 \ mysql:5.7 -sudo docker exec -i mysql57 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql57)" == "\"healthy\"" ] +do + echo "Waiting for MySQL to become ready…" + sleep 1 +done diff --git a/tests/travis/install-mysql-8.0.sh b/tests/travis/install-mysql-8.0.sh index 952a4300ba7..79d72a263c8 100644 --- a/tests/travis/install-mysql-8.0.sh +++ b/tests/travis/install-mysql-8.0.sh @@ -6,6 +6,7 @@ echo "Starting MySQL 8.0..." sudo docker pull mysql:8.0 sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -14,4 +15,8 @@ sudo docker run \ mysql:8.0 \ --default-authentication-plugin=mysql_native_password -sudo docker exec -i mysql80 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql80)" == "\"healthy\"" ] +do + echo "Waiting for MySQL to become ready…" + sleep 1 +done From e7aef4e8ba64ff5ba72ea427cfa2a09b42801522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 11:30:33 +0100 Subject: [PATCH 29/64] Refactor MySQL and MariaDB run in a single script --- .travis.yml | 86 ++++++--------------- tests/travis/create-mysql-schema.sql | 10 --- tests/travis/docker-run-mysql-or-mariadb.sh | 42 ++++++++++ tests/travis/install-mariadb.sh | 18 ----- tests/travis/install-mysql-5.7.sh | 20 ----- tests/travis/install-mysql-8.0.sh | 22 ------ 6 files changed, 65 insertions(+), 133 deletions(-) delete mode 100644 tests/travis/create-mysql-schema.sql create mode 100644 tests/travis/docker-run-mysql-or-mariadb.sh delete mode 100644 tests/travis/install-mariadb.sh delete mode 100644 tests/travis/install-mysql-5.7.sh delete mode 100644 tests/travis/install-mysql-8.0.sh diff --git a/.travis.yml b/.travis.yml index df61d4a44eb..63fe477c054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,11 @@ before_install: fi before_script: - - if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; + - | + if [[ -n "$IMAGE" ]] + then + bash ./tests/travis/docker-run-mysql-or-mariadb.sh + fi install: - travis_retry composer -n install --prefer-dist @@ -53,34 +57,24 @@ jobs: - stage: Test php: 7.2 - env: DB=mysql.docker MYSQL_VERSION=8.0 - sudo: required + env: DB=mysql.docker IMAGE=mysql:8.0 services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.2 - env: DB=mysqli.docker MYSQL_VERSION=8.0 - sudo: required + env: DB=mysqli.docker IMAGE=mysql:8.0 services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.2 - env: DB=mariadb.docker MARIADB_VERSION=10.3 + env: DB=mariadb.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.2 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.2 env: DB=pgsql POSTGRESQL_VERSION=11.0 @@ -114,74 +108,50 @@ jobs: - bash ./tests/travis/install-mssql.sh - stage: Test php: 7.3 - env: DB=mysql.docker MYSQL_VERSION=5.7 COVERAGE=yes - sudo: required - before_script: - - bash ./tests/travis/install-mysql-5.7.sh + env: DB=mysql.docker IMAGE=mysql:5.7 COVERAGE=yes - stage: Test php: 7.3 - env: DB=mysql.docker MYSQL_VERSION=8.0 COVERAGE=yes - sudo: required + env: DB=mysql.docker IMAGE=mysql:8.0 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.3 - env: DB=mysqli.docker MYSQL_VERSION=5.7 COVERAGE=yes - sudo: required - before_script: - - bash ./tests/travis/install-mysql-5.7.sh + env: DB=mysqli.docker IMAGE=mysql:5.7 COVERAGE=yes - stage: Test php: 7.3 - env: DB=mysqli.docker MYSQL_VERSION=8.0 COVERAGE=yes - sudo: required + env: DB=mysqli.docker IMAGE=mysql:8.0 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.1 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.1 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.2 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.2 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.3 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.3 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.2 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.2 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes @@ -249,34 +219,24 @@ jobs: - travis_retry composer update --prefer-dist --prefer-lowest - stage: Test php: 7.4 - env: DB=mysql.docker MYSQL_VERSION=8.0 - sudo: required + env: DB=mysql.docker IMAGE=mysql:8.0 services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.4 - env: DB=mysqli.docker MYSQL_VERSION=8.0 - sudo: required + env: DB=mysqli.docker IMAGE=mysql:8.0 services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.4 - env: DB=mariadb.docker MARIADB_VERSION=10.3 + env: DB=mariadb.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.4 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.4 env: DB=pgsql POSTGRESQL_VERSION=11.0 diff --git a/tests/travis/create-mysql-schema.sql b/tests/travis/create-mysql-schema.sql deleted file mode 100644 index 78a32358065..00000000000 --- a/tests/travis/create-mysql-schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -DROP USER IF EXISTS 'travis'@'%'; -CREATE USER 'travis'@'%'; - -CREATE SCHEMA doctrine_tests; -CREATE SCHEMA test_create_database; -CREATE SCHEMA test_drop_database; - -GRANT ALL PRIVILEGES ON doctrine_tests.* to travis@'%'; -GRANT ALL PRIVILEGES ON test_create_database.* to travis@'%'; -GRANT ALL PRIVILEGES ON test_drop_database.* to travis@'%'; diff --git a/tests/travis/docker-run-mysql-or-mariadb.sh b/tests/travis/docker-run-mysql-or-mariadb.sh new file mode 100644 index 00000000000..1b8d4c12772 --- /dev/null +++ b/tests/travis/docker-run-mysql-or-mariadb.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +set -ex + +echo "Starting RDBMS…">&2 + +if [[ "$IMAGE" == "mysql:8.0" ]] +then + CMD_OPTIONS="--default-authentication-plugin=mysql_native_password" +else + CMD_OPTIONS="" +fi + +docker run \ + --health-cmd='mysqladmin ping --silent' \ + --detach \ + --env MYSQL_ALLOW_EMPTY_PASSWORD=yes \ + --env MYSQL_DATABASE=doctrine_tests \ + --publish 33306:3306 \ + --name rdbms \ + "$IMAGE" $CMD_OPTIONS + +while true; do + healthStatus=$(docker inspect --format "{{json .State.Health.Status }}" rdbms) + case $healthStatus in + '"starting"') + echo "Waiting for RDBMS to become ready…">&2 + sleep 1 + ;; + '"healthy"') + echo "Container is healthy">&2 + break + ;; + '"unhealthy"') + echo "Container is unhealthy">&2 + exit 1 + ;; + *) + echo "Unexpected health status $healthStatus…">&2 + ;; + esac +done diff --git a/tests/travis/install-mariadb.sh b/tests/travis/install-mariadb.sh deleted file mode 100644 index b089c3b25fb..00000000000 --- a/tests/travis/install-mariadb.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -d \ - -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - -e MYSQL_DATABASE=doctrine_tests \ - -p 33306:3306 \ - --name mariadb \ - mariadb:${MARIADB_VERSION} - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mariadb)" == "\"healthy\"" ] -do - echo "Waiting for MariaDB to become ready…" - sleep 1 -done diff --git a/tests/travis/install-mysql-5.7.sh b/tests/travis/install-mysql-5.7.sh deleted file mode 100644 index 8967166635a..00000000000 --- a/tests/travis/install-mysql-5.7.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Starting MySQL 5.7..." - -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -d \ - -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - -e MYSQL_DATABASE=doctrine_tests \ - -p 33306:3306 \ - --name mysql57 \ - mysql:5.7 - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql57)" == "\"healthy\"" ] -do - echo "Waiting for MySQL to become ready…" - sleep 1 -done diff --git a/tests/travis/install-mysql-8.0.sh b/tests/travis/install-mysql-8.0.sh deleted file mode 100644 index 79d72a263c8..00000000000 --- a/tests/travis/install-mysql-8.0.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Starting MySQL 8.0..." - -sudo docker pull mysql:8.0 -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -d \ - -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - -e MYSQL_DATABASE=doctrine_tests \ - -p 33306:3306 \ - --name mysql80 \ - mysql:8.0 \ - --default-authentication-plugin=mysql_native_password - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql80)" == "\"healthy\"" ] -do - echo "Waiting for MySQL to become ready…" - sleep 1 -done From 6e5fbcb92fde8deba09337762cb76a55a8daed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 17:32:30 +0100 Subject: [PATCH 30/64] Do not enable docker explicitely It seems to be enabled by default. --- .travis.yml | 52 --------------------- tests/travis/docker-run-mysql-or-mariadb.sh | 2 +- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63fe477c054..9fee4c4b8b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,29 +58,19 @@ jobs: - stage: Test php: 7.2 env: DB=mysql.docker IMAGE=mysql:8.0 - services: - - docker - stage: Test php: 7.2 env: DB=mysqli.docker IMAGE=mysql:8.0 - services: - - docker - stage: Test php: 7.2 env: DB=mariadb.docker IMAGE=mariadb:10.3 - services: - - docker - stage: Test php: 7.2 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 - services: - - docker - stage: Test php: 7.2 env: DB=pgsql POSTGRESQL_VERSION=11.0 sudo: required - services: - - docker before_script: - bash ./tests/travis/install-postgres-11.sh - stage: Test @@ -90,8 +80,6 @@ jobs: php: 7.2 env: DB=sqlsrv sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh @@ -100,8 +88,6 @@ jobs: php: 7.2 env: DB=pdo_sqlsrv sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh @@ -112,46 +98,30 @@ jobs: - stage: Test php: 7.3 env: DB=mysql.docker IMAGE=mysql:8.0 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mysqli.docker IMAGE=mysql:5.7 COVERAGE=yes - stage: Test php: 7.3 env: DB=mysqli.docker IMAGE=mysql:8.0 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.docker IMAGE=mariadb:10.1 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.docker IMAGE=mariadb:10.2 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.docker IMAGE=mariadb:10.3 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.2 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes - services: - - docker - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes @@ -179,16 +149,12 @@ jobs: php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=11.0 COVERAGE=yes sudo: required - services: - - docker before_script: - bash ./tests/travis/install-postgres-11.sh - stage: Test php: 7.3 env: DB=sqlsrv COVERAGE=yes sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh @@ -197,8 +163,6 @@ jobs: php: 7.3 env: DB=pdo_sqlsrv COVERAGE=yes sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh @@ -207,8 +171,6 @@ jobs: php: 7.3 env: DB=ibm_db2 COVERAGE=yes sudo: required - services: - - docker before_script: - bash ./tests/travis/install-db2.sh - bash ./tests/travis/install-db2-ibm_db2.sh @@ -220,29 +182,19 @@ jobs: - stage: Test php: 7.4 env: DB=mysql.docker IMAGE=mysql:8.0 - services: - - docker - stage: Test php: 7.4 env: DB=mysqli.docker IMAGE=mysql:8.0 - services: - - docker - stage: Test php: 7.4 env: DB=mariadb.docker IMAGE=mariadb:10.3 - services: - - docker - stage: Test php: 7.4 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 - services: - - docker - stage: Test php: 7.4 env: DB=pgsql POSTGRESQL_VERSION=11.0 sudo: required - services: - - docker before_script: - bash ./tests/travis/install-postgres-11.sh - stage: Test @@ -252,8 +204,6 @@ jobs: php: 7.4 env: DB=sqlsrv sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh @@ -262,8 +212,6 @@ jobs: php: 7.4 env: DB=pdo_sqlsrv sudo: required - services: - - docker before_script: - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh diff --git a/tests/travis/docker-run-mysql-or-mariadb.sh b/tests/travis/docker-run-mysql-or-mariadb.sh index 1b8d4c12772..a78ce4adb6e 100644 --- a/tests/travis/docker-run-mysql-or-mariadb.sh +++ b/tests/travis/docker-run-mysql-or-mariadb.sh @@ -36,7 +36,7 @@ while true; do exit 1 ;; *) - echo "Unexpected health status $healthStatus…">&2 + echo "Unexpected health status $healthStatus">&2 ;; esac done From 398f23eace85bd0f67e2dcb9ed23c0ca1e3a42a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 19:04:04 +0100 Subject: [PATCH 31/64] Synchronize the number of code coverage runs --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a3b8a5621ca..aeca6bd5d5c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -21,7 +21,7 @@ before_commands: tools: external_code_coverage: timeout: 3600 - runs: 30 # 25x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP + runs: 24 # 19x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP filter: excluded_paths: From 6e505dec525530b406d0090b8d7a90a1952edf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 21:02:05 +0100 Subject: [PATCH 32/64] Continue testing unsupported versions They are no longer supported by their vendors, but until we do support them, we should continue testing them. --- .scrutinizer.yml | 2 +- .travis.yml | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index aeca6bd5d5c..cb9872f6761 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -21,7 +21,7 @@ before_commands: tools: external_code_coverage: timeout: 3600 - runs: 24 # 19x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP + runs: 28 # 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP filter: excluded_paths: diff --git a/.travis.yml b/.travis.yml index 9fee4c4b8b6..823fd073e72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,6 +104,9 @@ jobs: - stage: Test php: 7.3 env: DB=mysqli.docker IMAGE=mysql:8.0 COVERAGE=yes + - stage: Test + php: 7.3 + env: DB=mariadb.docker IMAGE=mariadb:10.0 COVERAGE=yes - stage: Test php: 7.3 env: DB=mariadb.docker IMAGE=mariadb:10.1 COVERAGE=yes @@ -113,6 +116,9 @@ jobs: - stage: Test php: 7.3 env: DB=mariadb.docker IMAGE=mariadb:10.3 COVERAGE=yes + - stage: Test + php: 7.3 + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.0 COVERAGE=yes - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 COVERAGE=yes @@ -122,6 +128,22 @@ jobs: - stage: Test php: 7.3 env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes + - stage: Test + dist: trusty + php: 7.3 + env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes + services: + - postgresql + addons: + postgresql: "9.2" + - stage: Test + dist: trusty + php: 7.3 + env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes + services: + - postgresql + addons: + postgresql: "9.3" - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes From 17159482f07a8f0d070d5626c628987a9fc6ca0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 21:54:24 +0100 Subject: [PATCH 33/64] Display badges for current branch --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7495d20d7ee..4b488db9d9a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Doctrine DBAL -| [Master][Master] | [2.9][2.9] | [Develop][develop] | +| [Master][Master] | [2.10][2.10] | [Develop][develop] | |:----------------:|:----------:|:------------------:| -| [![Build status][Master image]][Master] | [![Build status][2.9 image]][2.9] | [![Build status][develop image]][develop] | -| [![Build Status][ContinuousPHP image]][ContinuousPHP] | [![Build Status][ContinuousPHP 2.9 image]][ContinuousPHP] | [![Build Status][ContinuousPHP develop image]][ContinuousPHP] | -| [![Code Coverage][Coverage image]][Scrutinizer Master] | [![Code Coverage][Coverage 2.9 image]][Scrutinizer 2.9] | [![Code Coverage][Coverage develop image]][Scrutinizer develop] | -| [![Code Quality][Quality image]][Scrutinizer Master] | [![Code Quality][Quality 2.9 image]][Scrutinizer 2.9] | [![Code Quality][Quality develop image]][Scrutinizer develop] | -| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.9 image]][AppVeyor 2.9] | [![AppVeyor][AppVeyor develop image]][AppVeyor develop] | +| [![Build status][Master image]][Master] | [![Build status][2.10 image]][2.10] | [![Build status][develop image]][develop] | +| [![Build Status][ContinuousPHP image]][ContinuousPHP] | [![Build Status][ContinuousPHP 2.10 image]][ContinuousPHP] | [![Build Status][ContinuousPHP develop image]][ContinuousPHP] | +| [![Code Coverage][Coverage image]][Scrutinizer Master] | [![Code Coverage][Coverage 2.10 image]][Scrutinizer 2.10] | [![Code Coverage][Coverage develop image]][Scrutinizer develop] | +| [![Code Quality][Quality image]][Scrutinizer Master] | [![Code Quality][Quality 2.10 image]][Scrutinizer 2.10] | [![Code Quality][Quality develop image]][Scrutinizer develop] | +| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.10 image]][AppVeyor 2.10] | [![AppVeyor][AppVeyor develop image]][AppVeyor develop] | Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction. @@ -26,14 +26,14 @@ Powerful database abstraction layer with many features for database schema intro [AppVeyor master image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/master?svg=true [ContinuousPHP]: https://continuousphp.com/git-hub/doctrine/dbal - [2.9 image]: https://img.shields.io/travis/doctrine/dbal/2.9.svg?style=flat-square - [Coverage 2.9 image]: https://img.shields.io/scrutinizer/coverage/g/doctrine/dbal/2.9.svg?style=flat-square - [Quality 2.9 image]: https://img.shields.io/scrutinizer/g/doctrine/dbal/2.9.svg?style=flat-square - [ContinuousPHP 2.9 image]: https://img.shields.io/continuousphp/git-hub/doctrine/dbal/2.9.svg?style=flat-square - [2.9]: https://github.com/doctrine/dbal/tree/2.9 - [Scrutinizer 2.9]: https://scrutinizer-ci.com/g/doctrine/dbal/?branch=2.9 - [AppVeyor 2.9]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.9 - [AppVeyor 2.9 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.9?svg=true + [2.10 image]: https://img.shields.io/travis/doctrine/dbal/2.10.x.svg?style=flat-square + [Coverage 2.10 image]: https://img.shields.io/scrutinizer/coverage/g/doctrine/dbal/2.10.x.svg?style=flat-square + [Quality 2.10 image]: https://img.shields.io/scrutinizer/g/doctrine/dbal/2.10.x.svg?style=flat-square + [ContinuousPHP 2.10 image]: https://img.shields.io/continuousphp/git-hub/doctrine/dbal/2.10.x.svg?style=flat-square + [2.10]: https://github.com/doctrine/dbal/tree/2.10.x + [Scrutinizer 2.10]: https://scrutinizer-ci.com/g/doctrine/dbal/?branch=2.10.x + [AppVeyor 2.10]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.10.x + [AppVeyor 2.10 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.10.x?svg=true [develop]: https://github.com/doctrine/dbal/tree/develop [develop image]: https://img.shields.io/travis/doctrine/dbal/develop.svg?style=flat-square From b8e2c28b3d2222c92cc1d769dd2075180ac10ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 29 Feb 2020 21:55:37 +0100 Subject: [PATCH 34/64] Remove column about develop This branch seems to have been removed. --- README.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4b488db9d9a..37ffcad5734 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Doctrine DBAL -| [Master][Master] | [2.10][2.10] | [Develop][develop] | -|:----------------:|:----------:|:------------------:| -| [![Build status][Master image]][Master] | [![Build status][2.10 image]][2.10] | [![Build status][develop image]][develop] | -| [![Build Status][ContinuousPHP image]][ContinuousPHP] | [![Build Status][ContinuousPHP 2.10 image]][ContinuousPHP] | [![Build Status][ContinuousPHP develop image]][ContinuousPHP] | -| [![Code Coverage][Coverage image]][Scrutinizer Master] | [![Code Coverage][Coverage 2.10 image]][Scrutinizer 2.10] | [![Code Coverage][Coverage develop image]][Scrutinizer develop] | -| [![Code Quality][Quality image]][Scrutinizer Master] | [![Code Quality][Quality 2.10 image]][Scrutinizer 2.10] | [![Code Quality][Quality develop image]][Scrutinizer develop] | -| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.10 image]][AppVeyor 2.10] | [![AppVeyor][AppVeyor develop image]][AppVeyor develop] | +| [Master][Master] | [2.10][2.10] | +|:----------------:|:----------:| +| [![Build status][Master image]][Master] | [![Build status][2.10 image]][2.10] | +| [![Build Status][ContinuousPHP image]][ContinuousPHP] | [![Build Status][ContinuousPHP 2.10 image]][ContinuousPHP] | +| [![Code Coverage][Coverage image]][Scrutinizer Master] | [![Code Coverage][Coverage 2.10 image]][Scrutinizer 2.10] | +| [![Code Quality][Quality image]][Scrutinizer Master] | [![Code Quality][Quality 2.10 image]][Scrutinizer 2.10] | +| [![AppVeyor][AppVeyor master image]][AppVeyor master] | [![AppVeyor][AppVeyor 2.10 image]][AppVeyor 2.10] | Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction. @@ -34,13 +34,3 @@ Powerful database abstraction layer with many features for database schema intro [Scrutinizer 2.10]: https://scrutinizer-ci.com/g/doctrine/dbal/?branch=2.10.x [AppVeyor 2.10]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.10.x [AppVeyor 2.10 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.10.x?svg=true - - [develop]: https://github.com/doctrine/dbal/tree/develop - [develop image]: https://img.shields.io/travis/doctrine/dbal/develop.svg?style=flat-square - [Coverage develop image]: https://img.shields.io/scrutinizer/coverage/g/doctrine/dbal/develop.svg?style=flat-square - [Quality develop image]: https://img.shields.io/scrutinizer/g/doctrine/dbal/develop.svg?style=flat-square - [ContinuousPHP develop image]: https://img.shields.io/continuousphp/git-hub/doctrine/dbal/develop.svg?style=flat-square - [develop]: https://github.com/doctrine/dbal/tree/develop - [Scrutinizer develop]: https://scrutinizer-ci.com/g/doctrine/dbal/?branch=develop - [AppVeyor develop]: https://ci.appveyor.com/project/doctrine/dbal/branch/develop - [AppVeyor develop image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/develop?svg=true From 24cefe5d83a8e0ccc49b18fe774b11105a7fbcd9 Mon Sep 17 00:00:00 2001 From: Craig Duncan Date: Tue, 10 Mar 2020 15:53:44 +0000 Subject: [PATCH 35/64] Ensure the constructor arguments are passed to custom classes --- lib/Doctrine/DBAL/Statement.php | 6 +----- tests/Doctrine/Tests/DBAL/StatementTest.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/DBAL/Statement.php b/lib/Doctrine/DBAL/Statement.php index 09913bb56ae..13140a6a600 100644 --- a/lib/Doctrine/DBAL/Statement.php +++ b/lib/Doctrine/DBAL/Statement.php @@ -249,11 +249,7 @@ public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEX */ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) { - if ($fetchArgument) { - return $this->stmt->fetchAll($fetchMode, $fetchArgument); - } - - return $this->stmt->fetchAll($fetchMode); + return $this->stmt->fetchAll($fetchMode, $fetchArgument, $ctorArgs); } /** diff --git a/tests/Doctrine/Tests/DBAL/StatementTest.php b/tests/Doctrine/Tests/DBAL/StatementTest.php index bb86e9cab3c..1c0794ac4cc 100644 --- a/tests/Doctrine/Tests/DBAL/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/StatementTest.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\Connection as DriverConnection; +use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\Logging\SQLLogger; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Statement; @@ -28,7 +29,7 @@ class StatementTest extends DbalTestCase protected function setUp() : void { $this->pdoStatement = $this->getMockBuilder(PDOStatement::class) - ->onlyMethods(['execute', 'bindParam', 'bindValue']) + ->onlyMethods(['execute', 'bindParam', 'bindValue', 'fetchAll']) ->getMock(); $driverConnection = $this->createMock(DriverConnection::class); @@ -150,4 +151,15 @@ public function testExecuteCallsLoggerStopQueryOnException() : void $statement->execute(); } + + public function testPDOCustomClassConstructorArgs() : void + { + $statement = new Statement('', $this->conn); + + $this->pdoStatement->expects($this->once()) + ->method('fetchAll') + ->with(self::equalTo(FetchMode::CUSTOM_OBJECT), self::equalTo('Example'), self::equalTo(['arg1'])); + + $statement->fetchAll(FetchMode::CUSTOM_OBJECT, 'Example', ['arg1']); + } } From 21512f9ef5ee1b4acccb553f4b474cd0715ae628 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 2 Mar 2020 20:07:23 -0800 Subject: [PATCH 36/64] Make sure that the $types array has the same keys $params This will allow to omit parameters with unspecified types --- lib/Doctrine/DBAL/SQLParserUtils.php | 6 + .../Tests/DBAL/SQLParserUtilsTest.php | 118 +++++++++--------- 2 files changed, 67 insertions(+), 57 deletions(-) diff --git a/lib/Doctrine/DBAL/SQLParserUtils.php b/lib/Doctrine/DBAL/SQLParserUtils.php index 0807308ad59..6329a84e20d 100644 --- a/lib/Doctrine/DBAL/SQLParserUtils.php +++ b/lib/Doctrine/DBAL/SQLParserUtils.php @@ -4,7 +4,9 @@ use const PREG_OFFSET_CAPTURE; use function array_fill; +use function array_fill_keys; use function array_key_exists; +use function array_keys; use function array_merge; use function array_slice; use function array_values; @@ -131,6 +133,10 @@ public static function expandListParameters($query, $params, $types) $bindIndex = -1; if ($isPositional) { + // make sure that $types has the same keys as $params + // to allow omitting parameters with unspecified types + $types += array_fill_keys(array_keys($params), null); + ksort($params); ksort($types); } diff --git a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php index ba087eaa28d..a582a272dd1 100644 --- a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php +++ b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php @@ -110,8 +110,7 @@ public function testGetPlaceholderPositions(string $query, bool $isPositional, a public static function dataExpandListParameters() : iterable { return [ - // Positional: Very simple with one needle - [ + 'Positional: Very simple with one needle' => [ 'SELECT * FROM Foo WHERE foo IN (?)', [[1, 2, 3]], [Connection::PARAM_INT_ARRAY], @@ -119,8 +118,7 @@ public static function dataExpandListParameters() : iterable [1, 2, 3], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], ], - // Positional: One non-list before d one after list-needle - [ + 'Positional: One non-list before d one after list-needle' => [ 'SELECT * FROM Foo WHERE foo = ? AND bar IN (?)', ['string', [1, 2, 3]], [ParameterType::STRING, Connection::PARAM_INT_ARRAY], @@ -128,8 +126,7 @@ public static function dataExpandListParameters() : iterable ['string', 1, 2, 3], [ParameterType::STRING, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], ], - // Positional: One non-list after list-needle - [ + 'Positional: One non-list after list-needle' => [ 'SELECT * FROM Foo WHERE bar IN (?) AND baz = ?', [[1, 2, 3], 'foo'], [Connection::PARAM_INT_ARRAY, ParameterType::STRING], @@ -137,8 +134,7 @@ public static function dataExpandListParameters() : iterable [1, 2, 3, 'foo'], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::STRING], ], - // Positional: One non-list before and one after list-needle - [ + 'Positional: One non-list before and one after list-needle' => [ 'SELECT * FROM Foo WHERE foo = ? AND bar IN (?) AND baz = ?', [1, [1, 2, 3], 4], [ParameterType::INTEGER, Connection::PARAM_INT_ARRAY, ParameterType::INTEGER], @@ -152,8 +148,7 @@ public static function dataExpandListParameters() : iterable ParameterType::INTEGER, ], ], - // Positional: Two lists - [ + 'Positional: Two lists' => [ 'SELECT * FROM Foo WHERE foo IN (?, ?)', [[1, 2, 3], [4, 5]], [Connection::PARAM_INT_ARRAY, Connection::PARAM_INT_ARRAY], @@ -167,8 +162,7 @@ public static function dataExpandListParameters() : iterable ParameterType::INTEGER, ], ], - // Positional: Empty "integer" array DDC-1978 - [ + 'Positional: Empty "integer" array (DDC-1978)' => [ 'SELECT * FROM Foo WHERE foo IN (?)', [[]], [Connection::PARAM_INT_ARRAY], @@ -176,8 +170,7 @@ public static function dataExpandListParameters() : iterable [], [], ], - // Positional: Empty "str" array DDC-1978 - [ + 'Positional: Empty "str" array (DDC-1978)' => [ 'SELECT * FROM Foo WHERE foo IN (?)', [[]], [Connection::PARAM_STR_ARRAY], @@ -185,17 +178,15 @@ public static function dataExpandListParameters() : iterable [], [], ], - // Positional: explicit keys for params and types - [ + 'Positional: explicit keys for params and types' => [ 'SELECT * FROM Foo WHERE foo = ? AND bar = ? AND baz = ?', [1 => 'bar', 2 => 'baz', 0 => 1], [2 => ParameterType::STRING, 1 => ParameterType::STRING], 'SELECT * FROM Foo WHERE foo = ? AND bar = ? AND baz = ?', [1 => 'bar', 0 => 1, 2 => 'baz'], - [1 => ParameterType::STRING, 2 => ParameterType::STRING], + [1 => ParameterType::STRING, 2 => ParameterType::STRING, 0 => null], ], - // Positional: explicit keys for array params and array types - [ + 'Positional: explicit keys for array params and array types' => [ 'SELECT * FROM Foo WHERE foo IN (?) AND bar IN (?) AND baz = ?', [1 => ['bar1', 'bar2'], 2 => true, 0 => [1, 2, 3]], [2 => ParameterType::BOOLEAN, 1 => Connection::PARAM_STR_ARRAY, 0 => Connection::PARAM_INT_ARRAY], @@ -210,8 +201,7 @@ public static function dataExpandListParameters() : iterable ParameterType::BOOLEAN, ], ], - // Positional starts from 1: One non-list before and one after list-needle - [ + 'Positional starts from 1: One non-list before and one after list-needle' => [ 'SELECT * FROM Foo WHERE foo = ? AND bar IN (?) AND baz = ? AND foo IN (?)', [1 => 1, 2 => [1, 2, 3], 3 => 4, 4 => [5, 6]], [ @@ -232,8 +222,7 @@ public static function dataExpandListParameters() : iterable ParameterType::INTEGER, ], ], - // Named parameters : Very simple with param int - [ + 'Named: Very simple with param int' => [ 'SELECT * FROM Foo WHERE foo = :foo', ['foo' => 1], ['foo' => ParameterType::INTEGER], @@ -241,9 +230,7 @@ public static function dataExpandListParameters() : iterable [1], [ParameterType::INTEGER], ], - - // Named parameters : Very simple with param int and string - [ + 'Named: Very simple with param int and string' => [ 'SELECT * FROM Foo WHERE foo = :foo AND bar = :bar', ['bar' => 'Some String','foo' => 1], ['foo' => ParameterType::INTEGER, 'bar' => ParameterType::STRING], @@ -251,8 +238,7 @@ public static function dataExpandListParameters() : iterable [1,'Some String'], [ParameterType::INTEGER, ParameterType::STRING], ], - // Named parameters : Very simple with one needle - [ + 'Named: Very simple with one needle' => [ 'SELECT * FROM Foo WHERE foo IN (:foo)', ['foo' => [1, 2, 3]], ['foo' => Connection::PARAM_INT_ARRAY], @@ -260,8 +246,7 @@ public static function dataExpandListParameters() : iterable [1, 2, 3], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], ], - // Named parameters: One non-list before d one after list-needle - [ + 'Named: One non-list before d one after list-needle' => [ 'SELECT * FROM Foo WHERE foo = :foo AND bar IN (:bar)', ['foo' => 'string', 'bar' => [1, 2, 3]], ['foo' => ParameterType::STRING, 'bar' => Connection::PARAM_INT_ARRAY], @@ -269,8 +254,7 @@ public static function dataExpandListParameters() : iterable ['string', 1, 2, 3], [ParameterType::STRING, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], ], - // Named parameters: One non-list after list-needle - [ + 'Named: One non-list after list-needle' => [ 'SELECT * FROM Foo WHERE bar IN (:bar) AND baz = :baz', ['bar' => [1, 2, 3], 'baz' => 'foo'], ['bar' => Connection::PARAM_INT_ARRAY, 'baz' => ParameterType::STRING], @@ -278,26 +262,39 @@ public static function dataExpandListParameters() : iterable [1, 2, 3, 'foo'], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::STRING], ], - // Named parameters: One non-list before and one after list-needle - [ + 'Named: One non-list before and one after list-needle' => [ 'SELECT * FROM Foo WHERE foo = :foo AND bar IN (:bar) AND baz = :baz', ['bar' => [1, 2, 3],'foo' => 1, 'baz' => 4], - ['bar' => Connection::PARAM_INT_ARRAY, 'foo' => ParameterType::INTEGER, 'baz' => ParameterType::INTEGER], + [ + 'bar' => Connection::PARAM_INT_ARRAY, + 'foo' => ParameterType::INTEGER, + 'baz' => ParameterType::INTEGER, + ], 'SELECT * FROM Foo WHERE foo = ? AND bar IN (?, ?, ?) AND baz = ?', [1, 1, 2, 3, 4], - [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], + [ + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ], ], - // Named parameters: Two lists - [ + 'Named: Two lists' => [ 'SELECT * FROM Foo WHERE foo IN (:a, :b)', ['b' => [4, 5],'a' => [1, 2, 3]], ['a' => Connection::PARAM_INT_ARRAY, 'b' => Connection::PARAM_INT_ARRAY], 'SELECT * FROM Foo WHERE foo IN (?, ?, ?, ?, ?)', [1, 2, 3, 4, 5], - [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], + [ + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ], ], - // Named parameters : With the same name arg type string - [ + 'Named: With the same name arg type string' => [ 'SELECT * FROM Foo WHERE foo <> :arg AND bar = :arg', ['arg' => 'Some String'], ['arg' => ParameterType::STRING], @@ -305,18 +302,22 @@ public static function dataExpandListParameters() : iterable ['Some String','Some String'], [ParameterType::STRING,ParameterType::STRING], ], - // Named parameters : With the same name arg - [ + 'Named: With the same name arg' => [ 'SELECT * FROM Foo WHERE foo IN (:arg) AND NOT bar IN (:arg)', ['arg' => [1, 2, 3]], ['arg' => Connection::PARAM_INT_ARRAY], 'SELECT * FROM Foo WHERE foo IN (?, ?, ?) AND NOT bar IN (?, ?, ?)', [1, 2, 3, 1, 2, 3], - [ParameterType::INTEGER,ParameterType::INTEGER, ParameterType::INTEGER,ParameterType::INTEGER,ParameterType::INTEGER, ParameterType::INTEGER], + [ + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ParameterType::INTEGER, + ], ], - - // Named parameters : Same name, other name in between DBAL-299 - [ + 'Named: Same name, other name in between (DBAL-299)' => [ 'SELECT * FROM Foo WHERE (:foo = 2) AND (:bar = 3) AND (:foo = 2)', ['foo' => 2,'bar' => 3], ['foo' => ParameterType::INTEGER,'bar' => ParameterType::INTEGER], @@ -324,8 +325,7 @@ public static function dataExpandListParameters() : iterable [2, 3, 2], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER], ], - // Named parameters : Empty "integer" array DDC-1978 - [ + 'Named: Empty "integer" array (DDC-1978)' => [ 'SELECT * FROM Foo WHERE foo IN (:foo)', ['foo' => []], ['foo' => Connection::PARAM_INT_ARRAY], @@ -333,8 +333,7 @@ public static function dataExpandListParameters() : iterable [], [], ], - // Named parameters : Two empty "str" array DDC-1978 - [ + 'Named: Two empty "str" array (DDC-1978)' => [ 'SELECT * FROM Foo WHERE foo IN (:foo) OR bar IN (:bar)', ['foo' => [], 'bar' => []], ['foo' => Connection::PARAM_STR_ARRAY, 'bar' => Connection::PARAM_STR_ARRAY], @@ -358,8 +357,7 @@ public static function dataExpandListParameters() : iterable [1, 2, 'bar'], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::STRING], ], - // Params/types with colons - [ + 'Params/types with colons' => [ 'SELECT * FROM Foo WHERE foo = :foo OR bar = :bar', [':foo' => 'foo', ':bar' => 'bar'], [':foo' => ParameterType::INTEGER], @@ -391,8 +389,7 @@ public static function dataExpandListParameters() : iterable [1, 2, 'bar'], [ParameterType::INTEGER, ParameterType::INTEGER, ParameterType::STRING], ], - // DBAL-522 - null valued parameters are not considered - [ + 'Null valued parameters (DBAL-522)' => [ 'INSERT INTO Foo (foo, bar) values (:foo, :bar)', ['foo' => 1, 'bar' => null], [':foo' => ParameterType::INTEGER, ':bar' => ParameterType::NULL], @@ -408,8 +405,7 @@ public static function dataExpandListParameters() : iterable [1, null], [ParameterType::INTEGER, ParameterType::NULL], ], - // DBAL-1205 - Escaped single quotes SQL- and C-Style - [ + 'Escaped single quotes SQL- and C-Style (DBAL-1205)' => [ "SELECT * FROM Foo WHERE foo = :foo||''':not_a_param''\\'' OR bar = ''':not_a_param''\\'':bar", [':foo' => 1, ':bar' => 2], [':foo' => ParameterType::INTEGER, 'bar' => ParameterType::INTEGER], @@ -417,6 +413,14 @@ public static function dataExpandListParameters() : iterable [1, 2], [ParameterType::INTEGER, ParameterType::INTEGER], ], + [ + 'SELECT NULL FROM dummy WHERE ? IN (?)', + ['foo', ['bar', 'baz']], + [1 => Connection::PARAM_STR_ARRAY], + 'SELECT NULL FROM dummy WHERE ? IN (?, ?)', + ['foo', 'bar', 'baz'], + [null, ParameterType::STRING, ParameterType::STRING], + ], ]; } From 68f0d99fcf270525b3df59294f277a6643facbf9 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 16 Mar 2020 12:15:57 -0700 Subject: [PATCH 37/64] Updated documentation for QueryBuilder::execute() return value type --- lib/Doctrine/DBAL/Query/QueryBuilder.php | 4 ++-- phpstan.neon.dist | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 86d7a1ce91a..5148c82ca94 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -3,7 +3,7 @@ namespace Doctrine\DBAL\Query; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\Statement; +use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\Expression\CompositeExpression; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; @@ -198,7 +198,7 @@ public function getState() * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate} * for insert, update and delete statements. * - * @return Statement|int + * @return ResultStatement|int */ public function execute() { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4ae1fda3f8a..f60bf2d4ff5 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -19,7 +19,6 @@ parameters: - "~^Casting to bool something that's already bool.~" - "~^Casting to int something that's already int.~" - '~^Method Doctrine\\DBAL\\Driver\\IBMDB2\\DB2Connection::exec\(\) should return int but returns bool\.\z~' - - '~^Method Doctrine\\DBAL\\Query\\QueryBuilder::execute\(\) should return Doctrine\\DBAL\\Driver\\Statement\|int but returns Doctrine\\DBAL\\Driver\\ResultStatement\.\z~' - '~^Property Doctrine\\DBAL\\Schema\\Table::\$_primaryKeyName \(string\) does not accept (default value of type )?false\.\z~' - '~^Property Doctrine\\DBAL\\Schema\\Schema::\$_schemaConfig \(Doctrine\\DBAL\\Schema\\SchemaConfig\) does not accept default value of type false\.\z~' - '~^Method Doctrine\\DBAL\\Schema\\ForeignKeyConstraint::onEvent\(\) should return string\|null but returns false\.\z~' From ab88b96026df54b1f9f49bf3585100ff2ac04b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Mon, 30 Dec 2019 12:51:50 +0100 Subject: [PATCH 38/64] Upgrade to PHPStan v0.12 Allowing us to use more advanced checks and have full generic support. This also adds a baseline file, since we have new violations being reported but don't want to address them right now. --- composer.json | 2 +- composer.lock | 1090 ++++++++++--------------------------------------- 2 files changed, 228 insertions(+), 864 deletions(-) diff --git a/composer.json b/composer.json index 4a426e4881a..52eaf21f5bc 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "require-dev": { "doctrine/coding-standard": "^6.0", "jetbrains/phpstorm-stubs": "^2019.1", - "phpstan/phpstan": "^0.11.3", + "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^8.4.1", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0" }, diff --git a/composer.lock b/composer.lock index aa0428c2019..e66402ad6c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "120172ae44052999ec9a50b1121414cc", + "content-hash": "c5e7640a7c04d2174aa72c365cf067eb", "packages": [ { "name": "doctrine/cache", @@ -156,50 +156,6 @@ } ], "packages-dev": [ - { - "name": "composer/xdebug-handler", - "version": "1.3.3", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "time": "2019-05-27T17:52:04+00:00" - }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.5.0", @@ -383,57 +339,6 @@ ], "time": "2019-03-17T17:37:11+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "1.2", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.2.0", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A wrapper for ocramius/package-versions to get pretty versions strings", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "time": "2018-06-13T13:22:40+00:00" - }, { "name": "jetbrains/phpstorm-stubs", "version": "v2019.1", @@ -508,554 +413,31 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2019-08-09T12:45:53+00:00" - }, - { - "name": "nette/bootstrap", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/nette/bootstrap.git", - "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/e1075af05c211915e03e0c86542f3ba5433df4a3", - "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3", - "shasum": "" - }, - "require": { - "nette/di": "^3.0", - "nette/utils": "^3.0", - "php": ">=7.1" - }, - "require-dev": { - "latte/latte": "^2.2", - "nette/application": "^3.0", - "nette/caching": "^3.0", - "nette/database": "^3.0", - "nette/forms": "^3.0", - "nette/http": "^3.0", - "nette/mail": "^3.0", - "nette/robot-loader": "^3.0", - "nette/safe-stream": "^2.2", - "nette/security": "^3.0", - "nette/tester": "^2.0", - "tracy/tracy": "^2.6" - }, - "suggest": { - "nette/robot-loader": "to use Configurator::createRobotLoader()", - "tracy/tracy": "to use Configurator::enableTracy()" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", - "homepage": "https://nette.org", - "keywords": [ - "bootstrapping", - "configurator", - "nette" - ], - "time": "2019-03-26T12:59:07+00:00" - }, - { - "name": "nette/di", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "4aff517a1c6bb5c36fa09733d4cea089f529de6d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/4aff517a1c6bb5c36fa09733d4cea089f529de6d", - "reference": "4aff517a1c6bb5c36fa09733d4cea089f529de6d", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^3.0", - "nette/php-generator": "^3.2.2", - "nette/robot-loader": "^3.2", - "nette/schema": "^1.0", - "nette/utils": "^3.0", - "php": ">=7.1" - }, - "conflict": { - "nette/bootstrap": "<3.0" - }, - "require-dev": { - "nette/tester": "^2.2", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ], - "files": [ - "src/compatibility.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2019-08-07T12:11:33+00:00" - }, - { - "name": "nette/finder", - "version": "v2.5.0", - "source": { - "type": "git", - "url": "https://github.com/nette/finder.git", - "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/6be1b83ea68ac558aff189d640abe242e0306fe2", - "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4 || ~3.0.0", - "php": ">=7.1" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🔍 Nette Finder: find files and directories with an intuitive API.", - "homepage": "https://nette.org", - "keywords": [ - "filesystem", - "glob", - "iterator", - "nette" - ], - "time": "2019-02-28T18:13:25+00:00" - }, - { - "name": "nette/neon", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/cbff32059cbdd8720deccf9e9eace6ee516f02eb", - "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=7.0" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍸 Nette NEON: encodes and decodes NEON file format.", - "homepage": "http://ne-on.org", - "keywords": [ - "export", - "import", - "neon", - "nette", - "yaml" - ], - "time": "2019-02-05T21:30:40+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.2.3", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "aea6e81437bb238e5f0e5b5ce06337433908e63b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/aea6e81437bb238e5f0e5b5ce06337433908e63b", - "reference": "aea6e81437bb238e5f0e5b5ce06337433908e63b", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.3 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2019-07-05T13:01:56+00:00" - }, - { - "name": "nette/robot-loader", - "version": "v3.2.0", - "source": { - "type": "git", - "url": "https://github.com/nette/robot-loader.git", - "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", - "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/finder": "^2.5", - "nette/utils": "^3.0", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "? Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", - "homepage": "https://nette.org", - "keywords": [ - "autoload", - "class", - "interface", - "nette", - "trait" - ], - "time": "2019-03-08T21:57:24+00:00" - }, - { - "name": "nette/schema", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/nette/schema.git", - "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", - "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", - "shasum": "" - }, - "require": { - "nette/utils": "^3.0.1", - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.2", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "📐 Nette Schema: validating data structures against a given Schema.", - "homepage": "https://nette.org", - "keywords": [ - "config", - "nette" - ], - "time": "2019-04-03T15:53:25+00:00" - }, - { - "name": "nette/utils", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "bd961f49b211997202bda1d0fbc410905be370d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/bd961f49b211997202bda1d0fbc410905be370d4", - "reference": "bd961f49b211997202bda1d0fbc410905be370d4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } + "license": [ + "MIT" ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", + "description": "Create deep copies (clones) of your objects", "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "time": "2019-03-22T01:00:30+00:00" + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2019-08-09T12:45:53+00:00" }, { "name": "nikic/php-parser", - "version": "v4.2.3", + "version": "v4.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "e612609022e935f3d0337c1295176505b41188c8" + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e612609022e935f3d0337c1295176505b41188c8", - "reference": "e612609022e935f3d0337c1295176505b41188c8", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", "shasum": "" }, "require": { @@ -1063,6 +445,7 @@ "php": ">=7.0" }, "require-dev": { + "ircmaxell/php-yacc": "0.0.5", "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" }, "bin": [ @@ -1071,7 +454,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -1093,57 +476,7 @@ "parser", "php" ], - "time": "2019-08-12T20:17:41+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", - "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0.0", - "php": "^7.1.0" - }, - "require-dev": { - "composer/composer": "^1.6.3", - "doctrine/coding-standard": "^5.0.1", - "ext-zip": "*", - "infection/infection": "^0.7.1", - "phpunit/phpunit": "^7.0.0" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2019-02-21T12:16:21+00:00" + "time": "2019-11-08T13:50:10+00:00" }, { "name": "phar-io/manifest", @@ -1509,78 +842,56 @@ }, { "name": "phpstan/phpstan", - "version": "0.11.15", + "version": "0.12.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1be5b3a706db16ac472a4c40ec03cf4c810b118d" + "reference": "1ce27fe29c8660a27926127d350d53d80c4d4286" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1be5b3a706db16ac472a4c40ec03cf4c810b118d", - "reference": "1be5b3a706db16ac472a4c40ec03cf4c810b118d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1ce27fe29c8660a27926127d350d53d80c4d4286", + "reference": "1ce27fe29c8660a27926127d350d53d80c4d4286", "shasum": "" }, "require": { - "composer/xdebug-handler": "^1.3.0", - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/schema": "^1.0", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^4.2.3", - "php": "~7.1", - "phpstan/phpdoc-parser": "^0.3.5", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "conflict": { - "symfony/console": "3.4.16 || 4.1.5" - }, - "require-dev": { - "brianium/paratest": "^2.0 || ^3.0", - "consistence/coding-standard": "^3.5", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "ext-intl": "*", - "ext-mysqli": "*", - "ext-simplexml": "*", - "ext-soap": "*", - "ext-zip": "*", - "jakub-onderka/php-parallel-lint": "^1.0", - "localheinz/composer-normalize": "^1.1.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-php-parser": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.5.14 || ^8.0", - "slevomat/coding-standard": "^4.7.2", - "squizlabs/php_codesniffer": "^3.3.2" + "php": "^7.1" }, "bin": [ - "bin/phpstan" + "phpstan", + "phpstan.phar" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "0.11-dev" + "dev-master": "0.12-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/", - "build/PHPStan" - ] - } + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2019-08-18T20:51:53+00:00" + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2020-03-22T16:51:47+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1917,18 +1228,67 @@ ], "time": "2019-10-07T12:57:41+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, { "name": "psr/log", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -1937,7 +1297,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1962,7 +1322,7 @@ "psr", "psr-3" ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2528,8 +1888,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], "description": "Collection of value objects that represent the types of the PHP type system", @@ -2672,37 +2032,41 @@ }, { "name": "symfony/console", - "version": "v4.2.4", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9" + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9", - "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9", + "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/contracts": "^1.0", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2713,7 +2077,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2740,48 +2104,44 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-02-23T15:17:42+00:00" + "time": "2019-12-17T13:20:22+00:00" }, { - "name": "symfony/contracts", - "version": "v1.0.2", + "name": "symfony/debug", + "version": "v4.0.6", "source": { "type": "git", - "url": "https://github.com/symfony/contracts.git", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + "url": "https://github.com/symfony/debug.git", + "reference": "1721e4e7effb23480966690cdcdc7d2a4152d489" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "url": "https://api.github.com/repos/symfony/debug/zipball/1721e4e7effb23480966690cdcdc7d2a4152d489", + "reference": "1721e4e7effb23480966690cdcdc7d2a4152d489", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.1.3", + "psr/log": "~1.0" }, - "require-dev": { - "psr/cache": "^1.0", - "psr/container": "^1.0" + "conflict": { + "symfony/http-kernel": "<3.4" }, - "suggest": { - "psr/cache": "When using the Cache contracts", - "psr/container": "When using the Service contracts", - "symfony/cache-contracts-implementation": "", - "symfony/service-contracts-implementation": "", - "symfony/translation-contracts-implementation": "" + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Contracts\\": "" + "Symfony\\Component\\Debug\\": "" }, "exclude-from-classmap": [ - "**/Tests/" + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2790,62 +2150,50 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A set of abstractions extracted out of the Symfony components", + "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2018-12-05T08:06:11+00:00" + "time": "2018-02-28T21:50:02+00:00" }, { - "name": "symfony/debug", - "version": "v4.0.6", + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "1721e4e7effb23480966690cdcdc7d2a4152d489" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/1721e4e7effb23480966690cdcdc7d2a4152d489", - "reference": "1721e4e7effb23480966690cdcdc7d2a4152d489", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", "shasum": "" }, "require": { - "php": "^7.1.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": "<3.4" + "php": ">=5.3.3" }, - "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "1.12-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2854,47 +2202,56 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", - "time": "2018-02-28T21:50:02+00:00" + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-08-06T08:03:45+00:00" }, { - "name": "symfony/finder", - "version": "v4.3.3", + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "9638d41e3729459860bb96f6247ccb61faaa45f2" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9638d41e3729459860bb96f6247ccb61faaa45f2", - "reference": "9638d41e3729459860bb96f6247ccb61faaa45f2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "1.13-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Finder\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2903,50 +2260,57 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", - "time": "2019-06-28T13:16:30+00:00" + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "name": "symfony/polyfill-php73", + "version": "v1.13.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "suggest": { - "ext-ctype": "For best performance" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-master": "1.13-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" + "Symfony\\Polyfill\\Php73\\": "" }, "files": [ "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2955,57 +2319,55 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "ctype", "polyfill", - "portable" + "portable", + "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "time": "2019-11-27T16:25:15+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.10.0", + "name": "symfony/service-contracts", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.2.5", + "psr/container": "^1.0" }, "suggest": { - "ext-mbstring": "For best performance" + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "2.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Contracts\\Service\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3021,16 +2383,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], - "time": "2018-09-21T13:07:52+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "theseer/tokenizer", @@ -3132,5 +2495,6 @@ "php": "^7.2", "ext-pdo": "*" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } From f440d92cecf704e6267a9eb9dd925581a752d91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 31 Dec 2019 10:03:06 +0100 Subject: [PATCH 39/64] Respect interface's return type in methods --- lib/Doctrine/DBAL/Cache/ArrayStatement.php | 2 ++ .../DBAL/Driver/IBMDB2/DB2Connection.php | 19 ++++++++++++++++--- .../SQLAnywhere/SQLAnywhereStatement.php | 2 ++ .../DBAL/Driver/SQLSrv/SQLSrvConnection.php | 6 ++++++ .../DBAL/Driver/SQLSrv/SQLSrvStatement.php | 6 ++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/DBAL/Cache/ArrayStatement.php b/lib/Doctrine/DBAL/Cache/ArrayStatement.php index 449a220a2af..5b72e599ac3 100644 --- a/lib/Doctrine/DBAL/Cache/ArrayStatement.php +++ b/lib/Doctrine/DBAL/Cache/ArrayStatement.php @@ -46,6 +46,8 @@ public function __construct(array $data) public function closeCursor() { unset($this->data); + + return true; } /** diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php index cb1e6018f3e..f03fa6a20c3 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php @@ -8,6 +8,7 @@ use stdClass; use const DB2_AUTOCOMMIT_OFF; use const DB2_AUTOCOMMIT_ON; +use function assert; use function db2_autocommit; use function db2_commit; use function db2_conn_error; @@ -23,6 +24,7 @@ use function db2_server_info; use function db2_stmt_errormsg; use function func_get_args; +use function is_bool; class DB2Connection implements Connection, ServerInfoAwareConnection { @@ -140,7 +142,10 @@ public function lastInsertId($name = null) */ public function beginTransaction() { - db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF); + $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF); + assert(is_bool($result)); + + return $result; } /** @@ -151,7 +156,11 @@ public function commit() if (! db2_commit($this->conn)) { throw new DB2Exception(db2_conn_errormsg($this->conn)); } - db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + + $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + assert(is_bool($result)); + + return $result; } /** @@ -162,7 +171,11 @@ public function rollBack() if (! db2_rollback($this->conn)) { throw new DB2Exception(db2_conn_errormsg($this->conn)); } - db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + + $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + assert(is_bool($result)); + + return $result; } /** diff --git a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php index 886bb245873..ff1759aba26 100644 --- a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php +++ b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php @@ -313,6 +313,8 @@ public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) $this->defaultFetchMode = $fetchMode; $this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass; $this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs; + + return true; } /** diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php index 35ad913ff5b..71b450d98e0 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php @@ -152,6 +152,8 @@ public function beginTransaction() if (! sqlsrv_begin_transaction($this->conn)) { throw SQLSrvException::fromSqlSrvErrors(); } + + return true; } /** @@ -162,6 +164,8 @@ public function commit() if (! sqlsrv_commit($this->conn)) { throw SQLSrvException::fromSqlSrvErrors(); } + + return true; } /** @@ -172,6 +176,8 @@ public function rollBack() if (! sqlsrv_rollback($this->conn)) { throw SQLSrvException::fromSqlSrvErrors(); } + + return true; } /** diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php index 5e7016c5a74..1e1c0a2a7f2 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php @@ -158,6 +158,8 @@ public function bindValue($param, $value, $type = ParameterType::STRING) $this->variables[$param] = $value; $this->types[$param] = $type; + + return true; } /** @@ -174,6 +176,8 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l // unset the statement resource if it exists as the new one will need to be bound to the new variable $this->stmt = null; + + return true; } /** @@ -263,6 +267,8 @@ public function execute($params = null) } $this->result = true; + + return true; } /** From 35beaca3bed81ad4983e58706ae38688de34a853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 31 Dec 2019 11:13:34 +0100 Subject: [PATCH 40/64] Declare return types in a BC compatible manner --- lib/Doctrine/DBAL/Configuration.php | 2 ++ lib/Doctrine/DBAL/Connection.php | 10 ++++++++-- lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php | 4 ++-- lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php | 4 ++-- lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php | 2 ++ lib/Doctrine/DBAL/Platforms/AbstractPlatform.php | 6 ++++++ lib/Doctrine/DBAL/Platforms/DB2Platform.php | 2 +- lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php | 3 ++- lib/Doctrine/DBAL/Platforms/OraclePlatform.php | 5 ++++- lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php | 2 ++ lib/Doctrine/DBAL/Platforms/SqlitePlatform.php | 6 ++++-- lib/Doctrine/DBAL/Query/QueryBuilder.php | 2 +- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 3 ++- lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php | 4 ++++ lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php | 4 ++-- .../Synchronizer/AbstractSchemaSynchronizer.php | 4 ++++ lib/Doctrine/DBAL/Schema/Table.php | 2 ++ lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php | 2 ++ .../DBAL/Schema/Visitor/SchemaDiffVisitor.php | 11 +++++++++++ .../DBAL/Tools/Console/Command/ImportCommand.php | 4 +--- .../Tools/Console/Command/ReservedWordsCommand.php | 4 +--- .../DBAL/Tools/Console/Command/RunSqlCommand.php | 4 +--- lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php | 2 ++ lib/Doctrine/DBAL/Types/ConversionException.php | 3 +++ 24 files changed, 71 insertions(+), 24 deletions(-) diff --git a/lib/Doctrine/DBAL/Configuration.php b/lib/Doctrine/DBAL/Configuration.php index 2cc0070d0cb..13260cd08bb 100644 --- a/lib/Doctrine/DBAL/Configuration.php +++ b/lib/Doctrine/DBAL/Configuration.php @@ -140,6 +140,8 @@ public function getSchemaAssetsFilter() : ?callable * @see getAutoCommit * * @param bool $autoCommit True to enable auto-commit mode; false to disable it. + * + * @return void */ public function setAutoCommit($autoCommit) { diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index ee6c08635ce..e2d78ae1559 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -383,7 +383,7 @@ public function connect() * * @throws DBALException If an invalid platform was specified for this connection. */ - private function detectDatabasePlatform() + private function detectDatabasePlatform() : void { $version = $this->getDatabasePlatformVersion(); @@ -504,6 +504,8 @@ public function isAutoCommit() * @see isAutoCommit * * @param bool $autoCommit True to enable auto-commit mode; false to disable it. + * + * @return void */ public function setAutoCommit($autoCommit) { @@ -1316,7 +1318,7 @@ public function commit() /** * Commits all current nesting transactions. */ - private function commitAll() + private function commitAll() : void { while ($this->transactionNestingLevel !== 0) { if ($this->autoCommit === false && $this->transactionNestingLevel === 1) { @@ -1334,6 +1336,8 @@ private function commitAll() /** * Cancels any database changes done during the current transaction. * + * @return bool + * * @throws ConnectionException If the rollback operation failed. */ public function rollBack() @@ -1373,6 +1377,8 @@ public function rollBack() $this->isRollbackOnly = true; --$this->transactionNestingLevel; } + + return true; } /** diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php index 1f1a1d218c3..68096ba80e0 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php @@ -222,7 +222,7 @@ public function errorInfo() * @throws MysqliException When one of of the options is not supported. * @throws MysqliException When applying doesn't work - e.g. due to incorrect value. */ - private function setDriverOptions(array $driverOptions = []) + private function setDriverOptions(array $driverOptions = []) : void { $supportedDriverOptions = [ MYSQLI_OPT_CONNECT_TIMEOUT, @@ -281,7 +281,7 @@ public function ping() * * @throws MysqliException */ - private function setSecureConnection(array $params) + private function setSecureConnection(array $params) : void { if (! isset($params['ssl_key']) && ! isset($params['ssl_cert']) && diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php index 43d70853ef5..17b7cb28a7c 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php @@ -207,7 +207,7 @@ public function execute($params = null) /** * Binds parameters with known types previously bound to the statement */ - private function bindTypedParameters() + private function bindTypedParameters() : void { $streams = $values = []; $types = $this->types; @@ -245,7 +245,7 @@ private function bindTypedParameters() * * @throws MysqliException */ - private function sendLongData($streams) + private function sendLongData($streams) : void { foreach ($streams as $paramNr => $stream) { while (! feof($stream)) { diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php b/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php index 363b260950e..94c19f6effc 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php @@ -12,6 +12,8 @@ class LastInsertId /** * @param int $id + * + * @return void */ public function setId($id) { diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index 3d833dfaaeb..f805b3d8c52 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -156,6 +156,8 @@ public function __construct() /** * Sets the EventManager used by the Platform. + * + * @return void */ public function setEventManager(EventManager $eventManager) { @@ -391,6 +393,8 @@ abstract public function getName(); * @param string $dbType * @param string $doctrineType * + * @return void + * * @throws DBALException If the type is not found. */ public function registerDoctrineTypeMapping($dbType, $doctrineType) @@ -3291,6 +3295,8 @@ public function hasNativeJsonType() /** * @deprecated * + * @return string + * * @todo Remove in 3.0 */ public function getIdentityColumnNullInsertSQL() diff --git a/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/lib/Doctrine/DBAL/Platforms/DB2Platform.php index 25d4163b6ec..2dbf7f5df86 100644 --- a/lib/Doctrine/DBAL/Platforms/DB2Platform.php +++ b/lib/Doctrine/DBAL/Platforms/DB2Platform.php @@ -628,7 +628,7 @@ public function getAlterTableSQL(TableDiff $diff) * @param string[] $sql The sequence of table alteration statements to fill. * @param mixed[] $queryParts The sequence of column alteration clauses to fill. */ - private function gatherAlterColumnSQL(Identifier $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts) + private function gatherAlterColumnSQL(Identifier $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts) : void { $alterColumnClauses = $this->getAlterColumnClausesSQL($columnDiff); diff --git a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php index 8f6f0966323..983046afcd0 100644 --- a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php @@ -435,7 +435,8 @@ public function getDropIndexSQL($index, $table = null) } /** - * {@inheritDoc} + * + * @return string */ protected function getDropPrimaryKeySQL($table) { diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index 21b13a2d691..3fa40870140 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -37,6 +37,8 @@ class OraclePlatform extends AbstractPlatform * * @param string $identifier * + * @return void + * * @throws DBALException */ public static function assertValidIdentifier($identifier) @@ -59,7 +61,8 @@ public function getSubstringExpression($value, $position, $length = null) } /** - * {@inheritDoc} + * + * @return string */ public function getNowExpression($type = 'timestamp') { diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index dd90f2cb6b3..a2bdf26219a 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -69,6 +69,8 @@ class PostgreSqlPlatform extends AbstractPlatform * Enables use of 'true'/'false' or otherwise 1 and 0 instead. * * @param bool $flag + * + * @return void */ public function setUseBooleanTrueFalseStrings($flag) { diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index 02d2482c86e..d3a7d499faa 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -222,7 +222,8 @@ public function getBigIntTypeDeclarationSQL(array $field) } /** - * {@inheritDoc} + * + * @return string */ public function getTinyIntTypeDeclarationSql(array $field) { @@ -248,7 +249,8 @@ public function getSmallIntTypeDeclarationSQL(array $field) } /** - * {@inheritDoc} + * + * @return string */ public function getMediumIntTypeDeclarationSql(array $field) { diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 5148c82ca94..e76ca0e0758 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -1174,7 +1174,7 @@ private function getFromClauses() * * @throws QueryException */ - private function verifyAllAliasesAreKnown(array $knownAliases) + private function verifyAllAliasesAreKnown(array $knownAliases) : void { foreach ($this->sqlParts['join'] as $fromAlias => $joins) { if (! isset($knownAliases[$fromAlias])) { diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index b1fe64afef4..6b2d63b64bb 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -178,7 +178,8 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) } /** - * {@inheritdoc} + * + * @return string|null */ protected function _getPortableForeignKeyRuleDef($def) { diff --git a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php index c169a6e0708..13cdcb0952d 100644 --- a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php @@ -47,6 +47,8 @@ public function dropDatabase($database) * Starts a database. * * @param string $database The name of the database to start. + * + * @return void */ public function startDatabase($database) { @@ -58,6 +60,8 @@ public function startDatabase($database) * Stops a database. * * @param string $database The name of the database to stop. + * + * @return void */ public function stopDatabase($database) { diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index ac758015a0f..6af35e9c206 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -223,9 +223,9 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null } /** - * {@inheritdoc} - * * @deprecated + * + * @return array */ protected function _getPortableTableIndexDefinition($tableIndex) { diff --git a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php index b597b8db9b2..9b1974747e7 100644 --- a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php +++ b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php @@ -20,6 +20,8 @@ public function __construct(Connection $conn) /** * @param string[] $sql + * + * @return void */ protected function processSqlSafely(array $sql) { @@ -33,6 +35,8 @@ protected function processSqlSafely(array $sql) /** * @param string[] $sql + * + * @return void */ protected function processSql(array $sql) { diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php index 8e613320f79..842d1fccf67 100644 --- a/lib/Doctrine/DBAL/Schema/Table.php +++ b/lib/Doctrine/DBAL/Schema/Table.php @@ -300,6 +300,8 @@ public function addColumn($columnName, $typeName, array $options = []) * @param string $oldColumnName * @param string $newColumnName * + * @return void + * * @throws DBALException */ public function renameColumn($oldColumnName, $newColumnName) diff --git a/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php b/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php index 186fe1b4213..b0548d6064a 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/NamespaceVisitor.php @@ -11,6 +11,8 @@ interface NamespaceVisitor * Accepts a schema namespace name. * * @param string $namespaceName The schema namespace name to accept. + * + * @return void */ public function acceptNamespace($namespaceName); } diff --git a/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php b/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php index 5ec843d9be6..040b59f5549 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/SchemaDiffVisitor.php @@ -14,26 +14,37 @@ interface SchemaDiffVisitor { /** * Visit an orphaned foreign key whose table was deleted. + * + * @return void */ public function visitOrphanedForeignKey(ForeignKeyConstraint $foreignKey); /** * Visit a sequence that has changed. + * + * @return void */ public function visitChangedSequence(Sequence $sequence); /** * Visit a sequence that has been removed. + * + * @return void */ public function visitRemovedSequence(Sequence $sequence); + /** @return void */ public function visitNewSequence(Sequence $sequence); + /** @return void */ public function visitNewTable(Table $table); + /** @return void */ public function visitNewTableForeignKey(Table $table, ForeignKeyConstraint $foreignKey); + /** @return void */ public function visitRemovedTable(Table $table); + /** @return void */ public function visitChangedTable(TableDiff $tableDiff); } diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php index 0cd2999c97a..c142accfd77 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php @@ -28,9 +28,7 @@ */ class ImportCommand extends Command { - /** - * {@inheritdoc} - */ + /** @return void */ protected function configure() { $this diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php index 2e0c48a815b..6de3345b128 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php @@ -66,9 +66,7 @@ public function setKeywordListClass($name, $class) $this->keywordListClasses[$name] = $class; } - /** - * {@inheritdoc} - */ + /** @return void */ protected function configure() { $this diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php index b479baec2ee..5111a6505db 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php @@ -21,9 +21,7 @@ */ class RunSqlCommand extends Command { - /** - * {@inheritdoc} - */ + /** @return void */ protected function configure() { $this diff --git a/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php b/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php index 520a9af80aa..e028c807c01 100644 --- a/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php +++ b/lib/Doctrine/DBAL/Tools/Console/ConsoleRunner.php @@ -63,6 +63,8 @@ public static function addCommands(Application $cli) /** * Prints the instructions to create a configuration file + * + * @return void */ public static function printCliConfigTemplate() { diff --git a/lib/Doctrine/DBAL/Types/ConversionException.php b/lib/Doctrine/DBAL/Types/ConversionException.php index 87f79a91cdc..7ec6e75f52e 100644 --- a/lib/Doctrine/DBAL/Types/ConversionException.php +++ b/lib/Doctrine/DBAL/Types/ConversionException.php @@ -90,6 +90,9 @@ public static function conversionFailedInvalidType( ), 0, $previous); } + /** + * @return ConversionException + */ public static function conversionFailedSerialization($value, $format, $error) { $actualType = is_object($value) ? get_class($value) : gettype($value); From 2649ae6a3cec71dd77fe9f7d92db305cc95dbd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Tue, 31 Dec 2019 10:38:10 +0100 Subject: [PATCH 41/64] Fix argument type declaration By either defining their types or renaming to match parent class (or interface). --- .../DBAL/Connections/MasterSlaveConnection.php | 4 +++- lib/Doctrine/DBAL/DBALException.php | 2 +- lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php | 6 +++++- lib/Doctrine/DBAL/Driver/PDOConnection.php | 5 ++++- lib/Doctrine/DBAL/Driver/PDOStatement.php | 8 +++++++- lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php | 6 +++++- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 5 ++++- lib/Doctrine/DBAL/Platforms/OraclePlatform.php | 1 + lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php | 5 ++++- lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php | 5 ++++- lib/Doctrine/DBAL/Platforms/SqlitePlatform.php | 13 ++++++++++--- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 1 + lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php | 2 ++ lib/Doctrine/DBAL/Types/ConversionException.php | 4 ++++ 14 files changed, 55 insertions(+), 12 deletions(-) diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index ff310d9196b..1f8ae27ba51 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -120,7 +120,9 @@ public function isConnectedToMaster() } /** - * {@inheritDoc} + * @param string|null $connectionName + * + * @return bool */ public function connect($connectionName = null) { diff --git a/lib/Doctrine/DBAL/DBALException.php b/lib/Doctrine/DBAL/DBALException.php index 4961af2f35f..fe706daffcf 100644 --- a/lib/Doctrine/DBAL/DBALException.php +++ b/lib/Doctrine/DBAL/DBALException.php @@ -157,7 +157,7 @@ public static function driverException(Driver $driver, Throwable $driverEx) /** * @return self */ - private static function wrapException(Driver $driver, Throwable $driverEx, $msg) + private static function wrapException(Driver $driver, Throwable $driverEx, string $msg) { if ($driverEx instanceof DriverException) { return $driverEx; diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php index 17b7cb28a7c..b1edcf4eed3 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php @@ -213,6 +213,8 @@ private function bindTypedParameters() : void $types = $this->types; foreach ($this->_bindedValues as $parameter => $value) { + assert(is_int($parameter)); + if (! isset($types[$parameter - 1])) { $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; } @@ -243,9 +245,11 @@ private function bindTypedParameters() : void /** * Handle $this->_longData after regular query parameters have been bound * + * @param array $streams + * * @throws MysqliException */ - private function sendLongData($streams) : void + private function sendLongData(array $streams) : void { foreach ($streams as $paramNr => $stream) { while (! feof($stream)) { diff --git a/lib/Doctrine/DBAL/Driver/PDOConnection.php b/lib/Doctrine/DBAL/Driver/PDOConnection.php index 336542ea50a..ffd80d7423c 100644 --- a/lib/Doctrine/DBAL/Driver/PDOConnection.php +++ b/lib/Doctrine/DBAL/Driver/PDOConnection.php @@ -53,7 +53,10 @@ public function getServerVersion() } /** - * {@inheritdoc} + * @param string $prepareString + * @param array $driverOptions + * + * @return Statement */ public function prepare($prepareString, $driverOptions = []) { diff --git a/lib/Doctrine/DBAL/Driver/PDOStatement.php b/lib/Doctrine/DBAL/Driver/PDOStatement.php index 6e61d22555a..26f0f2e7819 100644 --- a/lib/Doctrine/DBAL/Driver/PDOStatement.php +++ b/lib/Doctrine/DBAL/Driver/PDOStatement.php @@ -85,7 +85,13 @@ public function bindValue($param, $value, $type = ParameterType::STRING) } /** - * {@inheritdoc} + * @param mixed $column + * @param mixed $variable + * @param int $type + * @param int|null $length + * @param mixed $driverOptions + * + * @return bool */ public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) { diff --git a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php index 983046afcd0..60aef82cebe 100644 --- a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php @@ -335,7 +335,10 @@ public function getListTableColumnsSQL($table, $database = null) } /** - * {@inheritDoc} + * @param string $table + * @param string|null $database + * + * @return string */ public function getListTableForeignKeysSQL($table, $database = null) { @@ -435,6 +438,7 @@ public function getDropIndexSQL($index, $table = null) } /** + * @param string $table * * @return string */ diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index 57c448ce93e..409f6eef86a 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -175,7 +175,10 @@ public function getListViewsSQL($database) } /** - * {@inheritDoc} + * @param string $table + * @param string|null $database + * + * @return string */ public function getListTableForeignKeysSQL($table, $database = null) { diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index 3fa40870140..a4bf28c9670 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -61,6 +61,7 @@ public function getSubstringExpression($value, $position, $length = null) } /** + * @param string $type * * @return string */ diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index a2bdf26219a..6237898e2e8 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -279,7 +279,10 @@ public function getListViewsSQL($database) } /** - * {@inheritDoc} + * @param string $table + * @param string|null $database + * + * @return string */ public function getListTableForeignKeysSQL($table, $database = null) { diff --git a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index a37f7c9394a..6a7130bd674 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -933,7 +933,10 @@ public function getListTableColumnsSQL($table, $database = null) } /** - * {@inheritDoc} + * @param string $table + * @param string|null $database + * + * @return string */ public function getListTableForeignKeysSQL($table, $database = null) { diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index d3a7d499faa..57cf47c1d52 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -55,7 +55,9 @@ public function getGuidExpression() } /** - * {@inheritDoc} + * @param string $type + * + * @return string */ public function getNowExpression($type = 'timestamp') { @@ -222,6 +224,7 @@ public function getBigIntTypeDeclarationSQL(array $field) } /** + * @param array $field * * @return string */ @@ -249,6 +252,7 @@ public function getSmallIntTypeDeclarationSQL(array $field) } /** + * @param array $field * * @return string */ @@ -602,7 +606,7 @@ public static function udfLocate($str, $substr, $offset = 0) /** * {@inheritDoc} */ - public function getForUpdateSql() + public function getForUpdateSQL() { return ''; } @@ -812,7 +816,10 @@ public function getCreateTableSQL(Table $table, $createFlags = null) } /** - * {@inheritDoc} + * @param string $table + * @param string|null $database + * + * @return string */ public function getListTableForeignKeysSQL($table, $database = null) { diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index 6b2d63b64bb..426fa665881 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -178,6 +178,7 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) } /** + * @param string $def * * @return string|null */ diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index 6af35e9c206..68e1e1f8487 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -225,6 +225,8 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null /** * @deprecated * + * @param array $tableIndex + * * @return array */ protected function _getPortableTableIndexDefinition($tableIndex) diff --git a/lib/Doctrine/DBAL/Types/ConversionException.php b/lib/Doctrine/DBAL/Types/ConversionException.php index 7ec6e75f52e..82c6df912b7 100644 --- a/lib/Doctrine/DBAL/Types/ConversionException.php +++ b/lib/Doctrine/DBAL/Types/ConversionException.php @@ -91,6 +91,10 @@ public static function conversionFailedInvalidType( } /** + * @param mixed $value + * @param string $format + * @param string $error + * * @return ConversionException */ public static function conversionFailedSerialization($value, $format, $error) From d267775e918b2edf8aa533b45032ad20d6b5bff2 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:24:50 -0700 Subject: [PATCH 42/64] Do not ignore the result of array_change_key_case() --- lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php index 19f2b3fd335..9e374856078 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php @@ -49,9 +49,8 @@ public function postConnect(ConnectionEventArgs $args) return; } - array_change_key_case($this->_defaultSessionVars, CASE_UPPER); $vars = []; - foreach ($this->_defaultSessionVars as $option => $value) { + foreach (array_change_key_case($this->_defaultSessionVars, CASE_UPPER) as $option => $value) { if ($option === 'CURRENT_SCHEMA') { $vars[] = $option . ' = ' . $value; } else { From e6bfcaddf815cf21e00b64270df6c934a3c6e3f3 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:25:59 -0700 Subject: [PATCH 43/64] Assert that the value fetched from the database is always an integer --- lib/Doctrine/DBAL/Id/TableGenerator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Doctrine/DBAL/Id/TableGenerator.php b/lib/Doctrine/DBAL/Id/TableGenerator.php index cb34dcd5c4b..62ad0d35c48 100644 --- a/lib/Doctrine/DBAL/Id/TableGenerator.php +++ b/lib/Doctrine/DBAL/Id/TableGenerator.php @@ -10,6 +10,8 @@ use Throwable; use const CASE_LOWER; use function array_change_key_case; +use function assert; +use function is_int; /** * Table ID Generator for those poor languages that are missing sequences. @@ -111,6 +113,8 @@ public function nextValue($sequenceName) $value = $row['sequence_value']; $value++; + assert(is_int($value)); + if ($row['sequence_increment_by'] > 1) { $this->sequences[$sequenceName] = [ 'value' => $value, From e5068b42f12bf07e96f34fc9b8a921cb3db6c210 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:26:21 -0700 Subject: [PATCH 44/64] Removed redundant break statements --- lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index 6e3b2fcb958..6e99f093294 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -628,15 +628,12 @@ public function getForeignKeyMatchClauseSQL($type) case self::FOREIGN_KEY_MATCH_SIMPLE: return 'SIMPLE'; - break; case self::FOREIGN_KEY_MATCH_FULL: return 'FULL'; - break; case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE: return 'UNIQUE SIMPLE'; - break; case self::FOREIGN_KEY_MATCH_FULL_UNIQUE: return 'UNIQUE FULL'; default: From 4650d9c3d4a2ed61ea48f65ae48ded04f23a2503 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:26:52 -0700 Subject: [PATCH 45/64] AbstractPlatform::_getTransactionIsolationLevelSQL() must return a string --- lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php | 8 ++++---- lib/Doctrine/DBAL/Platforms/SqlitePlatform.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index 6e99f093294..21850d2ba45 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -1293,13 +1293,13 @@ protected function _getTransactionIsolationLevelSQL($level) { switch ($level) { case TransactionIsolationLevel::READ_UNCOMMITTED: - return 0; + return '0'; case TransactionIsolationLevel::READ_COMMITTED: - return 1; + return '1'; case TransactionIsolationLevel::REPEATABLE_READ: - return 2; + return '2'; case TransactionIsolationLevel::SERIALIZABLE: - return 3; + return '3'; default: throw new InvalidArgumentException('Invalid isolation level:' . $level); } diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index 57cf47c1d52..b0e3713ab27 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -168,11 +168,11 @@ protected function _getTransactionIsolationLevelSQL($level) { switch ($level) { case TransactionIsolationLevel::READ_UNCOMMITTED: - return 0; + return '0'; case TransactionIsolationLevel::READ_COMMITTED: case TransactionIsolationLevel::REPEATABLE_READ: case TransactionIsolationLevel::SERIALIZABLE: - return 1; + return '1'; default: return parent::_getTransactionIsolationLevelSQL($level); } From c9ec61835188f4f5ba6976548ccb722c3b530b50 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:28:09 -0700 Subject: [PATCH 46/64] Make sure that the options row was fetched successfully --- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 5 ++++- lib/Doctrine/DBAL/Schema/OracleSchemaManager.php | 5 ++++- lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index 426fa665881..ae2af864f97 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -222,7 +222,10 @@ public function listTableDetails($tableName) : Table $sql = $platform->getListTableCommentsSQL($tableName); $tableOptions = $this->_conn->fetchAssoc($sql); - $table->addOption('comment', $tableOptions['REMARKS']); + + if ($tableOptions !== false) { + $table->addOption('comment', $tableOptions['REMARKS']); + } return $table; } diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index afe610ddbc4..9718f932ef5 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -399,7 +399,10 @@ public function listTableDetails($tableName) : Table $sql = $platform->getListTableCommentsSQL($tableName); $tableOptions = $this->_conn->fetchAssoc($sql); - $table->addOption('comment', $tableOptions['COMMENTS']); + + if ($tableOptions !== false) { + $table->addOption('comment', $tableOptions['COMMENTS']); + } return $table; } diff --git a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php index e9608e7c193..ffc7c87d453 100644 --- a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php @@ -500,7 +500,9 @@ public function listTableDetails($tableName) : Table $tableOptions = $this->_conn->fetchAssoc($sql); - $table->addOption('comment', $tableOptions['table_comment']); + if ($tableOptions !== false) { + $table->addOption('comment', $tableOptions['table_comment']); + } return $table; } From e247a10388d32df093340d717a0d4920feffb29c Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:30:40 -0700 Subject: [PATCH 47/64] ForeignKeyConstraint::onEvent() must return null as an empty action --- lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php index 270f3dda312..3611b77dccd 100644 --- a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php +++ b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php @@ -365,7 +365,7 @@ private function onEvent($event) } } - return false; + return null; } /** From a56eeee8a96ed34c1effcbe5f2263aa471a54909 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 15:32:33 -0700 Subject: [PATCH 48/64] Use strings to work with ini_get() and ini_set() Additionally, set the new value and get the old one in one ini_set() call. --- lib/Doctrine/DBAL/Tools/Dumper.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/DBAL/Tools/Dumper.php b/lib/Doctrine/DBAL/Tools/Dumper.php index 3668efbe4d1..8cb8f4b8689 100644 --- a/lib/Doctrine/DBAL/Tools/Dumper.php +++ b/lib/Doctrine/DBAL/Tools/Dumper.php @@ -17,7 +17,6 @@ use function extension_loaded; use function get_class; use function html_entity_decode; -use function ini_get; use function ini_set; use function is_array; use function is_object; @@ -55,14 +54,11 @@ private function __construct() */ public static function dump($var, int $maxDepth = 2) : string { - $html = ini_get('html_errors'); - - if ($html !== true) { - ini_set('html_errors', true); - } + $html = ini_set('html_errors', '1'); + assert(is_string($html)); if (extension_loaded('xdebug')) { - ini_set('xdebug.var_display_max_depth', $maxDepth); + ini_set('xdebug.var_display_max_depth', (string) $maxDepth); } $var = self::export($var, $maxDepth); From 0d36ac828ba156dcb162784d46b1994b04f86e77 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 29 Mar 2020 11:35:13 -0700 Subject: [PATCH 49/64] Disabled some options and whitelisted false-positives --- phpstan.neon.dist | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f60bf2d4ff5..85bc4ce351c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,6 +5,8 @@ parameters: autoload_files: - %currentWorkingDirectory%/tests/phpstan-polyfill.php reportUnmatchedIgnoredErrors: false + checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false ignoreErrors: # extension not available - '~^(Used )?(Function|Constant) sasql_\S+ not found\.\z~i' @@ -23,7 +25,6 @@ parameters: - '~^Property Doctrine\\DBAL\\Schema\\Schema::\$_schemaConfig \(Doctrine\\DBAL\\Schema\\SchemaConfig\) does not accept default value of type false\.\z~' - '~^Method Doctrine\\DBAL\\Schema\\ForeignKeyConstraint::onEvent\(\) should return string\|null but returns false\.\z~' - '~^Method Doctrine\\DBAL\\Schema\\(Oracle|PostgreSql|SQLServer)SchemaManager::_getPortableTableDefinition\(\) should return array but returns string\.\z~' - - '~^Method Doctrine\\DBAL\\Platforms\\(|SQLAnywhere|Sqlite)Platform::_getTransactionIsolationLevelSQL\(\) should return string but returns int\.\z~' - '~^Method Doctrine\\DBAL\\Driver\\OCI8\\OCI8Connection::lastInsertId\(\) should return string but returns (int|false)\.\z~' - '~^Method Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvConnection::errorCode\(\) should return string\|null but returns false\.\z~' @@ -31,11 +32,11 @@ parameters: - '~^Call to an undefined method Doctrine\\DBAL\\Driver\\PDOConnection::sqliteCreateFunction\(\)\.\z~' # https://github.com/phpstan/phpstan/issues/1847 - - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::unknownAlias\(\) expects array, array given\.\z~' - - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array, array given\.\z~' + - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::unknownAlias\(\) expects array, array given\.\z~' + - '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array, array given\.\z~' # PHPStan is too strict about preg_replace(): https://phpstan.org/r/993dc99f-0d43-4b51-868b-d01f982c1463 - - '~^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform::escapeStringForLike\(\) should return string but returns string|null\.\z~' + - '~^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform::escapeStringForLike\(\) should return string but returns string\|null\.\z~' # legacy variadic-like signature - '~^Method Doctrine\\DBAL(\\.*)?Connection::query\(\) invoked with \d+ parameters?, 0 required\.\z~' @@ -55,3 +56,19 @@ parameters: # weird class name, represented in stubs as OCI_(Lob|Collection) - '~unknown class OCI-(Lob|Collection)~' + + # https://github.com/JetBrains/phpstorm-stubs/pull/766 + - '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement::_fetch\(\) never returns null so it can be removed from the return typehint\.$~' + + # The ReflectionException in the case when the class does not exist is acceptable and does not need to be handled + - '~^Parameter #1 \$argument of class ReflectionClass constructor expects class-string\|T of object, string given\.$~' + + # https://github.com/phpstan/phpstan/issues/3132 + - + message: '~^Call to function in_array\(\) with arguments Doctrine\\DBAL\\Schema\\Column, array and true will always evaluate to false\.$~' + path: %currentWorkingDirectory%/lib/Doctrine/DBAL/Schema/Table.php + + # https://github.com/phpstan/phpstan/issues/3133 + - + message: '~^Cannot cast array\|bool\|string\|null to int\.$~' + path: %currentWorkingDirectory%/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php From a5a09a102eb605fd0228361c0f2f4d7de1bf1dfb Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Thu, 9 Apr 2020 23:59:10 -0700 Subject: [PATCH 50/64] Fix parsing column comments on SQLite --- lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php | 2 +- .../Functional/Schema/SqliteSchemaManagerTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index 68e1e1f8487..3de11178c9c 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -496,7 +496,7 @@ private function parseTableCommentFromSQL(string $table, string $sql) : ?string private function parseColumnCommentFromSQL(string $column, string $sql) : ?string { $pattern = '{[\s(,](?:\W' . preg_quote($this->_platform->quoteSingleIdentifier($column)) . '\W|\W' . preg_quote($column) - . '\W)(?:\(.*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}i'; + . '\W)(?:\([^)]*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}i'; if (preg_match($pattern, $sql, $match) !== 1) { return null; diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index cce8f92f72d..166b0d08d5b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -278,4 +278,19 @@ public function testPrimaryKeyNoAutoIncrement() : void // with an empty table, non autoincrement rowid is always 1 $this->assertEquals(1, $lastUsedIdAfterDelete); } + + public function testOnlyOwnCommentIsParsed() : void + { + $table = new Table('own_column_comment'); + $table->addColumn('col1', 'string', ['length' => 16]); + $table->addColumn('col2', 'string', ['length' => 16, 'comment' => 'Column #2']); + $table->addColumn('col3', 'string', ['length' => 16]); + + $sm = $this->connection->getSchemaManager(); + $sm->createTable($table); + + $this->assertNull($sm->listTableDetails('own_column_comment') + ->getColumn('col1') + ->getComment()); + } } From 2293b4526f32735773d6cb8ed36bfe6ea7e29a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 14 Apr 2020 19:20:36 +0200 Subject: [PATCH 51/64] Install dependencies compatible with 7.2 This should make it easier to work with Composer from machines using different versions of PHP than the lowest one we use in the CI. --- composer.json | 5 +++- composer.lock | 67 +++++++++++++++++++++------------------------------ 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/composer.json b/composer.json index 52eaf21f5bc..8876177940a 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,10 @@ }, "bin": ["bin/doctrine-dbal"], "config": { - "sort-packages": true + "sort-packages": true, + "platform": { + "php": "7.2.0" + } }, "autoload": { "psr-4": { "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" } diff --git a/composer.lock b/composer.lock index e66402ad6c9..2db08ab5931 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c5e7640a7c04d2174aa72c365cf067eb", + "content-hash": "c7626e822b555a1ba84abd995ff763e2", "packages": [ { "name": "doctrine/cache", @@ -877,20 +877,6 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], "time": "2020-03-22T16:51:47+00:00" }, { @@ -2032,41 +2018,41 @@ }, { "name": "symfony/console", - "version": "v5.0.2", + "version": "v4.4.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" + "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", + "url": "https://api.github.com/repos/symfony/console/zipball/10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", + "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", "symfony/service-contracts": "^1.1|^2" }, "conflict": { - "symfony/dependency-injection": "<4.4", - "symfony/event-dispatcher": "<4.4", + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/process": "<3.3" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2077,7 +2063,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -2104,7 +2090,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T13:20:22+00:00" + "time": "2020-03-30T11:41:10+00:00" }, { "name": "symfony/debug", @@ -2339,20 +2325,20 @@ }, { "name": "symfony/service-contracts", - "version": "v2.0.1", + "version": "v1.1.8", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": "^7.1.3", "psr/container": "^1.0" }, "suggest": { @@ -2361,7 +2347,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -2393,7 +2379,7 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "time": "2019-10-14T12:27:06+00:00" }, { "name": "theseer/tokenizer", @@ -2428,8 +2414,8 @@ "authors": [ { "name": "Arne Blankerts", - "role": "Developer", - "email": "arne@blankerts.de" + "email": "arne@blankerts.de", + "role": "Developer" } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", @@ -2496,5 +2482,8 @@ "ext-pdo": "*" }, "platform-dev": [], + "platform-overrides": { + "php": "7.2.0" + }, "plugin-api-version": "1.1.0" } From bee2a5a5488ab32aeb4a92ccae1dcae4b882735b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 14 Apr 2020 18:50:16 +0200 Subject: [PATCH 52/64] Setup static analysis with Psalm --- .github/workflows/continuous-integration.yml | 16 + baseline.xml | 216 ++++++ composer.json | 3 +- composer.lock | 680 ++++++++++++++++++- psalm.xml | 25 + 5 files changed, 938 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml create mode 100644 baseline.xml create mode 100644 psalm.xml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 00000000000..e9c863cb838 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,16 @@ + +name: "Continuous Integration" + +on: + pull_request: + +jobs: + static-analysis-psalm: + name: Static Analysis with Psalm + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Psalm + uses: docker://vimeo/psalm-github-actions diff --git a/baseline.xml b/baseline.xml new file mode 100644 index 00000000000..a75903a9716 --- /dev/null +++ b/baseline.xml @@ -0,0 +1,216 @@ + + + + + int + + + + + public function getMessage(); + + + + + PDO::SQLSRV_ENCODING_BINARY + + + + + sasql_pconnect($dsn) + sasql_connect($dsn) + sasql_set_option($this->connection, 'verbose_errors', false) + sasql_set_option($this->connection, 'auto_commit', 'on') + sasql_set_option($this->connection, 'auto_commit', 'off') + sasql_commit($this->connection) + sasql_errorcode($this->connection) + sasql_error($this->connection) + sasql_real_query($this->connection, $statement) + sasql_affected_rows($this->connection) + sasql_insert_id($this->connection) + sasql_escape_string($this->connection, $input) + sasql_rollback($this->connection) + sasql_set_option($this->connection, 'auto_commit', 'on') + + + + + sasql_sqlstate($conn) + sasql_sqlstate() + sasql_stmt_errno($stmt) + sasql_stmt_error($stmt) + sasql_errorcode($conn) + sasql_error($conn) + sasql_errorcode() + sasql_error() + + + + + SASQL_BOTH + + + sasql_prepare($conn, $sql) + sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null) + sasql_stmt_reset($this->stmt) + sasql_stmt_field_count($this->stmt) + sasql_stmt_errno($this->stmt) + sasql_stmt_error($this->stmt) + sasql_stmt_execute($this->stmt) + sasql_stmt_result_metadata($this->stmt) + sasql_fetch_assoc($this->result) + sasql_fetch_array($this->result, SASQL_BOTH) + sasql_fetch_object($this->result) + sasql_fetch_row($this->result) + sasql_fetch_object($this->result) + sasql_stmt_affected_rows($this->stmt) + + + + + sqlsrv_get_field($this->stmt, 0) + + + + + int + + + + + string + + + + + Collection + + + + + PDO::PGSQL_ATTR_DISABLE_PREPARES + PDO::PGSQL_ATTR_DISABLE_PREPARES + PDO::PGSQL_ATTR_DISABLE_PREPARES + PDO::PGSQL_ATTR_DISABLE_PREPARES + PDO::PGSQL_ATTR_DISABLE_PREPARES + + + + + MySqlPlatform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + $this->platform + + + + + $this->platform + $this->platform + $this->platform + $this->platform + + + + + $this->platform + $this->platform + $this->platform + $this->platform + + + + + $this->platform + + + diff --git a/composer.json b/composer.json index 8876177940a..fd88e428cf2 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "jetbrains/phpstorm-stubs": "^2019.1", "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^8.4.1", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0" + "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", + "vimeo/psalm": "^3.11" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." diff --git a/composer.lock b/composer.lock index 2db08ab5931..4dda16ace6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c7626e822b555a1ba84abd995ff763e2", + "content-hash": "a0ee337c9500698eeb5d25f1e4a84b69", "packages": [ { "name": "doctrine/cache", @@ -156,6 +156,260 @@ } ], "packages-dev": [ + { + "name": "amphp/amp", + "version": "v2.4.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "feca077369a47263b22156b3c6389e55f3809f24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/feca077369a47263b22156b3c6389e55f3809f24", + "reference": "feca077369a47263b22156b3c6389e55f3809f24", + "shasum": "" + }, + "require": { + "php": ">=7" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6.0.9 | ^7", + "react/promise": "^2", + "vimeo/psalm": "^3.9@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\": "lib" + }, + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "http://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "time": "2020-04-04T15:05:26+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.7.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/b867505edb79dda8f253ca3c3a2bbadae4b16592", + "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592", + "shasum": "" + }, + "require": { + "amphp/amp": "^2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "vimeo/psalm": "^3.9@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\ByteStream\\": "lib" + }, + "files": [ + "lib/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "time": "2020-04-04T16:56:54+00:00" + }, + { + "name": "composer/semver", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2020-01-13T12:06:48+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + } + ], + "time": "2020-03-01T12:26:26+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.5.0", @@ -339,6 +593,94 @@ ], "time": "2019-03-17T17:37:11+00:00" }, + { + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^1.0 || ^2.0", + "php": ">=7.0", + "phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "time": "2020-03-11T15:21:41+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/378801f6139bb74ac215d81cca1272af61df9a9f", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpstan/phpstan": "*", + "phpunit/phpunit": "^6.3", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "time": "2019-06-23T21:03:50+00:00" + }, { "name": "jetbrains/phpstorm-stubs", "version": "v2019.1", @@ -426,6 +768,52 @@ ], "time": "2019-08-09T12:45:53+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e245890383c3ed38b6d202ee373c23ccfebc0f54", + "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "time": "2020-03-04T17:23:33+00:00" + }, { "name": "nikic/php-parser", "version": "v4.3.0", @@ -478,6 +866,105 @@ ], "time": "2019-11-08T13:50:10+00:00" }, + { + "name": "ocramius/package-versions", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2019-11-15T16:17:10+00:00" + }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "time": "2019-03-29T20:06:56+00:00" + }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -2421,6 +2908,104 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "time": "2019-06-13T22:48:21+00:00" }, + { + "name": "vimeo/psalm", + "version": "3.11.2", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d470903722cfcbc1cd04744c5491d3e6d13ec3d9", + "reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.1", + "amphp/byte-stream": "^1.5", + "composer/semver": "^1.4", + "composer/xdebug-handler": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.4", + "netresearch/jsonmapper": "^1.0 || ^2.0", + "nikic/php-parser": "^4.3", + "ocramius/package-versions": "^1.2", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1.3|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "webmozart/glob": "^4.1", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "amphp/amp": "^2.4.2", + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0.0", + "ext-curl": "*", + "php-coveralls/php-coveralls": "^2.2", + "phpmyadmin/sql-parser": "5.1.0", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", + "psalm/plugin-phpunit": "^0.10", + "slevomat/coding-standard": "^5.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3" + }, + "suggest": { + "ext-igbinary": "^2.0.5" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psalm\\Plugin\\": "src/Psalm/Plugin", + "Psalm\\": "src/Psalm" + }, + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "time": "2020-04-13T12:47:11+00:00" + }, { "name": "webmozart/assert", "version": "1.5.0", @@ -2470,6 +3055,99 @@ "validate" ], "time": "2019-08-24T08:43:50+00:00" + }, + { + "name": "webmozart/glob", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/glob.git", + "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/glob/zipball/3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", + "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0", + "webmozart/path-util": "^2.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1", + "symfony/filesystem": "^2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Glob\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A PHP implementation of Ant's glob.", + "time": "2015-12-29T11:14:33+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000000..2b9fdb0d21b --- /dev/null +++ b/psalm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + From b222367582031a882479cddf4402656ce5cf4593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 18:45:48 +0200 Subject: [PATCH 53/64] Upgrade nikic/php-parser For some reason a low version crashes Psalm. --- composer.json | 1 + composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index fd88e428cf2..f17794bcec0 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "require-dev": { "doctrine/coding-standard": "^6.0", "jetbrains/phpstorm-stubs": "^2019.1", + "nikic/php-parser": "^4.4", "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^8.4.1", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", diff --git a/composer.lock b/composer.lock index 4dda16ace6b..215798b08a1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a0ee337c9500698eeb5d25f1e4a84b69", + "content-hash": "b7f970513c9756e5eaaba3974429c23c", "packages": [ { "name": "doctrine/cache", @@ -816,16 +816,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.3.0", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" + "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", + "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", "shasum": "" }, "require": { @@ -864,7 +864,7 @@ "parser", "php" ], - "time": "2019-11-08T13:50:10+00:00" + "time": "2020-04-10T16:34:50+00:00" }, { "name": "ocramius/package-versions", From bcf6a619fb2bcd6b581c6cd2e6f129f75406fe05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 18:37:45 +0200 Subject: [PATCH 54/64] Add missing use statement --- baseline.xml | 118 ------------------ .../AbstractMySQLPlatformTestCase.php | 1 + 2 files changed, 1 insertion(+), 118 deletions(-) diff --git a/baseline.xml b/baseline.xml index a75903a9716..957906892c3 100644 --- a/baseline.xml +++ b/baseline.xml @@ -95,122 +95,4 @@ PDO::PGSQL_ATTR_DISABLE_PREPARES - - - MySqlPlatform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - $this->platform - - - - - $this->platform - $this->platform - $this->platform - $this->platform - - - - - $this->platform - $this->platform - $this->platform - $this->platform - - - - - $this->platform - - diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php index bbae08c5b2c..9bd0ae62f85 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\DBAL\Platforms; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; From 1e17583551b802057c206b9cc3acfcdb8d224678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 19:01:42 +0200 Subject: [PATCH 55/64] Avoid conflict with parent phpdoc --- baseline.xml | 10 ---------- lib/Doctrine/DBAL/Platforms/SqlitePlatform.php | 2 ++ lib/Doctrine/DBAL/Schema/OracleSchemaManager.php | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/baseline.xml b/baseline.xml index 957906892c3..775fb2bdcfa 100644 --- a/baseline.xml +++ b/baseline.xml @@ -71,16 +71,6 @@ sqlsrv_get_field($this->stmt, 0) - - - int - - - - - string - - Collection diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index b0e3713ab27..4eff83e8dcf 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -807,6 +807,8 @@ public function getCreateConstraintSQL(Constraint $constraint, $table) /** * {@inheritDoc} + * + * @param int|null $createFlags */ public function getCreateTableSQL(Table $table, $createFlags = null) { diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index 9718f932ef5..dd10cd0f928 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -287,6 +287,8 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} * + * @param string|null $database + * * Calling this method without an argument or by passing NULL is deprecated. */ public function createDatabase($database = null) From 4cff5bc66d26a23c2131e3c6579788eef737d874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 19:12:43 +0200 Subject: [PATCH 56/64] Add stub file for PDO --- baseline.xml | 5 ----- psalm.xml | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/baseline.xml b/baseline.xml index 775fb2bdcfa..811b273fd05 100644 --- a/baseline.xml +++ b/baseline.xml @@ -10,11 +10,6 @@ public function getMessage(); - - - PDO::SQLSRV_ENCODING_BINARY - - sasql_pconnect($dsn) diff --git a/psalm.xml b/psalm.xml index 2b9fdb0d21b..93f3d2c03c8 100644 --- a/psalm.xml +++ b/psalm.xml @@ -16,6 +16,7 @@ + From 5a61341fea474990fe2c4fb5e27515c053ccf4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 19:27:14 +0200 Subject: [PATCH 57/64] Mark exceptions as immutable --- baseline.xml | 5 ----- lib/Doctrine/DBAL/Driver/AbstractDriverException.php | 2 ++ lib/Doctrine/DBAL/Driver/DriverException.php | 2 ++ lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php | 2 ++ lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php | 3 +++ lib/Doctrine/DBAL/Driver/PDOException.php | 2 ++ .../DBAL/Driver/SQLAnywhere/SQLAnywhereException.php | 2 ++ lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php | 3 +++ 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/baseline.xml b/baseline.xml index 811b273fd05..194eced230f 100644 --- a/baseline.xml +++ b/baseline.xml @@ -5,11 +5,6 @@ int - - - public function getMessage(); - - sasql_pconnect($dsn) diff --git a/lib/Doctrine/DBAL/Driver/AbstractDriverException.php b/lib/Doctrine/DBAL/Driver/AbstractDriverException.php index d9af92d1744..f57de38f09c 100644 --- a/lib/Doctrine/DBAL/Driver/AbstractDriverException.php +++ b/lib/Doctrine/DBAL/Driver/AbstractDriverException.php @@ -6,6 +6,8 @@ /** * Abstract base implementation of the {@link DriverException} interface. + * + * @psalm-immutable */ abstract class AbstractDriverException extends Exception implements DriverException { diff --git a/lib/Doctrine/DBAL/Driver/DriverException.php b/lib/Doctrine/DBAL/Driver/DriverException.php index 79480ac72be..14cd5186e4d 100644 --- a/lib/Doctrine/DBAL/Driver/DriverException.php +++ b/lib/Doctrine/DBAL/Driver/DriverException.php @@ -9,6 +9,8 @@ * * Driver exceptions provide the SQLSTATE of the driver * and the driver specific error code at the time the error occurred. + * + * @psalm-immutable */ interface DriverException extends Throwable { diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php index 1fa0c900fbd..8e8e697c4a3 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php @@ -6,6 +6,8 @@ /** * Exception thrown in case the mysqli driver errors. + * + * @psalm-immutable */ class MysqliException extends AbstractDriverException { diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php index af3a9d1a7a9..42283e08a57 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php @@ -4,6 +4,9 @@ use Doctrine\DBAL\Driver\AbstractDriverException; +/** + * @psalm-immutable + */ class OCI8Exception extends AbstractDriverException { /** diff --git a/lib/Doctrine/DBAL/Driver/PDOException.php b/lib/Doctrine/DBAL/Driver/PDOException.php index 277d7a62500..c2571032b80 100644 --- a/lib/Doctrine/DBAL/Driver/PDOException.php +++ b/lib/Doctrine/DBAL/Driver/PDOException.php @@ -4,6 +4,8 @@ /** * Tiny wrapper for PDOException instances to implement the {@link DriverException} interface. + * + * @psalm-immutable */ class PDOException extends \PDOException implements DriverException { diff --git a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php index 0f8bc3e57e6..022cfe2dfa7 100644 --- a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php +++ b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php @@ -12,6 +12,8 @@ /** * SAP Sybase SQL Anywhere driver exception. + * + * @psalm-immutable */ class SQLAnywhereException extends AbstractDriverException { diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php index 1c1e8c472d7..5618ed73560 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php @@ -7,6 +7,9 @@ use function rtrim; use function sqlsrv_errors; +/** + * @psalm-immutable + */ class SQLSrvException extends AbstractDriverException { /** From 827bd2201a2d0a690cbd8c4f6a22e5163116f921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 20:04:47 +0200 Subject: [PATCH 58/64] Suppress errors about SqlAnywhere symbols --- baseline.xml | 51 --------------------------------------------------- psalm.xml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/baseline.xml b/baseline.xml index 194eced230f..3d5340ab863 100644 --- a/baseline.xml +++ b/baseline.xml @@ -5,57 +5,6 @@ int - - - sasql_pconnect($dsn) - sasql_connect($dsn) - sasql_set_option($this->connection, 'verbose_errors', false) - sasql_set_option($this->connection, 'auto_commit', 'on') - sasql_set_option($this->connection, 'auto_commit', 'off') - sasql_commit($this->connection) - sasql_errorcode($this->connection) - sasql_error($this->connection) - sasql_real_query($this->connection, $statement) - sasql_affected_rows($this->connection) - sasql_insert_id($this->connection) - sasql_escape_string($this->connection, $input) - sasql_rollback($this->connection) - sasql_set_option($this->connection, 'auto_commit', 'on') - - - - - sasql_sqlstate($conn) - sasql_sqlstate() - sasql_stmt_errno($stmt) - sasql_stmt_error($stmt) - sasql_errorcode($conn) - sasql_error($conn) - sasql_errorcode() - sasql_error() - - - - - SASQL_BOTH - - - sasql_prepare($conn, $sql) - sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null) - sasql_stmt_reset($this->stmt) - sasql_stmt_field_count($this->stmt) - sasql_stmt_errno($this->stmt) - sasql_stmt_error($this->stmt) - sasql_stmt_execute($this->stmt) - sasql_stmt_result_metadata($this->stmt) - sasql_fetch_assoc($this->result) - sasql_fetch_array($this->result, SASQL_BOTH) - sasql_fetch_object($this->result) - sasql_fetch_row($this->result) - sasql_fetch_object($this->result) - sasql_stmt_affected_rows($this->stmt) - - sqlsrv_get_field($this->stmt, 0) diff --git a/psalm.xml b/psalm.xml index 93f3d2c03c8..c9e0fdedff3 100644 --- a/psalm.xml +++ b/psalm.xml @@ -23,4 +23,16 @@ + + + + + + + + + + + + From 365b4d7d85c38c10d6cbb07a4c8bfd01c0efd300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 22:59:46 +0200 Subject: [PATCH 59/64] Suppress errors about unreleased stubs --- baseline.xml | 19 ------------------- psalm.xml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/baseline.xml b/baseline.xml index 3d5340ab863..24b901585e4 100644 --- a/baseline.xml +++ b/baseline.xml @@ -5,23 +5,4 @@ int - - - sqlsrv_get_field($this->stmt, 0) - - - - - Collection - - - - - PDO::PGSQL_ATTR_DISABLE_PREPARES - PDO::PGSQL_ATTR_DISABLE_PREPARES - PDO::PGSQL_ATTR_DISABLE_PREPARES - PDO::PGSQL_ATTR_DISABLE_PREPARES - PDO::PGSQL_ATTR_DISABLE_PREPARES - - diff --git a/psalm.xml b/psalm.xml index c9e0fdedff3..ce0f988ac87 100644 --- a/psalm.xml +++ b/psalm.xml @@ -24,9 +24,23 @@ + + + + + + + + @@ -34,5 +48,11 @@ + + + + + + From bbf31dc400d3dde13199caeedaea847d38b9c6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 15 Apr 2020 23:19:00 +0200 Subject: [PATCH 60/64] Use a proper default value null contradicts the phpdoc --- baseline.xml | 8 -------- lib/Doctrine/DBAL/Connection.php | 2 +- psalm.xml | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 baseline.xml diff --git a/baseline.xml b/baseline.xml deleted file mode 100644 index 24b901585e4..00000000000 --- a/baseline.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - int - - - diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index e2d78ae1559..10da0f98f4d 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -823,7 +823,7 @@ public function quoteIdentifier($str) /** * {@inheritDoc} */ - public function quote($input, $type = null) + public function quote($input, $type = ParameterType::STRING) { $connection = $this->getWrappedConnection(); diff --git a/psalm.xml b/psalm.xml index ce0f988ac87..3db108eb2ac 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,7 +6,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - errorBaseline="baseline.xml" > From 59aa258ec20379fa8a4b6607b169d791d8e737c8 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Thu, 16 Apr 2020 20:39:10 -0700 Subject: [PATCH 61/64] Reworked LoggingTest to be able to test Statement::executeUpdate() --- .../Tests/DBAL/Connection/LoggingTest.php | 65 +++++++++++++++++++ .../Tests/DBAL/Functional/LoggingTest.php | 55 ---------------- 2 files changed, 65 insertions(+), 55 deletions(-) create mode 100644 tests/Doctrine/Tests/DBAL/Connection/LoggingTest.php delete mode 100644 tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php diff --git a/tests/Doctrine/Tests/DBAL/Connection/LoggingTest.php b/tests/Doctrine/Tests/DBAL/Connection/LoggingTest.php new file mode 100644 index 00000000000..a7b04f94994 --- /dev/null +++ b/tests/Doctrine/Tests/DBAL/Connection/LoggingTest.php @@ -0,0 +1,65 @@ +createStub(DriverConnection::class); + $driverConnection->method('query') + ->willReturn($this->createStub(Statement::class)); + + $this->createConnection($driverConnection, 'SELECT * FROM table') + ->executeQuery('SELECT * FROM table'); + } + + public function testLogExecuteUpdate() : void + { + $this->createConnection( + $this->createStub(DriverConnection::class), + 'UPDATE table SET foo = ?' + ) + ->executeUpdate('UPDATE table SET foo = ?'); + } + + public function testLogPrepareExecute() : void + { + $driverConnection = $this->createStub(DriverConnection::class); + $driverConnection->method('prepare') + ->willReturn($this->createStub(Statement::class)); + + $this->createConnection($driverConnection, 'UPDATE table SET foo = ?') + ->prepare('UPDATE table SET foo = ?') + ->execute(); + } + + private function createConnection(DriverConnection $driverConnection, string $expectedSQL) : Connection + { + $driver = $this->createStub(Driver::class); + $driver->method('connect') + ->willReturn($driverConnection); + $driver->method('getDatabasePlatform') + ->willReturn($this->createMock(AbstractPlatform::class)); + + $logger = $this->createMock(SQLLogger::class); + $logger->expects($this->once()) + ->method('startQuery') + ->with($this->equalTo($expectedSQL), $this->equalTo([])); + $logger->expects($this->at(1)) + ->method('stopQuery'); + + $connection = new Connection([], $driver); + $connection->getConfiguration()->setSQLLogger($logger); + + return $connection; + } +} diff --git a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php b/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php deleted file mode 100644 index aa63af708df..00000000000 --- a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php +++ /dev/null @@ -1,55 +0,0 @@ -connection->getDatabasePlatform()->getDummySelectSQL(); - - $logMock = $this->createMock(SQLLogger::class); - $logMock->expects($this->at(0)) - ->method('startQuery') - ->with($this->equalTo($sql), $this->equalTo([]), $this->equalTo([])); - $logMock->expects($this->at(1)) - ->method('stopQuery'); - $this->connection->getConfiguration()->setSQLLogger($logMock); - $this->connection->executeQuery($sql, []); - } - - public function testLogExecuteUpdate() : void - { - $this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).'); - - $sql = $this->connection->getDatabasePlatform()->getDummySelectSQL(); - - $logMock = $this->createMock(SQLLogger::class); - $logMock->expects($this->at(0)) - ->method('startQuery') - ->with($this->equalTo($sql), $this->equalTo([]), $this->equalTo([])); - $logMock->expects($this->at(1)) - ->method('stopQuery'); - $this->connection->getConfiguration()->setSQLLogger($logMock); - $this->connection->executeUpdate($sql, []); - } - - public function testLogPrepareExecute() : void - { - $sql = $this->connection->getDatabasePlatform()->getDummySelectSQL(); - - $logMock = $this->createMock(SQLLogger::class); - $logMock->expects($this->once()) - ->method('startQuery') - ->with($this->equalTo($sql), $this->equalTo([])); - $logMock->expects($this->at(1)) - ->method('stopQuery'); - $this->connection->getConfiguration()->setSQLLogger($logMock); - - $stmt = $this->connection->prepare($sql); - $stmt->execute(); - } -} From 9474267363018d9c49b5721e4b5a969ebbd77c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 18 Apr 2020 08:29:39 +0200 Subject: [PATCH 62/64] Stop relying on the master version of Psalm I just got bitten by a bug on master at https://github.com/doctrine/sql-formatter/pull/43#issuecomment-615576443, and there are good chances we have the bug on the Dbal too. Anyway, it only makes sense to use the same version as in the vendors. --- .github/workflows/continuous-integration.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e9c863cb838..a211af1b3fb 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -8,9 +8,26 @@ jobs: static-analysis-psalm: name: Static Analysis with Psalm runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v2 + - name: "Install PHP" + uses: "shivammathur/setup-php@1.8.1" + with: + coverage: "none" + php-version: "7.4" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v1.0.3" + with: + path: "~/.composer/cache" + key: "composer-${{ hashFiles('composer.json') }}" + restore-keys: "composer-" + + - name: "Install dependencies with composer" + run: "composer update --no-interaction --no-progress --no-suggest" + - name: Psalm - uses: docker://vimeo/psalm-github-actions + run: "vendor/bin/psalm" From fedac50334c7a0d7006fd621124c1b466b96ba78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 18 Apr 2020 18:56:05 +0200 Subject: [PATCH 63/64] Mark every exception as immutable --- lib/Doctrine/DBAL/Cache/CacheException.php | 3 +++ lib/Doctrine/DBAL/ConnectionException.php | 3 +++ lib/Doctrine/DBAL/DBALException.php | 3 +++ lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php | 3 +++ lib/Doctrine/DBAL/Exception/ConnectionException.php | 2 ++ lib/Doctrine/DBAL/Exception/ConstraintViolationException.php | 2 ++ lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php | 2 ++ .../DBAL/Exception/DatabaseObjectNotFoundException.php | 2 ++ lib/Doctrine/DBAL/Exception/DeadlockException.php | 2 ++ lib/Doctrine/DBAL/Exception/DriverException.php | 2 ++ .../DBAL/Exception/ForeignKeyConstraintViolationException.php | 2 ++ lib/Doctrine/DBAL/Exception/InvalidArgumentException.php | 2 ++ lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php | 2 ++ lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php | 2 ++ lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php | 2 ++ .../DBAL/Exception/NotNullConstraintViolationException.php | 2 ++ lib/Doctrine/DBAL/Exception/ReadOnlyException.php | 2 ++ lib/Doctrine/DBAL/Exception/ServerException.php | 2 ++ lib/Doctrine/DBAL/Exception/SyntaxErrorException.php | 2 ++ lib/Doctrine/DBAL/Exception/TableExistsException.php | 2 ++ lib/Doctrine/DBAL/Exception/TableNotFoundException.php | 2 ++ .../DBAL/Exception/UniqueConstraintViolationException.php | 2 ++ lib/Doctrine/DBAL/Query/QueryException.php | 3 +++ lib/Doctrine/DBAL/SQLParserUtilsException.php | 2 ++ lib/Doctrine/DBAL/Schema/SchemaException.php | 3 +++ lib/Doctrine/DBAL/Sharding/ShardingException.php | 2 ++ lib/Doctrine/DBAL/Types/ConversionException.php | 2 ++ 27 files changed, 60 insertions(+) diff --git a/lib/Doctrine/DBAL/Cache/CacheException.php b/lib/Doctrine/DBAL/Cache/CacheException.php index 636c948a616..6bb5d1b5f6b 100644 --- a/lib/Doctrine/DBAL/Cache/CacheException.php +++ b/lib/Doctrine/DBAL/Cache/CacheException.php @@ -4,6 +4,9 @@ use Doctrine\DBAL\DBALException; +/** + * @psalm-immutable + */ class CacheException extends DBALException { /** diff --git a/lib/Doctrine/DBAL/ConnectionException.php b/lib/Doctrine/DBAL/ConnectionException.php index d3d11bc6743..47c6ed9a0d4 100644 --- a/lib/Doctrine/DBAL/ConnectionException.php +++ b/lib/Doctrine/DBAL/ConnectionException.php @@ -2,6 +2,9 @@ namespace Doctrine\DBAL; +/** + * @psalm-immutable + */ class ConnectionException extends DBALException { /** diff --git a/lib/Doctrine/DBAL/DBALException.php b/lib/Doctrine/DBAL/DBALException.php index fe706daffcf..b2852e55182 100644 --- a/lib/Doctrine/DBAL/DBALException.php +++ b/lib/Doctrine/DBAL/DBALException.php @@ -22,6 +22,9 @@ use function spl_object_hash; use function sprintf; +/** + * @psalm-immutable + */ class DBALException extends Exception { /** diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php index b01c4552a23..662d8533a8e 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php @@ -4,6 +4,9 @@ use Exception; +/** + * @psalm-immutable + */ class DB2Exception extends Exception { } diff --git a/lib/Doctrine/DBAL/Exception/ConnectionException.php b/lib/Doctrine/DBAL/Exception/ConnectionException.php index e96a29191e4..6b7c901a345 100644 --- a/lib/Doctrine/DBAL/Exception/ConnectionException.php +++ b/lib/Doctrine/DBAL/Exception/ConnectionException.php @@ -4,6 +4,8 @@ /** * Base class for all connection related errors detected in the driver. + * + * @psalm-immutable */ class ConnectionException extends DriverException { diff --git a/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php b/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php index 3959f39af95..435e8b19f16 100644 --- a/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php +++ b/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php @@ -4,6 +4,8 @@ /** * Base class for all constraint violation related errors detected in the driver. + * + * @psalm-immutable */ class ConstraintViolationException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php b/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php index 7e0ba0299e9..fb19f5baed5 100644 --- a/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php +++ b/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php @@ -8,6 +8,8 @@ * A database object is considered any asset that can be created in a database * such as schemas, tables, views, sequences, triggers, constraints, indexes, * functions, stored procedures etc. + * + * @psalm-immutable */ class DatabaseObjectExistsException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php b/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php index 3342bce8d58..2d3d78d9930 100644 --- a/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php +++ b/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php @@ -8,6 +8,8 @@ * A database object is considered any asset that can be created in a database * such as schemas, tables, views, sequences, triggers, constraints, indexes, * functions, stored procedures etc. + * + * @psalm-immutable */ class DatabaseObjectNotFoundException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/DeadlockException.php b/lib/Doctrine/DBAL/Exception/DeadlockException.php index fd0550a56b0..f36be908a4a 100644 --- a/lib/Doctrine/DBAL/Exception/DeadlockException.php +++ b/lib/Doctrine/DBAL/Exception/DeadlockException.php @@ -4,6 +4,8 @@ /** * Exception for a deadlock error of a transaction detected in the driver. + * + * @psalm-immutable */ class DeadlockException extends ServerException implements RetryableException { diff --git a/lib/Doctrine/DBAL/Exception/DriverException.php b/lib/Doctrine/DBAL/Exception/DriverException.php index d3753329882..2a3338733db 100644 --- a/lib/Doctrine/DBAL/Exception/DriverException.php +++ b/lib/Doctrine/DBAL/Exception/DriverException.php @@ -7,6 +7,8 @@ /** * Base class for all errors detected in the driver. + * + * @psalm-immutable */ class DriverException extends DBALException { diff --git a/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php b/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php index 48d736f9e28..f1a612b2184 100644 --- a/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php +++ b/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php @@ -4,6 +4,8 @@ /** * Exception for a foreign key constraint violation detected in the driver. + * + * @psalm-immutable */ class ForeignKeyConstraintViolationException extends ConstraintViolationException { diff --git a/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php b/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php index 5d431e6031d..5d20332af09 100644 --- a/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php +++ b/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php @@ -6,6 +6,8 @@ /** * Exception to be thrown when invalid arguments are passed to any DBAL API + * + * @psalm-immutable */ class InvalidArgumentException extends DBALException { diff --git a/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php b/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php index d960feaf869..234941bf64a 100644 --- a/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php +++ b/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php @@ -4,6 +4,8 @@ /** * Exception for an invalid specified field name in a statement detected in the driver. + * + * @psalm-immutable */ class InvalidFieldNameException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php b/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php index bfc3a498a3c..62aa10fca87 100644 --- a/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php +++ b/lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php @@ -4,6 +4,8 @@ /** * Exception for a lock wait timeout error of a transaction detected in the driver. + * + * @psalm-immutable */ class LockWaitTimeoutException extends ServerException implements RetryableException { diff --git a/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php b/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php index fd56f89691f..9ff66273395 100644 --- a/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php +++ b/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php @@ -4,6 +4,8 @@ /** * Exception for a non-unique/ambiguous specified field name in a statement detected in the driver. + * + * @psalm-immutable */ class NonUniqueFieldNameException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php b/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php index e327bc94d4d..113b737bb22 100644 --- a/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php +++ b/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php @@ -4,6 +4,8 @@ /** * Exception for a NOT NULL constraint violation detected in the driver. + * + * @psalm-immutable */ class NotNullConstraintViolationException extends ConstraintViolationException { diff --git a/lib/Doctrine/DBAL/Exception/ReadOnlyException.php b/lib/Doctrine/DBAL/Exception/ReadOnlyException.php index a846f2501c8..621363af9b8 100644 --- a/lib/Doctrine/DBAL/Exception/ReadOnlyException.php +++ b/lib/Doctrine/DBAL/Exception/ReadOnlyException.php @@ -4,6 +4,8 @@ /** * Exception for a write operation attempt on a read-only database element detected in the driver. + * + * @psalm-immutable */ class ReadOnlyException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/ServerException.php b/lib/Doctrine/DBAL/Exception/ServerException.php index c88c3863b62..194bc9cdd34 100644 --- a/lib/Doctrine/DBAL/Exception/ServerException.php +++ b/lib/Doctrine/DBAL/Exception/ServerException.php @@ -4,6 +4,8 @@ /** * Base class for all server related errors detected in the driver. + * + * @psalm-immutable */ class ServerException extends DriverException { diff --git a/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php b/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php index 0b413b71971..2603ac27435 100644 --- a/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php +++ b/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php @@ -4,6 +4,8 @@ /** * Exception for a syntax error in a statement detected in the driver. + * + * @psalm-immutable */ class SyntaxErrorException extends ServerException { diff --git a/lib/Doctrine/DBAL/Exception/TableExistsException.php b/lib/Doctrine/DBAL/Exception/TableExistsException.php index ff0df89afac..b6575a25d00 100644 --- a/lib/Doctrine/DBAL/Exception/TableExistsException.php +++ b/lib/Doctrine/DBAL/Exception/TableExistsException.php @@ -4,6 +4,8 @@ /** * Exception for an already existing table referenced in a statement detected in the driver. + * + * @psalm-immutable */ class TableExistsException extends DatabaseObjectExistsException { diff --git a/lib/Doctrine/DBAL/Exception/TableNotFoundException.php b/lib/Doctrine/DBAL/Exception/TableNotFoundException.php index aeaa0057d49..445a38b5ab1 100644 --- a/lib/Doctrine/DBAL/Exception/TableNotFoundException.php +++ b/lib/Doctrine/DBAL/Exception/TableNotFoundException.php @@ -4,6 +4,8 @@ /** * Exception for an unknown table referenced in a statement detected in the driver. + * + * @psalm-immutable */ class TableNotFoundException extends DatabaseObjectNotFoundException { diff --git a/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php b/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php index c762ad3c78a..f38045a3d0b 100644 --- a/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php +++ b/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php @@ -4,6 +4,8 @@ /** * Exception for a unique constraint violation detected in the driver. + * + * @psalm-immutable */ class UniqueConstraintViolationException extends ConstraintViolationException { diff --git a/lib/Doctrine/DBAL/Query/QueryException.php b/lib/Doctrine/DBAL/Query/QueryException.php index 3fcb3b480ec..604bcb7565c 100644 --- a/lib/Doctrine/DBAL/Query/QueryException.php +++ b/lib/Doctrine/DBAL/Query/QueryException.php @@ -5,6 +5,9 @@ use Doctrine\DBAL\DBALException; use function implode; +/** + * @psalm-immutable + */ class QueryException extends DBALException { /** diff --git a/lib/Doctrine/DBAL/SQLParserUtilsException.php b/lib/Doctrine/DBAL/SQLParserUtilsException.php index a500ed52dd3..0857fce8c36 100644 --- a/lib/Doctrine/DBAL/SQLParserUtilsException.php +++ b/lib/Doctrine/DBAL/SQLParserUtilsException.php @@ -6,6 +6,8 @@ /** * Doctrine\DBAL\ConnectionException + * + * @psalm-immutable */ class SQLParserUtilsException extends DBALException { diff --git a/lib/Doctrine/DBAL/Schema/SchemaException.php b/lib/Doctrine/DBAL/Schema/SchemaException.php index 213d218475b..68d778f53fd 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaException.php +++ b/lib/Doctrine/DBAL/Schema/SchemaException.php @@ -6,6 +6,9 @@ use function implode; use function sprintf; +/** + * @psalm-immutable + */ class SchemaException extends DBALException { public const TABLE_DOESNT_EXIST = 10; diff --git a/lib/Doctrine/DBAL/Sharding/ShardingException.php b/lib/Doctrine/DBAL/Sharding/ShardingException.php index b46bda2ff0d..4d9f41a30e3 100644 --- a/lib/Doctrine/DBAL/Sharding/ShardingException.php +++ b/lib/Doctrine/DBAL/Sharding/ShardingException.php @@ -6,6 +6,8 @@ /** * Sharding related Exceptions + * + * @psalm-immutable */ class ShardingException extends DBALException { diff --git a/lib/Doctrine/DBAL/Types/ConversionException.php b/lib/Doctrine/DBAL/Types/ConversionException.php index 82c6df912b7..ba8c2a9192e 100644 --- a/lib/Doctrine/DBAL/Types/ConversionException.php +++ b/lib/Doctrine/DBAL/Types/ConversionException.php @@ -15,6 +15,8 @@ /** * Conversion Exception is thrown when the database to PHP conversion fails. + * + * @psalm-immutable */ class ConversionException extends DBALException { From aab745e7b6b2de3b47019da81e7225e14dcfdac8 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 20 Apr 2020 10:19:26 -0700 Subject: [PATCH 64/64] Release v2.10.2 --- lib/Doctrine/DBAL/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Version.php b/lib/Doctrine/DBAL/Version.php index 011646b60c4..93fd502741a 100644 --- a/lib/Doctrine/DBAL/Version.php +++ b/lib/Doctrine/DBAL/Version.php @@ -14,7 +14,7 @@ class Version /** * Current Doctrine Version. */ - public const VERSION = '2.10.2-DEV'; + public const VERSION = '2.10.2'; /** * Compares a Doctrine version with the current one.