diff --git a/composer.json b/composer.json index 302097728..7941118c8 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "cweagans/composer-patches": "^1.7", "deepdiver/zipstreamer": "^2.0.3", "deepdiver1975/tarstreamer": "^2.1.0", - "doctrine/dbal": "^3.9.1", + "doctrine/dbal": "^3.10.2", "egulias/email-validator": "^4.0.4", "fusonic/opengraph": "^3.0.0", "giggsey/libphonenumber-for-php-lite": "^9.0.9", diff --git a/composer.lock b/composer.lock index 4462493dc..8a5386069 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": "da5eb2bfe4a8042d87046a29df555986", + "content-hash": "39a6768c6a7bf532f55138f2cc892101", "packages": [ { "name": "aws/aws-crt-php", @@ -432,135 +432,43 @@ }, "time": "2023-06-16T08:01:55+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, { "name": "doctrine/dbal", - "version": "3.9.1", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7" + "reference": "c6c16cf787eaba3112203dfcd715fa2059c62282" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", - "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6c16cf787eaba3112203dfcd715fa2059c62282", + "reference": "c6c16cf787eaba3112203dfcd715fa2059c62282", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1|^2", "php": "^7.4 || ^8.0", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, + "conflict": { + "doctrine/cache": "< 1.11" + }, "require-dev": { - "doctrine/coding-standard": "12.0.0", + "doctrine/cache": "^1.11|^2.0", + "doctrine/coding-standard": "13.0.1", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.12.0", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "9.6.20", - "psalm/plugin-phpunit": "0.18.4", - "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.10.2", + "phpstan/phpstan": "2.1.22", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "9.6.23", + "slevomat/coding-standard": "8.16.2", + "squizlabs/php_codesniffer": "3.13.1", "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/console": "^4.4|^5.4|^6.0|^7.0", - "vimeo/psalm": "4.30.0" + "symfony/console": "^4.4|^5.4|^6.0|^7.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -620,7 +528,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.9.1" + "source": "https://github.com/doctrine/dbal/tree/3.10.2" }, "funding": [ { @@ -636,7 +544,7 @@ "type": "tidelift" } ], - "time": "2024-09-01T13:49:23+00:00" + "time": "2025-09-04T23:51:27+00:00" }, { "name": "doctrine/deprecations", @@ -688,30 +596,29 @@ }, { "name": "doctrine/event-manager", - "version": "1.2.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/b680156fa328f1dfd874fd48c7026c41570b9c6e", + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "conflict": { "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^10.5", + "vimeo/psalm": "^5.24" }, "type": "library", "autoload": { @@ -760,7 +667,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + "source": "https://github.com/doctrine/event-manager/tree/2.0.1" }, "funding": [ { @@ -776,7 +683,7 @@ "type": "tidelift" } ], - "time": "2022-10-12T20:51:15+00:00" + "time": "2024-05-22T20:47:39+00:00" }, { "name": "doctrine/lexer", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 9edc42b30..b7a46ca4a 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -446,19 +446,6 @@ 'DateObjectError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php', 'DateRangeError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php', 'Deprecated' => $vendorDir . '/symfony/polyfill-php84/Resources/stubs/Deprecated.php', - 'Doctrine\\Common\\Cache\\Cache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php', - 'Doctrine\\Common\\Cache\\CacheProvider' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php', - 'Doctrine\\Common\\Cache\\ClearableCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php', - 'Doctrine\\Common\\Cache\\FlushableCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php', - 'Doctrine\\Common\\Cache\\MultiDeleteCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiDeleteCache.php', - 'Doctrine\\Common\\Cache\\MultiGetCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php', - 'Doctrine\\Common\\Cache\\MultiOperationCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiOperationCache.php', - 'Doctrine\\Common\\Cache\\MultiPutCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php', - 'Doctrine\\Common\\Cache\\Psr6\\CacheAdapter' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php', - 'Doctrine\\Common\\Cache\\Psr6\\CacheItem' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheItem.php', - 'Doctrine\\Common\\Cache\\Psr6\\DoctrineProvider' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php', - 'Doctrine\\Common\\Cache\\Psr6\\InvalidArgument' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/InvalidArgument.php', - 'Doctrine\\Common\\Cache\\Psr6\\TypedCacheItem' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/TypedCacheItem.php', 'Doctrine\\Common\\EventArgs' => $vendorDir . '/doctrine/event-manager/src/EventArgs.php', 'Doctrine\\Common\\EventManager' => $vendorDir . '/doctrine/event-manager/src/EventManager.php', 'Doctrine\\Common\\EventSubscriber' => $vendorDir . '/doctrine/event-manager/src/EventSubscriber.php', @@ -550,6 +537,7 @@ 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/Exception.php', 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php', 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/OCI/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\PDOConnect' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/PDOConnect.php', 'Doctrine\\DBAL\\Driver\\PDO\\PDOException' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/PDOException.php', 'Doctrine\\DBAL\\Driver\\PDO\\ParameterTypeMap' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php', 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php', @@ -626,6 +614,7 @@ 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => $vendorDir . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', 'Doctrine\\DBAL\\Exception\\TableExistsException' => $vendorDir . '/doctrine/dbal/src/Exception/TableExistsException.php', 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => $vendorDir . '/doctrine/dbal/src/Exception/TableNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\TransactionRolledBack' => $vendorDir . '/doctrine/dbal/src/Exception/TransactionRolledBack.php', 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/UniqueConstraintViolationException.php', 'Doctrine\\DBAL\\ExpandArrayParameters' => $vendorDir . '/doctrine/dbal/src/ExpandArrayParameters.php', 'Doctrine\\DBAL\\FetchMode' => $vendorDir . '/doctrine/dbal/src/FetchMode.php', @@ -649,6 +638,7 @@ 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/KeywordList.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDBKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb117Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MariaDb117Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL84Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL84Keywords.php', @@ -667,6 +657,7 @@ 'Doctrine\\DBAL\\Platforms\\MariaDb1043Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb1043Platform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1052Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb1052Platform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1060Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb1060Platform.php', + 'Doctrine\\DBAL\\Platforms\\MariaDb110700Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb110700Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL57Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL80Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL84Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL84Platform.php', diff --git a/composer/autoload_psr4.php b/composer/autoload_psr4.php index 6de82b85e..5db7d9475 100644 --- a/composer/autoload_psr4.php +++ b/composer/autoload_psr4.php @@ -80,7 +80,6 @@ 'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/src'), 'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/src'), 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/src'), - 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'), 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/src'), 'Cose\\' => array($vendorDir . '/web-auth/cose-lib/src'), 'CBOR\\' => array($vendorDir . '/spomky-labs/cbor-php/src'), diff --git a/composer/autoload_static.php b/composer/autoload_static.php index a8b673624..abc7d725d 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -171,7 +171,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\Deprecations\\' => 22, 'Doctrine\\DBAL\\' => 14, 'Doctrine\\Common\\Lexer\\' => 22, - 'Doctrine\\Common\\Cache\\' => 22, 'Doctrine\\Common\\' => 16, ), 'C' => @@ -487,10 +486,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 array ( 0 => __DIR__ . '/..' . '/doctrine/lexer/src', ), - 'Doctrine\\Common\\Cache\\' => - array ( - 0 => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache', - ), 'Doctrine\\Common\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/event-manager/src', @@ -978,19 +973,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'DateObjectError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php', 'DateRangeError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php', 'Deprecated' => __DIR__ . '/..' . '/symfony/polyfill-php84/Resources/stubs/Deprecated.php', - 'Doctrine\\Common\\Cache\\Cache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php', - 'Doctrine\\Common\\Cache\\CacheProvider' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php', - 'Doctrine\\Common\\Cache\\ClearableCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php', - 'Doctrine\\Common\\Cache\\FlushableCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php', - 'Doctrine\\Common\\Cache\\MultiDeleteCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiDeleteCache.php', - 'Doctrine\\Common\\Cache\\MultiGetCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php', - 'Doctrine\\Common\\Cache\\MultiOperationCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiOperationCache.php', - 'Doctrine\\Common\\Cache\\MultiPutCache' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php', - 'Doctrine\\Common\\Cache\\Psr6\\CacheAdapter' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php', - 'Doctrine\\Common\\Cache\\Psr6\\CacheItem' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheItem.php', - 'Doctrine\\Common\\Cache\\Psr6\\DoctrineProvider' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php', - 'Doctrine\\Common\\Cache\\Psr6\\InvalidArgument' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/InvalidArgument.php', - 'Doctrine\\Common\\Cache\\Psr6\\TypedCacheItem' => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/TypedCacheItem.php', 'Doctrine\\Common\\EventArgs' => __DIR__ . '/..' . '/doctrine/event-manager/src/EventArgs.php', 'Doctrine\\Common\\EventManager' => __DIR__ . '/..' . '/doctrine/event-manager/src/EventManager.php', 'Doctrine\\Common\\EventSubscriber' => __DIR__ . '/..' . '/doctrine/event-manager/src/EventSubscriber.php', @@ -1082,6 +1064,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Driver\\PDO\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/Exception.php', 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php', 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/OCI/Driver.php', + 'Doctrine\\DBAL\\Driver\\PDO\\PDOConnect' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/PDOConnect.php', 'Doctrine\\DBAL\\Driver\\PDO\\PDOException' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/PDOException.php', 'Doctrine\\DBAL\\Driver\\PDO\\ParameterTypeMap' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php', 'Doctrine\\DBAL\\Driver\\PDO\\PgSQL\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php', @@ -1158,6 +1141,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', 'Doctrine\\DBAL\\Exception\\TableExistsException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TableExistsException.php', 'Doctrine\\DBAL\\Exception\\TableNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TableNotFoundException.php', + 'Doctrine\\DBAL\\Exception\\TransactionRolledBack' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TransactionRolledBack.php', 'Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/UniqueConstraintViolationException.php', 'Doctrine\\DBAL\\ExpandArrayParameters' => __DIR__ . '/..' . '/doctrine/dbal/src/ExpandArrayParameters.php', 'Doctrine\\DBAL\\FetchMode' => __DIR__ . '/..' . '/doctrine/dbal/src/FetchMode.php', @@ -1181,6 +1165,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/KeywordList.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDBKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb102Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\MariaDb117Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MariaDb117Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL57Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL84Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL84Keywords.php', @@ -1199,6 +1184,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Platforms\\MariaDb1043Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb1043Platform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1052Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb1052Platform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1060Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb1060Platform.php', + 'Doctrine\\DBAL\\Platforms\\MariaDb110700Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb110700Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL57Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL57Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL80Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL80Platform.php', 'Doctrine\\DBAL\\Platforms\\MySQL84Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL84Platform.php', diff --git a/composer/installed.json b/composer/installed.json index e084d0b5c..b082eaf68 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -447,144 +447,49 @@ }, "install-path": "../deepdiver1975/tarstreamer" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "version_normalized": "2.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "time": "2022-05-20T20:07:39+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "install-path": "../doctrine/cache" - }, { "name": "doctrine/dbal", - "version": "3.9.1", - "version_normalized": "3.9.1.0", + "version": "3.10.2", + "version_normalized": "3.10.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7" + "reference": "c6c16cf787eaba3112203dfcd715fa2059c62282" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", - "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6c16cf787eaba3112203dfcd715fa2059c62282", + "reference": "c6c16cf787eaba3112203dfcd715fa2059c62282", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1|^2", "php": "^7.4 || ^8.0", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, + "conflict": { + "doctrine/cache": "< 1.11" + }, "require-dev": { - "doctrine/coding-standard": "12.0.0", + "doctrine/cache": "^1.11|^2.0", + "doctrine/coding-standard": "13.0.1", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.12.0", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "9.6.20", - "psalm/plugin-phpunit": "0.18.4", - "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.10.2", + "phpstan/phpstan": "2.1.22", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "9.6.23", + "slevomat/coding-standard": "8.16.2", + "squizlabs/php_codesniffer": "3.13.1", "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/console": "^4.4|^5.4|^6.0|^7.0", - "vimeo/psalm": "4.30.0" + "symfony/console": "^4.4|^5.4|^6.0|^7.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "time": "2024-09-01T13:49:23+00:00", + "time": "2025-09-04T23:51:27+00:00", "bin": [ "bin/doctrine-dbal" ], @@ -641,7 +546,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.9.1" + "source": "https://github.com/doctrine/dbal/tree/3.10.2" }, "funding": [ { @@ -712,33 +617,32 @@ }, { "name": "doctrine/event-manager", - "version": "1.2.0", - "version_normalized": "1.2.0.0", + "version": "2.0.1", + "version_normalized": "2.0.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/b680156fa328f1dfd874fd48c7026c41570b9c6e", + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "conflict": { "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^10.5", + "vimeo/psalm": "^5.24" }, - "time": "2022-10-12T20:51:15+00:00", + "time": "2024-05-22T20:47:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -787,7 +691,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + "source": "https://github.com/doctrine/event-manager/tree/2.0.1" }, "funding": [ { diff --git a/composer/installed.php b/composer/installed.php index d0eb84e14..9cc08ce50 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'nextcloud/3rdparty', - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-stable32', + 'version' => 'dev-stable32', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', @@ -73,19 +73,10 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'doctrine/cache' => array( - 'pretty_version' => '2.2.0', - 'version' => '2.2.0.0', - 'reference' => '1ca8f21980e770095a31456042471a57bc4c68fb', - 'type' => 'library', - 'install_path' => __DIR__ . '/../doctrine/cache', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'doctrine/dbal' => array( - 'pretty_version' => '3.9.1', - 'version' => '3.9.1.0', - 'reference' => 'd7dc08f98cba352b2bab5d32c5e58f7e745c11a7', + 'pretty_version' => '3.10.2', + 'version' => '3.10.2.0', + 'reference' => 'c6c16cf787eaba3112203dfcd715fa2059c62282', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/dbal', 'aliases' => array(), @@ -101,9 +92,9 @@ 'dev_requirement' => false, ), 'doctrine/event-manager' => array( - 'pretty_version' => '1.2.0', - 'version' => '1.2.0.0', - 'reference' => '95aa4cb529f1e96576f3fda9f5705ada4056a520', + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'reference' => 'b680156fa328f1dfd874fd48c7026c41570b9c6e', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/event-manager', 'aliases' => array(), @@ -308,8 +299,8 @@ 'dev_requirement' => false, ), 'nextcloud/3rdparty' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-stable32', + 'version' => 'dev-stable32', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', diff --git a/doctrine/cache/LICENSE b/doctrine/cache/LICENSE deleted file mode 100644 index 8c38cc1bc..000000000 --- a/doctrine/cache/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2006-2015 Doctrine Project - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php b/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php deleted file mode 100644 index 4cfab6c0f..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php +++ /dev/null @@ -1,90 +0,0 @@ -hits - * Number of keys that have been requested and found present. - * - * - misses - * Number of items that have been requested and not found. - * - * - uptime - * Time that the server is running. - * - * - memory_usage - * Memory used by this server to store items. - * - * - memory_available - * Memory allowed to use for storage. - * - * @return mixed[]|null An associative array with server's statistics if available, NULL otherwise. - */ - public function getStats(); -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php b/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php deleted file mode 100644 index 180482a7b..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php +++ /dev/null @@ -1,325 +0,0 @@ -namespace = (string) $namespace; - $this->namespaceVersion = null; - } - - /** - * Retrieves the namespace that prefixes all cache ids. - * - * @return string - */ - public function getNamespace() - { - return $this->namespace; - } - - /** - * {@inheritdoc} - */ - public function fetch($id) - { - return $this->doFetch($this->getNamespacedId($id)); - } - - /** - * {@inheritdoc} - */ - public function fetchMultiple(array $keys) - { - if (empty($keys)) { - return []; - } - - // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys - $namespacedKeys = array_combine($keys, array_map([$this, 'getNamespacedId'], $keys)); - $items = $this->doFetchMultiple($namespacedKeys); - $foundItems = []; - - // no internal array function supports this sort of mapping: needs to be iterative - // this filters and combines keys in one pass - foreach ($namespacedKeys as $requestedKey => $namespacedKey) { - if (! isset($items[$namespacedKey]) && ! array_key_exists($namespacedKey, $items)) { - continue; - } - - $foundItems[$requestedKey] = $items[$namespacedKey]; - } - - return $foundItems; - } - - /** - * {@inheritdoc} - */ - public function saveMultiple(array $keysAndValues, $lifetime = 0) - { - $namespacedKeysAndValues = []; - foreach ($keysAndValues as $key => $value) { - $namespacedKeysAndValues[$this->getNamespacedId($key)] = $value; - } - - return $this->doSaveMultiple($namespacedKeysAndValues, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function contains($id) - { - return $this->doContains($this->getNamespacedId($id)); - } - - /** - * {@inheritdoc} - */ - public function save($id, $data, $lifeTime = 0) - { - return $this->doSave($this->getNamespacedId($id), $data, $lifeTime); - } - - /** - * {@inheritdoc} - */ - public function deleteMultiple(array $keys) - { - return $this->doDeleteMultiple(array_map([$this, 'getNamespacedId'], $keys)); - } - - /** - * {@inheritdoc} - */ - public function delete($id) - { - return $this->doDelete($this->getNamespacedId($id)); - } - - /** - * {@inheritdoc} - */ - public function getStats() - { - return $this->doGetStats(); - } - - /** - * {@inheritDoc} - */ - public function flushAll() - { - return $this->doFlush(); - } - - /** - * {@inheritDoc} - */ - public function deleteAll() - { - $namespaceCacheKey = $this->getNamespaceCacheKey(); - $namespaceVersion = $this->getNamespaceVersion() + 1; - - if ($this->doSave($namespaceCacheKey, $namespaceVersion)) { - $this->namespaceVersion = $namespaceVersion; - - return true; - } - - return false; - } - - /** - * Prefixes the passed id with the configured namespace value. - * - * @param string $id The id to namespace. - * - * @return string The namespaced id. - */ - private function getNamespacedId(string $id): string - { - $namespaceVersion = $this->getNamespaceVersion(); - - return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); - } - - /** - * Returns the namespace cache key. - */ - private function getNamespaceCacheKey(): string - { - return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); - } - - /** - * Returns the namespace version. - */ - private function getNamespaceVersion(): int - { - if ($this->namespaceVersion !== null) { - return $this->namespaceVersion; - } - - $namespaceCacheKey = $this->getNamespaceCacheKey(); - $this->namespaceVersion = (int) $this->doFetch($namespaceCacheKey) ?: 1; - - return $this->namespaceVersion; - } - - /** - * Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it. - * - * @param string[] $keys Array of keys to retrieve from cache - * - * @return mixed[] Array of values retrieved for the given keys. - */ - protected function doFetchMultiple(array $keys) - { - $returnValues = []; - - foreach ($keys as $key) { - $item = $this->doFetch($key); - if ($item === false && ! $this->doContains($key)) { - continue; - } - - $returnValues[$key] = $item; - } - - return $returnValues; - } - - /** - * Fetches an entry from the cache. - * - * @param string $id The id of the cache entry to fetch. - * - * @return mixed|false The cached data or FALSE, if no cache entry exists for the given id. - */ - abstract protected function doFetch($id); - - /** - * Tests if an entry exists in the cache. - * - * @param string $id The cache id of the entry to check for. - * - * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise. - */ - abstract protected function doContains($id); - - /** - * Default implementation of doSaveMultiple. Each driver that supports multi-put should override it. - * - * @param mixed[] $keysAndValues Array of keys and values to save in cache - * @param int $lifetime The lifetime. If != 0, sets a specific lifetime for these - * cache entries (0 => infinite lifeTime). - * - * @return bool TRUE if the operation was successful, FALSE if it wasn't. - */ - protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) - { - $success = true; - - foreach ($keysAndValues as $key => $value) { - if ($this->doSave($key, $value, $lifetime)) { - continue; - } - - $success = false; - } - - return $success; - } - - /** - * Puts data into the cache. - * - * @param string $id The cache id. - * @param string $data The cache entry/data. - * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this - * cache entry (0 => infinite lifeTime). - * - * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise. - */ - abstract protected function doSave($id, $data, $lifeTime = 0); - - /** - * Default implementation of doDeleteMultiple. Each driver that supports multi-delete should override it. - * - * @param string[] $keys Array of keys to delete from cache - * - * @return bool TRUE if the operation was successful, FALSE if it wasn't - */ - protected function doDeleteMultiple(array $keys) - { - $success = true; - - foreach ($keys as $key) { - if ($this->doDelete($key)) { - continue; - } - - $success = false; - } - - return $success; - } - - /** - * Deletes a cache entry. - * - * @param string $id The cache id. - * - * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise. - */ - abstract protected function doDelete($id); - - /** - * Flushes all cache entries. - * - * @return bool TRUE if the cache entries were successfully flushed, FALSE otherwise. - */ - abstract protected function doFlush(); - - /** - * Retrieves cached information from the data store. - * - * @return mixed[]|null An associative array with server's statistics if available, NULL otherwise. - */ - abstract protected function doGetStats(); -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php b/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php deleted file mode 100644 index b94618e46..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php +++ /dev/null @@ -1,21 +0,0 @@ - infinite lifeTime). - * - * @return bool TRUE if the operation was successful, FALSE if it wasn't. - */ - public function saveMultiple(array $keysAndValues, $lifetime = 0); -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php b/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php deleted file mode 100644 index d3693b7c6..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheAdapter.php +++ /dev/null @@ -1,340 +0,0 @@ - */ - private $deferredItems = []; - - public static function wrap(Cache $cache): CacheItemPoolInterface - { - if ($cache instanceof DoctrineProvider && ! $cache->getNamespace()) { - return $cache->getPool(); - } - - if ($cache instanceof SymfonyDoctrineProvider && ! $cache->getNamespace()) { - $getPool = function () { - // phpcs:ignore Squiz.Scope.StaticThisUsage.Found - return $this->pool; - }; - - return $getPool->bindTo($cache, SymfonyDoctrineProvider::class)(); - } - - return new self($cache); - } - - private function __construct(Cache $cache) - { - $this->cache = $cache; - } - - /** @internal */ - public function getCache(): Cache - { - return $this->cache; - } - - /** - * {@inheritDoc} - */ - public function getItem($key): CacheItemInterface - { - assert(self::validKey($key)); - - if (isset($this->deferredItems[$key])) { - $this->commit(); - } - - $value = $this->cache->fetch($key); - - if (PHP_VERSION_ID >= 80000) { - if ($value !== false) { - return new TypedCacheItem($key, $value, true); - } - - return new TypedCacheItem($key, null, false); - } - - if ($value !== false) { - return new CacheItem($key, $value, true); - } - - return new CacheItem($key, null, false); - } - - /** - * {@inheritDoc} - */ - public function getItems(array $keys = []): array - { - if ($this->deferredItems) { - $this->commit(); - } - - assert(self::validKeys($keys)); - - $values = $this->doFetchMultiple($keys); - $items = []; - - if (PHP_VERSION_ID >= 80000) { - foreach ($keys as $key) { - if (array_key_exists($key, $values)) { - $items[$key] = new TypedCacheItem($key, $values[$key], true); - } else { - $items[$key] = new TypedCacheItem($key, null, false); - } - } - - return $items; - } - - foreach ($keys as $key) { - if (array_key_exists($key, $values)) { - $items[$key] = new CacheItem($key, $values[$key], true); - } else { - $items[$key] = new CacheItem($key, null, false); - } - } - - return $items; - } - - /** - * {@inheritDoc} - */ - public function hasItem($key): bool - { - assert(self::validKey($key)); - - if (isset($this->deferredItems[$key])) { - $this->commit(); - } - - return $this->cache->contains($key); - } - - public function clear(): bool - { - $this->deferredItems = []; - - if (! $this->cache instanceof ClearableCache) { - return false; - } - - return $this->cache->deleteAll(); - } - - /** - * {@inheritDoc} - */ - public function deleteItem($key): bool - { - assert(self::validKey($key)); - unset($this->deferredItems[$key]); - - return $this->cache->delete($key); - } - - /** - * {@inheritDoc} - */ - public function deleteItems(array $keys): bool - { - foreach ($keys as $key) { - assert(self::validKey($key)); - unset($this->deferredItems[$key]); - } - - return $this->doDeleteMultiple($keys); - } - - public function save(CacheItemInterface $item): bool - { - return $this->saveDeferred($item) && $this->commit(); - } - - public function saveDeferred(CacheItemInterface $item): bool - { - if (! $item instanceof CacheItem && ! $item instanceof TypedCacheItem) { - return false; - } - - $this->deferredItems[$item->getKey()] = $item; - - return true; - } - - public function commit(): bool - { - if (! $this->deferredItems) { - return true; - } - - $now = microtime(true); - $itemsCount = 0; - $byLifetime = []; - $expiredKeys = []; - - foreach ($this->deferredItems as $key => $item) { - $lifetime = ($item->getExpiry() ?? $now) - $now; - - if ($lifetime < 0) { - $expiredKeys[] = $key; - - continue; - } - - ++$itemsCount; - $byLifetime[(int) $lifetime][$key] = $item->get(); - } - - $this->deferredItems = []; - - switch (count($expiredKeys)) { - case 0: - break; - case 1: - $this->cache->delete(current($expiredKeys)); - break; - default: - $this->doDeleteMultiple($expiredKeys); - break; - } - - if ($itemsCount === 1) { - return $this->cache->save($key, $item->get(), (int) $lifetime); - } - - $success = true; - foreach ($byLifetime as $lifetime => $values) { - $success = $this->doSaveMultiple($values, $lifetime) && $success; - } - - return $success; - } - - public function __destruct() - { - $this->commit(); - } - - /** - * @param mixed $key - */ - private static function validKey($key): bool - { - if (! is_string($key)) { - throw new InvalidArgument(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - - if ($key === '') { - throw new InvalidArgument('Cache key length must be greater than zero.'); - } - - if (strpbrk($key, self::RESERVED_CHARACTERS) !== false) { - throw new InvalidArgument(sprintf('Cache key "%s" contains reserved characters "%s".', $key, self::RESERVED_CHARACTERS)); - } - - return true; - } - - /** - * @param mixed[] $keys - */ - private static function validKeys(array $keys): bool - { - foreach ($keys as $key) { - self::validKey($key); - } - - return true; - } - - /** - * @param mixed[] $keys - */ - private function doDeleteMultiple(array $keys): bool - { - if ($this->cache instanceof MultiDeleteCache) { - return $this->cache->deleteMultiple($keys); - } - - $success = true; - foreach ($keys as $key) { - $success = $this->cache->delete($key) && $success; - } - - return $success; - } - - /** - * @param mixed[] $keys - * - * @return mixed[] - */ - private function doFetchMultiple(array $keys): array - { - if ($this->cache instanceof MultiGetCache) { - return $this->cache->fetchMultiple($keys); - } - - $values = []; - foreach ($keys as $key) { - $value = $this->cache->fetch($key); - if (! $value) { - continue; - } - - $values[$key] = $value; - } - - return $values; - } - - /** - * @param mixed[] $keysAndValues - */ - private function doSaveMultiple(array $keysAndValues, int $lifetime = 0): bool - { - if ($this->cache instanceof MultiPutCache) { - return $this->cache->saveMultiple($keysAndValues, $lifetime); - } - - $success = true; - foreach ($keysAndValues as $key => $value) { - $success = $this->cache->save($key, $value, $lifetime) && $success; - } - - return $success; - } -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheItem.php b/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheItem.php deleted file mode 100644 index 0b6f0a28d..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/CacheItem.php +++ /dev/null @@ -1,118 +0,0 @@ -key = $key; - $this->value = $data; - $this->isHit = $isHit; - } - - public function getKey(): string - { - return $this->key; - } - - /** - * {@inheritDoc} - * - * @return mixed - */ - public function get() - { - return $this->value; - } - - public function isHit(): bool - { - return $this->isHit; - } - - /** - * {@inheritDoc} - */ - public function set($value): self - { - $this->value = $value; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function expiresAt($expiration): self - { - if ($expiration === null) { - $this->expiry = null; - } elseif ($expiration instanceof DateTimeInterface) { - $this->expiry = (float) $expiration->format('U.u'); - } else { - throw new TypeError(sprintf( - 'Expected $expiration to be an instance of DateTimeInterface or null, got %s', - is_object($expiration) ? get_class($expiration) : gettype($expiration) - )); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function expiresAfter($time): self - { - if ($time === null) { - $this->expiry = null; - } elseif ($time instanceof DateInterval) { - $this->expiry = microtime(true) + DateTime::createFromFormat('U', 0)->add($time)->format('U.u'); - } elseif (is_int($time)) { - $this->expiry = $time + microtime(true); - } else { - throw new TypeError(sprintf( - 'Expected $time to be either an integer, an instance of DateInterval or null, got %s', - is_object($time) ? get_class($time) : gettype($time) - )); - } - - return $this; - } - - /** - * @internal - */ - public function getExpiry(): ?float - { - return $this->expiry; - } -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php b/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php deleted file mode 100644 index 3b0f416c1..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/DoctrineProvider.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Doctrine\Common\Cache\Psr6; - -use Doctrine\Common\Cache\Cache; -use Doctrine\Common\Cache\CacheProvider; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\Adapter\DoctrineAdapter as SymfonyDoctrineAdapter; -use Symfony\Contracts\Service\ResetInterface; - -use function rawurlencode; - -/** - * This class was copied from the Symfony Framework, see the original copyright - * notice above. The code is distributed subject to the license terms in - * https://github.com/symfony/symfony/blob/ff0cf61278982539c49e467db9ab13cbd342f76d/LICENSE - */ -final class DoctrineProvider extends CacheProvider -{ - /** @var CacheItemPoolInterface */ - private $pool; - - public static function wrap(CacheItemPoolInterface $pool): Cache - { - if ($pool instanceof CacheAdapter) { - return $pool->getCache(); - } - - if ($pool instanceof SymfonyDoctrineAdapter) { - $getCache = function () { - // phpcs:ignore Squiz.Scope.StaticThisUsage.Found - return $this->provider; - }; - - return $getCache->bindTo($pool, SymfonyDoctrineAdapter::class)(); - } - - return new self($pool); - } - - private function __construct(CacheItemPoolInterface $pool) - { - $this->pool = $pool; - } - - /** @internal */ - public function getPool(): CacheItemPoolInterface - { - return $this->pool; - } - - public function reset(): void - { - if ($this->pool instanceof ResetInterface) { - $this->pool->reset(); - } - - $this->setNamespace($this->getNamespace()); - } - - /** - * {@inheritdoc} - */ - protected function doFetch($id) - { - $item = $this->pool->getItem(rawurlencode($id)); - - return $item->isHit() ? $item->get() : false; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - protected function doContains($id) - { - return $this->pool->hasItem(rawurlencode($id)); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - protected function doSave($id, $data, $lifeTime = 0) - { - $item = $this->pool->getItem(rawurlencode($id)); - - if (0 < $lifeTime) { - $item->expiresAfter($lifeTime); - } - - return $this->pool->save($item->set($data)); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - protected function doDelete($id) - { - return $this->pool->deleteItem(rawurlencode($id)); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - protected function doFlush() - { - return $this->pool->clear(); - } - - /** - * {@inheritdoc} - * - * @return array|null - */ - protected function doGetStats() - { - return null; - } -} diff --git a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/InvalidArgument.php b/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/InvalidArgument.php deleted file mode 100644 index 196f1bca9..000000000 --- a/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/InvalidArgument.php +++ /dev/null @@ -1,13 +0,0 @@ -key; - } - - public function get(): mixed - { - return $this->value; - } - - public function isHit(): bool - { - return $this->isHit; - } - - public function set(mixed $value): static - { - $this->value = $value; - - return $this; - } - - /** - * {@inheritDoc} - */ - public function expiresAt($expiration): static - { - if ($expiration === null) { - $this->expiry = null; - } elseif ($expiration instanceof DateTimeInterface) { - $this->expiry = (float) $expiration->format('U.u'); - } else { - throw new TypeError(sprintf( - 'Expected $expiration to be an instance of DateTimeInterface or null, got %s', - get_debug_type($expiration) - )); - } - - return $this; - } - - /** - * {@inheritDoc} - */ - public function expiresAfter($time): static - { - if ($time === null) { - $this->expiry = null; - } elseif ($time instanceof DateInterval) { - $this->expiry = microtime(true) + DateTime::createFromFormat('U', 0)->add($time)->format('U.u'); - } elseif (is_int($time)) { - $this->expiry = $time + microtime(true); - } else { - throw new TypeError(sprintf( - 'Expected $time to be either an integer, an instance of DateInterval or null, got %s', - get_debug_type($time) - )); - } - - return $this; - } - - /** - * @internal - */ - public function getExpiry(): ?float - { - return $this->expiry; - } -} diff --git a/doctrine/dbal/phpstan-baseline.neon b/doctrine/dbal/phpstan-baseline.neon new file mode 100644 index 000000000..7bb0252a5 --- /dev/null +++ b/doctrine/dbal/phpstan-baseline.neon @@ -0,0 +1,829 @@ +parameters: + ignoreErrors: + - + message: '#^@readonly property cannot have a default value\.$#' + identifier: property.readOnlyByPhpDocDefaultValue + count: 1 + path: src/Driver/AbstractException.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllAssociative\(\) should return list\\> but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Driver/OCI8/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllNumeric\(\) should return list\\> but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Driver/OCI8/Result.php + + - + message: '#^@readonly property Doctrine\\DBAL\\Driver\\PDO\\PDOException\:\:\$sqlState is assigned outside of the constructor\.$#' + identifier: property.readOnlyByPhpDocAssignNotInConstructor + count: 1 + path: src/Driver/PDO/PDOException.php + + - + message: '#^@readonly property cannot have a default value\.$#' + identifier: property.readOnlyByPhpDocDefaultValue + count: 1 + path: src/Driver/PDO/PDOException.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\PDO\\Result\:\:fetchAll\(\) should return list\ but returns array\.$#' + identifier: return.type + count: 1 + path: src/Driver/PDO/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllAssociative\(\) should return list\\> but returns array\\>\.$#' + identifier: return.type + count: 1 + path: src/Driver/PgSQL/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllNumeric\(\) should return list\\> but returns array\\>\.$#' + identifier: return.type + count: 1 + path: src/Driver/PgSQL/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchFirstColumn\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Driver/PgSQL/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Driver\\SQLite3\\Result\:\:fetchNumeric\(\) should return list\\|false but returns array\|false\.$#' + identifier: return.type + count: 1 + path: src/Driver/SQLite3/Result.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/AbstractMySQLPlatform.php + + - + message: '#^Parameter \#1 \$assets of method Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform\:\:indexAssetsByLowerCaseName\(\) expects list\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/Platforms/AbstractMySQLPlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:buildCreateTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 2 + path: src/Platforms/AbstractPlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\DB2Platform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/DB2Platform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\OraclePlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/OraclePlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/PostgreSQLPlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\SQLServerPlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 2 + path: src/Platforms/SQLServerPlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\SqlitePlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/SqlitePlatform.php + + - + message: '#^Method Doctrine\\DBAL\\Platforms\\SqlitePlatform\:\:getAlterTableSQL\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Platforms/SqlitePlatform.php + + - + message: '#^Parameter &\$knownAliases by\-ref type of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:getSQLForJoins\(\) expects array\, non\-empty\-array\ given\.$#' + identifier: parameterByRef.type + count: 1 + path: src/Query/QueryBuilder.php + + - + message: '#^Property Doctrine\\DBAL\\Query\\QueryBuilder\:\:\$params \(array\\|string, mixed\>\) does not accept non\-empty\-array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Query/QueryBuilder.php + + - + message: '#^Parameter \#1 \$sequences of method Doctrine\\DBAL\\SQL\\Builder\\DropSchemaObjectsSQLBuilder\:\:buildSequenceStatements\(\) expects list\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/SQL/Builder/DropSchemaObjectsSQLBuilder.php + + - + message: '#^Parameter \#1 \$tables of method Doctrine\\DBAL\\SQL\\Builder\\DropSchemaObjectsSQLBuilder\:\:buildTableStatements\(\) expects list\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/SQL/Builder/DropSchemaObjectsSQLBuilder.php + + - + message: '#^Method Doctrine\\DBAL\\Schema\\AbstractSchemaManager\:\:doListTableNames\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Schema/AbstractSchemaManager.php + + - + message: '#^Template type T is declared as covariant, but occurs in invariant position in property Doctrine\\DBAL\\Schema\\AbstractSchemaManager\:\:\$_platform\.$#' + identifier: generics.variance + count: 1 + path: src/Schema/AbstractSchemaManager.php + + - + message: '#^Parameter \#1 \$tables of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getDropTablesSQL\(\) expects list\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/Schema/SchemaDiff.php + + - + message: '#^Method Doctrine\\DBAL\\Schema\\SqliteSchemaManager\:\:addDetailsToTableForeignKeyColumns\(\) should return list\\> but returns array\, array\\>\.$#' + identifier: return.type + count: 1 + path: src/Schema/SqliteSchemaManager.php + + - + message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getAddedForeignKeys\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Schema/TableDiff.php + + - + message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getDroppedForeignKeys\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Schema/TableDiff.php + + - + message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getModifiedForeignKeys\(\) should return list\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Schema/TableDiff.php + + - + message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringNotContainsString\(\) expects string, array\\|string given\.$#' + identifier: argument.type + count: 1 + path: tests/Cache/QueryCacheProfileTest.php + + - + message: '#^Parameter \#1 \$cache of method Doctrine\\DBAL\\Tests\\Connection\\CachedQueryTest\:\:assertCachedQueryIsExecutedOnceAndYieldsTheSameResult\(\) expects Doctrine\\Common\\Cache\\Cache\|Psr\\Cache\\CacheItemPoolInterface, Doctrine\\Common\\Cache\\ArrayCache given\.$#' + identifier: argument.type + count: 1 + path: tests/Connection/CachedQueryTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:equalTo\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Connection/LoggingTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\TestCase\:\:once\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Connection/LoggingTest.php + + - + message: '#^Dead catch \- RuntimeException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Parameter \#1 \$params of class Doctrine\\DBAL\\Connection constructor expects array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}, array\{driver\: ''pdo_mysql'', host\: ''localhost'', user\: ''root'', password\: ''password'', port\: 1234, platform\: stdClass\} given\.$#' + identifier: argument.type + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Return type \(void\) of method Doctrine\\DBAL\\Connection@anonymous/tests/ConnectionTest\.php\:1079\:\:rollBack\(\) should be compatible with return type \(bool\) of method Doctrine\\DBAL\\Connection\:\:rollBack\(\)$#' + identifier: method.childReturnType + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Return type \(void\) of method Doctrine\\DBAL\\Connection@anonymous/tests/ConnectionTest\.php\:1103\:\:commit\(\) should be compatible with return type \(bool\) of method Doctrine\\DBAL\\Connection\:\:commit\(\)$#' + identifier: method.childReturnType + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Return type \(void\) of method Doctrine\\DBAL\\Connection@anonymous/tests/ConnectionTest\.php\:1103\:\:rollBack\(\) should be compatible with return type \(bool\) of method Doctrine\\DBAL\\Connection\:\:rollBack\(\)$#' + identifier: method.childReturnType + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable + count: 1 + path: tests/ConnectionTest.php + + - + message: '#^Call to an undefined method Doctrine\\DBAL\\Driver\:\:createDatabasePlatformForVersion\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Driver/AbstractDriverTestCase.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Driver/IBMDB2/DataSourceNameTest.php + + - + message: '#^Parameter \#1 \$params of method Doctrine\\DBAL\\Driver\\Mysqli\\Driver\:\:connect\(\) expects array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}, array\{persistent\: ''true''\} given\.$#' + identifier: argument.type + count: 1 + path: tests/Driver/Mysqli/ConnectionTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Driver/PDO/PgSQL/DriverTest.php + + - + message: '#^Offset string might not exist on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}\.$#' + identifier: offsetAccess.notFound + count: 2 + path: tests/DriverManagerTest.php + + - + message: '#^Parameter \#1 \$params of static method Doctrine\\DBAL\\DriverManager\:\:getConnection\(\) expects array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}, array\{driver\: ''invalid_driver''\} given\.$#' + identifier: argument.type + count: 1 + path: tests/DriverManagerTest.php + + - + message: '#^Parameter \#1 \$params of static method Doctrine\\DBAL\\DriverManager\:\:getConnection\(\) expects array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}, array\{driver\: ''pdo_sqlite'', memory\: true, wrapperClass\: ''stdClass''\} given\.$#' + identifier: argument.type + count: 1 + path: tests/DriverManagerTest.php + + - + message: '#^Parameter \#1 \$params of static method Doctrine\\DBAL\\DriverManager\:\:getConnection\(\) expects array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}, array\{driverClass\: ''stdClass''\} given\.$#' + identifier: argument.type + count: 1 + path: tests/DriverManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Connection/ConnectionLostTest.php + + - + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable + count: 1 + path: tests/Functional/ConnectionTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertNull\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Driver/DBAL6024Test.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/Driver/DBAL6044Test.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertFalse\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Driver/DBAL6044Test.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Driver/DBAL6044Test.php + + - + message: '#^Cannot access property \$affected_rows on mysqli_stmt\|false\.$#' + identifier: property.nonObject + count: 1 + path: tests/Functional/Driver/Mysqli/ResultTest.php + + - + message: '#^Cannot call method execute\(\) on mysqli_stmt\|false\.$#' + identifier: method.nonObject + count: 2 + path: tests/Functional/Driver/Mysqli/ResultTest.php + + - + message: '#^Parameter \#1 \$statement of class Doctrine\\DBAL\\Driver\\Mysqli\\Result constructor expects mysqli_stmt, mysqli_stmt\|false given\.$#' + identifier: argument.type + count: 2 + path: tests/Functional/Driver/Mysqli/ResultTest.php + + - + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable + count: 1 + path: tests/Functional/Driver/Mysqli/ResultTest.php + + - + message: '#^Call to sprintf contains 0 placeholders, 1 value given\.$#' + identifier: argument.sprintf + count: 2 + path: tests/Functional/Driver/OCI8/ResultTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Driver/OCI8/ResultTest.php + + - + message: '#^Cannot access offset ''name'' on array\{name\: string, passwd\: string, uid\: int, gid\: int, gecos\: string, dir\: string, shell\: string\}\|false\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: tests/Functional/ExceptionTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/LegacyAPITest.php + + - + message: '#^Parameter \#1 \$mode of method Doctrine\\DBAL\\Result\:\:fetch\(\) expects 2\|3\|7, 1 given\.$#' + identifier: argument.type + count: 1 + path: tests/Functional/LegacyAPITest.php + + - + message: '#^Parameter \#1 \$mode of method Doctrine\\DBAL\\Result\:\:fetchAll\(\) expects 2\|3\|7, 1 given\.$#' + identifier: argument.type + count: 1 + path: tests/Functional/LegacyAPITest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/ModifyLimitQueryTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/Platform/PlatformRestrictionsTest.php + + - + message: '#^Offset ''replica'' might not exist on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, default_dbname\?\: string, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, \.\.\.\}\.$#' + identifier: offsetAccess.notFound + count: 1 + path: tests/Functional/PrimaryReadReplicaConnectionTest.php + + - + message: '#^Instanceof between Doctrine\\DBAL\\Platforms\\MariaDBPlatform and Doctrine\\DBAL\\Platforms\\MariaDb1010Platform will always evaluate to false\.$#' + identifier: instanceof.alwaysFalse + count: 1 + path: tests/Functional/Query/QueryBuilderTest.php + + - + message: '#^PHPDoc tag @param for parameter \$expectedDefault with type mixed is not subtype of native type string\|null\.$#' + identifier: parameter.phpDocType + count: 2 + path: tests/Functional/Schema/DefaultValueTest.php + + - + message: '#^Only numeric types are allowed in \+, int\|null given on the left side\.$#' + identifier: plus.leftNonNumeric + count: 1 + path: tests/Functional/Schema/MySQL/ComparatorTest.php + + - + message: '#^Call to function array_filter\(\) requires parameter \#2 to be passed to avoid loose comparison semantics\.$#' + identifier: arrayFilter.strict + count: 1 + path: tests/Functional/Schema/MySQL/JsonCollationTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 3 + path: tests/Functional/Schema/MySQL/JsonCollationTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Schema/PostgreSQL/SchemaTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertNotFalse\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/Schema/PostgreSQL/SchemaTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true and mixed will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 2 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Cannot call method getForeignTableName\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|null\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertCount\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 4 + path: tests/Functional/Schema/PostgreSQLSchemaManagerTest.php + + - + message: '#^Cannot call method getColumns\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SQLServerSchemaManagerTest.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\AbstractAsset\:\:getName\(\) with incorrect case\: getname$#' + identifier: method.nameCase + count: 6 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getDefault\(\) with incorrect case\: getdefault$#' + identifier: method.nameCase + count: 6 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getFixed\(\) with incorrect case\: getfixed$#' + identifier: method.nameCase + count: 3 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getLength\(\) with incorrect case\: getlength$#' + identifier: method.nameCase + count: 2 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getNotnull\(\) with incorrect case\: getnotnull$#' + identifier: method.nameCase + count: 6 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getPrecision\(\) with incorrect case\: getprecision$#' + identifier: method.nameCase + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getScale\(\) with incorrect case\: getscale$#' + identifier: method.nameCase + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getType\(\) with incorrect case\: gettype$#' + identifier: method.nameCase + count: 6 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Call to method Doctrine\\DBAL\\Schema\\Column\:\:getUnsigned\(\) with incorrect case\: getunsigned$#' + identifier: method.nameCase + count: 2 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method getColumns\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|false\.$#' + identifier: method.nonObject + count: 2 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method getForeignColumns\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method getForeignTableName\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method getName\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method isUnique\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SchemaManagerFunctionalTestCase.php + + - + message: '#^Cannot call method getForeignColumns\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|null\.$#' + identifier: method.nonObject + count: 5 + path: tests/Functional/Schema/SqliteSchemaManagerTest.php + + - + message: '#^Cannot call method getForeignTableName\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|null\.$#' + identifier: method.nonObject + count: 1 + path: tests/Functional/Schema/SqliteSchemaManagerTest.php + + - + message: '#^Cannot call method getLocalColumns\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|null\.$#' + identifier: method.nonObject + count: 5 + path: tests/Functional/Schema/SqliteSchemaManagerTest.php + + - + message: '#^Cannot call method getName\(\) on Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|null\.$#' + identifier: method.nonObject + count: 4 + path: tests/Functional/Schema/SqliteSchemaManagerTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Functional/StatementTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Functional/TransactionTest.php + + - + message: '#^Method Doctrine\\DBAL\\Tests\\Functional\\Types\\JsonTest\:\:insert\(\) has parameter \$value with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Functional/Types/JsonTest.php + + - + message: '#^Method Doctrine\\DBAL\\Tests\\Functional\\Types\\JsonTest\:\:select\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Functional/Types/JsonTest.php + + - + message: '#^Method PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker\:\:with\(\) invoked with unpacked array with possibly string key, but it''s not allowed because of @no\-named\-arguments\.$#' + identifier: argument.named + count: 1 + path: tests/Logging/LoggerChainTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertStringEndsNotWith\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#1 \$value1 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitAndComparisonExpression\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#1 \$value1 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitOrComparisonExpression\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#1 \$value1 of method Doctrine\\DBAL\\Tests\\Platforms\\AbstractPlatformTestCase\\:\:getBitAndComparisonExpressionSql\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#1 \$value1 of method Doctrine\\DBAL\\Tests\\Platforms\\AbstractPlatformTestCase\\:\:getBitOrComparisonExpressionSql\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$limit of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:modifyLimitQuery\(\) expects int\|null, string given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$lockMode of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:appendLockHint\(\) expects 0\|1\|2\|4, 128 given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitAndComparisonExpression\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitOrComparisonExpression\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Tests\\Platforms\\AbstractPlatformTestCase\\:\:getBitAndComparisonExpressionSql\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Tests\\Platforms\\AbstractPlatformTestCase\\:\:getBitOrComparisonExpressionSql\(\) expects string, int given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Parameter \#3 \$offset of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:modifyLimitQuery\(\) expects int, string given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/AbstractPlatformTestCase.php + + - + message: '#^Cannot access offset ''boolean'' on iterable\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: tests/Platforms/DB2PlatformTest.php + + - + message: '#^Method Doctrine\\DBAL\\Tests\\Platforms\\DB2PlatformTest\:\:getIsCommentedDoctrineType\(\) should return array\ but returns array\\|\(ArrayAccess&iterable\)\.$#' + identifier: return.type + count: 1 + path: tests/Platforms/DB2PlatformTest.php + + - + message: '#^Parameter \#3 \$message of static method PHPUnit\\Framework\\Assert\:\:assertEquals\(\) expects string, true given\.$#' + identifier: argument.type + count: 1 + path: tests/Platforms/DB2PlatformTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Platforms/MySQL/MariaDbJsonComparatorTest.php + + - + message: '#^Dynamic call to static method Doctrine\\DBAL\\Platforms\\OraclePlatform\:\:assertValidIdentifier\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 2 + path: tests/Platforms/OraclePlatformTest.php + + - + message: '#^Unreachable statement \- code above always terminates\.$#' + identifier: deadCode.unreachable + count: 1 + path: tests/Platforms/PostgreSQLPlatformTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\Assert\:\:markTestSkipped\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Platforms/SqlitePlatformTest.php + + - + message: '#^PHPDoc tag @return contains unresolvable type\.$#' + identifier: return.unresolvableType + count: 1 + path: tests/Portability/StatementTest.php + + - + message: '#^Return type of call to method PHPUnit\\Framework\\MockObject\\MockBuilder\\:\:getMock\(\) contains unresolvable type\.$#' + identifier: method.unresolvableReturnType + count: 1 + path: tests/Portability/StatementTest.php + + - + message: '#^Parameter \#2 \$y of method Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder\:\:in\(\) expects array\\|string, array\ given\.$#' + identifier: argument.type + count: 1 + path: tests/Query/Expression/ExpressionBuilderTest.php + + - + message: '#^Parameter \#2 \$y of method Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder\:\:notIn\(\) expects array\\|string, array\ given\.$#' + identifier: argument.type + count: 1 + path: tests/Query/Expression/ExpressionBuilderTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\TestCase\:\:any\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Query/QueryBuilderTest.php + + - + message: '#^Parameter \#1 \$precision of method Doctrine\\DBAL\\Schema\\Column\:\:setPrecision\(\) expects int, null given\.$#' + identifier: argument.type + count: 1 + path: tests/Schema/AbstractComparatorTestCase.php + + - + message: '#^Static call to instance method Doctrine\\DBAL\\Schema\\Comparator\:\:compareSchemas\(\)\.$#' + identifier: method.staticCall + count: 1 + path: tests/Schema/AbstractComparatorTestCase.php + + - + message: '#^Cannot call method getName\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Schema/SchemaTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\TestCase\:\:exactly\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 3 + path: tests/Schema/SchemaTest.php + + - + message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|false given\.$#' + identifier: argument.type + count: 1 + path: tests/Schema/SchemaTest.php + + - + message: '#^Parameter \#1 \$object of method ReflectionProperty\:\:getValue\(\) expects object\|null, Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|false given\.$#' + identifier: argument.type + count: 1 + path: tests/Schema/SchemaTest.php + + - + message: '#^Cannot call method getColumns\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 1 + path: tests/Schema/TableTest.php + + - + message: '#^Cannot call method getName\(\) on Doctrine\\DBAL\\Schema\\Index\|false\.$#' + identifier: method.nonObject + count: 2 + path: tests/Schema/TableTest.php + + - + message: '#^Dynamic call to static method PHPUnit\\Framework\\TestCase\:\:any\(\)\.$#' + identifier: staticMethod.dynamicCall + count: 1 + path: tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php diff --git a/doctrine/dbal/src/ArrayParameterType.php b/doctrine/dbal/src/ArrayParameterType.php index 65e1a29c2..d78cd5f16 100644 --- a/doctrine/dbal/src/ArrayParameterType.php +++ b/doctrine/dbal/src/ArrayParameterType.php @@ -27,9 +27,9 @@ final class ArrayParameterType /** * @internal * - * @psalm-param self::* $type + * @phpstan-param self::* $type * - * @psalm-return ParameterType::INTEGER|ParameterType::STRING|ParameterType::ASCII|ParameterType::BINARY + * @phpstan-return ParameterType::INTEGER|ParameterType::STRING|ParameterType::ASCII|ParameterType::BINARY */ public static function toElementParameterType(int $type): int { diff --git a/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php b/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php index cd9b9756a..8fd40a357 100644 --- a/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php +++ b/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php @@ -7,7 +7,6 @@ use function sprintf; -/** @psalm-immutable */ class MissingNamedParameter extends LogicException implements Exception { public static function new(string $name): self diff --git a/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php b/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php index f89a98b79..2cd311491 100644 --- a/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php +++ b/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php @@ -7,11 +7,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ class MissingPositionalParameter extends LogicException implements Exception { public static function new(int $index): self diff --git a/doctrine/dbal/src/Cache/CacheException.php b/doctrine/dbal/src/Cache/CacheException.php index 18e95d6be..fd10fd5d8 100644 --- a/doctrine/dbal/src/Cache/CacheException.php +++ b/doctrine/dbal/src/Cache/CacheException.php @@ -4,7 +4,6 @@ use Doctrine\DBAL\Exception; -/** @psalm-immutable */ class CacheException extends Exception { /** @return CacheException */ diff --git a/doctrine/dbal/src/Cache/QueryCacheProfile.php b/doctrine/dbal/src/Cache/QueryCacheProfile.php index 1601a9828..71d5b04c4 100644 --- a/doctrine/dbal/src/Cache/QueryCacheProfile.php +++ b/doctrine/dbal/src/Cache/QueryCacheProfile.php @@ -8,8 +8,10 @@ use Doctrine\DBAL\Types\Type; use Doctrine\Deprecations\Deprecation; use Psr\Cache\CacheItemPoolInterface; +use RuntimeException; use TypeError; +use function class_exists; use function get_class; use function hash; use function serialize; @@ -82,7 +84,19 @@ public function getResultCacheDriver() __METHOD__, ); - return $this->resultCache !== null ? DoctrineProvider::wrap($this->resultCache) : null; + if ($this->resultCache === null) { + return null; + } + + if (! class_exists(DoctrineProvider::class)) { + throw new RuntimeException(sprintf( + 'Calling %s() is not supported if the doctrine/cache package is not installed. ' + . 'Try running "composer require doctrine/cache" or migrate cache access to PSR-6.', + __METHOD__, + )); + } + + return DoctrineProvider::wrap($this->resultCache); } /** @return int */ diff --git a/doctrine/dbal/src/Configuration.php b/doctrine/dbal/src/Configuration.php index 5cdae8135..106eccae8 100644 --- a/doctrine/dbal/src/Configuration.php +++ b/doctrine/dbal/src/Configuration.php @@ -10,8 +10,12 @@ use Doctrine\DBAL\Schema\SchemaManagerFactory; use Doctrine\Deprecations\Deprecation; use Psr\Cache\CacheItemPoolInterface; +use RuntimeException; +use function class_exists; use function func_num_args; +use function interface_exists; +use function sprintf; /** * Configuration container for the Doctrine DBAL. @@ -129,6 +133,14 @@ public function getResultCacheImpl(): ?Cache __METHOD__, ); + if ($this->resultCache !== null && ! interface_exists(Cache::class)) { + throw new RuntimeException(sprintf( + 'Calling %s() is not supported if the doctrine/cache package is not installed. ' + . 'Try running "composer require doctrine/cache" or migrate cache access to PSR-6.', + __METHOD__, + )); + } + return $this->resultCacheImpl; } @@ -137,8 +149,11 @@ public function getResultCacheImpl(): ?Cache */ public function setResultCache(CacheItemPoolInterface $cache): void { - $this->resultCacheImpl = DoctrineProvider::wrap($cache); - $this->resultCache = $cache; + if (class_exists(DoctrineProvider::class)) { + $this->resultCacheImpl = DoctrineProvider::wrap($cache); + } + + $this->resultCache = $cache; } /** diff --git a/doctrine/dbal/src/Connection.php b/doctrine/dbal/src/Connection.php index b97567060..2902429f4 100644 --- a/doctrine/dbal/src/Connection.php +++ b/doctrine/dbal/src/Connection.php @@ -9,14 +9,19 @@ use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Driver\API\ExceptionConverter; use Doctrine\DBAL\Driver\Connection as DriverConnection; +use Doctrine\DBAL\Driver\Exception as TheDriverException; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Event\TransactionBeginEventArgs; use Doctrine\DBAL\Event\TransactionCommitEventArgs; use Doctrine\DBAL\Event\TransactionRollBackEventArgs; use Doctrine\DBAL\Exception\ConnectionLost; +use Doctrine\DBAL\Exception\DeadlockException; use Doctrine\DBAL\Exception\DriverException; +use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use Doctrine\DBAL\Exception\InvalidArgumentException; +use Doctrine\DBAL\Exception\TransactionRolledBack; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Query\Expression\ExpressionBuilder; use Doctrine\DBAL\Query\QueryBuilder; @@ -48,8 +53,8 @@ * A database abstraction-level connection that implements features like events, transaction isolation levels, * configuration, emulated transaction nesting, lazy connecting and more. * - * @psalm-import-type Params from DriverManager - * @psalm-consistent-constructor + * @phpstan-import-type Params from DriverManager + * @phpstan-consistent-constructor */ class Connection { @@ -131,7 +136,7 @@ class Connection * The parameters used during creation of the Connection instance. * * @var array - * @psalm-var Params + * @phpstan-var Params */ private array $params; @@ -175,7 +180,7 @@ class Connection * @param Driver $driver The driver to use. * @param Configuration|null $config The configuration, optional. * @param EventManager|null $eventManager The event manager, optional. - * @psalm-param Params $params + * @phpstan-param Params $params * * @throws Exception */ @@ -239,7 +244,7 @@ public function __construct( * @internal * * @return array - * @psalm-return Params + * @phpstan-return Params */ public function getParams() { @@ -360,7 +365,7 @@ public function getExpressionBuilder() * * @throws Exception * - * @psalm-assert !null $this->_conn + * @phpstan-assert !null $this->_conn */ public function connect() { @@ -1278,16 +1283,41 @@ public function lastInsertId($name = null) public function transactional(Closure $func) { $this->beginTransaction(); + + $successful = false; + try { $res = $func($this); + + $successful = true; + } finally { + if (! $successful) { + $this->rollBack(); + } + } + + $shouldRollback = true; + try { $this->commit(); - return $res; - } catch (Throwable $e) { - $this->rollBack(); + $shouldRollback = false; + } catch (TheDriverException $t) { + $convertedException = $this->handleDriverException($t, null); + $shouldRollback = ! ( + $convertedException instanceof TransactionRolledBack + || $convertedException instanceof UniqueConstraintViolationException + || $convertedException instanceof ForeignKeyConstraintViolationException + || $convertedException instanceof DeadlockException + ); - throw $e; + throw $t; + } finally { + if ($shouldRollback) { + $this->rollBack(); + } } + + return $res; } /** @@ -1419,12 +1449,21 @@ public function commit() $connection = $this->getWrappedConnection(); - if ($this->transactionNestingLevel === 1) { - $result = $this->doCommit($connection); - } elseif ($this->nestTransactionsWithSavepoints) { - $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); + try { + if ($this->transactionNestingLevel === 1) { + $result = $this->doCommit($connection); + } elseif ($this->nestTransactionsWithSavepoints) { + $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); + } + } finally { + $this->updateTransactionStateAfterCommit(); } + return $result; + } + + private function updateTransactionStateAfterCommit(): void + { --$this->transactionNestingLevel; $eventManager = $this->getEventManager(); @@ -1441,12 +1480,10 @@ public function commit() } if ($this->autoCommit !== false || $this->transactionNestingLevel !== 0) { - return $result; + return; } $this->beginTransaction(); - - return $result; } /** diff --git a/doctrine/dbal/src/ConnectionException.php b/doctrine/dbal/src/ConnectionException.php index f1e18987b..49d9efe41 100644 --- a/doctrine/dbal/src/ConnectionException.php +++ b/doctrine/dbal/src/ConnectionException.php @@ -2,7 +2,6 @@ namespace Doctrine\DBAL; -/** @psalm-immutable */ class ConnectionException extends Exception { /** @return ConnectionException */ diff --git a/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php b/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php index 2617fb802..0a6d13744 100644 --- a/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php +++ b/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php @@ -59,7 +59,7 @@ * * Instantiation through the DriverManager looks like: * - * @psalm-import-type Params from DriverManager + * @phpstan-import-type Params from DriverManager * @example * * $conn = DriverManager::getConnection(array( @@ -98,7 +98,7 @@ class PrimaryReadReplicaConnection extends Connection * @internal The connection can be only instantiated by the driver manager. * * @param array $params - * @psalm-param Params $params + * @phpstan-param Params $params * * @throws Exception * @throws InvalidArgumentException diff --git a/doctrine/dbal/src/Driver.php b/doctrine/dbal/src/Driver.php index 46e422ba9..a376f069b 100644 --- a/doctrine/dbal/src/Driver.php +++ b/doctrine/dbal/src/Driver.php @@ -13,7 +13,7 @@ * Driver interface. * Interface that all DBAL drivers must implement. * - * @psalm-import-type Params from DriverManager + * @phpstan-import-type Params from DriverManager */ interface Driver { @@ -21,7 +21,7 @@ interface Driver * Attempts to create a connection with the database. * * @param array $params All connection parameters. - * @psalm-param Params $params All connection parameters. + * @phpstan-param Params $params All connection parameters. * * @return DriverConnection The database connection. * diff --git a/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php index fdfc75a77..10507afd7 100644 --- a/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php @@ -22,6 +22,8 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; +use function strpos; + /** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { @@ -85,6 +87,15 @@ public function convert(Exception $exception, ?Query $query): DriverException case 1626: return new SyntaxErrorException($exception, $query); + case 1524: + if (strpos($exception->getMessage(), 'Plugin \'mysql_native_password\' is not loaded') === false) { + break; + } + + // Workaround for MySQL 8.4 if we request an unknown user. + // https://bugs.mysql.com/bug.php?id=114876 + return new ConnectionException($exception, $query); + case 1044: case 1045: case 1046: diff --git a/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php index 4703a57d5..62a08a799 100644 --- a/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php @@ -6,6 +6,8 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; use Doctrine\DBAL\Driver\Exception; +use Doctrine\DBAL\Driver\OCI8\Exception\Error; +use Doctrine\DBAL\Driver\PDO\PDOException; use Doctrine\DBAL\Exception\ConnectionException; use Doctrine\DBAL\Exception\DatabaseDoesNotExist; use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; @@ -17,16 +19,30 @@ use Doctrine\DBAL\Exception\SyntaxErrorException; use Doctrine\DBAL\Exception\TableExistsException; use Doctrine\DBAL\Exception\TableNotFoundException; +use Doctrine\DBAL\Exception\TransactionRolledBack; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; +use function explode; +use function str_replace; + /** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { /** @link http://www.dba-oracle.com/t_error_code_list.htm */ public function convert(Exception $exception, ?Query $query): DriverException { - switch ($exception->getCode()) { + /** @phpstan-var int|'HY000' $code */ // @phpstan-ignore varTag.type + $code = $exception->getCode(); + // @phpstan-ignore property.notFound, property.notFound + if ($code === 'HY000' && isset($exception->errorInfo[1], $exception->errorInfo[2])) { + $errorInfo = $exception->errorInfo; + $exception = new PDOException($errorInfo[2], $errorInfo[1]); + $exception->errorInfo = $errorInfo; + $code = $exception->getCode(); + } + + switch ($code) { case 1: case 2299: case 38911: @@ -58,6 +74,22 @@ public function convert(Exception $exception, ?Query $query): DriverException case 1918: return new DatabaseDoesNotExist($exception, $query); + case 2091: + //ORA-02091: transaction rolled back + //ORA-00001: unique constraint (DOCTRINE.GH3423_UNIQUE) violated + [, $causeError] = explode("\n", $exception->getMessage(), 2); + + [$causeCode] = explode(': ', $causeError, 2); + $code = (int) str_replace('ORA-', '', $causeCode); + + if ($exception instanceof PDOException) { + $why = $this->convert(new PDOException($causeError, $code, $exception), $query); + } else { + $why = $this->convert(new Error($causeError, null, $code, $exception), $query); + } + + return new TransactionRolledBack($why, $query); + case 2289: case 2443: case 4080: diff --git a/doctrine/dbal/src/Driver/AbstractException.php b/doctrine/dbal/src/Driver/AbstractException.php index 389f82e70..9b7bff40f 100644 --- a/doctrine/dbal/src/Driver/AbstractException.php +++ b/doctrine/dbal/src/Driver/AbstractException.php @@ -11,8 +11,6 @@ * Base implementation of the {@see Exception} interface. * * @internal - * - * @psalm-immutable */ abstract class AbstractException extends BaseException implements Exception { diff --git a/doctrine/dbal/src/Driver/AbstractMySQLDriver.php b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php index f8c3b3996..1bb327033 100644 --- a/doctrine/dbal/src/Driver/AbstractMySQLDriver.php +++ b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\Platforms\MariaDb1043Platform; use Doctrine\DBAL\Platforms\MariaDb1052Platform; use Doctrine\DBAL\Platforms\MariaDb1060Platform; +use Doctrine\DBAL\Platforms\MariaDb110700Platform; use Doctrine\DBAL\Platforms\MySQL57Platform; use Doctrine\DBAL\Platforms\MySQL80Platform; use Doctrine\DBAL\Platforms\MySQL84Platform; @@ -42,6 +43,10 @@ public function createDatabasePlatformForVersion($version) if ($mariadb) { $mariaDbVersion = $this->getMariaDbMysqlVersionNumber($version); + if (version_compare($mariaDbVersion, '11.7.0', '>=')) { + return new MariaDb110700Platform(); + } + if (version_compare($mariaDbVersion, '10.10.0', '>=')) { return new MariaDb1010Platform(); } diff --git a/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php b/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php index ea8dcc461..3b2665617 100644 --- a/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php +++ b/doctrine/dbal/src/Driver/AbstractSQLServerDriver/Exception/PortWithoutHost.php @@ -6,11 +6,7 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class PortWithoutHost extends AbstractException { public static function new(): self diff --git a/doctrine/dbal/src/Driver/Exception.php b/doctrine/dbal/src/Driver/Exception.php index f963563b8..cf824a5f5 100644 --- a/doctrine/dbal/src/Driver/Exception.php +++ b/doctrine/dbal/src/Driver/Exception.php @@ -6,7 +6,6 @@ use Throwable; -/** @psalm-immutable */ interface Exception extends Throwable { /** diff --git a/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php b/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php index 01a9b3d0c..a7490cc7a 100644 --- a/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php +++ b/doctrine/dbal/src/Driver/Exception/UnknownParameterType.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class UnknownParameterType extends AbstractException { /** @param mixed $type */ diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php index 231c9d473..05099faf0 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php @@ -6,14 +6,10 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class CannotCopyStreamToStream extends AbstractException { - /** @psalm-param array{message: string}|null $error */ + /** @param array{message: string}|null $error */ public static function new(?array $error): self { $message = 'Could not copy source stream to temporary file'; diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php index 63f7ca1e2..70a355732 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php @@ -6,14 +6,10 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class CannotCreateTemporaryFile extends AbstractException { - /** @psalm-param array{message: string}|null $error */ + /** @param array{message: string}|null $error */ public static function new(?array $error): self { $message = 'Could not create temporary file'; diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php index b7bd8be69..c6c40b93f 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php @@ -9,11 +9,7 @@ use function db2_conn_error; use function db2_conn_errormsg; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class ConnectionError extends AbstractException { /** @param resource $connection */ diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php index 9dd04434e..0826e5c92 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php @@ -9,11 +9,7 @@ use function db2_conn_error; use function db2_conn_errormsg; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class ConnectionFailed extends AbstractException { public static function new(): self diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php index 91b9b439c..d2d30127e 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php @@ -8,11 +8,7 @@ use function preg_match; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Factory { /** diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php index 42df5e15c..95da1cdc3 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php @@ -6,14 +6,10 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class PrepareFailed extends AbstractException { - /** @psalm-param array{message: string}|null $error */ + /** @param array{message: string}|null $error */ public static function new(?array $error): self { if ($error === null) { diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php index 6bf851131..d4c0d0bd1 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php @@ -9,11 +9,7 @@ use function db2_stmt_error; use function db2_stmt_errormsg; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class StatementError extends AbstractException { /** @param resource|null $statement */ diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php index ef5b98017..f5755932b 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php @@ -9,11 +9,7 @@ use mysqli_sql_exception; use ReflectionProperty; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class ConnectionError extends AbstractException { public static function new(mysqli $connection): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php index 44a8cab99..051f141fd 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php @@ -11,11 +11,7 @@ use function assert; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class ConnectionFailed extends AbstractException { public static function new(mysqli $connection): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php b/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php index 6f26dbec8..f20d8bc1d 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class FailedReadingStreamOffset extends AbstractException { public static function new(int $parameter): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php b/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php index d3359fcdf..644f3fd5e 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php @@ -6,11 +6,7 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class HostRequired extends AbstractException { public static function forPersistentConnection(): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php index 8c6bbb476..71a5bc60b 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php @@ -11,11 +11,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class InvalidCharset extends AbstractException { public static function fromCharset(mysqli $connection, string $charset): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php index 6fb46316e..abbda01c0 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class InvalidOption extends AbstractException { /** @param mixed $value */ diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php b/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php index 566d63638..7b50de545 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class NonStreamResourceUsedAsLargeObject extends AbstractException { public static function new(int $parameter): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php b/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php index 78dc8556b..716e2cd24 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php @@ -9,11 +9,7 @@ use mysqli_stmt; use ReflectionProperty; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class StatementError extends AbstractException { public static function new(mysqli_stmt $statement): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Result.php b/doctrine/dbal/src/Driver/Mysqli/Result.php index c7dc65d1d..bfd558b4f 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Result.php +++ b/doctrine/dbal/src/Driver/Mysqli/Result.php @@ -20,6 +20,15 @@ final class Result implements ResultInterface { private mysqli_stmt $statement; + /** + * Maintains a reference to the Statement that generated this result. This ensures that the lifetime of the + * Statement is managed in conjunction with its associated results, so they are destroyed together + * at the appropriate time {@see Statement::__destruct()}. + * + * @phpstan-ignore property.onlyWritten + */ + private ?Statement $statementReference = null; + /** * Whether the statement result has columns. The property should be used only after the result metadata * has been fetched ({@see $metadataFetched}). Otherwise, the property value is undetermined. @@ -42,9 +51,12 @@ final class Result implements ResultInterface * * @throws Exception */ - public function __construct(mysqli_stmt $statement) - { - $this->statement = $statement; + public function __construct( + mysqli_stmt $statement, + ?Statement $statementReference = null + ) { + $this->statement = $statement; + $this->statementReference = $statementReference; $meta = $statement->result_metadata(); diff --git a/doctrine/dbal/src/Driver/Mysqli/Statement.php b/doctrine/dbal/src/Driver/Mysqli/Statement.php index fec7c95c3..be555e3dd 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Statement.php +++ b/doctrine/dbal/src/Driver/Mysqli/Statement.php @@ -61,12 +61,17 @@ public function __construct(mysqli_stmt $stmt) $this->boundValues = array_fill(1, $paramCount, null); } + public function __destruct() + { + @$this->stmt->close(); + } + /** * @deprecated Use {@see bindValue()} instead. * * {@inheritDoc} * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { @@ -101,7 +106,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le /** * {@inheritDoc} * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindValue($param, $value, $type = ParameterType::STRING): bool { @@ -159,7 +164,7 @@ public function execute($params = null): ResultInterface throw StatementError::new($this->stmt); } - return new Result($this->stmt); + return new Result($this->stmt, $this); } /** diff --git a/doctrine/dbal/src/Driver/OCI8/Connection.php b/doctrine/dbal/src/Driver/OCI8/Connection.php index 72353fa31..155b2d1d3 100644 --- a/doctrine/dbal/src/Driver/OCI8/Connection.php +++ b/doctrine/dbal/src/Driver/OCI8/Connection.php @@ -142,7 +142,7 @@ public function beginTransaction(): bool public function commit(): bool { - if (! oci_commit($this->connection)) { + if (! @oci_commit($this->connection)) { throw Error::new($this->connection); } diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php index cefe9a3ad..691d1e31f 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/ConnectionFailed.php @@ -9,11 +9,7 @@ use function assert; use function oci_error; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class ConnectionFailed extends AbstractException { public static function new(): self diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/Error.php b/doctrine/dbal/src/Driver/OCI8/Exception/Error.php index 6abdf233c..9e627c77a 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/Error.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/Error.php @@ -9,11 +9,7 @@ use function assert; use function oci_error; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Error extends AbstractException { /** @param resource $resource */ diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/InvalidConfiguration.php b/doctrine/dbal/src/Driver/OCI8/Exception/InvalidConfiguration.php index e9d2d0ebd..ef3bb29de 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/InvalidConfiguration.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/InvalidConfiguration.php @@ -6,11 +6,7 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class InvalidConfiguration extends AbstractException { public static function forPersistentAndExclusive(): self diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php b/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php index 776728fbe..fab0b27a8 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class NonTerminatedStringLiteral extends AbstractException { public static function new(int $offset): self diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php b/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php index 5fa43caba..c31c35142 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/SequenceDoesNotExist.php @@ -6,11 +6,7 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class SequenceDoesNotExist extends AbstractException { public static function new(): self diff --git a/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php b/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php index 2cd3fe796..d39bb4547 100644 --- a/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php +++ b/doctrine/dbal/src/Driver/OCI8/Exception/UnknownParameterIndex.php @@ -8,11 +8,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class UnknownParameterIndex extends AbstractException { public static function new(int $index): self diff --git a/doctrine/dbal/src/Driver/PDO/Connection.php b/doctrine/dbal/src/Driver/PDO/Connection.php index 290dcc2d2..4320879c8 100644 --- a/doctrine/dbal/src/Driver/PDO/Connection.php +++ b/doctrine/dbal/src/Driver/PDO/Connection.php @@ -82,7 +82,7 @@ public function query(string $sql): ResultInterface * * @throws UnknownParameterType * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function quote($value, $type = ParameterType::STRING) { diff --git a/doctrine/dbal/src/Driver/PDO/Exception.php b/doctrine/dbal/src/Driver/PDO/Exception.php index fbb81253b..0c0d1554b 100644 --- a/doctrine/dbal/src/Driver/PDO/Exception.php +++ b/doctrine/dbal/src/Driver/PDO/Exception.php @@ -7,11 +7,7 @@ use Doctrine\DBAL\Driver\AbstractException; use PDOException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Exception extends AbstractException { public static function new(PDOException $exception): self diff --git a/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php index 2492698b4..4a006daad 100644 --- a/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php @@ -5,12 +5,15 @@ use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Exception; +use Doctrine\DBAL\Driver\PDO\PDOConnect; use PDO; use PDOException; use SensitiveParameter; final class Driver extends AbstractMySQLDriver { + use PDOConnect; + /** * {@inheritDoc} * @@ -30,7 +33,7 @@ public function connect( unset($safeParams['password'], $safeParams['url']); try { - $pdo = new PDO( + $pdo = $this->doConnect( $this->constructPdoDsn($safeParams), $params['user'] ?? '', $params['password'] ?? '', diff --git a/doctrine/dbal/src/Driver/PDO/OCI/Driver.php b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php index 10ada9f0e..a66a5cde8 100644 --- a/doctrine/dbal/src/Driver/PDO/OCI/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php @@ -5,12 +5,15 @@ use Doctrine\DBAL\Driver\AbstractOracleDriver; use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Exception; +use Doctrine\DBAL\Driver\PDO\PDOConnect; use PDO; use PDOException; use SensitiveParameter; final class Driver extends AbstractOracleDriver { + use PDOConnect; + /** * {@inheritDoc} * @@ -30,7 +33,7 @@ public function connect( unset($safeParams['password'], $safeParams['url']); try { - $pdo = new PDO( + $pdo = $this->doConnect( $this->constructPdoDsn($params), $params['user'] ?? '', $params['password'] ?? '', diff --git a/doctrine/dbal/src/Driver/PDO/PDOConnect.php b/doctrine/dbal/src/Driver/PDO/PDOConnect.php new file mode 100644 index 000000000..346c6cd59 --- /dev/null +++ b/doctrine/dbal/src/Driver/PDO/PDOConnect.php @@ -0,0 +1,27 @@ + $options */ + private function doConnect( + string $dsn, + string $username, + string $password, + array $options + ): PDO { + if (PHP_VERSION_ID < 80400) { + return new PDO($dsn, $username, $password, $options); + } + + return PDO::connect($dsn, $username, $password, $options); + } +} diff --git a/doctrine/dbal/src/Driver/PDO/PDOException.php b/doctrine/dbal/src/Driver/PDO/PDOException.php index 6eefda40a..4b0b177d2 100644 --- a/doctrine/dbal/src/Driver/PDO/PDOException.php +++ b/doctrine/dbal/src/Driver/PDO/PDOException.php @@ -6,11 +6,7 @@ use Doctrine\DBAL\Driver\Exception as DriverException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class PDOException extends \PDOException implements DriverException { private ?string $sqlState = null; diff --git a/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php b/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php index f17b585f7..af705b032 100644 --- a/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php +++ b/doctrine/dbal/src/Driver/PDO/ParameterTypeMap.php @@ -24,11 +24,11 @@ final class ParameterTypeMap /** * Converts DBAL parameter type to PDO parameter type * - * @psalm-return PDO::PARAM_* + * @phpstan-return PDO::PARAM_* * * @throws UnknownParameterType * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public static function convertParamType(int $type): int { diff --git a/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php index 5bfcd730c..b62c62318 100644 --- a/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php @@ -5,13 +5,19 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver; use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Exception; +use Doctrine\DBAL\Driver\PDO\PDOConnect; use Doctrine\Deprecations\Deprecation; use PDO; +use Pdo\Pgsql; use PDOException; use SensitiveParameter; +use const PHP_VERSION_ID; + final class Driver extends AbstractPostgreSQLDriver { + use PDOConnect; + /** * {@inheritDoc} * @@ -31,7 +37,7 @@ public function connect( unset($safeParams['password'], $safeParams['url']); try { - $pdo = new PDO( + $pdo = $this->doConnect( $this->constructPdoDsn($safeParams), $params['user'] ?? '', $params['password'] ?? '', @@ -41,11 +47,14 @@ public function connect( throw Exception::new($exception); } + $disablePreparesAttr = PHP_VERSION_ID >= 80400 + ? Pgsql::ATTR_DISABLE_PREPARES + : PDO::PGSQL_ATTR_DISABLE_PREPARES; if ( - ! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) - || $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] === true + ! isset($driverOptions[$disablePreparesAttr]) + || $driverOptions[$disablePreparesAttr] === true ) { - $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); + $pdo->setAttribute($disablePreparesAttr, true); } $connection = new Connection($pdo); diff --git a/doctrine/dbal/src/Driver/PDO/Result.php b/doctrine/dbal/src/Driver/PDO/Result.php index 67970ac56..506fdd4a9 100644 --- a/doctrine/dbal/src/Driver/PDO/Result.php +++ b/doctrine/dbal/src/Driver/PDO/Result.php @@ -91,7 +91,7 @@ public function free(): void } /** - * @psalm-param PDO::FETCH_* $mode + * @phpstan-param PDO::FETCH_* $mode * * @return mixed * @@ -107,7 +107,7 @@ private function fetch(int $mode) } /** - * @psalm-param PDO::FETCH_* $mode + * @phpstan-param PDO::FETCH_* $mode * * @return list * diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php index 63eabb71a..fe2064aab 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection; use Doctrine\DBAL\Driver\PDO\Exception as PDOException; +use Doctrine\DBAL\Driver\PDO\PDOConnect; use PDO; use SensitiveParameter; @@ -15,6 +16,8 @@ final class Driver extends AbstractSQLServerDriver { + use PDOConnect; + /** * {@inheritDoc} * @@ -44,7 +47,7 @@ public function connect( unset($safeParams['password'], $safeParams['url']); try { - $pdo = new PDO( + $pdo = $this->doConnect( $this->constructDsn($safeParams, $dsnOptions), $params['user'] ?? '', $params['password'] ?? '', diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php index cb2dfaedb..a63ff79d7 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php @@ -36,7 +36,7 @@ public function __construct(PDOStatement $statement) * * @throws UnknownParameterType * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindParam( $param, @@ -91,7 +91,7 @@ public function bindParam( * * {@inheritDoc} * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindValue($param, $value, $type = ParameterType::STRING): bool { diff --git a/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php index 2e97788e6..2fa0e700c 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php @@ -6,8 +6,9 @@ use Doctrine\DBAL\Driver\API\SQLite\UserDefinedFunctions; use Doctrine\DBAL\Driver\PDO\Connection; use Doctrine\DBAL\Driver\PDO\Exception; +use Doctrine\DBAL\Driver\PDO\PDOConnect; use Doctrine\Deprecations\Deprecation; -use PDO; +use Pdo\Sqlite; use PDOException; use SensitiveParameter; @@ -15,6 +16,8 @@ final class Driver extends AbstractSQLiteDriver { + use PDOConnect; + /** * {@inheritDoc} * @@ -40,7 +43,7 @@ public function connect( } try { - $pdo = new PDO( + $pdo = $this->doConnect( $this->constructPdoDsn(array_intersect_key($params, ['path' => true, 'memory' => true])), $params['user'] ?? '', $params['password'] ?? '', @@ -51,7 +54,7 @@ public function connect( } UserDefinedFunctions::register( - [$pdo, 'sqliteCreateFunction'], + $pdo instanceof Sqlite ? [$pdo, 'createFunction'] : [$pdo, 'sqliteCreateFunction'], $userDefinedFunctions, ); diff --git a/doctrine/dbal/src/Driver/PDO/Statement.php b/doctrine/dbal/src/Driver/PDO/Statement.php index 64f318d2c..e631fad3d 100644 --- a/doctrine/dbal/src/Driver/PDO/Statement.php +++ b/doctrine/dbal/src/Driver/PDO/Statement.php @@ -29,7 +29,7 @@ public function __construct(PDOStatement $stmt) * * @throws UnknownParameterType * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindValue($param, $value, $type = ParameterType::STRING) { @@ -64,7 +64,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) * * @throws UnknownParameterType * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindParam( $param, diff --git a/doctrine/dbal/src/Driver/PgSQL/Driver.php b/doctrine/dbal/src/Driver/PgSQL/Driver.php index 6377499a7..1cdaee1f2 100644 --- a/doctrine/dbal/src/Driver/PgSQL/Driver.php +++ b/doctrine/dbal/src/Driver/PgSQL/Driver.php @@ -15,6 +15,7 @@ use function func_get_args; use function implode; use function pg_connect; +use function preg_match; use function restore_error_handler; use function set_error_handler; use function sprintf; @@ -64,9 +65,18 @@ private function constructConnectionString( #[SensitiveParameter] array $params ): string { + // pg_connect used by Doctrine DBAL does not support [...] notation, + // but requires the host address in plain form like `aa:bb:99...` + $matches = []; + if (isset($params['host']) && preg_match('/^\[(.+)\]$/', $params['host'], $matches) === 1) { + $params['hostaddr'] = $matches[1]; + unset($params['host']); + } + $components = array_filter( [ 'host' => $params['host'] ?? null, + 'hostaddr' => $params['hostaddr'] ?? null, 'port' => $params['port'] ?? null, 'dbname' => $params['dbname'] ?? 'postgres', 'user' => $params['user'] ?? null, diff --git a/doctrine/dbal/src/Driver/PgSQL/Exception.php b/doctrine/dbal/src/Driver/PgSQL/Exception.php index 41e0dff19..5e7086ba0 100644 --- a/doctrine/dbal/src/Driver/PgSQL/Exception.php +++ b/doctrine/dbal/src/Driver/PgSQL/Exception.php @@ -10,11 +10,7 @@ use const PGSQL_DIAG_MESSAGE_PRIMARY; use const PGSQL_DIAG_SQLSTATE; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Exception extends AbstractException { /** @param PgSqlResult|resource $result */ diff --git a/doctrine/dbal/src/Driver/PgSQL/Exception/UnexpectedValue.php b/doctrine/dbal/src/Driver/PgSQL/Exception/UnexpectedValue.php index ef69817b7..d295cf5e8 100644 --- a/doctrine/dbal/src/Driver/PgSQL/Exception/UnexpectedValue.php +++ b/doctrine/dbal/src/Driver/PgSQL/Exception/UnexpectedValue.php @@ -9,7 +9,6 @@ use function sprintf; -/** @psalm-immutable */ final class UnexpectedValue extends UnexpectedValueException implements Exception { public static function new(string $value, string $type): self diff --git a/doctrine/dbal/src/Driver/PgSQL/Exception/UnknownParameter.php b/doctrine/dbal/src/Driver/PgSQL/Exception/UnknownParameter.php index 4619ecc0d..dd4b2694d 100644 --- a/doctrine/dbal/src/Driver/PgSQL/Exception/UnknownParameter.php +++ b/doctrine/dbal/src/Driver/PgSQL/Exception/UnknownParameter.php @@ -6,7 +6,6 @@ use function sprintf; -/** @psalm-immutable */ final class UnknownParameter extends AbstractException { public static function new(string $param): self diff --git a/doctrine/dbal/src/Driver/PgSQL/Statement.php b/doctrine/dbal/src/Driver/PgSQL/Statement.php index 75af66f30..43af9f1b6 100644 --- a/doctrine/dbal/src/Driver/PgSQL/Statement.php +++ b/doctrine/dbal/src/Driver/PgSQL/Statement.php @@ -40,7 +40,7 @@ final class Statement implements StatementInterface /** @var array */ private array $parameters = []; - /** @psalm-var array */ + /** @var array */ private array $parameterTypes = []; /** @@ -81,8 +81,17 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool throw UnknownParameter::new((string) $param); } - $this->parameters[$this->parameterMap[$param]] = $value; - $this->parameterTypes[$this->parameterMap[$param]] = $type; + if ($value === null) { + $type = ParameterType::NULL; + } + + if ($type === ParameterType::BOOLEAN) { + $this->parameters[$this->parameterMap[$param]] = (bool) $value === false ? 'f' : 't'; + $this->parameterTypes[$this->parameterMap[$param]] = ParameterType::STRING; + } else { + $this->parameters[$this->parameterMap[$param]] = $value; + $this->parameterTypes[$this->parameterMap[$param]] = $type; + } return true; } diff --git a/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php b/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php index f39d5fc4c..e9adb0528 100644 --- a/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Exception/Error.php @@ -11,11 +11,7 @@ use const SQLSRV_ERR_ERRORS; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Error extends AbstractException { public static function new(): self diff --git a/doctrine/dbal/src/Driver/SQLSrv/Result.php b/doctrine/dbal/src/Driver/SQLSrv/Result.php index db17e928d..6c0a368df 100644 --- a/doctrine/dbal/src/Driver/SQLSrv/Result.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Result.php @@ -106,7 +106,7 @@ public function free(): void // @link http://php.net/manual/en/pdostatement.closecursor.php // @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075 // deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them - while (sqlsrv_fetch($this->statement)) { + while (sqlsrv_fetch($this->statement) === true) { } } diff --git a/doctrine/dbal/src/Driver/SQLite3/Exception.php b/doctrine/dbal/src/Driver/SQLite3/Exception.php index 3ca1190bc..3219fc327 100644 --- a/doctrine/dbal/src/Driver/SQLite3/Exception.php +++ b/doctrine/dbal/src/Driver/SQLite3/Exception.php @@ -4,11 +4,7 @@ use Doctrine\DBAL\Driver\AbstractException; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class Exception extends AbstractException { public static function new(\Exception $exception): self diff --git a/doctrine/dbal/src/Driver/SQLite3/Statement.php b/doctrine/dbal/src/Driver/SQLite3/Statement.php index a4166aa61..01c3b8bbb 100644 --- a/doctrine/dbal/src/Driver/SQLite3/Statement.php +++ b/doctrine/dbal/src/Driver/SQLite3/Statement.php @@ -45,7 +45,7 @@ public function __construct(SQLite3 $connection, SQLite3Stmt $statement) * * {@inheritDoc} * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindValue($param, $value, $type = ParameterType::STRING): bool { @@ -66,7 +66,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool * * {@inheritDoc} * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { @@ -121,9 +121,9 @@ public function execute($params = null): Result } /** - * @psalm-return value-of + * @phpstan-return value-of * - * @psalm-assert ParameterType::* $type + * @phpstan-assert ParameterType::* $type */ private function convertParamType(int $type): int { diff --git a/doctrine/dbal/src/DriverManager.php b/doctrine/dbal/src/DriverManager.php index 056f42084..7586bc479 100644 --- a/doctrine/dbal/src/DriverManager.php +++ b/doctrine/dbal/src/DriverManager.php @@ -22,7 +22,7 @@ /** * Factory for creating {@see Connection} instances. * - * @psalm-type OverrideParams = array{ + * @phpstan-type OverrideParams = array{ * application_name?: string, * charset?: string, * dbname?: string, @@ -41,7 +41,7 @@ * user?: string, * unix_socket?: string, * } - * @psalm-type Params = array{ + * @phpstan-type Params = array{ * application_name?: string, * charset?: string, * dbname?: string, @@ -98,7 +98,7 @@ final class DriverManager * @deprecated Use actual driver names instead. * * @var array - * @psalm-var array> + * @phpstan-var array> */ private static array $driverSchemeAliases = [ 'db2' => 'ibm_db2', @@ -153,9 +153,9 @@ private function __construct() * * @param Configuration|null $config The configuration to use. * @param EventManager|null $eventManager The event manager to use. - * @psalm-param Params $params + * @phpstan-param Params $params * - * @psalm-return ($params is array{wrapperClass: class-string} ? T : Connection) + * @phpstan-return ($params is array{wrapperClass: class-string} ? T : Connection) * * @throws Exception * @@ -201,7 +201,7 @@ public static function getConnection( * Returns the list of supported drivers. * * @return string[] - * @psalm-return list> + * @phpstan-return list> */ public static function getAvailableDrivers(): array { @@ -211,8 +211,8 @@ public static function getAvailableDrivers(): array /** * @throws Exception * - * @psalm-assert key-of|null $driver - * @psalm-assert class-string|null $driverClass + * @phpstan-assert key-of|null $driver + * @phpstan-assert class-string|null $driverClass */ private static function createDriver(?string $driver, ?string $driverClass): Driver { @@ -238,11 +238,11 @@ private static function createDriver(?string $driver, ?string $driverClass): Dri * updated list of parameters. * * @param mixed[] $params The list of parameters. - * @psalm-param Params $params + * @phpstan-param Params $params * * @return mixed[] A modified list of parameters with info from a database * URL extracted into indidivual parameter parts. - * @psalm-return Params + * @phpstan-return Params * * @throws Exception */ diff --git a/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php b/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php index f45e3a15a..6f279e965 100644 --- a/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php @@ -4,7 +4,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Table; -use InvalidArgumentException; /** * Event Arguments used when the SQL query for dropping tables are generated inside {@see AbstractPlatform}. @@ -21,11 +20,7 @@ class SchemaDropTableEventArgs extends SchemaEventArgs /** @var string|null */ private $sql; - /** - * @param string|Table $table - * - * @throws InvalidArgumentException - */ + /** @param string|Table $table */ public function __construct($table, AbstractPlatform $platform) { $this->table = $table; diff --git a/doctrine/dbal/src/Exception.php b/doctrine/dbal/src/Exception.php index 3d2814c73..8475a140d 100644 --- a/doctrine/dbal/src/Exception.php +++ b/doctrine/dbal/src/Exception.php @@ -13,7 +13,6 @@ use function spl_object_hash; use function sprintf; -/** @psalm-immutable */ class Exception extends \Exception { public static function notSupported(string $method): self diff --git a/doctrine/dbal/src/Exception/ConnectionException.php b/doctrine/dbal/src/Exception/ConnectionException.php index 6b7c901a3..e96a29191 100644 --- a/doctrine/dbal/src/Exception/ConnectionException.php +++ b/doctrine/dbal/src/Exception/ConnectionException.php @@ -4,8 +4,6 @@ /** * Base class for all connection related errors detected in the driver. - * - * @psalm-immutable */ class ConnectionException extends DriverException { diff --git a/doctrine/dbal/src/Exception/ConnectionLost.php b/doctrine/dbal/src/Exception/ConnectionLost.php index c45085839..1195d98e9 100644 --- a/doctrine/dbal/src/Exception/ConnectionLost.php +++ b/doctrine/dbal/src/Exception/ConnectionLost.php @@ -2,7 +2,6 @@ namespace Doctrine\DBAL\Exception; -/** @psalm-immutable */ final class ConnectionLost extends ConnectionException { } diff --git a/doctrine/dbal/src/Exception/ConstraintViolationException.php b/doctrine/dbal/src/Exception/ConstraintViolationException.php index 435e8b19f..3959f39af 100644 --- a/doctrine/dbal/src/Exception/ConstraintViolationException.php +++ b/doctrine/dbal/src/Exception/ConstraintViolationException.php @@ -4,8 +4,6 @@ /** * Base class for all constraint violation related errors detected in the driver. - * - * @psalm-immutable */ class ConstraintViolationException extends ServerException { diff --git a/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php b/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php index dc71c82cb..a49f6dec8 100644 --- a/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php +++ b/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php @@ -2,7 +2,6 @@ namespace Doctrine\DBAL\Exception; -/** @psalm-immutable */ class DatabaseDoesNotExist extends DatabaseObjectNotFoundException { } diff --git a/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php b/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php index fb19f5bae..7e0ba0299 100644 --- a/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php +++ b/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php @@ -8,8 +8,6 @@ * 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/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php b/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php index 2d3d78d99..3342bce8d 100644 --- a/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php +++ b/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php @@ -8,8 +8,6 @@ * 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/doctrine/dbal/src/Exception/DatabaseRequired.php b/doctrine/dbal/src/Exception/DatabaseRequired.php index 49b7326cd..6889a5d23 100644 --- a/doctrine/dbal/src/Exception/DatabaseRequired.php +++ b/doctrine/dbal/src/Exception/DatabaseRequired.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ class DatabaseRequired extends Exception { public static function new(string $methodName): self diff --git a/doctrine/dbal/src/Exception/DeadlockException.php b/doctrine/dbal/src/Exception/DeadlockException.php index f36be908a..fd0550a56 100644 --- a/doctrine/dbal/src/Exception/DeadlockException.php +++ b/doctrine/dbal/src/Exception/DeadlockException.php @@ -4,8 +4,6 @@ /** * Exception for a deadlock error of a transaction detected in the driver. - * - * @psalm-immutable */ class DeadlockException extends ServerException implements RetryableException { diff --git a/doctrine/dbal/src/Exception/DriverException.php b/doctrine/dbal/src/Exception/DriverException.php index 8bba9dd87..559a40c29 100644 --- a/doctrine/dbal/src/Exception/DriverException.php +++ b/doctrine/dbal/src/Exception/DriverException.php @@ -10,8 +10,6 @@ /** * Base class for all errors detected in the driver. - * - * @psalm-immutable */ class DriverException extends Exception implements TheDriverException { diff --git a/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php b/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php index f1a612b21..48d736f9e 100644 --- a/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php +++ b/doctrine/dbal/src/Exception/ForeignKeyConstraintViolationException.php @@ -4,8 +4,6 @@ /** * Exception for a foreign key constraint violation detected in the driver. - * - * @psalm-immutable */ class ForeignKeyConstraintViolationException extends ConstraintViolationException { diff --git a/doctrine/dbal/src/Exception/InvalidArgumentException.php b/doctrine/dbal/src/Exception/InvalidArgumentException.php index 7f58510f0..044cecfec 100644 --- a/doctrine/dbal/src/Exception/InvalidArgumentException.php +++ b/doctrine/dbal/src/Exception/InvalidArgumentException.php @@ -6,8 +6,6 @@ /** * Exception to be thrown when invalid arguments are passed to any DBAL API - * - * @psalm-immutable */ class InvalidArgumentException extends Exception { diff --git a/doctrine/dbal/src/Exception/InvalidFieldNameException.php b/doctrine/dbal/src/Exception/InvalidFieldNameException.php index 234941bf6..d960feaf8 100644 --- a/doctrine/dbal/src/Exception/InvalidFieldNameException.php +++ b/doctrine/dbal/src/Exception/InvalidFieldNameException.php @@ -4,8 +4,6 @@ /** * Exception for an invalid specified field name in a statement detected in the driver. - * - * @psalm-immutable */ class InvalidFieldNameException extends ServerException { diff --git a/doctrine/dbal/src/Exception/InvalidLockMode.php b/doctrine/dbal/src/Exception/InvalidLockMode.php index f1780c459..9c38c77c2 100644 --- a/doctrine/dbal/src/Exception/InvalidLockMode.php +++ b/doctrine/dbal/src/Exception/InvalidLockMode.php @@ -6,7 +6,6 @@ use function sprintf; -/** @psalm-immutable */ class InvalidLockMode extends Exception { public static function fromLockMode(int $lockMode): self diff --git a/doctrine/dbal/src/Exception/LockWaitTimeoutException.php b/doctrine/dbal/src/Exception/LockWaitTimeoutException.php index 62aa10fca..bfc3a498a 100644 --- a/doctrine/dbal/src/Exception/LockWaitTimeoutException.php +++ b/doctrine/dbal/src/Exception/LockWaitTimeoutException.php @@ -4,8 +4,6 @@ /** * 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/doctrine/dbal/src/Exception/MalformedDsnException.php b/doctrine/dbal/src/Exception/MalformedDsnException.php index 01cd7c200..3f9b87443 100644 --- a/doctrine/dbal/src/Exception/MalformedDsnException.php +++ b/doctrine/dbal/src/Exception/MalformedDsnException.php @@ -4,7 +4,6 @@ use InvalidArgumentException; -/** @psalm-immutable */ class MalformedDsnException extends InvalidArgumentException { public static function new(): self diff --git a/doctrine/dbal/src/Exception/NoKeyValue.php b/doctrine/dbal/src/Exception/NoKeyValue.php index 545ade3ec..be5508a34 100644 --- a/doctrine/dbal/src/Exception/NoKeyValue.php +++ b/doctrine/dbal/src/Exception/NoKeyValue.php @@ -6,11 +6,7 @@ use function sprintf; -/** - * @internal - * - * @psalm-immutable - */ +/** @internal */ final class NoKeyValue extends Exception { public static function fromColumnCount(int $columnCount): self diff --git a/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php b/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php index 9ff662733..fd56f8969 100644 --- a/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php +++ b/doctrine/dbal/src/Exception/NonUniqueFieldNameException.php @@ -4,8 +4,6 @@ /** * 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/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php b/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php index 113b737bb..e327bc94d 100644 --- a/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php +++ b/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php @@ -4,8 +4,6 @@ /** * Exception for a NOT NULL constraint violation detected in the driver. - * - * @psalm-immutable */ class NotNullConstraintViolationException extends ConstraintViolationException { diff --git a/doctrine/dbal/src/Exception/ReadOnlyException.php b/doctrine/dbal/src/Exception/ReadOnlyException.php index 621363af9..a846f2501 100644 --- a/doctrine/dbal/src/Exception/ReadOnlyException.php +++ b/doctrine/dbal/src/Exception/ReadOnlyException.php @@ -4,8 +4,6 @@ /** * 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/doctrine/dbal/src/Exception/RetryableException.php b/doctrine/dbal/src/Exception/RetryableException.php index 79e325199..4cb94b100 100644 --- a/doctrine/dbal/src/Exception/RetryableException.php +++ b/doctrine/dbal/src/Exception/RetryableException.php @@ -6,8 +6,6 @@ /** * Marker interface for all exceptions where retrying the transaction makes sense. - * - * @psalm-immutable */ interface RetryableException extends Throwable { diff --git a/doctrine/dbal/src/Exception/SchemaDoesNotExist.php b/doctrine/dbal/src/Exception/SchemaDoesNotExist.php index de6fa5c00..13813838e 100644 --- a/doctrine/dbal/src/Exception/SchemaDoesNotExist.php +++ b/doctrine/dbal/src/Exception/SchemaDoesNotExist.php @@ -2,7 +2,6 @@ namespace Doctrine\DBAL\Exception; -/** @psalm-immutable */ class SchemaDoesNotExist extends DatabaseObjectNotFoundException { } diff --git a/doctrine/dbal/src/Exception/ServerException.php b/doctrine/dbal/src/Exception/ServerException.php index 194bc9cdd..c88c3863b 100644 --- a/doctrine/dbal/src/Exception/ServerException.php +++ b/doctrine/dbal/src/Exception/ServerException.php @@ -4,8 +4,6 @@ /** * Base class for all server related errors detected in the driver. - * - * @psalm-immutable */ class ServerException extends DriverException { diff --git a/doctrine/dbal/src/Exception/SyntaxErrorException.php b/doctrine/dbal/src/Exception/SyntaxErrorException.php index 2603ac274..0b413b719 100644 --- a/doctrine/dbal/src/Exception/SyntaxErrorException.php +++ b/doctrine/dbal/src/Exception/SyntaxErrorException.php @@ -4,8 +4,6 @@ /** * Exception for a syntax error in a statement detected in the driver. - * - * @psalm-immutable */ class SyntaxErrorException extends ServerException { diff --git a/doctrine/dbal/src/Exception/TableExistsException.php b/doctrine/dbal/src/Exception/TableExistsException.php index b6575a25d..ff0df89af 100644 --- a/doctrine/dbal/src/Exception/TableExistsException.php +++ b/doctrine/dbal/src/Exception/TableExistsException.php @@ -4,8 +4,6 @@ /** * Exception for an already existing table referenced in a statement detected in the driver. - * - * @psalm-immutable */ class TableExistsException extends DatabaseObjectExistsException { diff --git a/doctrine/dbal/src/Exception/TableNotFoundException.php b/doctrine/dbal/src/Exception/TableNotFoundException.php index 445a38b5a..aeaa0057d 100644 --- a/doctrine/dbal/src/Exception/TableNotFoundException.php +++ b/doctrine/dbal/src/Exception/TableNotFoundException.php @@ -4,8 +4,6 @@ /** * Exception for an unknown table referenced in a statement detected in the driver. - * - * @psalm-immutable */ class TableNotFoundException extends DatabaseObjectNotFoundException { diff --git a/doctrine/dbal/src/Exception/TransactionRolledBack.php b/doctrine/dbal/src/Exception/TransactionRolledBack.php new file mode 100644 index 000000000..c3605a468 --- /dev/null +++ b/doctrine/dbal/src/Exception/TransactionRolledBack.php @@ -0,0 +1,7 @@ + $createFlags + * @phpstan-param int-mask-of $createFlags * * @return list The list of SQL statements. * @@ -2226,7 +2226,7 @@ private function buildCreateTableSQL(Table $table, bool $createIndexes, bool $cr } /** - * @param list $tables + * @param Table[] $tables * * @return list * @@ -4564,7 +4564,7 @@ protected function createReservedKeywordsList(): KeywordList * @deprecated Implement {@see createReservedKeywordsList()} instead. * * @return string - * @psalm-return class-string + * @phpstan-return class-string * * @throws Exception If not supported on this platform. */ diff --git a/doctrine/dbal/src/Platforms/Keywords/KeywordList.php b/doctrine/dbal/src/Platforms/Keywords/KeywordList.php index 584277395..d8b4f4630 100644 --- a/doctrine/dbal/src/Platforms/Keywords/KeywordList.php +++ b/doctrine/dbal/src/Platforms/Keywords/KeywordList.php @@ -9,7 +9,7 @@ /** * Abstract interface for a SQL reserved keyword dictionary. * - * @psalm-consistent-constructor + * @phpstan-consistent-constructor */ abstract class KeywordList { diff --git a/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php b/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php index f9b50de54..24b824045 100644 --- a/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php +++ b/doctrine/dbal/src/Platforms/Keywords/MariaDb102Keywords.php @@ -11,7 +11,7 @@ * * @link https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ -final class MariaDb102Keywords extends MariaDBKeywords +class MariaDb102Keywords extends MariaDBKeywords { /** @deprecated */ public function getName(): string diff --git a/doctrine/dbal/src/Platforms/Keywords/MariaDb117Keywords.php b/doctrine/dbal/src/Platforms/Keywords/MariaDb117Keywords.php new file mode 100644 index 000000000..a33dcb946 --- /dev/null +++ b/doctrine/dbal/src/Platforms/Keywords/MariaDb117Keywords.php @@ -0,0 +1,46 @@ +getDropConstraintSQL($constraintName, $table); } + if ($table !== null) { + $indexName = $index instanceof Index ? $index->getQuotedName($this) : $index; + $tableName = $table instanceof Table ? $table->getQuotedName($this) : $table; + + if (strpos($tableName, '.') !== false) { + [$schema] = explode('.', $tableName); + $index = $schema . '.' . $indexName; + } + } + return parent::getDropIndexSQL($index, $table); } diff --git a/doctrine/dbal/src/Platforms/SQLServerPlatform.php b/doctrine/dbal/src/Platforms/SQLServerPlatform.php index 16d7bd4e7..eed1cbab4 100644 --- a/doctrine/dbal/src/Platforms/SQLServerPlatform.php +++ b/doctrine/dbal/src/Platforms/SQLServerPlatform.php @@ -38,6 +38,7 @@ use function preg_match; use function preg_match_all; use function sprintf; +use function str_contains; use function str_ends_with; use function str_replace; use function str_starts_with; @@ -1777,11 +1778,17 @@ private function generateIdentifierName($identifier): string protected function getCommentOnTableSQL(string $tableName, ?string $comment): string { + if (str_contains($tableName, '.')) { + [$schemaName, $tableName] = explode('.', $tableName); + } else { + $schemaName = 'dbo'; + } + return $this->getAddExtendedPropertySQL( 'MS_Description', $comment, 'SCHEMA', - $this->quoteStringLiteral('dbo'), + $this->quoteStringLiteral($schemaName), 'TABLE', $this->quoteStringLiteral($this->unquoteSingleIdentifier($tableName)), ); diff --git a/doctrine/dbal/src/Platforms/SqlitePlatform.php b/doctrine/dbal/src/Platforms/SqlitePlatform.php index 48c692fdb..b2e1280d0 100644 --- a/doctrine/dbal/src/Platforms/SqlitePlatform.php +++ b/doctrine/dbal/src/Platforms/SqlitePlatform.php @@ -908,7 +908,7 @@ public function getTemporaryTableName($tableName) */ public function canEmulateSchemas() { - Deprecation::trigger( + Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4805', 'SqlitePlatform::canEmulateSchemas() is deprecated.', @@ -1025,7 +1025,7 @@ public function getCreateConstraintSQL(Constraint $constraint, $table) * {@inheritDoc} * * @param int|null $createFlags - * @psalm-param int-mask-of|null $createFlags + * @phpstan-param int-mask-of|null $createFlags */ public function getCreateTableSQL(Table $table, $createFlags = null) { diff --git a/doctrine/dbal/src/Portability/Converter.php b/doctrine/dbal/src/Portability/Converter.php index d0503977b..effbf986f 100644 --- a/doctrine/dbal/src/Portability/Converter.php +++ b/doctrine/dbal/src/Portability/Converter.php @@ -151,7 +151,7 @@ private static function convertEmptyStringToNull($value) * @param T $value * * @return T|string - * @psalm-return (T is string ? string : T) + * @phpstan-return (T is string ? string : T) * * @template T */ @@ -228,7 +228,7 @@ private function createConvert(?callable $function, callable $id): callable return /** * @param T $value * - * @psalm-return (T is false ? false : T) + * @phpstan-return (T is false ? false : T) * * @template T */ diff --git a/doctrine/dbal/src/Query.php b/doctrine/dbal/src/Query.php index bfc9b14e2..e4ab80e7c 100644 --- a/doctrine/dbal/src/Query.php +++ b/doctrine/dbal/src/Query.php @@ -8,8 +8,6 @@ /** * An SQL query together with its bound parameters. - * - * @psalm-immutable */ final class Query { @@ -35,8 +33,6 @@ final class Query /** * @param array $params * @param array $types - * - * @psalm-suppress ImpurePropertyAssignment */ public function __construct(string $sql, array $params, array $types) { diff --git a/doctrine/dbal/src/Query/Expression/CompositeExpression.php b/doctrine/dbal/src/Query/Expression/CompositeExpression.php index 4cad8ec1d..c241ff7f2 100644 --- a/doctrine/dbal/src/Query/Expression/CompositeExpression.php +++ b/doctrine/dbal/src/Query/Expression/CompositeExpression.php @@ -149,7 +149,7 @@ public function with($part, ...$parts): self * Retrieves the amount of expressions on composite expression. * * @return int - * @psalm-return int<0, max> + * @phpstan-return int<0, max> */ #[ReturnTypeWillChange] public function count() diff --git a/doctrine/dbal/src/Query/QueryBuilder.php b/doctrine/dbal/src/Query/QueryBuilder.php index 4c5d6b8d4..208579c93 100644 --- a/doctrine/dbal/src/Query/QueryBuilder.php +++ b/doctrine/dbal/src/Query/QueryBuilder.php @@ -113,14 +113,14 @@ class QueryBuilder /** * The type of query this is. Can be select, update or delete. * - * @psalm-var self::SELECT|self::DELETE|self::UPDATE|self::INSERT + * @phpstan-var self::SELECT|self::DELETE|self::UPDATE|self::INSERT */ private int $type = self::SELECT; /** * The state of the query object. Can be dirty or clean. * - * @psalm-var self::STATE_* + * @phpstan-var self::STATE_* */ private int $state = self::STATE_CLEAN; @@ -219,7 +219,7 @@ public function getConnection() * @deprecated The builder state is an internal concern. * * @return int Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. - * @psalm-return self::STATE_* + * @phpstan-return self::STATE_* */ public function getState() { diff --git a/doctrine/dbal/src/Query/QueryException.php b/doctrine/dbal/src/Query/QueryException.php index 90d1f47d9..bfb5eafc3 100644 --- a/doctrine/dbal/src/Query/QueryException.php +++ b/doctrine/dbal/src/Query/QueryException.php @@ -6,7 +6,6 @@ use function implode; -/** @psalm-immutable */ class QueryException extends Exception { /** diff --git a/doctrine/dbal/src/Result.php b/doctrine/dbal/src/Result.php index 92235d064..f63b07f07 100644 --- a/doctrine/dbal/src/Result.php +++ b/doctrine/dbal/src/Result.php @@ -264,7 +264,7 @@ private function ensureHasKeyValue(): void * * @deprecated Use {@see fetchNumeric()}, {@see fetchAssociative()} or {@see fetchOne()} instead. * - * @psalm-param FetchMode::* $mode + * @phpstan-param FetchMode::* $mode * * @return mixed * @@ -303,7 +303,7 @@ public function fetch(int $mode = FetchMode::ASSOCIATIVE) * * @deprecated Use {@see fetchAllNumeric()}, {@see fetchAllAssociative()} or {@see fetchFirstColumn()} instead. * - * @psalm-param FetchMode::* $mode + * @phpstan-param FetchMode::* $mode * * @return list * diff --git a/doctrine/dbal/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php b/doctrine/dbal/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php index 2e392e661..74579b3e0 100644 --- a/doctrine/dbal/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php +++ b/doctrine/dbal/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php @@ -34,7 +34,7 @@ public function buildSQL(Schema $schema): array } /** - * @param list $namespaces + * @param string[] $namespaces * * @return list * @@ -54,7 +54,7 @@ private function buildNamespaceStatements(array $namespaces): array } /** - * @param list
$tables + * @param Table[] $tables * * @return list * @@ -66,7 +66,7 @@ private function buildTableStatements(array $tables): array } /** - * @param list $sequences + * @param Sequence[] $sequences * * @return list * diff --git a/doctrine/dbal/src/SQL/Parser.php b/doctrine/dbal/src/SQL/Parser.php index ae0d4428f..418af799f 100644 --- a/doctrine/dbal/src/SQL/Parser.php +++ b/doctrine/dbal/src/SQL/Parser.php @@ -7,14 +7,9 @@ use Doctrine\DBAL\SQL\Parser\Visitor; use function array_merge; -use function assert; -use function current; use function implode; -use function key; -use function next; use function preg_last_error; use function preg_match; -use function reset; use function sprintf; use function strlen; @@ -45,6 +40,7 @@ final class Parser private const OTHER = '[^' . self::SPECIAL_CHARS . ']+'; private string $sqlPattern; + private string $tokenPattern; public function __construct(bool $mySQLStringEscaping) { @@ -69,7 +65,12 @@ public function __construct(bool $mySQLStringEscaping) self::OTHER, ]); - $this->sqlPattern = sprintf('(%s)', implode('|', $patterns)); + $this->sqlPattern = sprintf('(%s)', implode('|', $patterns)); + $this->tokenPattern = '~\\G' + . '(?P' . self::NAMED_PARAMETER . ')' + . '|(?P' . self::POSITIONAL_PARAMETER . ')' + . '|(?P' . $this->sqlPattern . '|' . self::SPECIAL . ')' + . '~s'; } /** @@ -79,40 +80,26 @@ public function __construct(bool $mySQLStringEscaping) */ public function parse(string $sql, Visitor $visitor): void { - /** @var array $patterns */ - $patterns = [ - self::NAMED_PARAMETER => static function (string $sql) use ($visitor): void { - $visitor->acceptNamedParameter($sql); - }, - self::POSITIONAL_PARAMETER => static function (string $sql) use ($visitor): void { - $visitor->acceptPositionalParameter($sql); - }, - $this->sqlPattern => static function (string $sql) use ($visitor): void { - $visitor->acceptOther($sql); - }, - self::SPECIAL => static function (string $sql) use ($visitor): void { - $visitor->acceptOther($sql); - }, - ]; - $offset = 0; - - while (($handler = current($patterns)) !== false) { - if (preg_match('~\G' . key($patterns) . '~s', $sql, $matches, 0, $offset) === 1) { - $handler($matches[0]); - reset($patterns); - - $offset += strlen($matches[0]); + $length = strlen($sql); + while ($offset < $length) { + if (preg_match($this->tokenPattern, $sql, $matches, 0, $offset) === 1) { + $match = $matches[0]; + if ($matches['named'] !== '') { + $visitor->acceptNamedParameter($match); + } elseif ($matches['positional'] !== '') { + $visitor->acceptPositionalParameter($match); + } else { + $visitor->acceptOther($match); + } + + $offset += strlen($match); } elseif (preg_last_error() !== PREG_NO_ERROR) { // @codeCoverageIgnoreStart throw RegularExpressionError::new(); // @codeCoverageIgnoreEnd - } else { - next($patterns); } } - - assert($offset === strlen($sql)); } private function getMySQLStringLiteralPattern(string $delimiter): string diff --git a/doctrine/dbal/src/Schema/Comparator.php b/doctrine/dbal/src/Schema/Comparator.php index 28e7f2f73..8114ec5e2 100644 --- a/doctrine/dbal/src/Schema/Comparator.php +++ b/doctrine/dbal/src/Schema/Comparator.php @@ -636,7 +636,7 @@ public function diffColumn(Column $column1, Column $column2) // null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation. if ( ($properties1['default'] === null) !== ($properties2['default'] === null) - || $properties1['default'] != $properties2['default'] + || $properties1['default'] != $properties2['default'] // @phpstan-ignore notEqual.notAllowed ) { $changedProperties[] = 'default'; } diff --git a/doctrine/dbal/src/Schema/Exception/ColumnAlreadyExists.php b/doctrine/dbal/src/Schema/Exception/ColumnAlreadyExists.php index cc7acea03..a0d62d20d 100644 --- a/doctrine/dbal/src/Schema/Exception/ColumnAlreadyExists.php +++ b/doctrine/dbal/src/Schema/Exception/ColumnAlreadyExists.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class ColumnAlreadyExists extends SchemaException { public static function new(string $tableName, string $columnName): self diff --git a/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php index c9036a07c..7c4bb633c 100644 --- a/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class ColumnDoesNotExist extends SchemaException { public static function new(string $columnName, string $table): self diff --git a/doctrine/dbal/src/Schema/Exception/ForeignKeyDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/ForeignKeyDoesNotExist.php index bf57cd4ff..4833de5c0 100644 --- a/doctrine/dbal/src/Schema/Exception/ForeignKeyDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/ForeignKeyDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class ForeignKeyDoesNotExist extends SchemaException { public static function new(string $foreignKeyName, string $table): self diff --git a/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php b/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php index 25facb58a..292bf81e4 100644 --- a/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php +++ b/doctrine/dbal/src/Schema/Exception/IndexAlreadyExists.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class IndexAlreadyExists extends SchemaException { public static function new(string $indexName, string $table): self diff --git a/doctrine/dbal/src/Schema/Exception/IndexDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/IndexDoesNotExist.php index 9f4024185..526819726 100644 --- a/doctrine/dbal/src/Schema/Exception/IndexDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/IndexDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class IndexDoesNotExist extends SchemaException { public static function new(string $indexName, string $table): self diff --git a/doctrine/dbal/src/Schema/Exception/IndexNameInvalid.php b/doctrine/dbal/src/Schema/Exception/IndexNameInvalid.php index 5230f506e..d69b7a930 100644 --- a/doctrine/dbal/src/Schema/Exception/IndexNameInvalid.php +++ b/doctrine/dbal/src/Schema/Exception/IndexNameInvalid.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class IndexNameInvalid extends SchemaException { public static function new(string $indexName): self diff --git a/doctrine/dbal/src/Schema/Exception/InvalidTableName.php b/doctrine/dbal/src/Schema/Exception/InvalidTableName.php index 50e2d3af9..763e920f6 100644 --- a/doctrine/dbal/src/Schema/Exception/InvalidTableName.php +++ b/doctrine/dbal/src/Schema/Exception/InvalidTableName.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class InvalidTableName extends SchemaException { public static function new(string $tableName): self diff --git a/doctrine/dbal/src/Schema/Exception/NamedForeignKeyRequired.php b/doctrine/dbal/src/Schema/Exception/NamedForeignKeyRequired.php index 92d237e7a..453286136 100644 --- a/doctrine/dbal/src/Schema/Exception/NamedForeignKeyRequired.php +++ b/doctrine/dbal/src/Schema/Exception/NamedForeignKeyRequired.php @@ -11,7 +11,6 @@ use function implode; use function sprintf; -/** @psalm-immutable */ final class NamedForeignKeyRequired extends SchemaException { public static function new(Table $localTable, ForeignKeyConstraint $foreignKey): self diff --git a/doctrine/dbal/src/Schema/Exception/NamespaceAlreadyExists.php b/doctrine/dbal/src/Schema/Exception/NamespaceAlreadyExists.php index 008bd5f0e..527e196ef 100644 --- a/doctrine/dbal/src/Schema/Exception/NamespaceAlreadyExists.php +++ b/doctrine/dbal/src/Schema/Exception/NamespaceAlreadyExists.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class NamespaceAlreadyExists extends SchemaException { public static function new(string $namespaceName): self diff --git a/doctrine/dbal/src/Schema/Exception/SequenceAlreadyExists.php b/doctrine/dbal/src/Schema/Exception/SequenceAlreadyExists.php index d719c6a06..206220ef7 100644 --- a/doctrine/dbal/src/Schema/Exception/SequenceAlreadyExists.php +++ b/doctrine/dbal/src/Schema/Exception/SequenceAlreadyExists.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class SequenceAlreadyExists extends SchemaException { public static function new(string $sequenceName): self diff --git a/doctrine/dbal/src/Schema/Exception/SequenceDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/SequenceDoesNotExist.php index 3f948835c..6b4912d52 100644 --- a/doctrine/dbal/src/Schema/Exception/SequenceDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/SequenceDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class SequenceDoesNotExist extends SchemaException { public static function new(string $sequenceName): self diff --git a/doctrine/dbal/src/Schema/Exception/TableAlreadyExists.php b/doctrine/dbal/src/Schema/Exception/TableAlreadyExists.php index d7b235937..c5a64f6b8 100644 --- a/doctrine/dbal/src/Schema/Exception/TableAlreadyExists.php +++ b/doctrine/dbal/src/Schema/Exception/TableAlreadyExists.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class TableAlreadyExists extends SchemaException { public static function new(string $tableName): self diff --git a/doctrine/dbal/src/Schema/Exception/TableDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/TableDoesNotExist.php index 7c6dda9ab..47c5f0eab 100644 --- a/doctrine/dbal/src/Schema/Exception/TableDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/TableDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class TableDoesNotExist extends SchemaException { public static function new(string $tableName): self diff --git a/doctrine/dbal/src/Schema/Exception/UniqueConstraintDoesNotExist.php b/doctrine/dbal/src/Schema/Exception/UniqueConstraintDoesNotExist.php index dad6116c6..0ce19f756 100644 --- a/doctrine/dbal/src/Schema/Exception/UniqueConstraintDoesNotExist.php +++ b/doctrine/dbal/src/Schema/Exception/UniqueConstraintDoesNotExist.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class UniqueConstraintDoesNotExist extends SchemaException { public static function new(string $constraintName, string $table): self diff --git a/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php b/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php index 7a7c6f87a..d128e224f 100644 --- a/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php +++ b/doctrine/dbal/src/Schema/Exception/UnknownColumnOption.php @@ -8,7 +8,6 @@ use function sprintf; -/** @psalm-immutable */ final class UnknownColumnOption extends SchemaException { public static function new(string $name): self diff --git a/doctrine/dbal/src/Schema/ForeignKeyConstraint.php b/doctrine/dbal/src/Schema/ForeignKeyConstraint.php index 2f0311cd6..dc69c629a 100644 --- a/doctrine/dbal/src/Schema/ForeignKeyConstraint.php +++ b/doctrine/dbal/src/Schema/ForeignKeyConstraint.php @@ -251,6 +251,10 @@ public function getUnqualifiedForeignTableName() $name = substr($name, $position + 1); } + if ($this->isIdentifierQuoted($name)) { + $name = $this->trimQuotes($name); + } + return strtolower($name); } diff --git a/doctrine/dbal/src/Schema/OracleSchemaManager.php b/doctrine/dbal/src/Schema/OracleSchemaManager.php index 073752214..3608e0566 100644 --- a/doctrine/dbal/src/Schema/OracleSchemaManager.php +++ b/doctrine/dbal/src/Schema/OracleSchemaManager.php @@ -107,8 +107,6 @@ protected function _getPortableTableDefinition($table) /** * {@inheritDoc} - * - * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { diff --git a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php index 3ad313eba..0510d1a82 100644 --- a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php +++ b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php @@ -287,8 +287,6 @@ protected function _getPortableTableDefinition($table) /** * {@inheritDoc} - * - * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { @@ -296,9 +294,16 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null foreach ($tableIndexes as $row) { $colNumbers = array_map('intval', explode(' ', $row['indkey'])); $columnNameSql = sprintf( - 'SELECT attnum, attname FROM pg_attribute WHERE attrelid=%d AND attnum IN (%s) ORDER BY attnum ASC', + <<<'SQL' + SELECT attnum, + quote_ident(attname) AS attname + FROM pg_attribute + WHERE attrelid = %d + AND attnum IN (%s) + ORDER BY attnum + SQL, $row['indrelid'], - implode(' ,', $colNumbers), + implode(', ', $colNumbers), ); $indexColumns = $this->_conn->fetchAllAssociative($columnNameSql); @@ -604,6 +609,8 @@ protected function selectTableNames(string $databaseName): Result AND table_name != 'geometry_columns' AND table_name != 'spatial_ref_sys' AND table_type = 'BASE TABLE' +ORDER BY + quote_ident(table_name) SQL; return $this->_conn->executeQuery($sql, [$databaseName]); @@ -614,7 +621,7 @@ protected function selectTableColumns(string $databaseName, ?string $tableName = $sql = 'SELECT'; if ($tableName === null) { - $sql .= ' c.relname AS table_name, n.nspname AS schema_name,'; + $sql .= ' quote_ident(c.relname) AS table_name, quote_ident(n.nspname) AS schema_name,'; } $sql .= sprintf(<<<'SQL' @@ -666,7 +673,7 @@ protected function selectIndexColumns(string $databaseName, ?string $tableName = $sql = 'SELECT'; if ($tableName === null) { - $sql .= ' tc.relname AS table_name, tn.nspname AS schema_name,'; + $sql .= ' quote_ident(tc.relname) AS table_name, quote_ident(tn.nspname) AS schema_name,'; } $sql .= <<<'SQL' @@ -690,7 +697,7 @@ protected function selectIndexColumns(string $databaseName, ?string $tableName = 'c.relnamespace = n.oid', ], $this->buildQueryConditions($tableName)); - $sql .= ' WHERE ' . implode(' AND ', $conditions) . ')'; + $sql .= ' WHERE ' . implode(' AND ', $conditions) . ') ORDER BY quote_ident(ic.relname)'; return $this->_conn->executeQuery($sql); } @@ -700,7 +707,7 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN $sql = 'SELECT'; if ($tableName === null) { - $sql .= ' tc.relname AS table_name, tn.nspname AS schema_name,'; + $sql .= ' quote_ident(tc.relname) AS table_name, quote_ident(tn.nspname) AS schema_name,'; } $sql .= <<<'SQL' @@ -717,7 +724,7 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN $conditions = array_merge(['n.oid = c.relnamespace'], $this->buildQueryConditions($tableName)); - $sql .= ' WHERE ' . implode(' AND ', $conditions) . ") AND r.contype = 'f'"; + $sql .= ' WHERE ' . implode(' AND ', $conditions) . ") AND r.contype = 'f' ORDER BY quote_ident(r.conname)"; return $this->_conn->executeQuery($sql); } @@ -728,7 +735,8 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN protected function fetchTableOptionsByTable(string $databaseName, ?string $tableName = null): array { $sql = <<<'SQL' -SELECT c.relname, +SELECT n.nspname AS schema_name, + c.relname AS table_name, CASE c.relpersistence WHEN 'u' THEN true ELSE false END as unlogged, obj_description(c.oid, 'pg_class') AS comment FROM pg_class c @@ -740,7 +748,12 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table $sql .= ' WHERE ' . implode(' AND ', $conditions); - return $this->_conn->fetchAllAssociativeIndexed($sql); + $tableOptions = []; + foreach ($this->_conn->iterateAssociative($sql) as $row) { + $tableOptions[$this->_getPortableTableDefinition($row)] = $row; + } + + return $tableOptions; } /** diff --git a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php index acef511ab..e82ccded1 100644 --- a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php +++ b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php @@ -197,7 +197,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) private function parseDefaultExpression(string $value): ?string { - while (preg_match('/^\((.*)\)$/s', $value, $matches)) { + while (preg_match('/^\((.*)\)$/s', $value, $matches) === 1) { $value = $matches[1]; } @@ -227,9 +227,15 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $name = $tableForeignKey['ForeignKey']; if (! isset($foreignKeys[$name])) { + $referencedTableName = $tableForeignKey['ReferenceTableName']; + + if ($tableForeignKey['ReferenceSchemaName'] !== 'dbo') { + $referencedTableName = $tableForeignKey['ReferenceSchemaName'] . '.' . $referencedTableName; + } + $foreignKeys[$name] = [ 'local_columns' => [$tableForeignKey['ColumnName']], - 'foreign_table' => $tableForeignKey['ReferenceTableName'], + 'foreign_table' => $referencedTableName, 'foreign_columns' => [$tableForeignKey['ReferenceColumnName']], 'name' => $name, 'options' => [ @@ -556,31 +562,29 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table { $sql = <<<'SQL' SELECT - tbl.name, + scm.name AS schema_name, + tbl.name AS table_name, p.value AS [table_comment] FROM sys.tables AS tbl + JOIN sys.schemas AS scm + ON tbl.schema_id = scm.schema_id INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1 SQL; - $conditions = ["SCHEMA_NAME(tbl.schema_id) = N'dbo'", "p.name = N'MS_Description'"]; - $params = []; + $conditions = ["p.name = N'MS_Description'"]; if ($tableName !== null) { - $conditions[] = "tbl.name = N'" . $tableName . "'"; + $conditions[] = $this->getTableWhereClause($tableName, 'scm.name', 'tbl.name'); } $sql .= ' WHERE ' . implode(' AND ', $conditions); - /** @var array> $metadata */ - $metadata = $this->_conn->executeQuery($sql, $params) - ->fetchAllAssociativeIndexed(); - $tableOptions = []; - foreach ($metadata as $table => $data) { + foreach ($this->_conn->iterateAssociative($sql) as $data) { $data = array_change_key_case($data, CASE_LOWER); - $tableOptions[$table] = [ + $tableOptions[$this->_getPortableTableDefinition($data)] = [ 'comment' => $data['table_comment'], ]; } diff --git a/doctrine/dbal/src/Schema/SchemaException.php b/doctrine/dbal/src/Schema/SchemaException.php index 4ec091f8d..24a9dd346 100644 --- a/doctrine/dbal/src/Schema/SchemaException.php +++ b/doctrine/dbal/src/Schema/SchemaException.php @@ -19,7 +19,6 @@ use function sprintf; -/** @psalm-immutable */ class SchemaException extends Exception { /** @deprecated Use {@see TableDoesNotExist} instead. */ diff --git a/doctrine/dbal/src/Schema/SqliteSchemaManager.php b/doctrine/dbal/src/Schema/SqliteSchemaManager.php index 0419e934b..4b96739e1 100644 --- a/doctrine/dbal/src/Schema/SqliteSchemaManager.php +++ b/doctrine/dbal/src/Schema/SqliteSchemaManager.php @@ -222,8 +222,6 @@ protected function _getPortableTableDefinition($table) /** * {@inheritDoc} - * - * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { @@ -510,9 +508,8 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey): Fore private function parseColumnCollationFromSQL(string $column, string $sql): ?string { - $pattern = '{(?:\W' . preg_quote($column) . '\W|\W' - . preg_quote($this->_platform->quoteSingleIdentifier($column)) - . '\W)[^,(]+(?:\([^()]+\)[^,]*)?(?:(?:DEFAULT|CHECK)\s*(?:\(.*?\))?[^,]*)*COLLATE\s+["\']?([^\s,"\')]+)}is'; + $pattern = '{' . $this->buildIdentifierPattern($column) + . '[^,(]+(?:\([^()]+\)[^,]*)?(?:(?:DEFAULT|CHECK)\s*(?:\(.*?\))?[^,]*)*COLLATE\s+["\']?([^\s,"\')]+)}is'; if (preg_match($pattern, $sql, $match) !== 1) { return null; @@ -524,9 +521,7 @@ private function parseColumnCollationFromSQL(string $column, string $sql): ?stri private function parseTableCommentFromSQL(string $table, string $sql): ?string { $pattern = '/\s* # Allow whitespace characters at start of line -CREATE\sTABLE # Match "CREATE TABLE" -(?:\W"' . preg_quote($this->_platform->quoteSingleIdentifier($table), '/') . '"\W|\W' . preg_quote($table, '/') - . '\W) # Match table name (quoted and unquoted) +CREATE\sTABLE' . $this->buildIdentifierPattern($table) . ' ( # Start capture (?:\s*--[^\n]*\n?)+ # Capture anything that starts with whitespaces followed by -- until the end of the line(s) )/ix'; @@ -542,8 +537,8 @@ 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'; + $pattern = '{[\s(,]' . $this->buildIdentifierPattern($column) + . '(?:\([^)]*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}i'; if (preg_match($pattern, $sql, $match) !== 1) { return null; @@ -554,6 +549,22 @@ private function parseColumnCommentFromSQL(string $column, string $sql): ?string return $comment === '' ? null : $comment; } + /** + * Returns a regular expression pattern that matches the given unquoted or quoted identifier. + */ + private function buildIdentifierPattern(string $identifier): string + { + return '(?:' . implode('|', array_map( + static function (string $sql): string { + return '\W' . preg_quote($sql, '/') . '\W'; + }, + [ + $identifier, + $this->_platform->quoteSingleIdentifier($identifier), + ], + )) . ')'; + } + /** @throws Exception */ private function getCreateTableSQL(string $table): string { @@ -704,7 +715,9 @@ protected function selectTableColumns(string $databaseName, ?string $tableName = if ($tableName !== null) { $conditions[] = 't.name = ?'; - $params[] = str_replace('.', '__', $tableName); + $params[] = $this->_platform->canEmulateSchemas() + ? str_replace('.', '__', $tableName) + : $tableName; } $sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, c.cid'; @@ -729,7 +742,9 @@ protected function selectIndexColumns(string $databaseName, ?string $tableName = if ($tableName !== null) { $conditions[] = 't.name = ?'; - $params[] = str_replace('.', '__', $tableName); + $params[] = $this->_platform->canEmulateSchemas() + ? str_replace('.', '__', $tableName) + : $tableName; } $sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, i.seq'; @@ -755,7 +770,9 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN if ($tableName !== null) { $conditions[] = 't.name = ?'; - $params[] = str_replace('.', '__', $tableName); + $params[] = $this->_platform->canEmulateSchemas() + ? str_replace('.', '__', $tableName) + : $tableName; } $sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY t.name, p.id DESC, p.seq'; diff --git a/doctrine/dbal/src/Tools/Console/Command/CommandCompatibility.php b/doctrine/dbal/src/Tools/Console/Command/CommandCompatibility.php index 562b5ce45..0ef081c74 100644 --- a/doctrine/dbal/src/Tools/Console/Command/CommandCompatibility.php +++ b/doctrine/dbal/src/Tools/Console/Command/CommandCompatibility.php @@ -9,10 +9,32 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -if ((new ReflectionMethod(Command::class, 'execute'))->hasReturnType()) { +// Symfony 8 +if ((new ReflectionMethod(Command::class, 'configure'))->hasReturnType()) { /** @internal */ trait CommandCompatibility { + protected function configure(): void + { + $this->doConfigure(); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + return $this->doExecute($input, $output); + } + } +// Symfony 7 +} elseif ((new ReflectionMethod(Command::class, 'execute'))->hasReturnType()) { + /** @internal */ + trait CommandCompatibility + { + /** @return void */ + protected function configure() + { + $this->doConfigure(); + } + protected function execute(InputInterface $input, OutputInterface $output): int { return $this->doExecute($input, $output); @@ -22,6 +44,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @internal */ trait CommandCompatibility { + /** @return void */ + protected function configure() + { + $this->doConfigure(); + } + /** * {@inheritDoc} * diff --git a/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php index 2204b2e2a..238af5ed6 100644 --- a/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\Platforms\Keywords\DB2Keywords; use Doctrine\DBAL\Platforms\Keywords\KeywordList; use Doctrine\DBAL\Platforms\Keywords\MariaDb102Keywords; +use Doctrine\DBAL\Platforms\Keywords\MariaDb117Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords; use Doctrine\DBAL\Platforms\Keywords\MySQL84Keywords; @@ -57,6 +58,7 @@ public function __construct(ConnectionProvider $connectionProvider) $this->keywordLists = [ 'db2' => new DB2Keywords(), 'mariadb102' => new MariaDb102Keywords(), + 'mariadb117' => new MariaDb117Keywords(), 'mysql' => new MySQLKeywords(), 'mysql57' => new MySQL57Keywords(), 'mysql80' => new MySQL80Keywords(), @@ -97,8 +99,7 @@ public function setKeywordListClass($name, $class) $this->keywordLists[$name] = new $class(); } - /** @return void */ - protected function configure() + private function doConfigure(): void { $this ->setName('dbal:reserved-words') @@ -129,6 +130,7 @@ protected function configure() * db2 * mariadb102 + * mariadb117 * mysql * mysql57 * mysql80 diff --git a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php index 4e5681e27..64913be67 100644 --- a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php @@ -37,8 +37,7 @@ public function __construct(ConnectionProvider $connectionProvider) $this->connectionProvider = $connectionProvider; } - /** @return void */ - protected function configure() + private function doConfigure(): void { $this ->setName('dbal:run-sql') diff --git a/doctrine/dbal/src/Tools/DsnParser.php b/doctrine/dbal/src/Tools/DsnParser.php index 4ac0484d1..753701491 100644 --- a/doctrine/dbal/src/Tools/DsnParser.php +++ b/doctrine/dbal/src/Tools/DsnParser.php @@ -19,7 +19,7 @@ use function strpos; use function substr; -/** @psalm-import-type Params from DriverManager */ +/** @phpstan-import-type Params from DriverManager */ final class DsnParser { /** @var array> */ @@ -32,7 +32,7 @@ public function __construct(array $schemeMapping = []) } /** - * @psalm-return Params + * @phpstan-return Params * * @throws MalformedDsnException */ diff --git a/doctrine/dbal/src/Types/ArrayType.php b/doctrine/dbal/src/Types/ArrayType.php index c2aa2f4de..83940bf1e 100644 --- a/doctrine/dbal/src/Types/ArrayType.php +++ b/doctrine/dbal/src/Types/ArrayType.php @@ -35,7 +35,6 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { - // @todo 3.0 - $value === null check to save real NULL in database return serialize($value); } diff --git a/doctrine/dbal/src/Types/ConversionException.php b/doctrine/dbal/src/Types/ConversionException.php index 154b06d3e..2401aaeb9 100644 --- a/doctrine/dbal/src/Types/ConversionException.php +++ b/doctrine/dbal/src/Types/ConversionException.php @@ -19,8 +19,6 @@ /** * Conversion Exception is thrown when the database to PHP conversion fails. - * - * @psalm-immutable */ class ConversionException extends Exception { diff --git a/doctrine/dbal/src/Types/DateTimeTzImmutableType.php b/doctrine/dbal/src/Types/DateTimeTzImmutableType.php index e700f68d4..70f2c78b6 100644 --- a/doctrine/dbal/src/Types/DateTimeTzImmutableType.php +++ b/doctrine/dbal/src/Types/DateTimeTzImmutableType.php @@ -22,7 +22,7 @@ public function getName() /** * {@inheritDoc} * - * @psalm-param T $value + * @phpstan-param T $value * * @return (T is null ? null : string) * diff --git a/doctrine/dbal/src/Types/DateType.php b/doctrine/dbal/src/Types/DateType.php index 842e8bd09..86a5ab1ec 100644 --- a/doctrine/dbal/src/Types/DateType.php +++ b/doctrine/dbal/src/Types/DateType.php @@ -34,7 +34,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) /** * {@inheritDoc} * - * @psalm-param T $value + * @phpstan-param T $value * * @return (T is null ? null : string) * diff --git a/doctrine/event-manager/psalm-baseline.xml b/doctrine/event-manager/psalm-baseline.xml new file mode 100644 index 000000000..bc48ad847 --- /dev/null +++ b/doctrine/event-manager/psalm-baseline.xml @@ -0,0 +1,8 @@ + + + + + listeners[$event])]]> + + + diff --git a/doctrine/event-manager/src/EventArgs.php b/doctrine/event-manager/src/EventArgs.php index 4795ba6be..eea3d8a0a 100644 --- a/doctrine/event-manager/src/EventArgs.php +++ b/doctrine/event-manager/src/EventArgs.php @@ -15,10 +15,8 @@ class EventArgs { /** * Single instance of EventArgs. - * - * @var EventArgs|null */ - private static $_emptyEventArgsInstance; + private static EventArgs|null $emptyEventArgsInstance = null; /** * Gets the single, empty and immutable EventArgs instance. @@ -31,15 +29,9 @@ class EventArgs * * @link https://msdn.microsoft.com/en-us/library/system.eventargs.aspx * @see EventManager::dispatchEvent - * - * @return EventArgs */ - public static function getEmptyInstance() + public static function getEmptyInstance(): EventArgs { - if (! self::$_emptyEventArgsInstance) { - self::$_emptyEventArgsInstance = new EventArgs(); - } - - return self::$_emptyEventArgsInstance; + return self::$emptyEventArgsInstance ??= new EventArgs(); } } diff --git a/doctrine/event-manager/src/EventManager.php b/doctrine/event-manager/src/EventManager.php index 6d841be27..86f5e4536 100644 --- a/doctrine/event-manager/src/EventManager.php +++ b/doctrine/event-manager/src/EventManager.php @@ -1,8 +1,8 @@ */ - private $listeners = []; + private array $listeners = []; /** * Dispatches an event to all registered listeners. @@ -28,16 +28,14 @@ class EventManager * the name of the method that is invoked on listeners. * @param EventArgs|null $eventArgs The event arguments to pass to the event handlers/listeners. * If not supplied, the single empty EventArgs instance is used. - * - * @return void */ - public function dispatchEvent($eventName, ?EventArgs $eventArgs = null) + public function dispatchEvent(string $eventName, EventArgs|null $eventArgs = null): void { if (! isset($this->listeners[$eventName])) { return; } - $eventArgs = $eventArgs ?? EventArgs::getEmptyInstance(); + $eventArgs ??= EventArgs::getEmptyInstance(); foreach ($this->listeners[$eventName] as $listener) { $listener->$eventName($eventArgs); @@ -47,24 +45,12 @@ public function dispatchEvent($eventName, ?EventArgs $eventArgs = null) /** * Gets the listeners of a specific event. * - * @param string|null $event The name of the event. + * @param string $event The name of the event. * - * @return object[]|array The event listeners for the specified event, or all event listeners. - * @psalm-return ($event is null ? array : object[]) + * @return object[] */ - public function getListeners($event = null) + public function getListeners(string $event): array { - if ($event === null) { - Deprecation::trigger( - 'doctrine/event-manager', - 'https://github.com/doctrine/event-manager/pull/50', - 'Calling %s without an event name is deprecated. Call getAllListeners() instead.', - __METHOD__ - ); - - return $this->getAllListeners(); - } - return $this->listeners[$event] ?? []; } @@ -80,12 +66,8 @@ public function getAllListeners(): array /** * Checks whether an event has any registered listeners. - * - * @param string $event - * - * @return bool TRUE if the specified event has any listeners, FALSE otherwise. */ - public function hasListeners($event) + public function hasListeners(string $event): bool { return ! empty($this->listeners[$event]); } @@ -95,10 +77,8 @@ public function hasListeners($event) * * @param string|string[] $events The event(s) to listen on. * @param object $listener The listener object. - * - * @return void */ - public function addEventListener($events, $listener) + public function addEventListener(string|array $events, object $listener): void { // Picks the hash code related to that listener $hash = spl_object_hash($listener); @@ -114,11 +94,8 @@ public function addEventListener($events, $listener) * Removes an event listener from the specified events. * * @param string|string[] $events - * @param object $listener - * - * @return void */ - public function removeEventListener($events, $listener) + public function removeEventListener(string|array $events, object $listener): void { // Picks the hash code related to that listener $hash = spl_object_hash($listener); @@ -129,27 +106,23 @@ public function removeEventListener($events, $listener) } /** - * Adds an EventSubscriber. The subscriber is asked for all the events it is - * interested in and added as a listener for these events. + * Adds an EventSubscriber. * - * @param EventSubscriber $subscriber The subscriber. - * - * @return void + * The subscriber is asked for all the events it is interested in and added + * as a listener for these events. */ - public function addEventSubscriber(EventSubscriber $subscriber) + public function addEventSubscriber(EventSubscriber $subscriber): void { $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber); } /** - * Removes an EventSubscriber. The subscriber is asked for all the events it is - * interested in and removed as a listener for these events. - * - * @param EventSubscriber $subscriber The subscriber. + * Removes an EventSubscriber. * - * @return void + * The subscriber is asked for all the events it is interested in and removed + * as a listener for these events. */ - public function removeEventSubscriber(EventSubscriber $subscriber) + public function removeEventSubscriber(EventSubscriber $subscriber): void { $this->removeEventListener($subscriber->getSubscribedEvents(), $subscriber); }