From 84c0549ea4b3b058d747c9e5c4100834579a3c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 17 Nov 2022 17:09:20 +0100 Subject: [PATCH 1/3] Bump doctrine/dbal to 3.3.8 in master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- composer.json | 2 +- composer.lock | 234 +- composer/autoload_classmap.php | 45 +- composer/autoload_psr4.php | 4 +- composer/autoload_static.php | 57 +- composer/installed.json | 246 +- composer/installed.php | 52 +- .../package-versions-deprecated/CHANGELOG.md | 120 - .../CONTRIBUTING.md | 39 - .../package-versions-deprecated/README.md | 5 - .../package-versions-deprecated/SECURITY.md | 5 - .../package-versions-deprecated/composer.json | 48 - .../package-versions-deprecated/composer.lock | 2603 ----------------- .../src/PackageVersions/FallbackVersions.php | 128 - .../src/PackageVersions/Installer.php | 290 -- .../src/PackageVersions/Versions.php | 92 - doctrine/cache/UPGRADE-1.11.md | 12 + .../Common/Cache/Psr6/DoctrineProvider.php | 10 + doctrine/dbal/README.md | 38 +- doctrine/dbal/composer.json | 32 +- doctrine/dbal/src/Cache/ArrayResult.php | 6 +- doctrine/dbal/src/Cache/CachingResult.php | 184 -- doctrine/dbal/src/Cache/QueryCacheProfile.php | 80 +- doctrine/dbal/src/Configuration.php | 49 + doctrine/dbal/src/Connection.php | 240 +- .../src/Driver/API/ExceptionConverter.php | 4 +- .../Driver/API/IBMDB2/ExceptionConverter.php | 44 + .../Driver/API/MySQL/ExceptionConverter.php | 5 + .../src/Driver/API/OCI/ExceptionConverter.php | 10 + .../API/PostgreSQL/ExceptionConverter.php | 8 + .../Driver/API/SQLSrv/ExceptionConverter.php | 48 + .../API/SQLite/UserDefinedFunctions.php | 48 + .../dbal/src/Driver/AbstractDB2Driver.php | 6 +- .../dbal/src/Driver/AbstractException.php | 2 +- .../dbal/src/Driver/AbstractMySQLDriver.php | 16 +- .../dbal/src/Driver/AbstractOracleDriver.php | 6 +- .../src/Driver/AbstractPostgreSQLDriver.php | 14 +- .../src/Driver/AbstractSQLServerDriver.php | 6 +- .../dbal/src/Driver/AbstractSQLiteDriver.php | 6 +- doctrine/dbal/src/Driver/Connection.php | 5 + .../dbal/src/Driver/IBMDB2/Connection.php | 88 +- doctrine/dbal/src/Driver/IBMDB2/Driver.php | 28 +- .../Exception/CannotWriteToTemporaryFile.php | 29 - .../IBMDB2/Exception/ConnectionError.php | 7 +- .../IBMDB2/Exception/ConnectionFailed.php | 7 +- .../src/Driver/IBMDB2/Exception/Factory.php | 35 + .../IBMDB2/Exception/StatementError.php | 16 +- doctrine/dbal/src/Driver/IBMDB2/Statement.php | 88 +- .../AbstractConnectionMiddleware.php | 116 + .../Middleware/AbstractDriverMiddleware.php | 61 + .../Middleware/AbstractResultMiddleware.php | 79 + .../AbstractStatementMiddleware.php | 42 + .../dbal/src/Driver/Mysqli/Connection.php | 141 +- doctrine/dbal/src/Driver/Mysqli/Driver.php | 43 +- .../Mysqli/Exception/ConnectionFailed.php | 7 +- doctrine/dbal/src/Driver/Mysqli/Result.php | 15 +- doctrine/dbal/src/Driver/Mysqli/Statement.php | 98 +- doctrine/dbal/src/Driver/OCI8/Connection.php | 114 +- doctrine/dbal/src/Driver/OCI8/Driver.php | 40 +- doctrine/dbal/src/Driver/OCI8/Statement.php | 79 +- doctrine/dbal/src/Driver/PDO/Connection.php | 68 +- doctrine/dbal/src/Driver/PDO/Exception.php | 4 + doctrine/dbal/src/Driver/PDO/MySQL/Driver.php | 24 +- doctrine/dbal/src/Driver/PDO/OCI/Driver.php | 24 +- doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php | 35 +- doctrine/dbal/src/Driver/PDO/Result.php | 9 +- .../dbal/src/Driver/PDO/SQLSrv/Connection.php | 72 +- .../dbal/src/Driver/PDO/SQLSrv/Driver.php | 27 +- .../dbal/src/Driver/PDO/SQLSrv/Statement.php | 26 +- .../dbal/src/Driver/PDO/SQLite/Driver.php | 35 +- doctrine/dbal/src/Driver/PDO/Statement.php | 19 +- .../dbal/src/Driver/SQLSrv/Connection.php | 66 +- doctrine/dbal/src/Driver/SQLSrv/Driver.php | 16 +- doctrine/dbal/src/Driver/SQLSrv/Statement.php | 8 +- .../src/Driver/ServerInfoAwareConnection.php | 5 +- doctrine/dbal/src/Driver/Statement.php | 8 +- doctrine/dbal/src/DriverManager.php | 22 +- .../SchemaAlterTableAddColumnEventArgs.php | 2 +- .../SchemaAlterTableChangeColumnEventArgs.php | 2 +- .../src/Event/SchemaAlterTableEventArgs.php | 2 +- .../SchemaAlterTableRemoveColumnEventArgs.php | 2 +- .../SchemaAlterTableRenameColumnEventArgs.php | 2 +- .../Event/SchemaColumnDefinitionEventArgs.php | 2 +- .../SchemaCreateTableColumnEventArgs.php | 2 +- .../src/Event/SchemaCreateTableEventArgs.php | 2 +- .../src/Event/SchemaDropTableEventArgs.php | 2 +- .../Event/SchemaIndexDefinitionEventArgs.php | 2 +- .../src/Event/TransactionBeginEventArgs.php | 9 + .../src/Event/TransactionCommitEventArgs.php | 9 + .../dbal/src/Event/TransactionEventArgs.php | 24 + .../Event/TransactionRollBackEventArgs.php | 9 + doctrine/dbal/src/Events.php | 3 + doctrine/dbal/src/Exception.php | 5 - .../src/Exception/DatabaseDoesNotExist.php | 10 + .../dbal/src/Exception/SchemaDoesNotExist.php | 10 + doctrine/dbal/src/ExpandArrayParameters.php | 6 +- doctrine/dbal/src/Id/TableGenerator.php | 9 + .../src/Id/TableGeneratorSchemaVisitor.php | 10 + doctrine/dbal/src/Logging/Connection.php | 85 + doctrine/dbal/src/Logging/DebugStack.php | 13 + doctrine/dbal/src/Logging/Driver.php | 56 + doctrine/dbal/src/Logging/LoggerChain.php | 10 + doctrine/dbal/src/Logging/Middleware.php | 25 + doctrine/dbal/src/Logging/SQLLogger.php | 3 + doctrine/dbal/src/Logging/Statement.php | 76 + .../src/Platforms/AbstractMySQLPlatform.php | 1188 ++++++++ .../dbal/src/Platforms/AbstractPlatform.php | 607 +++- doctrine/dbal/src/Platforms/DB2Platform.php | 77 +- .../src/Platforms/Keywords/KeywordList.php | 2 + .../Platforms/Keywords/MariaDBKeywords.php | 267 ++ .../Platforms/Keywords/MariaDb102Keywords.php | 259 +- .../Platforms/Keywords/MySQL57Keywords.php | 2 + .../Keywords/PostgreSQL100Keywords.php | 2 + .../Keywords/PostgreSQL94Keywords.php | 119 +- .../Platforms/Keywords/PostgreSQLKeywords.php | 125 + .../Keywords/ReservedKeywordsValidator.php | 6 +- .../Keywords/SQLServer2012Keywords.php | 207 +- .../Platforms/Keywords/SQLServerKeywords.php | 214 ++ .../dbal/src/Platforms/MariaDBPlatform.php | 44 + .../src/Platforms/MariaDb1027Platform.php | 39 +- .../MySQL/CollationMetadataProvider.php | 13 + .../CachingCollationMetadataProvider.php | 35 + .../ConnectionCollationMetadataProvider.php | 45 + .../dbal/src/Platforms/MySQL/Comparator.php | 87 + .../dbal/src/Platforms/MySQL57Platform.php | 5 +- .../dbal/src/Platforms/MySQL80Platform.php | 2 +- doctrine/dbal/src/Platforms/MySQLPlatform.php | 1189 +------- .../dbal/src/Platforms/OraclePlatform.php | 92 +- .../src/Platforms/PostgreSQL100Platform.php | 5 +- .../src/Platforms/PostgreSQL94Platform.php | 1301 +------- .../dbal/src/Platforms/PostgreSQLPlatform.php | 1276 ++++++++ .../src/Platforms/SQLServer/Comparator.php | 56 + .../src/Platforms/SQLServer2012Platform.php | 1727 +---------- .../dbal/src/Platforms/SQLServerPlatform.php | 1660 +++++++++++ .../dbal/src/Platforms/SQLite/Comparator.php | 53 + .../dbal/src/Platforms/SqlitePlatform.php | 92 +- doctrine/dbal/src/Portability/Connection.php | 61 +- doctrine/dbal/src/Portability/Converter.php | 2 +- doctrine/dbal/src/Portability/Driver.php | 61 +- .../dbal/src/Portability/OptimizeFlags.php | 14 +- doctrine/dbal/src/Portability/Result.php | 36 +- doctrine/dbal/src/Portability/Statement.php | 28 +- .../Query/Expression/ExpressionBuilder.php | 5 +- doctrine/dbal/src/Query/QueryBuilder.php | 41 +- doctrine/dbal/src/Result.php | 34 +- doctrine/dbal/src/SQL/Parser.php | 2 +- doctrine/dbal/src/Schema/AbstractAsset.php | 10 + .../dbal/src/Schema/AbstractSchemaManager.php | 186 +- doctrine/dbal/src/Schema/ColumnDiff.php | 11 + doctrine/dbal/src/Schema/Comparator.php | 139 +- doctrine/dbal/src/Schema/Constraint.php | 2 + doctrine/dbal/src/Schema/DB2SchemaManager.php | 7 +- .../dbal/src/Schema/ForeignKeyConstraint.php | 14 +- doctrine/dbal/src/Schema/Index.php | 4 +- .../dbal/src/Schema/MySQLSchemaManager.php | 40 +- .../dbal/src/Schema/OracleSchemaManager.php | 18 +- .../src/Schema/PostgreSQLSchemaManager.php | 53 +- .../src/Schema/SQLServerSchemaManager.php | 83 +- doctrine/dbal/src/Schema/Schema.php | 46 +- doctrine/dbal/src/Schema/SchemaConfig.php | 24 +- doctrine/dbal/src/Schema/SchemaDiff.php | 5 +- .../dbal/src/Schema/SqliteSchemaManager.php | 76 +- doctrine/dbal/src/Schema/Table.php | 4 +- .../Visitor/CreateSchemaSqlCollector.php | 2 +- doctrine/dbal/src/Schema/Visitor/Graphviz.php | 15 +- doctrine/dbal/src/Statement.php | 33 +- .../Tools/Console/Command/RunSqlCommand.php | 44 +- .../dbal/src/Tools/Console/ConsoleRunner.php | 11 +- doctrine/dbal/src/Tools/Dumper.php | 181 -- doctrine/dbal/src/Types/ArrayType.php | 7 + doctrine/dbal/src/Types/AsciiStringType.php | 7 +- doctrine/dbal/src/Types/BooleanType.php | 11 + .../dbal/src/Types/ConversionException.php | 10 +- doctrine/dbal/src/Types/DecimalType.php | 5 +- doctrine/dbal/src/Types/JsonType.php | 26 +- doctrine/dbal/src/Types/Type.php | 13 +- .../dbal/src/VersionAwarePlatformDriver.php | 2 + doctrine/deprecations/.gitignore | 3 - .../deprecations}/LICENSE | 2 +- doctrine/deprecations/README.md | 7 + doctrine/deprecations/composer.json | 11 +- doctrine/deprecations/phpcs.xml | 2 + doctrine/deprecations/phpunit.xml.dist | 8 - .../deprecations/test_fixtures/src/Foo.php | 22 - .../test_fixtures/src/RootDeprecation.php | 20 - doctrine/event-manager/.doctrine-project.json | 18 - doctrine/event-manager/README.md | 6 +- doctrine/event-manager/UPGRADE.md | 7 + doctrine/event-manager/composer.json | 63 +- doctrine/event-manager/phpstan.neon.dist | 5 + doctrine/event-manager/psalm.xml | 15 + .../Doctrine/Common => src}/EventArgs.php | 2 +- .../Doctrine/Common => src}/EventManager.php | 44 +- .../Common => src}/EventSubscriber.php | 2 +- psr/cache/LICENSE.txt | 19 + psr/cache/README.md | 9 + psr/cache/composer.json | 25 + psr/cache/src/CacheException.php | 10 + psr/cache/src/CacheItemInterface.php | 105 + psr/cache/src/CacheItemPoolInterface.php | 138 + psr/cache/src/InvalidArgumentException.php | 13 + 201 files changed, 9079 insertions(+), 10488 deletions(-) delete mode 100644 composer/package-versions-deprecated/CHANGELOG.md delete mode 100644 composer/package-versions-deprecated/CONTRIBUTING.md delete mode 100644 composer/package-versions-deprecated/README.md delete mode 100644 composer/package-versions-deprecated/SECURITY.md delete mode 100644 composer/package-versions-deprecated/composer.json delete mode 100644 composer/package-versions-deprecated/composer.lock delete mode 100644 composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php delete mode 100644 composer/package-versions-deprecated/src/PackageVersions/Installer.php delete mode 100644 composer/package-versions-deprecated/src/PackageVersions/Versions.php delete mode 100644 doctrine/dbal/src/Cache/CachingResult.php create mode 100644 doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php delete mode 100644 doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php create mode 100644 doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php create mode 100644 doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php create mode 100644 doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php create mode 100644 doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php create mode 100644 doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php create mode 100644 doctrine/dbal/src/Event/TransactionBeginEventArgs.php create mode 100644 doctrine/dbal/src/Event/TransactionCommitEventArgs.php create mode 100644 doctrine/dbal/src/Event/TransactionEventArgs.php create mode 100644 doctrine/dbal/src/Event/TransactionRollBackEventArgs.php create mode 100644 doctrine/dbal/src/Exception/DatabaseDoesNotExist.php create mode 100644 doctrine/dbal/src/Exception/SchemaDoesNotExist.php create mode 100644 doctrine/dbal/src/Logging/Connection.php create mode 100644 doctrine/dbal/src/Logging/Driver.php create mode 100644 doctrine/dbal/src/Logging/Middleware.php create mode 100644 doctrine/dbal/src/Logging/Statement.php create mode 100644 doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php create mode 100644 doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php create mode 100644 doctrine/dbal/src/Platforms/Keywords/PostgreSQLKeywords.php create mode 100644 doctrine/dbal/src/Platforms/Keywords/SQLServerKeywords.php create mode 100644 doctrine/dbal/src/Platforms/MariaDBPlatform.php create mode 100644 doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php create mode 100644 doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php create mode 100644 doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php create mode 100644 doctrine/dbal/src/Platforms/MySQL/Comparator.php create mode 100644 doctrine/dbal/src/Platforms/PostgreSQLPlatform.php create mode 100644 doctrine/dbal/src/Platforms/SQLServer/Comparator.php create mode 100644 doctrine/dbal/src/Platforms/SQLServerPlatform.php create mode 100644 doctrine/dbal/src/Platforms/SQLite/Comparator.php delete mode 100644 doctrine/dbal/src/Tools/Dumper.php delete mode 100644 doctrine/deprecations/.gitignore rename {composer/package-versions-deprecated => doctrine/deprecations}/LICENSE (96%) delete mode 100644 doctrine/deprecations/phpunit.xml.dist delete mode 100644 doctrine/deprecations/test_fixtures/src/Foo.php delete mode 100644 doctrine/deprecations/test_fixtures/src/RootDeprecation.php delete mode 100644 doctrine/event-manager/.doctrine-project.json create mode 100644 doctrine/event-manager/UPGRADE.md create mode 100644 doctrine/event-manager/phpstan.neon.dist create mode 100644 doctrine/event-manager/psalm.xml rename doctrine/event-manager/{lib/Doctrine/Common => src}/EventArgs.php (97%) rename doctrine/event-manager/{lib/Doctrine/Common => src}/EventManager.php (72%) rename doctrine/event-manager/{lib/Doctrine/Common => src}/EventSubscriber.php (86%) create mode 100644 psr/cache/LICENSE.txt create mode 100644 psr/cache/README.md create mode 100644 psr/cache/composer.json create mode 100644 psr/cache/src/CacheException.php create mode 100644 psr/cache/src/CacheItemInterface.php create mode 100644 psr/cache/src/CacheItemPoolInterface.php create mode 100644 psr/cache/src/InvalidArgumentException.php diff --git a/composer.json b/composer.json index f4549fb96..548d8aa23 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "cweagans/composer-patches": "^1.7", "deepdiver/zipstreamer": "2.0.0", "deepdiver1975/tarstreamer": "v2.0.0", - "doctrine/dbal": "3.1.4", + "doctrine/dbal": "3.3.8", "egulias/email-validator": "3.1.1", "fusonic/opengraph": "^2.2", "giggsey/libphonenumber-for-php": "^8.12.37", diff --git a/composer.lock b/composer.lock index 2d3cd6f1b..6e4230849 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": "a1604425ae48e816f49a424526091ad7", + "content-hash": "f436bcdb0e4a3172df23313ad2a4fd67", "packages": [ { "name": "aws/aws-crt-php", @@ -343,79 +343,6 @@ }, "time": "2021-11-29T15:02:22+00:00" }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-09-13T08:41:34+00:00" - }, { "name": "cweagans/composer-patches", "version": "1.7.1", @@ -577,16 +504,16 @@ }, { "name": "doctrine/cache", - "version": "2.1.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce" + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/331b4d5dbaeab3827976273e9356b3b453c300ce", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", "shasum": "" }, "require": { @@ -596,18 +523,12 @@ "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "predis/predis": "~1.0", + "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.2 || ^6.0@dev", - "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" }, "type": "library", "autoload": { @@ -656,7 +577,7 @@ ], "support": { "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.1.1" + "source": "https://github.com/doctrine/cache/tree/2.2.0" }, "funding": [ { @@ -672,40 +593,42 @@ "type": "tidelift" } ], - "time": "2021-07-17T14:49:29+00:00" + "time": "2022-05-20T20:07:39+00:00" }, { "name": "doctrine/dbal", - "version": "3.1.4", + "version": "3.3.8", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9" + "reference": "f873a820227bc352d023791775a01f078a30dfe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/821b4f01a36ce63ed36c090ea74767b72db367e9", - "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/f873a820227bc352d023791775a01f078a30dfe1", + "reference": "f873a820227bc352d023791775a01f078a30dfe1", "shasum": "" }, "require": { - "composer/package-versions-deprecated": "^1.11.99", - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3", + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", - "php": "^7.3 || ^8.0" + "php": "^7.3 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.1.1", - "phpstan/phpstan-strict-rules": "^1", - "phpunit/phpunit": "9.5.10", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.1", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.8.2", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "9.5.21", + "psalm/plugin-phpunit": "0.17.0", + "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.12.0" + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.24.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -765,7 +688,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.4" + "source": "https://github.com/doctrine/dbal/tree/3.3.8" }, "funding": [ { @@ -781,29 +704,29 @@ "type": "tidelift" } ], - "time": "2021-11-15T16:44:33+00:00" + "time": "2022-08-05T15:35:35+00:00" }, { "name": "doctrine/deprecations", - "version": "v0.5.3", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", "shasum": "" }, "require": { "php": "^7.1|^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0" + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -822,43 +745,41 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v0.5.3" + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" }, - "time": "2021-03-21T12:59:47+00:00" + "time": "2022-05-02T15:47:09+00:00" }, { "name": "doctrine/event-manager", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", "shasum": "" }, "require": { + "doctrine/deprecations": "^0.5.3 || ^1", "php": "^7.1 || ^8.0" }, "conflict": { - "doctrine/common": "<2.9@dev" + "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" + "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" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" + "Doctrine\\Common\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -902,7 +823,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + "source": "https://github.com/doctrine/event-manager/tree/1.2.0" }, "funding": [ { @@ -918,7 +839,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T18:28:51+00:00" + "time": "2022-10-12T20:51:15+00:00" }, { "name": "doctrine/lexer", @@ -3311,6 +3232,55 @@ }, "time": "2021-10-28T11:13:42+00:00" }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "time": "2016-08-06T20:24:11+00:00" + }, { "name": "psr/container", "version": "1.1.1", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 66b569111..4dd597bf9 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -1051,16 +1051,15 @@ '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/lib/Doctrine/Common/EventArgs.php', - 'Doctrine\\Common\\EventManager' => $vendorDir . '/doctrine/event-manager/lib/Doctrine/Common/EventManager.php', - 'Doctrine\\Common\\EventSubscriber' => $vendorDir . '/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.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', 'Doctrine\\Common\\Lexer\\AbstractLexer' => $vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingNamedParameter' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingPositionalParameter' => $vendorDir . '/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php', 'Doctrine\\DBAL\\Cache\\ArrayResult' => $vendorDir . '/doctrine/dbal/src/Cache/ArrayResult.php', 'Doctrine\\DBAL\\Cache\\CacheException' => $vendorDir . '/doctrine/dbal/src/Cache/CacheException.php', - 'Doctrine\\DBAL\\Cache\\CachingResult' => $vendorDir . '/doctrine/dbal/src/Cache/CachingResult.php', 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => $vendorDir . '/doctrine/dbal/src/Cache/QueryCacheProfile.php', 'Doctrine\\DBAL\\ColumnCase' => $vendorDir . '/doctrine/dbal/src/ColumnCase.php', 'Doctrine\\DBAL\\Configuration' => $vendorDir . '/doctrine/dbal/src/Configuration.php', @@ -1076,6 +1075,7 @@ 'Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php', 'Doctrine\\DBAL\\Driver\\API\\SQLSrv\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php', 'Doctrine\\DBAL\\Driver\\API\\SQLite\\ExceptionConverter' => $vendorDir . '/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLite\\UserDefinedFunctions' => $vendorDir . '/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php', 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractDB2Driver.php', 'Doctrine\\DBAL\\Driver\\AbstractException' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractException.php', 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => $vendorDir . '/doctrine/dbal/src/Driver/AbstractMySQLDriver.php', @@ -1094,14 +1094,18 @@ 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Driver.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\Factory' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Result' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Result.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => $vendorDir . '/doctrine/dbal/src/Driver/IBMDB2/Statement.php', 'Doctrine\\DBAL\\Driver\\Middleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractConnectionMiddleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractDriverMiddleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractResultMiddleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractStatementMiddleware' => $vendorDir . '/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Connection.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Driver.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => $vendorDir . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php', @@ -1162,11 +1166,16 @@ 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php', 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaEventArgs.php', 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionBeginEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/TransactionBeginEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionCommitEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/TransactionCommitEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/TransactionEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionRollBackEventArgs' => $vendorDir . '/doctrine/dbal/src/Event/TransactionRollBackEventArgs.php', 'Doctrine\\DBAL\\Events' => $vendorDir . '/doctrine/dbal/src/Events.php', 'Doctrine\\DBAL\\Exception' => $vendorDir . '/doctrine/dbal/src/Exception.php', 'Doctrine\\DBAL\\Exception\\ConnectionException' => $vendorDir . '/doctrine/dbal/src/Exception/ConnectionException.php', 'Doctrine\\DBAL\\Exception\\ConnectionLost' => $vendorDir . '/doctrine/dbal/src/Exception/ConnectionLost.php', 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/ConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseDoesNotExist' => $vendorDir . '/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php', 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => $vendorDir . '/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php', 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => $vendorDir . '/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php', 'Doctrine\\DBAL\\Exception\\DeadlockException' => $vendorDir . '/doctrine/dbal/src/Exception/DeadlockException.php', @@ -1181,6 +1190,7 @@ 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => $vendorDir . '/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php', 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => $vendorDir . '/doctrine/dbal/src/Exception/ReadOnlyException.php', 'Doctrine\\DBAL\\Exception\\RetryableException' => $vendorDir . '/doctrine/dbal/src/Exception/RetryableException.php', + 'Doctrine\\DBAL\\Exception\\SchemaDoesNotExist' => $vendorDir . '/doctrine/dbal/src/Exception/SchemaDoesNotExist.php', 'Doctrine\\DBAL\\Exception\\ServerException' => $vendorDir . '/doctrine/dbal/src/Exception/ServerException.php', 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => $vendorDir . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', 'Doctrine\\DBAL\\Exception\\TableExistsException' => $vendorDir . '/doctrine/dbal/src/Exception/TableExistsException.php', @@ -1191,15 +1201,21 @@ 'Doctrine\\DBAL\\Id\\TableGenerator' => $vendorDir . '/doctrine/dbal/src/Id/TableGenerator.php', 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => $vendorDir . '/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php', 'Doctrine\\DBAL\\LockMode' => $vendorDir . '/doctrine/dbal/src/LockMode.php', + 'Doctrine\\DBAL\\Logging\\Connection' => $vendorDir . '/doctrine/dbal/src/Logging/Connection.php', 'Doctrine\\DBAL\\Logging\\DebugStack' => $vendorDir . '/doctrine/dbal/src/Logging/DebugStack.php', + 'Doctrine\\DBAL\\Logging\\Driver' => $vendorDir . '/doctrine/dbal/src/Logging/Driver.php', 'Doctrine\\DBAL\\Logging\\LoggerChain' => $vendorDir . '/doctrine/dbal/src/Logging/LoggerChain.php', + 'Doctrine\\DBAL\\Logging\\Middleware' => $vendorDir . '/doctrine/dbal/src/Logging/Middleware.php', 'Doctrine\\DBAL\\Logging\\SQLLogger' => $vendorDir . '/doctrine/dbal/src/Logging/SQLLogger.php', + 'Doctrine\\DBAL\\Logging\\Statement' => $vendorDir . '/doctrine/dbal/src/Logging/Statement.php', 'Doctrine\\DBAL\\ParameterType' => $vendorDir . '/doctrine/dbal/src/ParameterType.php', + 'Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php', 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/AbstractPlatform.php', 'Doctrine\\DBAL\\Platforms\\DB2Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/DB2Platform.php', 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => $vendorDir . '/doctrine/dbal/src/Platforms/DateIntervalUnit.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php', '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\\MySQL57Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', @@ -1207,17 +1223,28 @@ 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQLKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQLKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServerKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/SQLServerKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => $vendorDir . '/doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php', + 'Doctrine\\DBAL\\Platforms\\MariaDBPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDBPlatform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/MariaDb1027Platform.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\\MySQLPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQLPlatform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider\\CachingCollationMetadataProvider' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider\\ConnectionCollationMetadataProvider' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\Comparator' => $vendorDir . '/doctrine/dbal/src/Platforms/MySQL/Comparator.php', 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/OraclePlatform.php', 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php', 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/PostgreSQLPlatform.php', 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => $vendorDir . '/doctrine/dbal/src/Platforms/SQLServer2012Platform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServerPlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/SQLServerPlatform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServer\\Comparator' => $vendorDir . '/doctrine/dbal/src/Platforms/SQLServer/Comparator.php', + 'Doctrine\\DBAL\\Platforms\\SQLite\\Comparator' => $vendorDir . '/doctrine/dbal/src/Platforms/SQLite/Comparator.php', 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => $vendorDir . '/doctrine/dbal/src/Platforms/SqlitePlatform.php', 'Doctrine\\DBAL\\Platforms\\TrimMode' => $vendorDir . '/doctrine/dbal/src/Platforms/TrimMode.php', 'Doctrine\\DBAL\\Portability\\Connection' => $vendorDir . '/doctrine/dbal/src/Portability/Connection.php', @@ -1278,7 +1305,6 @@ 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConnectionProvider.php', 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => $vendorDir . '/doctrine/dbal/src/Tools/Console/ConsoleRunner.php', - 'Doctrine\\DBAL\\Tools\\Dumper' => $vendorDir . '/doctrine/dbal/src/Tools/Dumper.php', 'Doctrine\\DBAL\\TransactionIsolationLevel' => $vendorDir . '/doctrine/dbal/src/TransactionIsolationLevel.php', 'Doctrine\\DBAL\\Types\\ArrayType' => $vendorDir . '/doctrine/dbal/src/Types/ArrayType.php', 'Doctrine\\DBAL\\Types\\AsciiStringType' => $vendorDir . '/doctrine/dbal/src/Types/AsciiStringType.php', @@ -2003,9 +2029,6 @@ 'PEAR' => $vendorDir . '/pear/pear-core-minimal/src/PEAR.php', 'PEAR_ErrorStack' => $vendorDir . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php', 'PEAR_Exception' => $vendorDir . '/pear/pear_exception/PEAR/Exception.php', - 'PackageVersions\\FallbackVersions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php', - 'PackageVersions\\Installer' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php', - 'PackageVersions\\Versions' => $vendorDir . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php', 'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', 'PhpParser\\BuilderHelpers' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', @@ -2257,6 +2280,10 @@ 'Pimple\\Psr11\\ServiceLocator' => $vendorDir . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', 'Pimple\\ServiceIterator' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', + 'Psr\\Cache\\CacheException' => $vendorDir . '/psr/cache/src/CacheException.php', + 'Psr\\Cache\\CacheItemInterface' => $vendorDir . '/psr/cache/src/CacheItemInterface.php', + 'Psr\\Cache\\CacheItemPoolInterface' => $vendorDir . '/psr/cache/src/CacheItemPoolInterface.php', + 'Psr\\Cache\\InvalidArgumentException' => $vendorDir . '/psr/cache/src/InvalidArgumentException.php', 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', 'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php', diff --git a/composer/autoload_psr4.php b/composer/autoload_psr4.php index 59242d02e..e845bb85e 100644 --- a/composer/autoload_psr4.php +++ b/composer/autoload_psr4.php @@ -55,8 +55,8 @@ 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), - 'PackageVersions\\' => array($vendorDir . '/composer/package-versions-deprecated/src/PackageVersions'), 'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'), 'OpenStack\\' => array($vendorDir . '/php-opencloud/openstack/src'), 'Nextcloud\\LogNormalizer\\' => array($vendorDir . '/nextcloud/lognormalizer/src'), @@ -85,7 +85,7 @@ 'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/src'), 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'), - 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/lib/Doctrine/Common'), + 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/event-manager/src'), 'Cose\\' => array($vendorDir . '/web-auth/cose-lib/src'), 'CBOR\\' => array($vendorDir . '/spomky-labs/cbor-php/src'), 'Brick\\Math\\' => array($vendorDir . '/brick/math/src'), diff --git a/composer/autoload_static.php b/composer/autoload_static.php index e0442213d..a3773a857 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -204,8 +204,8 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Psr\\Http\\Client\\' => 16, 'Psr\\EventDispatcher\\' => 20, 'Psr\\Container\\' => 14, + 'Psr\\Cache\\' => 10, 'PhpParser\\' => 10, - 'PackageVersions\\' => 16, ), 'O' => array ( @@ -486,13 +486,13 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 array ( 0 => __DIR__ . '/..' . '/psr/container/src', ), - 'PhpParser\\' => + 'Psr\\Cache\\' => array ( - 0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser', + 0 => __DIR__ . '/..' . '/psr/cache/src', ), - 'PackageVersions\\' => + 'PhpParser\\' => array ( - 0 => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions', + 0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser', ), 'Opis\\Closure\\' => array ( @@ -609,7 +609,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 ), 'Doctrine\\Common\\' => array ( - 0 => __DIR__ . '/..' . '/doctrine/event-manager/lib/Doctrine/Common', + 0 => __DIR__ . '/..' . '/doctrine/event-manager/src', ), 'Cose\\' => array ( @@ -1718,16 +1718,15 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 '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/lib/Doctrine/Common/EventArgs.php', - 'Doctrine\\Common\\EventManager' => __DIR__ . '/..' . '/doctrine/event-manager/lib/Doctrine/Common/EventManager.php', - 'Doctrine\\Common\\EventSubscriber' => __DIR__ . '/..' . '/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.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', 'Doctrine\\Common\\Lexer\\AbstractLexer' => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingNamedParameter' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception/MissingNamedParameter.php', 'Doctrine\\DBAL\\ArrayParameters\\Exception\\MissingPositionalParameter' => __DIR__ . '/..' . '/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php', 'Doctrine\\DBAL\\Cache\\ArrayResult' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/ArrayResult.php', 'Doctrine\\DBAL\\Cache\\CacheException' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/CacheException.php', - 'Doctrine\\DBAL\\Cache\\CachingResult' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/CachingResult.php', 'Doctrine\\DBAL\\Cache\\QueryCacheProfile' => __DIR__ . '/..' . '/doctrine/dbal/src/Cache/QueryCacheProfile.php', 'Doctrine\\DBAL\\ColumnCase' => __DIR__ . '/..' . '/doctrine/dbal/src/ColumnCase.php', 'Doctrine\\DBAL\\Configuration' => __DIR__ . '/..' . '/doctrine/dbal/src/Configuration.php', @@ -1743,6 +1742,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php', 'Doctrine\\DBAL\\Driver\\API\\SQLSrv\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php', 'Doctrine\\DBAL\\Driver\\API\\SQLite\\ExceptionConverter' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php', + 'Doctrine\\DBAL\\Driver\\API\\SQLite\\UserDefinedFunctions' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php', 'Doctrine\\DBAL\\Driver\\AbstractDB2Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractDB2Driver.php', 'Doctrine\\DBAL\\Driver\\AbstractException' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractException.php', 'Doctrine\\DBAL\\Driver\\AbstractMySQLDriver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/AbstractMySQLDriver.php', @@ -1761,14 +1761,18 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Driver\\IBMDB2\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Driver.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCopyStreamToStream' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotCreateTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php', - 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\CannotWriteToTemporaryFile' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionError.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\ConnectionFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/ConnectionFailed.php', + 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\Factory' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\PrepareFailed' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/PrepareFailed.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Exception\\StatementError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Exception/StatementError.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Result.php', 'Doctrine\\DBAL\\Driver\\IBMDB2\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/IBMDB2/Statement.php', 'Doctrine\\DBAL\\Driver\\Middleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractConnectionMiddleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractDriverMiddleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractResultMiddleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php', + 'Doctrine\\DBAL\\Driver\\Middleware\\AbstractStatementMiddleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Connection.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Driver.php', 'Doctrine\\DBAL\\Driver\\Mysqli\\Exception\\ConnectionError' => __DIR__ . '/..' . '/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php', @@ -1829,11 +1833,16 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Event\\SchemaDropTableEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php', 'Doctrine\\DBAL\\Event\\SchemaEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaEventArgs.php', 'Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionBeginEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/TransactionBeginEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionCommitEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/TransactionCommitEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/TransactionEventArgs.php', + 'Doctrine\\DBAL\\Event\\TransactionRollBackEventArgs' => __DIR__ . '/..' . '/doctrine/dbal/src/Event/TransactionRollBackEventArgs.php', 'Doctrine\\DBAL\\Events' => __DIR__ . '/..' . '/doctrine/dbal/src/Events.php', 'Doctrine\\DBAL\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception.php', 'Doctrine\\DBAL\\Exception\\ConnectionException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConnectionException.php', 'Doctrine\\DBAL\\Exception\\ConnectionLost' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConnectionLost.php', 'Doctrine\\DBAL\\Exception\\ConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ConstraintViolationException.php', + 'Doctrine\\DBAL\\Exception\\DatabaseDoesNotExist' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DatabaseDoesNotExist.php', 'Doctrine\\DBAL\\Exception\\DatabaseObjectExistsException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DatabaseObjectExistsException.php', 'Doctrine\\DBAL\\Exception\\DatabaseObjectNotFoundException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DatabaseObjectNotFoundException.php', 'Doctrine\\DBAL\\Exception\\DeadlockException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/DeadlockException.php', @@ -1848,6 +1857,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/NotNullConstraintViolationException.php', 'Doctrine\\DBAL\\Exception\\ReadOnlyException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ReadOnlyException.php', 'Doctrine\\DBAL\\Exception\\RetryableException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/RetryableException.php', + 'Doctrine\\DBAL\\Exception\\SchemaDoesNotExist' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/SchemaDoesNotExist.php', 'Doctrine\\DBAL\\Exception\\ServerException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/ServerException.php', 'Doctrine\\DBAL\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/SyntaxErrorException.php', 'Doctrine\\DBAL\\Exception\\TableExistsException' => __DIR__ . '/..' . '/doctrine/dbal/src/Exception/TableExistsException.php', @@ -1858,15 +1868,21 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Id\\TableGenerator' => __DIR__ . '/..' . '/doctrine/dbal/src/Id/TableGenerator.php', 'Doctrine\\DBAL\\Id\\TableGeneratorSchemaVisitor' => __DIR__ . '/..' . '/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php', 'Doctrine\\DBAL\\LockMode' => __DIR__ . '/..' . '/doctrine/dbal/src/LockMode.php', + 'Doctrine\\DBAL\\Logging\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/Connection.php', 'Doctrine\\DBAL\\Logging\\DebugStack' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/DebugStack.php', + 'Doctrine\\DBAL\\Logging\\Driver' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/Driver.php', 'Doctrine\\DBAL\\Logging\\LoggerChain' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/LoggerChain.php', + 'Doctrine\\DBAL\\Logging\\Middleware' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/Middleware.php', 'Doctrine\\DBAL\\Logging\\SQLLogger' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/SQLLogger.php', + 'Doctrine\\DBAL\\Logging\\Statement' => __DIR__ . '/..' . '/doctrine/dbal/src/Logging/Statement.php', 'Doctrine\\DBAL\\ParameterType' => __DIR__ . '/..' . '/doctrine/dbal/src/ParameterType.php', + 'Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php', 'Doctrine\\DBAL\\Platforms\\AbstractPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/AbstractPlatform.php', 'Doctrine\\DBAL\\Platforms\\DB2Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/DB2Platform.php', 'Doctrine\\DBAL\\Platforms\\DateIntervalUnit' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/DateIntervalUnit.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\DB2Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/DB2Keywords.php', '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\\MySQL57Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL57Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\MySQL80Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/MySQL80Keywords.php', @@ -1874,17 +1890,28 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Platforms\\Keywords\\OracleKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/OracleKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL100Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL100Keywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQL94Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQL94Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\PostgreSQLKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/PostgreSQLKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\ReservedKeywordsValidator' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/ReservedKeywordsValidator.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServer2012Keywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/SQLServer2012Keywords.php', + 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLServerKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/SQLServerKeywords.php', 'Doctrine\\DBAL\\Platforms\\Keywords\\SQLiteKeywords' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/Keywords/SQLiteKeywords.php', + 'Doctrine\\DBAL\\Platforms\\MariaDBPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDBPlatform.php', 'Doctrine\\DBAL\\Platforms\\MariaDb1027Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MariaDb1027Platform.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\\MySQLPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQLPlatform.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider\\CachingCollationMetadataProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\CollationMetadataProvider\\ConnectionCollationMetadataProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php', + 'Doctrine\\DBAL\\Platforms\\MySQL\\Comparator' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/MySQL/Comparator.php', 'Doctrine\\DBAL\\Platforms\\OraclePlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/OraclePlatform.php', 'Doctrine\\DBAL\\Platforms\\PostgreSQL100Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php', 'Doctrine\\DBAL\\Platforms\\PostgreSQL94Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php', + 'Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/PostgreSQLPlatform.php', 'Doctrine\\DBAL\\Platforms\\SQLServer2012Platform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SQLServer2012Platform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServerPlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SQLServerPlatform.php', + 'Doctrine\\DBAL\\Platforms\\SQLServer\\Comparator' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SQLServer/Comparator.php', + 'Doctrine\\DBAL\\Platforms\\SQLite\\Comparator' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SQLite/Comparator.php', 'Doctrine\\DBAL\\Platforms\\SqlitePlatform' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/SqlitePlatform.php', 'Doctrine\\DBAL\\Platforms\\TrimMode' => __DIR__ . '/..' . '/doctrine/dbal/src/Platforms/TrimMode.php', 'Doctrine\\DBAL\\Portability\\Connection' => __DIR__ . '/..' . '/doctrine/dbal/src/Portability/Connection.php', @@ -1945,7 +1972,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConnectionProvider.php', 'Doctrine\\DBAL\\Tools\\Console\\ConnectionProvider\\SingleConnectionProvider' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php', 'Doctrine\\DBAL\\Tools\\Console\\ConsoleRunner' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Console/ConsoleRunner.php', - 'Doctrine\\DBAL\\Tools\\Dumper' => __DIR__ . '/..' . '/doctrine/dbal/src/Tools/Dumper.php', 'Doctrine\\DBAL\\TransactionIsolationLevel' => __DIR__ . '/..' . '/doctrine/dbal/src/TransactionIsolationLevel.php', 'Doctrine\\DBAL\\Types\\ArrayType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/ArrayType.php', 'Doctrine\\DBAL\\Types\\AsciiStringType' => __DIR__ . '/..' . '/doctrine/dbal/src/Types/AsciiStringType.php', @@ -2670,9 +2696,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'PEAR' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR.php', 'PEAR_ErrorStack' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php', 'PEAR_Exception' => __DIR__ . '/..' . '/pear/pear_exception/PEAR/Exception.php', - 'PackageVersions\\FallbackVersions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php', - 'PackageVersions\\Installer' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Installer.php', - 'PackageVersions\\Versions' => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions/Versions.php', 'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', 'PhpParser\\BuilderHelpers' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', @@ -2924,6 +2947,10 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Pimple\\Psr11\\ServiceLocator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', 'Pimple\\ServiceIterator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', + 'Psr\\Cache\\CacheException' => __DIR__ . '/..' . '/psr/cache/src/CacheException.php', + 'Psr\\Cache\\CacheItemInterface' => __DIR__ . '/..' . '/psr/cache/src/CacheItemInterface.php', + 'Psr\\Cache\\CacheItemPoolInterface' => __DIR__ . '/..' . '/psr/cache/src/CacheItemPoolInterface.php', + 'Psr\\Cache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/cache/src/InvalidArgumentException.php', 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', 'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php', diff --git a/composer/installed.json b/composer/installed.json index 811e97f79..9d0296c76 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -355,82 +355,6 @@ }, "install-path": "../christophwurst/id3parser" }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", - "version_normalized": "1.11.99.4", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "time": "2021-09-13T08:41:34+00:00", - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "install-path": "./package-versions-deprecated" - }, { "name": "cweagans/composer-patches", "version": "1.7.1", @@ -601,17 +525,17 @@ }, { "name": "doctrine/cache", - "version": "2.1.1", - "version_normalized": "2.1.1.0", + "version": "2.2.0", + "version_normalized": "2.2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce" + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/331b4d5dbaeab3827976273e9356b3b453c300ce", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", "shasum": "" }, "require": { @@ -621,20 +545,14 @@ "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "predis/predis": "~1.0", + "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.2 || ^6.0@dev", - "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" - }, - "time": "2021-07-17T14:49:29+00:00", + "time": "2022-05-20T20:07:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -683,7 +601,7 @@ ], "support": { "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.1.1" + "source": "https://github.com/doctrine/cache/tree/2.2.0" }, "funding": [ { @@ -703,42 +621,44 @@ }, { "name": "doctrine/dbal", - "version": "3.1.4", - "version_normalized": "3.1.4.0", + "version": "3.3.8", + "version_normalized": "3.3.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9" + "reference": "f873a820227bc352d023791775a01f078a30dfe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/821b4f01a36ce63ed36c090ea74767b72db367e9", - "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/f873a820227bc352d023791775a01f078a30dfe1", + "reference": "f873a820227bc352d023791775a01f078a30dfe1", "shasum": "" }, "require": { - "composer/package-versions-deprecated": "^1.11.99", - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3", + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", - "php": "^7.3 || ^8.0" + "php": "^7.3 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.1.1", - "phpstan/phpstan-strict-rules": "^1", - "phpunit/phpunit": "9.5.10", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.1", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.8.2", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "9.5.21", + "psalm/plugin-phpunit": "0.17.0", + "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.12.0" + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.24.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "time": "2021-11-15T16:44:33+00:00", + "time": "2022-08-05T15:35:35+00:00", "bin": [ "bin/doctrine-dbal" ], @@ -795,7 +715,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.4" + "source": "https://github.com/doctrine/dbal/tree/3.3.8" }, "funding": [ { @@ -815,31 +735,31 @@ }, { "name": "doctrine/deprecations", - "version": "v0.5.3", - "version_normalized": "0.5.3.0", + "version": "v1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", "shasum": "" }, "require": { "php": "^7.1|^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0" + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" }, - "time": "2021-03-21T12:59:47+00:00", + "time": "2022-05-02T15:47:09+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -855,46 +775,44 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v0.5.3" + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" }, "install-path": "../doctrine/deprecations" }, { "name": "doctrine/event-manager", - "version": "1.1.1", - "version_normalized": "1.1.1.0", + "version": "1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", "shasum": "" }, "require": { + "doctrine/deprecations": "^0.5.3 || ^1", "php": "^7.1 || ^8.0" }, "conflict": { - "doctrine/common": "<2.9@dev" + "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" + "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" }, - "time": "2020-05-29T18:28:51+00:00", + "time": "2022-10-12T20:51:15+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" + "Doctrine\\Common\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -938,7 +856,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + "source": "https://github.com/doctrine/event-manager/tree/1.2.0" }, "funding": [ { @@ -3455,6 +3373,58 @@ }, "install-path": "../pimple/pimple" }, + { + "name": "psr/cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T20:24:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "install-path": "../psr/cache" + }, { "name": "psr/container", "version": "1.1.1", diff --git a/composer/installed.php b/composer/installed.php index 75343ccc3..55343247c 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'c1fe9577fcc7006273d35848598df01eaa708b4f', + 'reference' => '02ba5bba999b61d40c79a6ed56683b69edf66619', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -64,15 +64,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'composer/package-versions-deprecated' => array( - 'pretty_version' => '1.11.99.4', - 'version' => '1.11.99.4', - 'reference' => 'b174585d1fe49ceed21928a945138948cb394600', - 'type' => 'composer-plugin', - 'install_path' => __DIR__ . '/./package-versions-deprecated', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'cweagans/composer-patches' => array( 'pretty_version' => '1.7.1', 'version' => '1.7.1.0', @@ -101,36 +92,36 @@ 'dev_requirement' => false, ), 'doctrine/cache' => array( - 'pretty_version' => '2.1.1', - 'version' => '2.1.1.0', - 'reference' => '331b4d5dbaeab3827976273e9356b3b453c300ce', + '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.1.4', - 'version' => '3.1.4.0', - 'reference' => '821b4f01a36ce63ed36c090ea74767b72db367e9', + 'pretty_version' => '3.3.8', + 'version' => '3.3.8.0', + 'reference' => 'f873a820227bc352d023791775a01f078a30dfe1', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/dbal', 'aliases' => array(), 'dev_requirement' => false, ), 'doctrine/deprecations' => array( - 'pretty_version' => 'v0.5.3', - 'version' => '0.5.3.0', - 'reference' => '9504165960a1f83cc1480e2be1dd0a0478561314', + 'pretty_version' => 'v1.0.0', + 'version' => '1.0.0.0', + 'reference' => '0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/deprecations', 'aliases' => array(), 'dev_requirement' => false, ), 'doctrine/event-manager' => array( - 'pretty_version' => '1.1.1', - 'version' => '1.1.1.0', - 'reference' => '41370af6a30faa9dc0368c4a6814d596e81aba7f', + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'reference' => '95aa4cb529f1e96576f3fda9f5705ada4056a520', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/event-manager', 'aliases' => array(), @@ -337,7 +328,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'c1fe9577fcc7006273d35848598df01eaa708b4f', + 'reference' => '02ba5bba999b61d40c79a6ed56683b69edf66619', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -361,12 +352,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'ocramius/package-versions' => array( - 'dev_requirement' => false, - 'replaced' => array( - 0 => '1.11.99', - ), - ), 'opis/closure' => array( 'pretty_version' => '3.6.3', 'version' => '3.6.3.0', @@ -487,6 +472,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'psr/cache' => array( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/cache', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'psr/container' => array( 'pretty_version' => '1.1.1', 'version' => '1.1.1.0', diff --git a/composer/package-versions-deprecated/CHANGELOG.md b/composer/package-versions-deprecated/CHANGELOG.md deleted file mode 100644 index a838c56ad..000000000 --- a/composer/package-versions-deprecated/CHANGELOG.md +++ /dev/null @@ -1,120 +0,0 @@ -# CHANGELOG - -## 1.1.3 - 2017-09-06 - -This release fixes a bug that caused PackageVersions to prevent -the `composer remove` and `composer update` commands to fail when -this package is removed. - -In addition to that, mutation testing has been added to the suite, -ensuring that the package is accurately and extensively tested. - -Total issues resolved: **3** - -- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius -- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus -- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85 - -## 1.1.2 - 2016-12-30 - -This release fixes a bug that caused PackageVersions to be enabled -even when it was part of a globally installed package. - -Total issues resolved: **3** - -- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35) -- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38) -- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39) - -## 1.1.1 - 2016-07-25 - -This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from -[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72), -as it is no longer needed for `composer install --classmap-authoritative`. -Also, that directive was causing issues with HHVM installations, since -PackageVersions is not compatible with it. - -Total issues resolved: **1** - -- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34) - -## 1.1.0 - 2016-07-22 - -This release introduces support for running `composer install --classmap-authoritative` -and `composer install --no-scripts`. Please note that performance -while using these modes may be degraded, but the package will -still work. - -Additionally, the package was tuned to prevent the plugin from -running twice at installation. - -Total issues resolved: **10** - -- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18) -- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20) -- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22) -- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23) -- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27) -- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29) -- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30) -- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31) -- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32) -- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33) - -## 1.0.4 - 2016-04-23 - -This release includes a fix/workaround for composer/composer#5237, -which causes `ocramius/package-versions` to sometimes generate a -`Versions` class with malformed name (something like -`Versions_composer_tmp0`) when running `composer require `. - -Total issues resolved: **2** - -- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16) -- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17) - -## 1.0.3 - 2016-02-26 - -This release fixes an issue related to concurrent autoloader -re-generation caused by multiple composer plugins being installed. -The issue was solved by removing autoloader re-generation from this -package, but it may still affect other packages. - -It is now recommended that you run `composer dump-autoload --optimize` -after installation when using this particular package. -Please note that `composer (install|update) -o` is not sufficient -to avoid autoload overhead when using this particular package. - -Total issues resolved: **1** - -- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15) - -## 1.0.2 - 2016-02-24 - -This release fixes issues related to installing the component without -any dev dependencies or with packages that don't have a source or dist -reference, which is usual with packages defined directly in the -`composer.json`. - -Total issues resolved: **3** - -- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11) -- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12) -- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13) - -## 1.0.1 - 2016-02-01 - -This release fixes an issue related with composer updates to -already installed versions. -Using `composer require` within a package that already used -`ocramius/package-versions` caused the installation to be unable -to write the `PackageVersions\Versions` class to a file. - -Total issues resolved: **6** - -- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2) -- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3) -- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5) -- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6) -- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7) -- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8) diff --git a/composer/package-versions-deprecated/CONTRIBUTING.md b/composer/package-versions-deprecated/CONTRIBUTING.md deleted file mode 100644 index 718061758..000000000 --- a/composer/package-versions-deprecated/CONTRIBUTING.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Contributing ---- - -# Contributing - - * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) - * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) - * Any contribution must provide tests for additional introduced conditions - * Any un-confirmed issue needs a failing test case before being accepted - * Pull requests must be sent from a new hotfix/feature branch, not from `master`. - -## Installation - -To install the project and run the tests, you need to clone it first: - -```sh -$ git clone git://github.com/Ocramius/PackageVersions.git -``` - -You will then need to run a composer installation: - -```sh -$ cd PackageVersions -$ curl -s https://getcomposer.org/installer | php -$ php composer.phar update -``` - -## Testing - -The PHPUnit version to be used is the one installed as a dev- dependency via composer: - -```sh -$ ./vendor/bin/phpunit -``` - -Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement -won't be merged. - diff --git a/composer/package-versions-deprecated/README.md b/composer/package-versions-deprecated/README.md deleted file mode 100644 index 7fe2097d4..000000000 --- a/composer/package-versions-deprecated/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Package Versions - -**`composer/package-versions-deprecated` is a fully-compatible fork of [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions)** which provides compatibility with Composer 1 and 2 on PHP 7+. It replaces ocramius/package-versions so if you have a dependency requiring it and you want to use Composer v2 but can not upgrade to PHP 7.4 just yet, you can require this package instead. - -If you have a direct dependency on ocramius/package-versions, we recommend instead that once you migrated to Composer 2 you also migrate to use the `Composer\InstalledVersions` class which offers the functionality present here out of the box. diff --git a/composer/package-versions-deprecated/SECURITY.md b/composer/package-versions-deprecated/SECURITY.md deleted file mode 100644 index da9c516dd..000000000 --- a/composer/package-versions-deprecated/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. diff --git a/composer/package-versions-deprecated/composer.json b/composer/package-versions-deprecated/composer.json deleted file mode 100644 index d5a40daac..000000000 --- a/composer/package-versions-deprecated/composer.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "composer/package-versions-deprecated", - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "type": "composer-plugin", - "license": "MIT", - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "require": { - "php": "^7 || ^8", - "composer-plugin-api": "^1.1.0 || ^2.0" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "phpunit/phpunit": "^6.5 || ^7", - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13" - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "autoload-dev": { - "psr-4": { - "PackageVersionsTest\\": "test/PackageVersionsTest" - } - }, - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "scripts": { - "post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass", - "post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass" - } -} diff --git a/composer/package-versions-deprecated/composer.lock b/composer/package-versions-deprecated/composer.lock deleted file mode 100644 index b711f6b13..000000000 --- a/composer/package-versions-deprecated/composer.lock +++ /dev/null @@ -1,2603 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "6bfe0a7d7a51c4bdf14a2d7ea1d22d11", - "packages": [], - "packages-dev": [ - { - "name": "composer/ca-bundle", - "version": "1.2.7", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-04-08T08:27:21+00:00" - }, - { - "name": "composer/composer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "a8c105da344dd84ebd5d11be7943a45b09dc076f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/a8c105da344dd84ebd5d11be7943a45b09dc076f", - "reference": "a8c105da344dd84ebd5d11be7943a45b09dc076f", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^1.1", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" - }, - "conflict": { - "symfony/console": "2.8.38" - }, - "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^3.4" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\": "src/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/master" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-03-29T14:59:26+00:00" - }, - { - "name": "composer/semver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/1.5.1" - }, - "time": "2020-01-13T12:06:48+00:00" - }, - { - "name": "composer/spdx-licenses", - "version": "1.5.3", - "source": { - "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Spdx\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "time": "2020-02-14T07:44:31+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/master" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - } - ], - "time": "2020-03-01T12:26:26+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/master" - }, - "time": "2019-10-21T16:45:58+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.9", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "44c6787311242a979fa15c704327c20e7221a0e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/44c6787311242a979fa15c704327c20e7221a0e4", - "reference": "44c6787311242a979fa15c704327c20e7221a0e4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "support": { - "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/5.2.9" - }, - "time": "2019-09-25T14:49:45+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.5", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.9.5" - }, - "time": "2020-01-17T21:11:47+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "time": "2018-08-07T13:53:10+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "shasum": "" - }, - "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" - }, - "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", - "shasum": "" - }, - "require": { - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/master" - }, - "time": "2020-02-18T18:59:58+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" - }, - "time": "2020-03-05T15:02:03+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-09-13T20:33:42+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2019-09-17T06:23:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2020-01-08T08:45:45+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2020-03-23T09:12:05+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2019-11-20T08:46:58+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2019-09-14T09:02:43+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "seld/jsonlint", - "version": "1.7.2", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/e2e5d290e4d2a4f0eb449f510071392e00e10d19", - "reference": "e2e5d290e4d2a4f0eb449f510071392e00e10d19", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "support": { - "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.7.2" - }, - "time": "2019-10-24T14:27:39+00:00" - }, - { - "name": "seld/phar-utils", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phar" - ], - "support": { - "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.1.0" - }, - "time": "2020-02-14T15:25:33+00:00" - }, - { - "name": "symfony/console", - "version": "v5.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", - "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/dependency-injection": "<4.4", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/console/tree/v5.0.7" - }, - "time": "2020-03-30T11:42:42+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v5.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ca3b87dd09fff9b771731637f5379965fbfab420", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.0.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-03-27T16:56:45+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/600a52c29afc0d1caa74acbec8d3095ca7e9910d", - "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d", - "shasum": "" - }, - "require": { - "php": "^7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/5.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-03-27T16:56:45+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.15-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.15.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-02-27T09:26:54+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.15-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.15.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-03-09T19:04:49+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.15-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.15.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-02-27T09:26:54+00:00" - }, - { - "name": "symfony/process", - "version": "v5.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", - "shasum": "" - }, - "require": { - "php": "^7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v5.0.7" - }, - "time": "2020-03-27T16:56:45+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.0.1" - }, - "time": "2019-11-18T17:27:11+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", - "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozart/assert/issues", - "source": "https://github.com/webmozart/assert/tree/master" - }, - "time": "2020-04-18T12:12:48+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "composer/composer": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7", - "composer-plugin-api": "^1.1.0 || ^2.0" - }, - "platform-dev": { - "ext-zip": "^1.13" - }, - "plugin-api-version": "1.1.0" -} diff --git a/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php b/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php deleted file mode 100644 index 18e5fe64f..000000000 --- a/composer/package-versions-deprecated/src/PackageVersions/FallbackVersions.php +++ /dev/null @@ -1,128 +0,0 @@ - - */ - private static function getVersions(array $packageData): Generator - { - foreach ($packageData as $package) { - yield $package['name'] => $package['version'] . '@' . ( - $package['source']['reference'] ?? $package['dist']['reference'] ?? '' - ); - } - - yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME; - } -} diff --git a/composer/package-versions-deprecated/src/PackageVersions/Installer.php b/composer/package-versions-deprecated/src/PackageVersions/Installer.php deleted file mode 100644 index 05bdac9a7..000000000 --- a/composer/package-versions-deprecated/src/PackageVersions/Installer.php +++ /dev/null @@ -1,290 +0,0 @@ - - * @internal - */ - const VERSIONS = %s; - - private function __construct() - { - } - - /** - * @psalm-pure - * - * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not - * cause any side effects here. - */ - public static function rootPackageName() : string - { - if (!self::composer2ApiUsable()) { - return self::ROOT_PACKAGE_NAME; - } - - return InstalledVersions::getRootPackage()['name']; - } - - /** - * @throws OutOfBoundsException If a version cannot be located. - * - * @psalm-param key-of $packageName - * @psalm-pure - * - * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not - * cause any side effects here. - */ - public static function getVersion(string $packageName): string - { - if (self::composer2ApiUsable()) { - return InstalledVersions::getPrettyVersion($packageName) - . '@' . InstalledVersions::getReference($packageName); - } - - if (isset(self::VERSIONS[$packageName])) { - return self::VERSIONS[$packageName]; - } - - throw new OutOfBoundsException( - 'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files' - ); - } - - private static function composer2ApiUsable(): bool - { - if (!class_exists(InstalledVersions::class, false)) { - return false; - } - - if (method_exists(InstalledVersions::class, 'getAllRawData')) { - $rawData = InstalledVersions::getAllRawData(); - if (count($rawData) === 1 && count($rawData[0]) === 0) { - return false; - } - } else { - $rawData = InstalledVersions::getRawData(); - if ($rawData === null || $rawData === []) { - return false; - } - } - - return true; - } -} - -PHP; - - public function activate(Composer $composer, IOInterface $io) - { - // Nothing to do here, as all features are provided through event listeners - } - - public function deactivate(Composer $composer, IOInterface $io) - { - // Nothing to do here, as all features are provided through event listeners - } - - public function uninstall(Composer $composer, IOInterface $io) - { - // Nothing to do here, as all features are provided through event listeners - } - - /** - * {@inheritDoc} - */ - public static function getSubscribedEvents(): array - { - return [ScriptEvents::POST_AUTOLOAD_DUMP => 'dumpVersionsClass']; - } - - /** - * @throws RuntimeException - */ - public static function dumpVersionsClass(Event $composerEvent) - { - $composer = $composerEvent->getComposer(); - $rootPackage = $composer->getPackage(); - $versions = iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage)); - - if (! array_key_exists('composer/package-versions-deprecated', $versions)) { - //plugin must be globally installed - we only want to generate versions for projects which specifically - //require composer/package-versions-deprecated - return; - } - - $versionClass = self::generateVersionsClass($rootPackage->getName(), $versions); - - self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO()); - } - - /** - * @param string[] $versions - */ - private static function generateVersionsClass(string $rootPackageName, array $versions): string - { - return sprintf( - self::$generatedClassTemplate, - 'fin' . 'al ' . 'cla' . 'ss ' . 'Versions', // note: workaround for regex-based code parsers :-( - $rootPackageName, - var_export($versions, true) - ); - } - - /** - * @throws RuntimeException - */ - private static function writeVersionClassToFile(string $versionClassSource, Composer $composer, IOInterface $io) - { - $installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage()) - . '/src/PackageVersions/Versions.php'; - - $installDir = dirname($installPath); - if (! file_exists($installDir)) { - $io->write('composer/package-versions-deprecated: Package not found (probably scheduled for removal); generation of version class skipped.'); - - return; - } - - if (! is_writable($installDir)) { - $io->write( - sprintf( - 'composer/package-versions-deprecated: %s is not writable; generation of version class skipped.', - $installDir - ) - ); - - return; - } - - $io->write('composer/package-versions-deprecated: Generating version class...'); - - $installPathTmp = $installPath . '_' . uniqid('tmp', true); - file_put_contents($installPathTmp, $versionClassSource); - chmod($installPathTmp, 0664); - rename($installPathTmp, $installPath); - - $io->write('composer/package-versions-deprecated: ...done generating version class'); - } - - /** - * @throws RuntimeException - */ - private static function locateRootPackageInstallPath( - Config $composerConfig, - RootPackageInterface $rootPackage - ): string { - if (self::getRootPackageAlias($rootPackage)->getName() === 'composer/package-versions-deprecated') { - return dirname($composerConfig->get('vendor-dir')); - } - - return $composerConfig->get('vendor-dir') . '/composer/package-versions-deprecated'; - } - - private static function getRootPackageAlias(RootPackageInterface $rootPackage): PackageInterface - { - $package = $rootPackage; - - while ($package instanceof AliasPackage) { - $package = $package->getAliasOf(); - } - - return $package; - } - - /** - * @return Generator&string[] - * - * @psalm-return Generator - */ - private static function getVersions(Locker $locker, RootPackageInterface $rootPackage): Generator - { - $lockData = $locker->getLockData(); - - $lockData['packages-dev'] = $lockData['packages-dev'] ?? []; - - $packages = $lockData['packages']; - if (getenv('COMPOSER_DEV_MODE') !== '0') { - $packages = array_merge($packages, $lockData['packages-dev']); - } - foreach ($packages as $package) { - yield $package['name'] => $package['version'] . '@' . ( - $package['source']['reference'] ?? $package['dist']['reference'] ?? '' - ); - } - - foreach ($rootPackage->getReplaces() as $replace) { - $version = $replace->getPrettyConstraint(); - if ($version === 'self.version') { - $version = $rootPackage->getPrettyVersion(); - } - - yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference(); - } - - yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference(); - } -} diff --git a/composer/package-versions-deprecated/src/PackageVersions/Versions.php b/composer/package-versions-deprecated/src/PackageVersions/Versions.php deleted file mode 100644 index 9cbf18772..000000000 --- a/composer/package-versions-deprecated/src/PackageVersions/Versions.php +++ /dev/null @@ -1,92 +0,0 @@ -pool; } + public function reset(): void + { + if ($this->pool instanceof ResetInterface) { + $this->pool->reset(); + } + + $this->setNamespace($this->getNamespace()); + } + /** * {@inheritdoc} */ diff --git a/doctrine/dbal/README.md b/doctrine/dbal/README.md index 8a1757886..21888b6f1 100644 --- a/doctrine/dbal/README.md +++ b/doctrine/dbal/README.md @@ -1,11 +1,11 @@ # Doctrine DBAL -| [4.0-dev][4.0] | [3.1][3.1] | [2.13][2.13] | -|:----------------:|:----------:|:----------:| -| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.1 image]][GA 3.1] | [![GitHub Actions][GA 2.13 image]][GA 2.13] | -| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.1 image]][AppVeyor 3.1] | [![AppVeyor][AppVeyor 2.13 image]][AppVeyor 2.13] | -| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.1 image]][CodeCov 3.1] | [![Code Coverage][Coverage 2.13 image]][CodeCov 2.13] | -| N/A | [![Code Coverage][TypeCov 3.1 image]][TypeCov 3.1] | N/A | +| [4.0-dev][4.0] | [3.3][3.3] | +|:-----------------------------------------------:|:---------------------------------------------------:| +| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.3 image]][GA 3.3] | +| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.3 image]][AppVeyor 3.3] | +| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.3 image]][CodeCov 3.3] | +| N/A | [![Code Coverage][TypeCov 3.3 image]][TypeCov 3.3] | Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features for database schema introspection and schema management. @@ -23,20 +23,12 @@ Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features f [GA 4.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x [GA 4.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg - [Coverage 3.1 image]: https://codecov.io/gh/doctrine/dbal/branch/3.1.x/graph/badge.svg - [3.1]: https://github.com/doctrine/dbal/tree/3.1.x - [CodeCov 3.1]: https://codecov.io/gh/doctrine/dbal/branch/3.1.x - [AppVeyor 3.1]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.1.x - [AppVeyor 3.1 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.1.x?svg=true - [GA 3.1]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.1.x - [GA 3.1 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.1.x - - [Coverage 2.13 image]: https://codecov.io/gh/doctrine/dbal/branch/2.13.x/graph/badge.svg - [2.13]: https://github.com/doctrine/dbal/tree/2.13.x - [CodeCov 2.13]: https://codecov.io/gh/doctrine/dbal/branch/2.13.x - [AppVeyor 2.13]: https://ci.appveyor.com/project/doctrine/dbal/branch/2.13.x - [AppVeyor 2.13 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/2.13.x?svg=true - [GA 2.13]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A2.13.x - [GA 2.13 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=2.13.x - [TypeCov 3.1]: https://shepherd.dev/github/doctrine/dbal - [TypeCov 3.1 image]: https://shepherd.dev/github/doctrine/dbal/coverage.svg + [Coverage 3.3 image]: https://codecov.io/gh/doctrine/dbal/branch/3.3.x/graph/badge.svg + [3.3]: https://github.com/doctrine/dbal/tree/3.3.x + [CodeCov 3.3]: https://codecov.io/gh/doctrine/dbal/branch/3.3.x + [AppVeyor 3.3]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.3.x + [AppVeyor 3.3 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.3.x?svg=true + [GA 3.3]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.3.x + [GA 3.3 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.3.x + [TypeCov 3.3]: https://shepherd.dev/github/doctrine/dbal + [TypeCov 3.3 image]: https://shepherd.dev/github/doctrine/dbal/coverage.svg diff --git a/doctrine/dbal/composer.json b/doctrine/dbal/composer.json index 2374d79c2..12e78d22c 100644 --- a/doctrine/dbal/composer.json +++ b/doctrine/dbal/composer.json @@ -32,29 +32,35 @@ ], "require": { "php": "^7.3 || ^8.0", - "composer/package-versions-deprecated": "^1.11.99", - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3", - "doctrine/event-manager": "^1.0" + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.1.1", - "phpstan/phpstan-strict-rules": "^1", - "phpunit/phpunit": "9.5.10", - "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.1", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.8.2", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "9.5.21", + "psalm/plugin-phpunit": "0.17.0", + "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.12.0" + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.24.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, "bin": ["bin/doctrine-dbal"], "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "composer/package-versions-deprecated": true + } }, "autoload": { "psr-4": { "Doctrine\\DBAL\\": "src" } diff --git a/doctrine/dbal/src/Cache/ArrayResult.php b/doctrine/dbal/src/Cache/ArrayResult.php index e2dc6e115..3b70d0c9e 100644 --- a/doctrine/dbal/src/Cache/ArrayResult.php +++ b/doctrine/dbal/src/Cache/ArrayResult.php @@ -14,7 +14,7 @@ */ final class ArrayResult implements Result { - /** @var mixed[] */ + /** @var list> */ private $data; /** @var int */ @@ -24,7 +24,7 @@ final class ArrayResult implements Result private $num = 0; /** - * @param mixed[] $data + * @param list> $data */ public function __construct(array $data) { @@ -112,7 +112,7 @@ public function free(): void } /** - * @return mixed|false + * @return array|false */ private function fetch() { diff --git a/doctrine/dbal/src/Cache/CachingResult.php b/doctrine/dbal/src/Cache/CachingResult.php deleted file mode 100644 index c060673c5..000000000 --- a/doctrine/dbal/src/Cache/CachingResult.php +++ /dev/null @@ -1,184 +0,0 @@ ->|null */ - private $data; - - /** - * @param string $cacheKey - * @param string $realKey - * @param int $lifetime - */ - public function __construct(Result $result, Cache $cache, $cacheKey, $realKey, $lifetime) - { - $this->result = $result; - $this->cache = $cache; - $this->cacheKey = $cacheKey; - $this->realKey = $realKey; - $this->lifetime = $lifetime; - } - - /** - * {@inheritdoc} - */ - public function fetchNumeric() - { - $row = $this->fetch(); - - if ($row === false) { - return false; - } - - return array_values($row); - } - - /** - * {@inheritdoc} - */ - public function fetchAssociative() - { - return $this->fetch(); - } - - /** - * {@inheritdoc} - */ - public function fetchOne() - { - return FetchUtils::fetchOne($this); - } - - /** - * {@inheritdoc} - */ - public function fetchAllNumeric(): array - { - return array_map('array_values', $this->fetchAllAssociative()); - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssociative(): array - { - $data = $this->result->fetchAllAssociative(); - - $this->store($data); - - return $data; - } - - /** - * {@inheritdoc} - */ - public function fetchFirstColumn(): array - { - return FetchUtils::fetchFirstColumn($this); - } - - public function rowCount(): int - { - return $this->result->rowCount(); - } - - public function columnCount(): int - { - return $this->result->columnCount(); - } - - public function free(): void - { - $this->data = null; - } - - /** - * @return array|false - * - * @throws Exception - */ - private function fetch() - { - if ($this->data === null) { - $this->data = []; - } - - $row = $this->result->fetchAssociative(); - - if ($row !== false) { - $this->data[] = $row; - - return $row; - } - - $this->saveToCache(); - - return false; - } - - /** - * @param array> $data - */ - private function store(array $data): void - { - $this->data = $data; - - $this->saveToCache(); - } - - private function saveToCache(): void - { - if ($this->data === null) { - return; - } - - $data = $this->cache->fetch($this->cacheKey); - - if ($data === false) { - $data = []; - } - - $data[$this->realKey] = $this->data; - - $this->cache->save($this->cacheKey, $data, $this->lifetime); - } -} diff --git a/doctrine/dbal/src/Cache/QueryCacheProfile.php b/doctrine/dbal/src/Cache/QueryCacheProfile.php index 21bd144dc..7115cc720 100644 --- a/doctrine/dbal/src/Cache/QueryCacheProfile.php +++ b/doctrine/dbal/src/Cache/QueryCacheProfile.php @@ -3,11 +3,18 @@ namespace Doctrine\DBAL\Cache; use Doctrine\Common\Cache\Cache; +use Doctrine\Common\Cache\Psr6\CacheAdapter; +use Doctrine\Common\Cache\Psr6\DoctrineProvider; use Doctrine\DBAL\Types\Type; +use Doctrine\Deprecations\Deprecation; +use Psr\Cache\CacheItemPoolInterface; +use TypeError; +use function get_class; use function hash; use function serialize; use function sha1; +use function sprintf; /** * Query Cache Profile handles the data relevant for query caching. @@ -16,8 +23,8 @@ */ class QueryCacheProfile { - /** @var Cache|null */ - private $resultCacheDriver; + /** @var CacheItemPoolInterface|null */ + private $resultCache; /** @var int */ private $lifetime; @@ -26,22 +33,57 @@ class QueryCacheProfile private $cacheKey; /** - * @param int $lifetime - * @param string|null $cacheKey + * @param int $lifetime + * @param string|null $cacheKey + * @param CacheItemPoolInterface|Cache|null $resultCache */ - public function __construct($lifetime = 0, $cacheKey = null, ?Cache $resultCache = null) + public function __construct($lifetime = 0, $cacheKey = null, ?object $resultCache = null) + { + $this->lifetime = $lifetime; + $this->cacheKey = $cacheKey; + if ($resultCache instanceof CacheItemPoolInterface) { + $this->resultCache = $resultCache; + } elseif ($resultCache instanceof Cache) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4620', + 'Passing an instance of %s to %s as $resultCache is deprecated. Pass an instance of %s instead.', + Cache::class, + __METHOD__, + CacheItemPoolInterface::class + ); + + $this->resultCache = CacheAdapter::wrap($resultCache); + } elseif ($resultCache !== null) { + throw new TypeError(sprintf( + '$resultCache: Expected either null or an instance of %s or %s, got %s.', + CacheItemPoolInterface::class, + Cache::class, + get_class($resultCache) + )); + } + } + + public function getResultCache(): ?CacheItemPoolInterface { - $this->lifetime = $lifetime; - $this->cacheKey = $cacheKey; - $this->resultCacheDriver = $resultCache; + return $this->resultCache; } /** + * @deprecated Use {@see getResultCache()} instead. + * * @return Cache|null */ public function getResultCacheDriver() { - return $this->resultCacheDriver; + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4620', + '%s is deprecated, call getResultCache() instead.', + __METHOD__ + ); + + return $this->resultCache !== null ? DoctrineProvider::wrap($this->resultCache) : null; } /** @@ -97,12 +139,26 @@ public function generateCacheKeys($sql, $params, $types, array $connectionParams return [$cacheKey, $realCacheKey]; } + public function setResultCache(CacheItemPoolInterface $cache): QueryCacheProfile + { + return new QueryCacheProfile($this->lifetime, $this->cacheKey, $cache); + } + /** + * @deprecated Use {@see setResultCache()} instead. + * * @return QueryCacheProfile */ public function setResultCacheDriver(Cache $cache) { - return new QueryCacheProfile($this->lifetime, $this->cacheKey, $cache); + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4620', + '%s is deprecated, call setResultCache() instead.', + __METHOD__ + ); + + return new QueryCacheProfile($this->lifetime, $this->cacheKey, CacheAdapter::wrap($cache)); } /** @@ -112,7 +168,7 @@ public function setResultCacheDriver(Cache $cache) */ public function setCacheKey($cacheKey) { - return new QueryCacheProfile($this->lifetime, $cacheKey, $this->resultCacheDriver); + return new QueryCacheProfile($this->lifetime, $cacheKey, $this->resultCache); } /** @@ -122,6 +178,6 @@ public function setCacheKey($cacheKey) */ public function setLifetime($lifetime) { - return new QueryCacheProfile($lifetime, $this->cacheKey, $this->resultCacheDriver); + return new QueryCacheProfile($lifetime, $this->cacheKey, $this->resultCache); } } diff --git a/doctrine/dbal/src/Configuration.php b/doctrine/dbal/src/Configuration.php index 109289f5a..2d27d733b 100644 --- a/doctrine/dbal/src/Configuration.php +++ b/doctrine/dbal/src/Configuration.php @@ -3,8 +3,12 @@ namespace Doctrine\DBAL; use Doctrine\Common\Cache\Cache; +use Doctrine\Common\Cache\Psr6\CacheAdapter; +use Doctrine\Common\Cache\Psr6\DoctrineProvider; use Doctrine\DBAL\Driver\Middleware; use Doctrine\DBAL\Logging\SQLLogger; +use Doctrine\Deprecations\Deprecation; +use Psr\Cache\CacheItemPoolInterface; /** * Configuration container for the Doctrine DBAL. @@ -24,6 +28,15 @@ class Configuration /** * The cache driver implementation that is used for query result caching. * + * @var CacheItemPoolInterface|null + */ + private $resultCache; + + /** + * The cache driver implementation that is used for query result caching. + * + * @deprecated Use {@see $resultCache} instead. + * * @var Cache|null */ protected $resultCacheImpl; @@ -61,17 +74,53 @@ public function getSQLLogger(): ?SQLLogger /** * Gets the cache driver implementation that is used for query result caching. */ + public function getResultCache(): ?CacheItemPoolInterface + { + return $this->resultCache; + } + + /** + * Gets the cache driver implementation that is used for query result caching. + * + * @deprecated Use {@see getResultCache()} instead. + */ public function getResultCacheImpl(): ?Cache { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4620', + '%s is deprecated, call getResultCache() instead.', + __METHOD__ + ); + return $this->resultCacheImpl; } /** * Sets the cache driver implementation that is used for query result caching. */ + public function setResultCache(CacheItemPoolInterface $cache): void + { + $this->resultCacheImpl = DoctrineProvider::wrap($cache); + $this->resultCache = $cache; + } + + /** + * Sets the cache driver implementation that is used for query result caching. + * + * @deprecated Use {@see setResultCache()} instead. + */ public function setResultCacheImpl(Cache $cacheImpl): void { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4620', + '%s is deprecated, call setResultCache() instead.', + __METHOD__ + ); + $this->resultCacheImpl = $cacheImpl; + $this->resultCache = CacheAdapter::wrap($cacheImpl); } /** diff --git a/doctrine/dbal/src/Connection.php b/doctrine/dbal/src/Connection.php index 7b3686c6a..9e4b1d23b 100644 --- a/doctrine/dbal/src/Connection.php +++ b/doctrine/dbal/src/Connection.php @@ -6,12 +6,14 @@ use Doctrine\Common\EventManager; use Doctrine\DBAL\Cache\ArrayResult; use Doctrine\DBAL\Cache\CacheException; -use Doctrine\DBAL\Cache\CachingResult; use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Driver\API\ExceptionConverter; use Doctrine\DBAL\Driver\Connection as DriverConnection; 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\DriverException; use Doctrine\DBAL\Exception\InvalidArgumentException; @@ -22,22 +24,26 @@ use Doctrine\DBAL\SQL\Parser; use Doctrine\DBAL\Types\Type; use Doctrine\Deprecations\Deprecation; +use LogicException; use Throwable; use Traversable; -use function array_key_exists; use function assert; use function count; +use function get_class; use function implode; use function is_int; use function is_string; use function key; +use function method_exists; +use function sprintf; /** * 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 */ class Connection { @@ -51,6 +57,11 @@ class Connection */ public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET; + /** + * Represents an array of ascii strings to be expanded by Doctrine SQL parsing. + */ + public const PARAM_ASCII_STR_ARRAY = ParameterType::ASCII + self::ARRAY_PARAM_OFFSET; + /** * Offset by which PARAM_* constants are detected as arrays of the param type. */ @@ -70,7 +81,7 @@ class Connection protected $_eventManager; /** - * @deprecated Use {@link createExpressionBuilder()} instead. + * @deprecated Use {@see createExpressionBuilder()} instead. * * @var ExpressionBuilder */ @@ -108,7 +119,6 @@ class Connection * The parameters used during creation of the Connection instance. * * @var array - * @phpstan-var array * @psalm-var Params */ private $params; @@ -129,7 +139,7 @@ class Connection /** * The schema manager. * - * @deprecated Use {@link createSchemaManager()} instead. + * @deprecated Use {@see createSchemaManager()} instead. * * @var AbstractSchemaManager|null */ @@ -172,14 +182,6 @@ public function __construct( $this->_driver = $driver; $this->params = $params; - if (isset($params['platform'])) { - if (! $params['platform'] instanceof Platforms\AbstractPlatform) { - throw Exception::invalidPlatformType($params['platform']); - } - - $this->platform = $params['platform']; - } - // Create default config and event manager if none given if ($config === null) { $config = new Configuration(); @@ -192,6 +194,15 @@ public function __construct( $this->_config = $config; $this->_eventManager = $eventManager; + if (isset($params['platform'])) { + if (! $params['platform'] instanceof Platforms\AbstractPlatform) { + throw Exception::invalidPlatformType($params['platform']); + } + + $this->platform = $params['platform']; + $this->platform->setEventManager($this->_eventManager); + } + $this->_expr = $this->createExpressionBuilder(); $this->autoCommit = $config->getAutoCommit(); @@ -204,7 +215,6 @@ public function __construct( * * @return array * @psalm-return Params - * @phpstan-return array */ public function getParams() { @@ -289,7 +299,7 @@ public function createExpressionBuilder(): ExpressionBuilder /** * Gets the ExpressionBuilder for the connection. * - * @deprecated Use {@link createExpressionBuilder()} instead. + * @deprecated Use {@see createExpressionBuilder()} instead. * * @return ExpressionBuilder */ @@ -308,6 +318,8 @@ public function getExpressionBuilder() /** * Establishes the connection with the database. * + * @internal This method will be made protected in DBAL 4.0. + * * @return bool TRUE if the connection was successfully established, FALSE if * the connection is already open. * @@ -315,6 +327,12 @@ public function getExpressionBuilder() */ public function connect() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4966', + 'Public access to Connection::connect() is deprecated.' + ); + if ($this->_conn !== null) { return false; } @@ -438,6 +456,13 @@ private function getServerVersion() } } + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4750', + 'Not implementing the ServerInfoAwareConnection interface in %s is deprecated', + get_class($connection) + ); + // Unable to detect platform version. return null; } @@ -503,11 +528,7 @@ public function setAutoCommit($autoCommit) */ public function fetchAssociative(string $query, array $params = [], array $types = []) { - try { - return $this->executeQuery($query, $params, $types)->fetchAssociative(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchAssociative(); } /** @@ -518,17 +539,13 @@ public function fetchAssociative(string $query, array $params = [], array $types * @param list|array $params Query parameters * @param array|array $types Parameter types * - * @return list< mixed>|false False is returned if no rows are found. + * @return list|false False is returned if no rows are found. * * @throws Exception */ public function fetchNumeric(string $query, array $params = [], array $types = []) { - try { - return $this->executeQuery($query, $params, $types)->fetchNumeric(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchNumeric(); } /** @@ -545,11 +562,7 @@ public function fetchNumeric(string $query, array $params = [], array $types = [ */ public function fetchOne(string $query, array $params = [], array $types = []) { - try { - return $this->executeQuery($query, $params, $types)->fetchOne(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchOne(); } /** @@ -611,7 +624,7 @@ private function addCriteriaCondition( * @param array $criteria Deletion criteria * @param array|array $types Parameter types * - * @return int The number of affected rows. + * @return int|string The number of affected rows. * * @throws Exception */ @@ -648,7 +661,7 @@ public function close() * * @param int $level The level to set. * - * @return int + * @return int|string * * @throws Exception */ @@ -685,7 +698,7 @@ public function getTransactionIsolation() * @param array $criteria Update criteria * @param array|array $types Parameter types * - * @return int The number of affected rows. + * @return int|string The number of affected rows. * * @throws Exception */ @@ -720,7 +733,7 @@ public function update($table, array $data, array $criteria, array $types = []) * @param array $data Column-value pairs * @param array|array $types Parameter types * - * @return int The number of affected rows. + * @return int|string The number of affected rows. * * @throws Exception */ @@ -756,7 +769,7 @@ public function insert($table, array $data, array $types = []) * * @return array|array */ - private function extractTypeValues(array $columnList, array $types) + private function extractTypeValues(array $columnList, array $types): array { $typeValues = []; @@ -787,6 +800,9 @@ public function quoteIdentifier($str) } /** + * The usage of this method is discouraged. Use prepared statements + * or {@see AbstractPlatform::quoteStringLiteral()} instead. + * * @param mixed $value * @param int|string|Type|null $type * @@ -814,11 +830,7 @@ public function quote($value, $type = ParameterType::STRING) */ public function fetchAllNumeric(string $query, array $params = [], array $types = []): array { - try { - return $this->executeQuery($query, $params, $types)->fetchAllNumeric(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchAllNumeric(); } /** @@ -834,11 +846,7 @@ public function fetchAllNumeric(string $query, array $params = [], array $types */ public function fetchAllAssociative(string $query, array $params = [], array $types = []): array { - try { - return $this->executeQuery($query, $params, $types)->fetchAllAssociative(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchAllAssociative(); } /** @@ -889,11 +897,7 @@ public function fetchAllAssociativeIndexed(string $query, array $params = [], ar */ public function fetchFirstColumn(string $query, array $params = [], array $types = []): array { - try { - return $this->executeQuery($query, $params, $types)->fetchFirstColumn(); - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->fetchFirstColumn(); } /** @@ -909,15 +913,7 @@ public function fetchFirstColumn(string $query, array $params = [], array $types */ public function iterateNumeric(string $query, array $params = [], array $types = []): Traversable { - try { - $result = $this->executeQuery($query, $params, $types); - - while (($row = $result->fetchNumeric()) !== false) { - yield $row; - } - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->iterateNumeric(); } /** @@ -934,15 +930,7 @@ public function iterateNumeric(string $query, array $params = [], array $types = */ public function iterateAssociative(string $query, array $params = [], array $types = []): Traversable { - try { - $result = $this->executeQuery($query, $params, $types); - - while (($row = $result->fetchAssociative()) !== false) { - yield $row; - } - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->iterateAssociative(); } /** @@ -993,15 +981,7 @@ public function iterateAssociativeIndexed(string $query, array $params = [], arr */ public function iterateColumn(string $query, array $params = [], array $types = []): Traversable { - try { - $result = $this->executeQuery($query, $params, $types); - - while (($value = $result->fetchOne()) !== false) { - yield $value; - } - } catch (Driver\Exception $e) { - throw $this->convertExceptionDuringQuery($e, $query, $params, $types); - } + return $this->executeQuery($query, $params, $types)->iterateColumn(); } /** @@ -1013,7 +993,15 @@ public function iterateColumn(string $query, array $params = [], array $types = */ public function prepare(string $sql): Statement { - return new Statement($sql, $this); + $connection = $this->getWrappedConnection(); + + try { + $statement = $connection->prepare($sql); + } catch (Driver\Exception $e) { + throw $this->convertExceptionDuringQuery($e, $sql); + } + + return new Statement($this, $statement, $sql); } /** @@ -1084,7 +1072,7 @@ public function executeQuery( */ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp): Result { - $resultCache = $qcp->getResultCacheDriver() ?? $this->_config->getResultCacheImpl(); + $resultCache = $qcp->getResultCache() ?? $this->_config->getResultCache(); if ($resultCache === null) { throw CacheException::noResultDriverConfigured(); @@ -1095,29 +1083,31 @@ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) [$cacheKey, $realKey] = $qcp->generateCacheKeys($sql, $params, $types, $connectionParams); - // fetch the row pointers entry - $data = $resultCache->fetch($cacheKey); + $item = $resultCache->getItem($cacheKey); - if ($data !== false) { - // is the real key part of this row pointers map or is the cache only pointing to other cache keys? - if (isset($data[$realKey])) { - $result = new ArrayResult($data[$realKey]); - } elseif (array_key_exists($realKey, $data)) { - $result = new ArrayResult([]); + if ($item->isHit()) { + $value = $item->get(); + if (isset($value[$realKey])) { + return new Result(new ArrayResult($value[$realKey]), $this); } + } else { + $value = []; } - if (! isset($result)) { - $result = new CachingResult( - $this->executeQuery($sql, $params, $types), - $resultCache, - $cacheKey, - $realKey, - $qcp->getLifetime() - ); + $data = $this->fetchAllAssociative($sql, $params, $types); + + $value[$realKey] = $data; + + $item->set($value); + + $lifetime = $qcp->getLifetime(); + if ($lifetime > 0) { + $item->expiresAfter($lifetime); } - return new Result($result, $this); + $resultCache->save($item); + + return new Result(new ArrayResult($data), $this); } /** @@ -1136,7 +1126,7 @@ public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) * @param list|array $params Statement parameters * @param array|array $types Parameter types * - * @return int The number of affected rows. + * @return int|string The number of affected rows. * * @throws Exception */ @@ -1204,6 +1194,14 @@ public function getTransactionNestingLevel() */ public function lastInsertId($name = null) { + if ($name !== null) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + } + try { return $this->getWrappedConnection()->lastInsertId($name); } catch (Driver\Exception $e) { @@ -1273,10 +1271,9 @@ public function getNestTransactionsWithSavepoints() } /** - * Returns the savepoint name to use for nested transactions are false if they are not supported - * "savepointFormat" parameter is not set + * Returns the savepoint name to use for nested transactions. * - * @return mixed A string with the savepoint name or false. + * @return string */ protected function _getNestedTransactionSavePointName() { @@ -1317,6 +1314,8 @@ public function beginTransaction() } } + $this->getEventManager()->dispatchEvent(Events::onTransactionBegin, new TransactionBeginEventArgs($this)); + return true; } @@ -1364,6 +1363,8 @@ public function commit() --$this->transactionNestingLevel; + $this->getEventManager()->dispatchEvent(Events::onTransactionCommit, new TransactionCommitEventArgs($this)); + if ($this->autoCommit !== false || $this->transactionNestingLevel !== 0) { return $result; } @@ -1440,6 +1441,8 @@ public function rollBack() --$this->transactionNestingLevel; } + $this->getEventManager()->dispatchEvent(Events::onTransactionRollBack, new TransactionRollBackEventArgs($this)); + return true; } @@ -1510,12 +1513,21 @@ public function rollbackSavepoint($savepoint) /** * Gets the wrapped driver connection. * + * @deprecated Use {@link getNativeConnection()} to access the native connection. + * * @return DriverConnection * * @throws Exception */ public function getWrappedConnection() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4966', + 'Connection::getWrappedConnection() is deprecated.' + . ' Use Connection::getNativeConnection() to access the native connection.' + ); + $this->connect(); assert($this->_conn !== null); @@ -1523,6 +1535,24 @@ public function getWrappedConnection() return $this->_conn; } + /** + * @return resource|object + */ + public function getNativeConnection() + { + $this->connect(); + + assert($this->_conn !== null); + if (! method_exists($this->_conn, 'getNativeConnection')) { + throw new LogicException(sprintf( + 'The driver connection %s does not support accessing the native connection.', + get_class($this->_conn) + )); + } + + return $this->_conn->getNativeConnection(); + } + /** * Creates a SchemaManager that can be used to inspect or change the * database schema through the connection. @@ -1541,7 +1571,7 @@ public function createSchemaManager(): AbstractSchemaManager * Gets the SchemaManager that can be used to inspect or change the * database schema through the connection. * - * @deprecated Use {@link createSchemaManager()} instead. + * @deprecated Use {@see createSchemaManager()} instead. * * @return AbstractSchemaManager * @@ -1761,7 +1791,11 @@ private function needsArrayParameterConversion(array $params, array $types): boo } foreach ($types as $type) { - if ($type === self::PARAM_INT_ARRAY || $type === self::PARAM_STR_ARRAY) { + if ( + $type === self::PARAM_INT_ARRAY + || $type === self::PARAM_STR_ARRAY + || $type === self::PARAM_ASCII_STR_ARRAY + ) { return true; } } diff --git a/doctrine/dbal/src/Driver/API/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/ExceptionConverter.php index b848b0e28..a7bf27139 100644 --- a/doctrine/dbal/src/Driver/API/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/ExceptionConverter.php @@ -14,12 +14,12 @@ interface ExceptionConverter * Converts a given driver-level exception into a DBAL-level driver exception. * * Implementors should use the vendor-specific error code and SQLSTATE of the exception - * and instantiate the most appropriate specialized {@link DriverException} subclass. + * and instantiate the most appropriate specialized {@see DriverException} subclass. * * @param Exception $exception The driver exception to convert. * @param Query|null $query The SQL query that triggered the exception, if any. * - * @return DriverException An instance of {@link DriverException} or one of its subclasses. + * @return DriverException An instance of {@see DriverException} or one of its subclasses. */ public function convert(Exception $exception, ?Query $query): DriverException; } diff --git a/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php index 20831e0fd..dbde0b10f 100644 --- a/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php @@ -6,16 +6,60 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; use Doctrine\DBAL\Driver\Exception; +use Doctrine\DBAL\Exception\ConnectionException; use Doctrine\DBAL\Exception\DriverException; +use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; +use Doctrine\DBAL\Exception\InvalidFieldNameException; +use Doctrine\DBAL\Exception\NonUniqueFieldNameException; +use Doctrine\DBAL\Exception\NotNullConstraintViolationException; +use Doctrine\DBAL\Exception\SyntaxErrorException; +use Doctrine\DBAL\Exception\TableExistsException; +use Doctrine\DBAL\Exception\TableNotFoundException; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; /** * @internal + * + * @link https://www.ibm.com/docs/en/db2/11.5?topic=messages-sql */ final class ExceptionConverter implements ExceptionConverterInterface { public function convert(Exception $exception, ?Query $query): DriverException { + switch ($exception->getCode()) { + case -104: + return new SyntaxErrorException($exception, $query); + + case -203: + return new NonUniqueFieldNameException($exception, $query); + + case -204: + return new TableNotFoundException($exception, $query); + + case -206: + return new InvalidFieldNameException($exception, $query); + + case -407: + return new NotNullConstraintViolationException($exception, $query); + + case -530: + case -531: + case -532: + case -20356: + return new ForeignKeyConstraintViolationException($exception, $query); + + case -601: + return new TableExistsException($exception, $query); + + case -803: + return new UniqueConstraintViolationException($exception, $query); + + case -1336: + case -30082: + return new ConnectionException($exception, $query); + } + return new DriverException($exception, $query); } } diff --git a/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php index 9abc0c168..c851949be 100644 --- a/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php @@ -8,6 +8,7 @@ use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Exception\ConnectionException; use Doctrine\DBAL\Exception\ConnectionLost; +use Doctrine\DBAL\Exception\DatabaseDoesNotExist; use Doctrine\DBAL\Exception\DeadlockException; use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; @@ -33,6 +34,9 @@ final class ExceptionConverter implements ExceptionConverterInterface public function convert(Exception $exception, ?Query $query): DriverException { switch ($exception->getCode()) { + case 1008: + return new DatabaseDoesNotExist($exception, $query); + case 1213: return new DeadlockException($exception, $query); @@ -95,6 +99,7 @@ public function convert(Exception $exception, ?Query $query): DriverException case 1429: case 2002: case 2005: + case 2054: return new ConnectionException($exception, $query); case 2006: diff --git a/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php index f25e58d6c..727a605d7 100644 --- a/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php @@ -7,6 +7,8 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Exception\ConnectionException; +use Doctrine\DBAL\Exception\DatabaseDoesNotExist; +use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use Doctrine\DBAL\Exception\InvalidFieldNameException; @@ -57,6 +59,14 @@ public function convert(Exception $exception, ?Query $query): DriverException case 1400: return new NotNullConstraintViolationException($exception, $query); + case 1918: + return new DatabaseDoesNotExist($exception, $query); + + case 2289: + case 2443: + case 4080: + return new DatabaseObjectNotFoundException($exception, $query); + case 2266: case 2291: case 2292: diff --git a/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php index b9530d0b2..df34802cf 100644 --- a/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php @@ -7,12 +7,14 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Exception\ConnectionException; +use Doctrine\DBAL\Exception\DatabaseDoesNotExist; use Doctrine\DBAL\Exception\DeadlockException; use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use Doctrine\DBAL\Exception\InvalidFieldNameException; use Doctrine\DBAL\Exception\NonUniqueFieldNameException; use Doctrine\DBAL\Exception\NotNullConstraintViolationException; +use Doctrine\DBAL\Exception\SchemaDoesNotExist; use Doctrine\DBAL\Exception\SyntaxErrorException; use Doctrine\DBAL\Exception\TableExistsException; use Doctrine\DBAL\Exception\TableNotFoundException; @@ -54,6 +56,12 @@ public function convert(Exception $exception, ?Query $query): DriverException case '23505': return new UniqueConstraintViolationException($exception, $query); + case '3D000': + return new DatabaseDoesNotExist($exception, $query); + + case '3F000': + return new SchemaDoesNotExist($exception, $query); + case '42601': return new SyntaxErrorException($exception, $query); diff --git a/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php b/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php index 3fc3ff081..d0e8e9f46 100644 --- a/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php +++ b/doctrine/dbal/src/Driver/API/SQLSrv/ExceptionConverter.php @@ -6,16 +6,64 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; use Doctrine\DBAL\Driver\Exception; +use Doctrine\DBAL\Exception\ConnectionException; +use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; use Doctrine\DBAL\Exception\DriverException; +use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; +use Doctrine\DBAL\Exception\InvalidFieldNameException; +use Doctrine\DBAL\Exception\NonUniqueFieldNameException; +use Doctrine\DBAL\Exception\NotNullConstraintViolationException; +use Doctrine\DBAL\Exception\SyntaxErrorException; +use Doctrine\DBAL\Exception\TableExistsException; +use Doctrine\DBAL\Exception\TableNotFoundException; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; /** * @internal + * + * @link https://docs.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors */ final class ExceptionConverter implements ExceptionConverterInterface { public function convert(Exception $exception, ?Query $query): DriverException { + switch ($exception->getCode()) { + case 102: + return new SyntaxErrorException($exception, $query); + + case 207: + return new InvalidFieldNameException($exception, $query); + + case 208: + return new TableNotFoundException($exception, $query); + + case 209: + return new NonUniqueFieldNameException($exception, $query); + + case 515: + return new NotNullConstraintViolationException($exception, $query); + + case 547: + case 4712: + return new ForeignKeyConstraintViolationException($exception, $query); + + case 2601: + case 2627: + return new UniqueConstraintViolationException($exception, $query); + + case 2714: + return new TableExistsException($exception, $query); + + case 3701: + case 15151: + return new DatabaseObjectNotFoundException($exception, $query); + + case 11001: + case 18456: + return new ConnectionException($exception, $query); + } + return new DriverException($exception, $query); } } diff --git a/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php b/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php new file mode 100644 index 000000000..29e73d1f2 --- /dev/null +++ b/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php @@ -0,0 +1,48 @@ + 0) { + $offset -= 1; + } + + $pos = strpos($str, $substr, $offset); + + if ($pos !== false) { + return $pos + 1; + } + + return 0; + } +} diff --git a/doctrine/dbal/src/Driver/AbstractDB2Driver.php b/doctrine/dbal/src/Driver/AbstractDB2Driver.php index d8c707bb0..38a460861 100644 --- a/doctrine/dbal/src/Driver/AbstractDB2Driver.php +++ b/doctrine/dbal/src/Driver/AbstractDB2Driver.php @@ -10,8 +10,10 @@ use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Schema\DB2SchemaManager; +use function assert; + /** - * Abstract base implementation of the {@link Driver} interface for IBM DB2 based drivers. + * Abstract base implementation of the {@see Driver} interface for IBM DB2 based drivers. */ abstract class AbstractDB2Driver implements Driver { @@ -28,6 +30,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof DB2Platform); + return new DB2SchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/AbstractException.php b/doctrine/dbal/src/Driver/AbstractException.php index d38669359..f14501b2f 100644 --- a/doctrine/dbal/src/Driver/AbstractException.php +++ b/doctrine/dbal/src/Driver/AbstractException.php @@ -8,7 +8,7 @@ use Throwable; /** - * Base implementation of the {@link Exception} interface. + * Base implementation of the {@see Exception} interface. * * @internal * diff --git a/doctrine/dbal/src/Driver/AbstractMySQLDriver.php b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php index 31949b9c1..7f74e42d4 100644 --- a/doctrine/dbal/src/Driver/AbstractMySQLDriver.php +++ b/doctrine/dbal/src/Driver/AbstractMySQLDriver.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Driver\API\ExceptionConverter; use Doctrine\DBAL\Driver\API\MySQL; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\MariaDb1027Platform; use Doctrine\DBAL\Platforms\MySQL57Platform; @@ -13,13 +14,15 @@ use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Schema\MySQLSchemaManager; use Doctrine\DBAL\VersionAwarePlatformDriver; +use Doctrine\Deprecations\Deprecation; +use function assert; use function preg_match; use function stripos; use function version_compare; /** - * Abstract base implementation of the {@link Driver} interface for MySQL based drivers. + * Abstract base implementation of the {@see Driver} interface for MySQL based drivers. */ abstract class AbstractMySQLDriver implements VersionAwarePlatformDriver { @@ -46,6 +49,13 @@ public function createDatabasePlatformForVersion($version) } } + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5060', + 'MySQL 5.6 support is deprecated and will be removed in DBAL 4.' + . ' Consider upgrading to MySQL 5.7 or later.' + ); + return $this->getDatabasePlatform(); } @@ -112,7 +122,7 @@ private function getMariaDbMysqlVersionNumber(string $versionString): string /** * {@inheritdoc} * - * @return MySQLPlatform + * @return AbstractMySQLPlatform */ public function getDatabasePlatform() { @@ -126,6 +136,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof AbstractMySQLPlatform); + return new MySQLSchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/AbstractOracleDriver.php b/doctrine/dbal/src/Driver/AbstractOracleDriver.php index 80e4a02c8..c62c87d90 100644 --- a/doctrine/dbal/src/Driver/AbstractOracleDriver.php +++ b/doctrine/dbal/src/Driver/AbstractOracleDriver.php @@ -11,8 +11,10 @@ use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Schema\OracleSchemaManager; +use function assert; + /** - * Abstract base implementation of the {@link Driver} interface for Oracle based drivers. + * Abstract base implementation of the {@see Driver} interface for Oracle based drivers. */ abstract class AbstractOracleDriver implements Driver { @@ -29,6 +31,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof OraclePlatform); + return new OracleSchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php b/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php index 6b11d6178..adc0be095 100644 --- a/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php +++ b/doctrine/dbal/src/Driver/AbstractPostgreSQLDriver.php @@ -9,14 +9,17 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\PostgreSQL100Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\PostgreSQLSchemaManager; use Doctrine\DBAL\VersionAwarePlatformDriver; +use Doctrine\Deprecations\Deprecation; +use function assert; use function preg_match; use function version_compare; /** - * Abstract base implementation of the {@link Driver} interface for PostgreSQL based drivers. + * Abstract base implementation of the {@see Driver} interface for PostgreSQL based drivers. */ abstract class AbstractPostgreSQLDriver implements VersionAwarePlatformDriver { @@ -41,6 +44,13 @@ public function createDatabasePlatformForVersion($version) return new PostgreSQL100Platform(); } + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5060', + 'PostgreSQL 9 support is deprecated and will be removed in DBAL 4.' + . ' Consider upgrading to Postgres 10 or later.' + ); + return new PostgreSQL94Platform(); } @@ -57,6 +67,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof PostgreSQLPlatform); + return new PostgreSQLSchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php b/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php index b3d0928bb..adf31f554 100644 --- a/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php +++ b/doctrine/dbal/src/Driver/AbstractSQLServerDriver.php @@ -10,8 +10,10 @@ use Doctrine\DBAL\Platforms\SQLServer2012Platform; use Doctrine\DBAL\Schema\SQLServerSchemaManager; +use function assert; + /** - * Abstract base implementation of the {@link Driver} interface for Microsoft SQL Server based drivers. + * Abstract base implementation of the {@see Driver} interface for Microsoft SQL Server based drivers. */ abstract class AbstractSQLServerDriver implements Driver { @@ -28,6 +30,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof SQLServer2012Platform); + return new SQLServerSchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php b/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php index 12b4cfa68..b6479267b 100644 --- a/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php +++ b/doctrine/dbal/src/Driver/AbstractSQLiteDriver.php @@ -10,8 +10,10 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\SqliteSchemaManager; +use function assert; + /** - * Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SQLite based drivers. + * Abstract base implementation of the {@see Doctrine\DBAL\Driver} interface for SQLite based drivers. */ abstract class AbstractSQLiteDriver implements Driver { @@ -28,6 +30,8 @@ public function getDatabasePlatform() */ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) { + assert($platform instanceof SqlitePlatform); + return new SqliteSchemaManager($conn, $platform); } diff --git a/doctrine/dbal/src/Driver/Connection.php b/doctrine/dbal/src/Driver/Connection.php index 9febe72a5..2f460fd10 100644 --- a/doctrine/dbal/src/Driver/Connection.php +++ b/doctrine/dbal/src/Driver/Connection.php @@ -7,6 +7,8 @@ /** * Connection interface. * Driver connections must implement this interface. + * + * @method resource|object getNativeConnection() */ interface Connection { @@ -27,6 +29,9 @@ public function query(string $sql): Result; /** * Quotes a string for use in a query. * + * The usage of this method is discouraged. Use prepared statements + * or {@see AbstractPlatform::quoteStringLiteral()} instead. + * * @param mixed $value * @param int $type * diff --git a/doctrine/dbal/src/Driver/IBMDB2/Connection.php b/doctrine/dbal/src/Driver/IBMDB2/Connection.php index c8e36da3e..aca2a02ce 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Connection.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Connection.php @@ -2,25 +2,23 @@ namespace Doctrine\DBAL\Driver\IBMDB2; -use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionError; -use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionFailed; use Doctrine\DBAL\Driver\IBMDB2\Exception\PrepareFailed; +use Doctrine\DBAL\Driver\IBMDB2\Exception\StatementError; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use stdClass; use function assert; use function db2_autocommit; use function db2_commit; -use function db2_connect; use function db2_escape_string; use function db2_exec; use function db2_last_insert_id; use function db2_num_rows; -use function db2_pconnect; use function db2_prepare; use function db2_rollback; use function db2_server_info; @@ -33,33 +31,16 @@ final class Connection implements ServerInfoAwareConnection { /** @var resource */ - private $conn; + private $connection; /** * @internal The connection can be only instantiated by its driver. * - * @param array $driverOptions - * - * @throws Exception + * @param resource $connection */ - public function __construct( - string $database, - bool $persistent, - string $username, - string $password, - array $driverOptions = [] - ) { - if ($persistent) { - $conn = db2_pconnect($database, $username, $password, $driverOptions); - } else { - $conn = db2_connect($database, $username, $password, $driverOptions); - } - - if ($conn === false) { - throw ConnectionFailed::new(); - } - - $this->conn = $conn; + public function __construct($connection) + { + $this->connection = $connection; } /** @@ -67,7 +48,7 @@ public function __construct( */ public function getServerVersion() { - $serverInfo = db2_server_info($this->conn); + $serverInfo = db2_server_info($this->connection); assert($serverInfo instanceof stdClass); return $serverInfo->DBMS_VER; @@ -75,7 +56,7 @@ public function getServerVersion() public function prepare(string $sql): DriverStatement { - $stmt = @db2_prepare($this->conn, $sql); + $stmt = @db2_prepare($this->connection, $sql); if ($stmt === false) { throw PrepareFailed::new(error_get_last()); @@ -105,10 +86,10 @@ public function quote($value, $type = ParameterType::STRING) public function exec(string $sql): int { - $stmt = @db2_exec($this->conn, $sql); + $stmt = @db2_exec($this->connection, $sql); if ($stmt === false) { - throw ConnectionError::new($this->conn); + throw StatementError::new(); } return db2_num_rows($stmt); @@ -119,47 +100,54 @@ public function exec(string $sql): int */ public function lastInsertId($name = null) { - return db2_last_insert_id($this->conn); + if ($name !== null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + } + + return db2_last_insert_id($this->connection) ?? false; } - /** - * {@inheritdoc} - */ - public function beginTransaction() + public function beginTransaction(): bool { - $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF); + $result = db2_autocommit($this->connection, DB2_AUTOCOMMIT_OFF); assert(is_bool($result)); return $result; } - /** - * {@inheritdoc} - */ - public function commit() + public function commit(): bool { - if (! db2_commit($this->conn)) { - throw ConnectionError::new($this->conn); + if (! db2_commit($this->connection)) { + throw ConnectionError::new($this->connection); } - $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + $result = db2_autocommit($this->connection, DB2_AUTOCOMMIT_ON); assert(is_bool($result)); return $result; } - /** - * {@inheritdoc} - */ - public function rollBack() + public function rollBack(): bool { - if (! db2_rollback($this->conn)) { - throw ConnectionError::new($this->conn); + if (! db2_rollback($this->connection)) { + throw ConnectionError::new($this->connection); } - $result = db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); + $result = db2_autocommit($this->connection, DB2_AUTOCOMMIT_ON); assert(is_bool($result)); return $result; } + + /** + * @return resource + */ + public function getNativeConnection() + { + return $this->connection; + } } diff --git a/doctrine/dbal/src/Driver/IBMDB2/Driver.php b/doctrine/dbal/src/Driver/IBMDB2/Driver.php index c08165520..142b369b3 100644 --- a/doctrine/dbal/src/Driver/IBMDB2/Driver.php +++ b/doctrine/dbal/src/Driver/IBMDB2/Driver.php @@ -3,6 +3,10 @@ namespace Doctrine\DBAL\Driver\IBMDB2; use Doctrine\DBAL\Driver\AbstractDB2Driver; +use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionFailed; + +use function db2_connect; +use function db2_pconnect; final class Driver extends AbstractDB2Driver { @@ -13,12 +17,22 @@ final class Driver extends AbstractDB2Driver */ public function connect(array $params) { - return new Connection( - DataSourceName::fromConnectionParameters($params)->toString(), - isset($params['persistent']) && $params['persistent'] === true, - $params['user'] ?? '', - $params['password'] ?? '', - $params['driverOptions'] ?? [] - ); + $dataSourceName = DataSourceName::fromConnectionParameters($params)->toString(); + + $username = $params['user'] ?? ''; + $password = $params['password'] ?? ''; + $driverOptions = $params['driverOptions'] ?? []; + + if (! empty($params['persistent'])) { + $connection = db2_pconnect($dataSourceName, $username, $password, $driverOptions); + } else { + $connection = db2_connect($dataSourceName, $username, $password, $driverOptions); + } + + if ($connection === false) { + throw ConnectionFailed::new(); + } + + return new Connection($connection); } } diff --git a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php b/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php deleted file mode 100644 index f2287b300..000000000 --- a/doctrine/dbal/src/Driver/IBMDB2/Exception/CannotWriteToTemporaryFile.php +++ /dev/null @@ -1,29 +0,0 @@ - */ private $lobs = []; @@ -59,7 +56,7 @@ public function __construct($stmt) /** * {@inheritdoc} */ - public function bindValue($param, $value, $type = ParameterType::STRING) + public function bindValue($param, $value, $type = ParameterType::STRING): bool { assert(is_int($param)); @@ -69,7 +66,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) /** * {@inheritdoc} */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { assert(is_int($param)); @@ -79,17 +76,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le break; case ParameterType::LARGE_OBJECT: - if (isset($this->lobs[$param])) { - [, $handle] = $this->lobs[$param]; - fclose($handle); - } - - $handle = $this->createTemporaryFile(); - $path = stream_get_meta_data($handle)['uri']; - - $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY); - - $this->lobs[$param] = [&$variable, $handle]; + $this->lobs[$param] = &$variable; break; default: @@ -108,9 +95,9 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le */ private function bind($position, &$variable, int $parameterType, int $dataType): void { - $this->bindParam[$position] =& $variable; + $this->parameters[$position] =& $variable; - if (! db2_bind_param($this->stmt, $position, 'variable', $parameterType, $dataType)) { + if (! db2_bind_param($this->stmt, $position, '', $parameterType, $dataType)) { throw StatementError::new($this->stmt); } } @@ -120,29 +107,11 @@ private function bind($position, &$variable, int $parameterType, int $dataType): */ public function execute($params = null): ResultInterface { - if ($params === null) { - ksort($this->bindParam); + $handles = $this->bindLobs(); - $params = []; + $result = @db2_execute($this->stmt, $params ?? $this->parameters); - foreach ($this->bindParam as $value) { - $params[] = $value; - } - } - - foreach ($this->lobs as [$source, $target]) { - if (is_resource($source)) { - $this->copyStreamToStream($source, $target); - - continue; - } - - $this->writeStringToStream($source, $target); - } - - $result = db2_execute($this->stmt, $params); - - foreach ($this->lobs as [, $handle]) { + foreach ($handles as $handle) { fclose($handle); } @@ -155,6 +124,31 @@ public function execute($params = null): ResultInterface return new Result($this->stmt); } + /** + * @return list + * + * @throws Exception + */ + private function bindLobs(): array + { + $handles = []; + + foreach ($this->lobs as $param => $value) { + if (is_resource($value)) { + $handle = $handles[] = $this->createTemporaryFile(); + $path = stream_get_meta_data($handle)['uri']; + + $this->copyStreamToStream($value, $handle); + + $this->bind($param, $path, DB2_PARAM_FILE, DB2_BINARY); + } else { + $this->bind($param, $value, DB2_PARAM_IN, DB2_CHAR); + } + } + + return $handles; + } + /** * @return resource * @@ -183,16 +177,4 @@ private function copyStreamToStream($source, $target): void throw CannotCopyStreamToStream::new(error_get_last()); } } - - /** - * @param resource $target - * - * @throws Exception - */ - private function writeStringToStream(string $string, $target): void - { - if (@fwrite($target, $string) === false) { - throw CannotWriteToTemporaryFile::new(error_get_last()); - } - } } diff --git a/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php b/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php new file mode 100644 index 000000000..a0e69a5e7 --- /dev/null +++ b/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php @@ -0,0 +1,116 @@ +wrappedConnection = $wrappedConnection; + } + + public function prepare(string $sql): Statement + { + return $this->wrappedConnection->prepare($sql); + } + + public function query(string $sql): Result + { + return $this->wrappedConnection->query($sql); + } + + /** + * {@inheritdoc} + */ + public function quote($value, $type = ParameterType::STRING) + { + return $this->wrappedConnection->quote($value, $type); + } + + public function exec(string $sql): int + { + return $this->wrappedConnection->exec($sql); + } + + /** + * {@inheritdoc} + */ + public function lastInsertId($name = null) + { + if ($name !== null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + } + + return $this->wrappedConnection->lastInsertId($name); + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + return $this->wrappedConnection->beginTransaction(); + } + + /** + * {@inheritdoc} + */ + public function commit() + { + return $this->wrappedConnection->commit(); + } + + /** + * {@inheritdoc} + */ + public function rollBack() + { + return $this->wrappedConnection->rollBack(); + } + + /** + * {@inheritdoc} + */ + public function getServerVersion() + { + if (! $this->wrappedConnection instanceof ServerInfoAwareConnection) { + throw new LogicException('The underlying connection is not a ServerInfoAwareConnection'); + } + + return $this->wrappedConnection->getServerVersion(); + } + + /** + * @return resource|object + */ + public function getNativeConnection() + { + if (! method_exists($this->wrappedConnection, 'getNativeConnection')) { + throw new LogicException(sprintf( + 'The driver connection %s does not support accessing the native connection.', + get_class($this->wrappedConnection) + )); + } + + return $this->wrappedConnection->getNativeConnection(); + } +} diff --git a/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php b/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php new file mode 100644 index 000000000..ab1f508f7 --- /dev/null +++ b/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php @@ -0,0 +1,61 @@ +wrappedDriver = $wrappedDriver; + } + + /** + * {@inheritdoc} + */ + public function connect(array $params) + { + return $this->wrappedDriver->connect($params); + } + + /** + * {@inheritdoc} + */ + public function getDatabasePlatform() + { + return $this->wrappedDriver->getDatabasePlatform(); + } + + /** + * {@inheritdoc} + */ + public function getSchemaManager(Connection $conn, AbstractPlatform $platform) + { + return $this->wrappedDriver->getSchemaManager($conn, $platform); + } + + public function getExceptionConverter(): ExceptionConverter + { + return $this->wrappedDriver->getExceptionConverter(); + } + + /** + * {@inheritdoc} + */ + public function createDatabasePlatformForVersion($version) + { + if ($this->wrappedDriver instanceof VersionAwarePlatformDriver) { + return $this->wrappedDriver->createDatabasePlatformForVersion($version); + } + + return $this->wrappedDriver->getDatabasePlatform(); + } +} diff --git a/doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php b/doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php new file mode 100644 index 000000000..ebc63c570 --- /dev/null +++ b/doctrine/dbal/src/Driver/Middleware/AbstractResultMiddleware.php @@ -0,0 +1,79 @@ +wrappedResult = $result; + } + + /** + * {@inheritdoc} + */ + public function fetchNumeric() + { + return $this->wrappedResult->fetchNumeric(); + } + + /** + * {@inheritdoc} + */ + public function fetchAssociative() + { + return $this->wrappedResult->fetchAssociative(); + } + + /** + * {@inheritdoc} + */ + public function fetchOne() + { + return $this->wrappedResult->fetchOne(); + } + + /** + * {@inheritdoc} + */ + public function fetchAllNumeric(): array + { + return $this->wrappedResult->fetchAllNumeric(); + } + + /** + * {@inheritdoc} + */ + public function fetchAllAssociative(): array + { + return $this->wrappedResult->fetchAllAssociative(); + } + + /** + * {@inheritdoc} + */ + public function fetchFirstColumn(): array + { + return $this->wrappedResult->fetchFirstColumn(); + } + + public function rowCount(): int + { + return $this->wrappedResult->rowCount(); + } + + public function columnCount(): int + { + return $this->wrappedResult->columnCount(); + } + + public function free(): void + { + $this->wrappedResult->free(); + } +} diff --git a/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php b/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php new file mode 100644 index 000000000..a646cd30c --- /dev/null +++ b/doctrine/dbal/src/Driver/Middleware/AbstractStatementMiddleware.php @@ -0,0 +1,42 @@ +wrappedStatement = $wrappedStatement; + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + return $this->wrappedStatement->bindValue($param, $value, $type); + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + return $this->wrappedStatement->bindParam($param, $variable, $type, $length); + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): Result + { + return $this->wrappedStatement->execute($params); + } +} diff --git a/doctrine/dbal/src/Driver/Mysqli/Connection.php b/doctrine/dbal/src/Driver/Mysqli/Connection.php index 736345362..8453f7406 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Connection.php +++ b/doctrine/dbal/src/Driver/Mysqli/Connection.php @@ -2,21 +2,15 @@ namespace Doctrine\DBAL\Driver\Mysqli; -use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError; -use Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionFailed; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use mysqli; use mysqli_sql_exception; -use function assert; -use function floor; -use function mysqli_init; -use function stripos; - final class Connection implements ServerInfoAwareConnection { /** @@ -25,49 +19,14 @@ final class Connection implements ServerInfoAwareConnection public const OPTION_FLAGS = 'flags'; /** @var mysqli */ - private $conn; + private $connection; /** * @internal The connection can be only instantiated by its driver. - * - * @param iterable $preInitializers - * @param iterable $postInitializers - * - * @throws Exception */ - public function __construct( - ?string $host = null, - ?string $username = null, - ?string $password = null, - ?string $database = null, - ?int $port = null, - ?string $socket = null, - int $flags = 0, - iterable $preInitializers = [], - iterable $postInitializers = [] - ) { - $connection = mysqli_init(); - assert($connection !== false); - - foreach ($preInitializers as $initializer) { - $initializer->initialize($connection); - } - - try { - $success = @$connection->real_connect($host, $username, $password, $database, $port, $socket, $flags); - } catch (mysqli_sql_exception $e) { - throw ConnectionFailed::upcast($e); - } - - if (! $success) { - throw ConnectionFailed::new($connection); - } - - foreach ($postInitializers as $initializer) { - $initializer->initialize($connection); - } - - $this->conn = $connection; + public function __construct(mysqli $connection) + { + $this->connection = $connection; } /** @@ -75,38 +34,38 @@ public function __construct( * * Could be used if part of your application is not using DBAL. * - * @return mysqli + * @deprecated Call {@see getNativeConnection()} instead. */ - public function getWrappedResourceHandle() + public function getWrappedResourceHandle(): mysqli { - return $this->conn; + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5037', + '%s is deprecated, call getNativeConnection() instead.', + __METHOD__ + ); + + return $this->getNativeConnection(); } - /** - * {@inheritdoc} - * - * The server version detection includes a special case for MariaDB - * to support '5.5.5-' prefixed versions introduced in Maria 10+ - * - * @link https://jira.mariadb.org/browse/MDEV-4088 - */ - public function getServerVersion() + public function getServerVersion(): string { - $serverInfos = $this->conn->get_server_info(); - if (stripos($serverInfos, 'mariadb') !== false) { - return $serverInfos; - } - - $majorVersion = floor($this->conn->server_version / 10000); - $minorVersion = floor(($this->conn->server_version - $majorVersion * 10000) / 100); - $patchVersion = floor($this->conn->server_version - $majorVersion * 10000 - $minorVersion * 100); - - return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; + return $this->connection->get_server_info(); } public function prepare(string $sql): DriverStatement { - return new Statement($this->conn, $sql); + try { + $stmt = $this->connection->prepare($sql); + } catch (mysqli_sql_exception $e) { + throw ConnectionError::upcast($e); + } + + if ($stmt === false) { + throw ConnectionError::new($this->connection); + } + + return new Statement($stmt); } public function query(string $sql): ResultInterface @@ -119,22 +78,22 @@ public function query(string $sql): ResultInterface */ public function quote($value, $type = ParameterType::STRING) { - return "'" . $this->conn->escape_string($value) . "'"; + return "'" . $this->connection->escape_string($value) . "'"; } public function exec(string $sql): int { try { - $result = $this->conn->query($sql); + $result = $this->connection->query($sql); } catch (mysqli_sql_exception $e) { throw ConnectionError::upcast($e); } if ($result === false) { - throw ConnectionError::new($this->conn); + throw ConnectionError::new($this->connection); } - return $this->conn->affected_rows; + return $this->connection->affected_rows; } /** @@ -142,40 +101,44 @@ public function exec(string $sql): int */ public function lastInsertId($name = null) { - return $this->conn->insert_id; + if ($name !== null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + } + + return $this->connection->insert_id; } - /** - * {@inheritdoc} - */ - public function beginTransaction() + public function beginTransaction(): bool { - $this->conn->query('START TRANSACTION'); + $this->connection->begin_transaction(); return true; } - /** - * {@inheritdoc} - */ - public function commit() + public function commit(): bool { try { - return $this->conn->commit(); + return $this->connection->commit(); } catch (mysqli_sql_exception $e) { return false; } } - /** - * {@inheritdoc} - */ - public function rollBack() + public function rollBack(): bool { try { - return $this->conn->rollback(); + return $this->connection->rollback(); } catch (mysqli_sql_exception $e) { return false; } } + + public function getNativeConnection(): mysqli + { + return $this->connection; + } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Driver.php b/doctrine/dbal/src/Driver/Mysqli/Driver.php index d459863d8..41a66a732 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Driver.php +++ b/doctrine/dbal/src/Driver/Mysqli/Driver.php @@ -3,10 +3,13 @@ namespace Doctrine\DBAL\Driver\Mysqli; use Doctrine\DBAL\Driver\AbstractMySQLDriver; +use Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionFailed; use Doctrine\DBAL\Driver\Mysqli\Exception\HostRequired; use Doctrine\DBAL\Driver\Mysqli\Initializer\Charset; use Doctrine\DBAL\Driver\Mysqli\Initializer\Options; use Doctrine\DBAL\Driver\Mysqli\Initializer\Secure; +use mysqli; +use mysqli_sql_exception; use function count; @@ -47,17 +50,35 @@ public function connect(array $params) $preInitializers = $this->withSecure($preInitializers, $params); $postInitializers = $this->withCharset($postInitializers, $params); - return new Connection( - $host, - $params['user'] ?? null, - $params['password'] ?? null, - $params['dbname'] ?? null, - $params['port'] ?? null, - $params['unix_socket'] ?? null, - $flags, - $preInitializers, - $postInitializers - ); + $connection = new mysqli(); + + foreach ($preInitializers as $initializer) { + $initializer->initialize($connection); + } + + try { + $success = @$connection->real_connect( + $host, + $params['user'] ?? null, + $params['password'] ?? null, + $params['dbname'] ?? null, + $params['port'] ?? null, + $params['unix_socket'] ?? null, + $flags + ); + } catch (mysqli_sql_exception $e) { + throw ConnectionFailed::upcast($e); + } + + if (! $success) { + throw ConnectionFailed::new($connection); + } + + foreach ($postInitializers as $initializer) { + $initializer->initialize($connection); + } + + return new Connection($connection); } /** diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php index faceeb086..44a8cab99 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php @@ -9,6 +9,8 @@ use mysqli_sql_exception; use ReflectionProperty; +use function assert; + /** * @internal * @@ -18,7 +20,10 @@ final class ConnectionFailed extends AbstractException { public static function new(mysqli $connection): self { - return new self($connection->connect_error, 'HY000', $connection->connect_errno); + $error = $connection->connect_error; + assert($error !== null); + + return new self($error, 'HY000', $connection->connect_errno); } public static function upcast(mysqli_sql_exception $exception): self diff --git a/doctrine/dbal/src/Driver/Mysqli/Result.php b/doctrine/dbal/src/Driver/Mysqli/Result.php index 230471526..ac36df033 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Result.php +++ b/doctrine/dbal/src/Driver/Mysqli/Result.php @@ -10,11 +10,10 @@ use Doctrine\DBAL\Driver\Result as ResultInterface; use mysqli_sql_exception; use mysqli_stmt; -use stdClass; +use function array_column; use function array_combine; use function array_fill; -use function array_map; use function count; final class Result implements ResultInterface @@ -58,11 +57,7 @@ public function __construct(mysqli_stmt $statement) $this->hasColumns = true; - $fields = $meta->fetch_fields(); - - $this->columnNames = array_map(static function (stdClass $field): string { - return $field->name; - }, $fields); + $this->columnNames = array_column($meta->fetch_fields(), 'name'); $meta->free(); @@ -84,10 +79,8 @@ public function __construct(mysqli_stmt $statement) // to the length of the ones fetched during the previous execution. $this->boundValues = array_fill(0, count($this->columnNames), null); - $refs = []; - foreach ($this->boundValues as &$value) { - $refs[] =& $value; - } + // The following is necessary as PHP cannot handle references to properties properly + $refs = &$this->boundValues; if (! $this->statement->bind_result(...$refs)) { throw StatementError::new($this->statement); diff --git a/doctrine/dbal/src/Driver/Mysqli/Statement.php b/doctrine/dbal/src/Driver/Mysqli/Statement.php index 249cb2c87..6e493c9e5 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Statement.php +++ b/doctrine/dbal/src/Driver/Mysqli/Statement.php @@ -4,14 +4,12 @@ use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Exception\UnknownParameterType; -use Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError; use Doctrine\DBAL\Driver\Mysqli\Exception\FailedReadingStreamOffset; use Doctrine\DBAL\Driver\Mysqli\Exception\NonStreamResourceUsedAsLargeObject; use Doctrine\DBAL\Driver\Mysqli\Exception\StatementError; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; -use mysqli; use mysqli_sql_exception; use mysqli_stmt; @@ -28,7 +26,7 @@ final class Statement implements StatementInterface { /** @var string[] */ - protected static $_paramTypeMap = [ + private static $paramTypeMap = [ ParameterType::ASCII => 's', ParameterType::STRING => 's', ParameterType::BINARY => 's', @@ -38,66 +36,47 @@ final class Statement implements StatementInterface ParameterType::LARGE_OBJECT => 'b', ]; - /** @var mysqli */ - protected $_conn; - /** @var mysqli_stmt */ - protected $_stmt; + private $stmt; /** @var mixed[] */ - protected $_bindedValues; + private $boundValues; /** @var string */ - protected $types; + private $types; /** * Contains ref values for bindValue(). * * @var mixed[] */ - protected $_values = []; + private $values = []; /** * @internal The statement can be only instantiated by its driver connection. - * - * @param string $prepareString - * - * @throws Exception */ - public function __construct(mysqli $conn, $prepareString) + public function __construct(mysqli_stmt $stmt) { - $this->_conn = $conn; - - try { - $stmt = $conn->prepare($prepareString); - } catch (mysqli_sql_exception $e) { - throw ConnectionError::upcast($e); - } + $this->stmt = $stmt; - if ($stmt === false) { - throw ConnectionError::new($this->_conn); - } - - $this->_stmt = $stmt; - - $paramCount = $this->_stmt->param_count; - $this->types = str_repeat('s', $paramCount); - $this->_bindedValues = array_fill(1, $paramCount, null); + $paramCount = $this->stmt->param_count; + $this->types = str_repeat('s', $paramCount); + $this->boundValues = array_fill(1, $paramCount, null); } /** * {@inheritdoc} */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { assert(is_int($param)); - if (! isset(self::$_paramTypeMap[$type])) { + if (! isset(self::$paramTypeMap[$type])) { throw UnknownParameterType::new($type); } - $this->_bindedValues[$param] =& $variable; - $this->types[$param - 1] = self::$_paramTypeMap[$type]; + $this->boundValues[$param] =& $variable; + $this->types[$param - 1] = self::$paramTypeMap[$type]; return true; } @@ -105,17 +84,17 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le /** * {@inheritdoc} */ - public function bindValue($param, $value, $type = ParameterType::STRING) + public function bindValue($param, $value, $type = ParameterType::STRING): bool { assert(is_int($param)); - if (! isset(self::$_paramTypeMap[$type])) { + if (! isset(self::$paramTypeMap[$type])) { throw UnknownParameterType::new($type); } - $this->_values[$param] = $value; - $this->_bindedValues[$param] =& $this->_values[$param]; - $this->types[$param - 1] = self::$_paramTypeMap[$type]; + $this->values[$param] = $value; + $this->boundValues[$param] =& $this->values[$param]; + $this->types[$param - 1] = self::$paramTypeMap[$type]; return true; } @@ -127,23 +106,23 @@ public function execute($params = null): ResultInterface { if ($params !== null && count($params) > 0) { if (! $this->bindUntypedValues($params)) { - throw StatementError::new($this->_stmt); + throw StatementError::new($this->stmt); } - } elseif (count($this->_bindedValues) > 0) { + } elseif (count($this->boundValues) > 0) { $this->bindTypedParameters(); } try { - $result = $this->_stmt->execute(); + $result = $this->stmt->execute(); } catch (mysqli_sql_exception $e) { throw StatementError::upcast($e); } if (! $result) { - throw StatementError::new($this->_stmt); + throw StatementError::new($this->stmt); } - return new Result($this->_stmt); + return new Result($this->stmt); } /** @@ -156,14 +135,14 @@ private function bindTypedParameters(): void $streams = $values = []; $types = $this->types; - foreach ($this->_bindedValues as $parameter => $value) { + foreach ($this->boundValues as $parameter => $value) { assert(is_int($parameter)); if (! isset($types[$parameter - 1])) { - $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; + $types[$parameter - 1] = self::$paramTypeMap[ParameterType::STRING]; } - if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) { + if ($types[$parameter - 1] === self::$paramTypeMap[ParameterType::LARGE_OBJECT]) { if (is_resource($value)) { if (get_resource_type($value) !== 'stream') { throw NonStreamResourceUsedAsLargeObject::new($parameter); @@ -174,14 +153,14 @@ private function bindTypedParameters(): void continue; } - $types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING]; + $types[$parameter - 1] = self::$paramTypeMap[ParameterType::STRING]; } $values[$parameter] = $value; } - if (! $this->_stmt->bind_param($types, ...$values)) { - throw StatementError::new($this->_stmt); + if (! $this->stmt->bind_param($types, ...$values)) { + throw StatementError::new($this->stmt); } $this->sendLongData($streams); @@ -204,8 +183,8 @@ private function sendLongData(array $streams): void throw FailedReadingStreamOffset::new($paramNr); } - if (! $this->_stmt->send_long_data($paramNr - 1, $chunk)) { - throw StatementError::new($this->_stmt); + if (! $this->stmt->send_long_data($paramNr - 1, $chunk)) { + throw StatementError::new($this->stmt); } } } @@ -215,18 +194,9 @@ private function sendLongData(array $streams): void * Binds a array of values to bound parameters. * * @param mixed[] $values - * - * @return bool */ - private function bindUntypedValues(array $values) + private function bindUntypedValues(array $values): bool { - $params = []; - $types = str_repeat('s', count($values)); - - foreach ($values as &$v) { - $params[] =& $v; - } - - return $this->_stmt->bind_param($types, ...$params); + return $this->stmt->bind_param(str_repeat('s', count($values)), ...$values); } } diff --git a/doctrine/dbal/src/Driver/OCI8/Connection.php b/doctrine/dbal/src/Driver/OCI8/Connection.php index b05892f96..46ff41866 100644 --- a/doctrine/dbal/src/Driver/OCI8/Connection.php +++ b/doctrine/dbal/src/Driver/OCI8/Connection.php @@ -3,79 +3,56 @@ namespace Doctrine\DBAL\Driver\OCI8; use Doctrine\DBAL\Driver\Exception; -use Doctrine\DBAL\Driver\OCI8\Exception\ConnectionFailed; use Doctrine\DBAL\Driver\OCI8\Exception\Error; use Doctrine\DBAL\Driver\OCI8\Exception\SequenceDoesNotExist; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; +use Doctrine\DBAL\SQL\Parser; +use Doctrine\Deprecations\Deprecation; use function addcslashes; use function assert; use function is_float; use function is_int; +use function is_resource; use function oci_commit; -use function oci_connect; -use function oci_pconnect; +use function oci_parse; use function oci_rollback; use function oci_server_version; use function preg_match; use function str_replace; -use const OCI_NO_AUTO_COMMIT; - final class Connection implements ServerInfoAwareConnection { /** @var resource */ - protected $dbh; + private $connection; + + /** @var Parser */ + private $parser; /** @var ExecutionMode */ private $executionMode; /** - * Creates a Connection to an Oracle Database using oci8 extension. - * * @internal The connection can be only instantiated by its driver. * - * @param string $username - * @param string $password - * @param string $db - * @param string $charset - * @param int $sessionMode - * @param bool $persistent - * - * @throws Exception + * @param resource $connection */ - public function __construct( - $username, - $password, - $db, - $charset = '', - $sessionMode = OCI_NO_AUTO_COMMIT, - $persistent = false - ) { - $dbh = $persistent - ? @oci_pconnect($username, $password, $db, $charset, $sessionMode) - : @oci_connect($username, $password, $db, $charset, $sessionMode); - - if ($dbh === false) { - throw ConnectionFailed::new(); - } - - $this->dbh = $dbh; + public function __construct($connection) + { + $this->connection = $connection; + $this->parser = new Parser(false); $this->executionMode = new ExecutionMode(); } - /** - * {@inheritdoc} - */ - public function getServerVersion() + public function getServerVersion(): string { - $version = oci_server_version($this->dbh); + $version = oci_server_version($this->connection); if ($version === false) { - throw Error::new($this->dbh); + throw Error::new($this->connection); } $result = preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches); @@ -84,11 +61,25 @@ public function getServerVersion() return $matches[1]; } + /** + * @throws Parser\Exception + */ public function prepare(string $sql): DriverStatement { - return new Statement($this->dbh, $sql, $this->executionMode); + $visitor = new ConvertPositionalToNamedPlaceholders(); + + $this->parser->parse($sql, $visitor); + + $statement = oci_parse($this->connection, $visitor->getSQL()); + assert(is_resource($statement)); + + return new Statement($this->connection, $statement, $visitor->getParameterMap(), $this->executionMode); } + /** + * @throws Exception + * @throws Parser\Exception + */ public function query(string $sql): ResultInterface { return $this->prepare($sql)->execute(); @@ -108,6 +99,10 @@ public function quote($value, $type = ParameterType::STRING) return "'" . addcslashes($value, "\000\n\r\\\032") . "'"; } + /** + * @throws Exception + * @throws Parser\Exception + */ public function exec(string $sql): int { return $this->prepare($sql)->execute()->rowCount(); @@ -119,6 +114,8 @@ public function exec(string $sql): int * @param string|null $name * * @return int|false + * + * @throws Parser\Exception */ public function lastInsertId($name = null) { @@ -126,6 +123,12 @@ public function lastInsertId($name = null) return false; } + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + $result = $this->query('SELECT ' . $name . '.CURRVAL FROM DUAL')->fetchOne(); if ($result === false) { @@ -135,23 +138,17 @@ public function lastInsertId($name = null) return (int) $result; } - /** - * {@inheritdoc} - */ - public function beginTransaction() + public function beginTransaction(): bool { $this->executionMode->disableAutoCommit(); return true; } - /** - * {@inheritdoc} - */ - public function commit() + public function commit(): bool { - if (! oci_commit($this->dbh)) { - throw Error::new($this->dbh); + if (! oci_commit($this->connection)) { + throw Error::new($this->connection); } $this->executionMode->enableAutoCommit(); @@ -159,17 +156,22 @@ public function commit() return true; } - /** - * {@inheritdoc} - */ - public function rollBack() + public function rollBack(): bool { - if (! oci_rollback($this->dbh)) { - throw Error::new($this->dbh); + if (! oci_rollback($this->connection)) { + throw Error::new($this->connection); } $this->executionMode->enableAutoCommit(); return true; } + + /** + * @return resource + */ + public function getNativeConnection() + { + return $this->connection; + } } diff --git a/doctrine/dbal/src/Driver/OCI8/Driver.php b/doctrine/dbal/src/Driver/OCI8/Driver.php index 351ffb87a..48ef0bbe4 100644 --- a/doctrine/dbal/src/Driver/OCI8/Driver.php +++ b/doctrine/dbal/src/Driver/OCI8/Driver.php @@ -3,6 +3,10 @@ namespace Doctrine\DBAL\Driver\OCI8; use Doctrine\DBAL\Driver\AbstractOracleDriver; +use Doctrine\DBAL\Driver\OCI8\Exception\ConnectionFailed; + +use function oci_connect; +use function oci_pconnect; use const OCI_NO_AUTO_COMMIT; @@ -18,25 +22,23 @@ final class Driver extends AbstractOracleDriver */ public function connect(array $params) { - return new Connection( - $params['user'] ?? '', - $params['password'] ?? '', - $this->_constructDsn($params), - $params['charset'] ?? '', - $params['sessionMode'] ?? OCI_NO_AUTO_COMMIT, - $params['persistent'] ?? false - ); - } + $username = $params['user'] ?? ''; + $password = $params['password'] ?? ''; + $charset = $params['charset'] ?? ''; + $sessionMode = $params['sessionMode'] ?? OCI_NO_AUTO_COMMIT; - /** - * Constructs the Oracle DSN. - * - * @param mixed[] $params - * - * @return string The DSN. - */ - protected function _constructDsn(array $params) - { - return $this->getEasyConnectString($params); + $connectionString = $this->getEasyConnectString($params); + + if (! empty($params['persistent'])) { + $connection = @oci_pconnect($username, $password, $connectionString, $charset, $sessionMode); + } else { + $connection = @oci_connect($username, $password, $connectionString, $charset, $sessionMode); + } + + if ($connection === false) { + throw ConnectionFailed::new(); + } + + return new Connection($connection); } } diff --git a/doctrine/dbal/src/Driver/OCI8/Statement.php b/doctrine/dbal/src/Driver/OCI8/Statement.php index 56602a364..c5e3774ba 100644 --- a/doctrine/dbal/src/Driver/OCI8/Statement.php +++ b/doctrine/dbal/src/Driver/OCI8/Statement.php @@ -2,21 +2,16 @@ namespace Doctrine\DBAL\Driver\OCI8; -use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\OCI8\Exception\Error; use Doctrine\DBAL\Driver\OCI8\Exception\UnknownParameterIndex; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; -use Doctrine\DBAL\SQL\Parser; -use function assert; use function is_int; -use function is_resource; use function oci_bind_by_name; use function oci_execute; use function oci_new_descriptor; -use function oci_parse; use const OCI_B_BIN; use const OCI_B_BLOB; @@ -29,84 +24,66 @@ final class Statement implements StatementInterface { /** @var resource */ - protected $_dbh; + private $connection; /** @var resource */ - protected $_sth; + private $statement; + + /** @var array */ + private $parameterMap; /** @var ExecutionMode */ private $executionMode; - /** @var string[] */ - protected $_paramMap = []; - - /** - * Holds references to bound parameter values. - * - * This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected. - * - * @var mixed[] - */ - private $boundValues = []; - /** - * Creates a new OCI8Statement that uses the given connection handle and SQL statement. - * * @internal The statement can be only instantiated by its driver connection. * - * @param resource $dbh The connection handle. - * @param string $query The SQL query. - * - * @throws Exception + * @param resource $connection + * @param resource $statement + * @param array $parameterMap */ - public function __construct($dbh, $query, ExecutionMode $executionMode) + public function __construct($connection, $statement, array $parameterMap, ExecutionMode $executionMode) { - $parser = new Parser(false); - $visitor = new ConvertPositionalToNamedPlaceholders(); - - $parser->parse($query, $visitor); - - $stmt = oci_parse($dbh, $visitor->getSQL()); - assert(is_resource($stmt)); - - $this->_sth = $stmt; - $this->_dbh = $dbh; - $this->_paramMap = $visitor->getParameterMap(); + $this->connection = $connection; + $this->statement = $statement; + $this->parameterMap = $parameterMap; $this->executionMode = $executionMode; } /** * {@inheritdoc} */ - public function bindValue($param, $value, $type = ParameterType::STRING) + public function bindValue($param, $value, $type = ParameterType::STRING): bool { - return $this->bindParam($param, $value, $type, null); + return $this->bindParam($param, $value, $type); } /** * {@inheritdoc} */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { if (is_int($param)) { - if (! isset($this->_paramMap[$param])) { + if (! isset($this->parameterMap[$param])) { throw UnknownParameterIndex::new($param); } - $param = $this->_paramMap[$param]; + $param = $this->parameterMap[$param]; } if ($type === ParameterType::LARGE_OBJECT) { - $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); - $lob->writeTemporary($variable, OCI_TEMP_BLOB); + if ($variable !== null) { + $lob = oci_new_descriptor($this->connection, OCI_D_LOB); + $lob->writeTemporary($variable, OCI_TEMP_BLOB); - $variable =& $lob; + $variable =& $lob; + } else { + $type = ParameterType::STRING; + } } - $this->boundValues[$param] =& $variable; - return oci_bind_by_name( - $this->_sth, + $this->statement, $param, $variable, $length ?? -1, @@ -152,11 +129,11 @@ public function execute($params = null): ResultInterface $mode = OCI_NO_AUTO_COMMIT; } - $ret = @oci_execute($this->_sth, $mode); + $ret = @oci_execute($this->statement, $mode); if (! $ret) { - throw Error::new($this->_sth); + throw Error::new($this->statement); } - return new Result($this->_sth); + return new Result($this->statement); } } diff --git a/doctrine/dbal/src/Driver/PDO/Connection.php b/doctrine/dbal/src/Driver/PDO/Connection.php index 169016937..505acba5f 100644 --- a/doctrine/dbal/src/Driver/PDO/Connection.php +++ b/doctrine/dbal/src/Driver/PDO/Connection.php @@ -2,11 +2,11 @@ namespace Doctrine\DBAL\Driver\PDO; -use Doctrine\DBAL\Driver\Exception as ExceptionInterface; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use PDO; use PDOException; use PDOStatement; @@ -20,22 +20,12 @@ final class Connection implements ServerInfoAwareConnection /** * @internal The connection can be only instantiated by its driver. - * - * @param string $dsn - * @param string|null $user - * @param string|null $password - * @param mixed[]|null $options - * - * @throws ExceptionInterface */ - public function __construct($dsn, $user = null, $password = null, ?array $options = null) + public function __construct(PDO $connection) { - try { - $this->connection = new PDO($dsn, (string) $user, (string) $password, (array) $options); - $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch (PDOException $exception) { - throw Exception::new($exception); - } + $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + $this->connection = $connection; } public function exec(string $sql): int @@ -70,7 +60,7 @@ public function prepare(string $sql): StatementInterface $stmt = $this->connection->prepare($sql); assert($stmt instanceof PDOStatement); - return $this->createStatement($stmt); + return new Statement($stmt); } catch (PDOException $exception) { throw Exception::new($exception); } @@ -106,46 +96,50 @@ public function lastInsertId($name = null) return $this->connection->lastInsertId(); } + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + return $this->connection->lastInsertId($name); } catch (PDOException $exception) { throw Exception::new($exception); } } - /** - * Creates a wrapped statement - */ - protected function createStatement(PDOStatement $stmt): Statement - { - return new Statement($stmt); - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() + public function beginTransaction(): bool { return $this->connection->beginTransaction(); } - /** - * {@inheritDoc} - */ - public function commit() + public function commit(): bool { return $this->connection->commit(); } - /** - * {@inheritDoc} - */ - public function rollBack() + public function rollBack(): bool { return $this->connection->rollBack(); } - public function getWrappedConnection(): PDO + public function getNativeConnection(): PDO { return $this->connection; } + + /** + * @deprecated Call {@see getNativeConnection()} instead. + */ + public function getWrappedConnection(): PDO + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5037', + '%s is deprecated, call getNativeConnection() instead.', + __METHOD__ + ); + + return $this->getNativeConnection(); + } } diff --git a/doctrine/dbal/src/Driver/PDO/Exception.php b/doctrine/dbal/src/Driver/PDO/Exception.php index 49f55951d..7036a0e43 100644 --- a/doctrine/dbal/src/Driver/PDO/Exception.php +++ b/doctrine/dbal/src/Driver/PDO/Exception.php @@ -18,6 +18,10 @@ public static function new(PDOException $exception): self { if ($exception->errorInfo !== null) { [$sqlState, $code] = $exception->errorInfo; + + if ($code === null) { + $code = 0; + } } else { $code = $exception->getCode(); $sqlState = null; diff --git a/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php index 50c05a40f..8aeb26964 100644 --- a/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php @@ -4,7 +4,9 @@ use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\Driver\PDO\Connection; +use Doctrine\DBAL\Driver\PDO\Exception; use PDO; +use PDOException; final class Driver extends AbstractMySQLDriver { @@ -21,22 +23,26 @@ public function connect(array $params) $driverOptions[PDO::ATTR_PERSISTENT] = true; } - return new Connection( - $this->constructPdoDsn($params), - $params['user'] ?? '', - $params['password'] ?? '', - $driverOptions - ); + try { + $pdo = new PDO( + $this->constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + + return new Connection($pdo); } /** * Constructs the MySQL PDO DSN. * * @param mixed[] $params - * - * @return string The DSN. */ - protected function constructPdoDsn(array $params) + private function constructPdoDsn(array $params): string { $dsn = 'mysql:'; if (isset($params['host']) && $params['host'] !== '') { diff --git a/doctrine/dbal/src/Driver/PDO/OCI/Driver.php b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php index a2c1f4652..705db6118 100644 --- a/doctrine/dbal/src/Driver/PDO/OCI/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/OCI/Driver.php @@ -4,7 +4,9 @@ use Doctrine\DBAL\Driver\AbstractOracleDriver; use Doctrine\DBAL\Driver\PDO\Connection; +use Doctrine\DBAL\Driver\PDO\Exception; use PDO; +use PDOException; final class Driver extends AbstractOracleDriver { @@ -21,22 +23,26 @@ public function connect(array $params) $driverOptions[PDO::ATTR_PERSISTENT] = true; } - return new Connection( - $this->constructPdoDsn($params), - $params['user'] ?? '', - $params['password'] ?? '', - $driverOptions - ); + try { + $pdo = new PDO( + $this->constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + } catch (PDOException $exception) { + throw Exception::new($exception); + } + + return new Connection($pdo); } /** * Constructs the Oracle PDO DSN. * * @param mixed[] $params - * - * @return string The DSN. */ - private function constructPdoDsn(array $params) + private function constructPdoDsn(array $params): string { $dsn = 'oci:dbname=' . $this->getEasyConnectString($params); diff --git a/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php index e9620bde7..b90e47262 100644 --- a/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/PgSQL/Driver.php @@ -4,9 +4,9 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver; use Doctrine\DBAL\Driver\PDO\Connection; +use Doctrine\DBAL\Driver\PDO\Exception; use PDO; - -use function defined; +use PDOException; final class Driver extends AbstractPostgreSQLDriver { @@ -23,24 +23,27 @@ public function connect(array $params) $driverOptions[PDO::ATTR_PERSISTENT] = true; } - $connection = new Connection( - $this->_constructPdoDsn($params), - $params['user'] ?? '', - $params['password'] ?? '', - $driverOptions, - ); + try { + $pdo = new PDO( + $this->constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + } catch (PDOException $exception) { + throw Exception::new($exception); + } if ( - defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') - && (! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) - || $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] === true - ) + ! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) + || $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] === true ) { - $connection->getWrappedConnection()->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); + $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); } + $connection = new Connection($pdo); + /* defining client_encoding via SET NAMES to avoid inconsistent DSN support - * - the 'client_encoding' connection param only works with postgres >= 9.1 * - passing client_encoding via the 'options' param breaks pgbouncer support */ if (isset($params['charset'])) { @@ -54,10 +57,8 @@ public function connect(array $params) * Constructs the Postgres PDO DSN. * * @param mixed[] $params - * - * @return string The DSN. */ - private function _constructPdoDsn(array $params) + private function constructPdoDsn(array $params): string { $dsn = 'pgsql:'; diff --git a/doctrine/dbal/src/Driver/PDO/Result.php b/doctrine/dbal/src/Driver/PDO/Result.php index 888716d81..b0efdf2e1 100644 --- a/doctrine/dbal/src/Driver/PDO/Result.php +++ b/doctrine/dbal/src/Driver/PDO/Result.php @@ -9,9 +9,6 @@ use PDOException; use PDOStatement; -use function assert; -use function is_array; - final class Result implements ResultInterface { /** @var PDOStatement */ @@ -118,13 +115,9 @@ private function fetch(int $mode) private function fetchAll(int $mode): array { try { - $data = $this->statement->fetchAll($mode); + return $this->statement->fetchAll($mode); } catch (PDOException $exception) { throw Exception::new($exception); } - - assert(is_array($data)); - - return $data; } } diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php index a64f4245a..0c34d4b9b 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Connection.php @@ -2,20 +2,21 @@ namespace Doctrine\DBAL\Driver\PDO\SQLSrv; +use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware; use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection; -use Doctrine\DBAL\Driver\Result; -use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as StatementInterface; -use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use PDO; -final class Connection implements ServerInfoAwareConnection +final class Connection extends AbstractConnectionMiddleware { /** @var PDOConnection */ private $connection; public function __construct(PDOConnection $connection) { + parent::__construct($connection); + $this->connection = $connection; } @@ -26,72 +27,43 @@ public function prepare(string $sql): StatementInterface ); } - public function query(string $sql): Result - { - return $this->connection->query($sql); - } - - /** - * {@inheritDoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - return $this->connection->quote($value, $type); - } - - public function exec(string $sql): int - { - return $this->connection->exec($sql); - } - /** * {@inheritDoc} */ public function lastInsertId($name = null) { if ($name === null) { - return $this->connection->lastInsertId($name); + return parent::lastInsertId($name); } + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + return $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') ->execute([$name]) ->fetchOne(); } - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - return $this->connection->beginTransaction(); - } - - /** - * {@inheritDoc} - */ - public function commit() - { - return $this->connection->commit(); - } - - /** - * {@inheritDoc} - */ - public function rollBack() + public function getNativeConnection(): PDO { - return $this->connection->rollBack(); + return $this->connection->getNativeConnection(); } /** - * {@inheritDoc} + * @deprecated Call {@see getNativeConnection()} instead. */ - public function getServerVersion() - { - return $this->connection->getServerVersion(); - } - public function getWrappedConnection(): PDO { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5037', + '%s is deprecated, call getNativeConnection() instead.', + __METHOD__ + ); + return $this->connection->getWrappedConnection(); } } diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php index c48425049..b664950f2 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Driver.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost; use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection; +use Doctrine\DBAL\Driver\PDO\Exception as PDOException; use PDO; use function is_int; @@ -20,12 +21,12 @@ final class Driver extends AbstractSQLServerDriver */ public function connect(array $params) { - $pdoOptions = $dsnOptions = []; + $driverOptions = $dsnOptions = []; if (isset($params['driverOptions'])) { foreach ($params['driverOptions'] as $option => $value) { if (is_int($option)) { - $pdoOptions[$option] = $value; + $driverOptions[$option] = $value; } else { $dsnOptions[$option] = $value; } @@ -33,17 +34,21 @@ public function connect(array $params) } if (! empty($params['persistent'])) { - $pdoOptions[PDO::ATTR_PERSISTENT] = true; + $driverOptions[PDO::ATTR_PERSISTENT] = true; } - return new Connection( - new PDOConnection( - $this->_constructPdoDsn($params, $dsnOptions), + try { + $pdo = new PDO( + $this->constructDsn($params, $dsnOptions), $params['user'] ?? '', $params['password'] ?? '', - $pdoOptions - ) - ); + $driverOptions + ); + } catch (\PDOException $exception) { + throw PDOException::new($exception); + } + + return new Connection(new PDOConnection($pdo)); } /** @@ -52,11 +57,9 @@ public function connect(array $params) * @param mixed[] $params * @param string[] $connectionOptions * - * @return string The DSN. - * * @throws Exception */ - private function _constructPdoDsn(array $params, array $connectionOptions) + private function constructDsn(array $params, array $connectionOptions): string { $dsn = 'sqlsrv:server='; diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php index 2f48874e0..43b07a3ab 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php @@ -2,16 +2,15 @@ namespace Doctrine\DBAL\Driver\PDO\SQLSrv; +use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware; use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement; -use Doctrine\DBAL\Driver\Result; -use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; use Doctrine\Deprecations\Deprecation; use PDO; use function func_num_args; -final class Statement implements StatementInterface +final class Statement extends AbstractStatementMiddleware { /** @var PDOStatement */ private $statement; @@ -21,6 +20,8 @@ final class Statement implements StatementInterface */ public function __construct(PDOStatement $statement) { + parent::__construct($statement); + $this->statement = $statement; } @@ -33,8 +34,13 @@ public function __construct(PDOStatement $statement) * @param int|null $length * @param mixed $driverOptions The usage of the argument is deprecated. */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) - { + public function bindParam( + $param, + &$variable, + $type = ParameterType::STRING, + $length = null, + $driverOptions = null + ): bool { if (func_num_args() > 4) { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', @@ -65,16 +71,8 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le /** * {@inheritdoc} */ - public function bindValue($param, $value, $type = ParameterType::STRING) + public function bindValue($param, $value, $type = ParameterType::STRING): bool { return $this->bindParam($param, $value, $type); } - - /** - * {@inheritdoc} - */ - public function execute($params = null): Result - { - return $this->statement->execute($params); - } } diff --git a/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php index d85ba28fa..5e72de08b 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php +++ b/doctrine/dbal/src/Driver/PDO/SQLite/Driver.php @@ -4,14 +4,17 @@ use Doctrine\DBAL\Driver\AbstractSQLiteDriver; use Doctrine\DBAL\Driver\PDO\Connection; +use Doctrine\DBAL\Driver\PDO\Exception; use Doctrine\DBAL\Platforms\SqlitePlatform; +use PDO; +use PDOException; use function array_merge; final class Driver extends AbstractSQLiteDriver { /** @var mixed[] */ - protected $_userDefinedFunctions = [ + private $userDefinedFunctions = [ 'sqrt' => ['callback' => [SqlitePlatform::class, 'udfSqrt'], 'numArgs' => 1], 'mod' => ['callback' => [SqlitePlatform::class, 'udfMod'], 'numArgs' => 2], 'locate' => ['callback' => [SqlitePlatform::class, 'udfLocate'], 'numArgs' => -1], @@ -27,37 +30,37 @@ public function connect(array $params) $driverOptions = $params['driverOptions'] ?? []; if (isset($driverOptions['userDefinedFunctions'])) { - $this->_userDefinedFunctions = array_merge( - $this->_userDefinedFunctions, + $this->userDefinedFunctions = array_merge( + $this->userDefinedFunctions, $driverOptions['userDefinedFunctions'] ); unset($driverOptions['userDefinedFunctions']); } - $connection = new Connection( - $this->_constructPdoDsn($params), - $params['user'] ?? '', - $params['password'] ?? '', - $driverOptions - ); - - $pdo = $connection->getWrappedConnection(); + try { + $pdo = new PDO( + $this->constructPdoDsn($params), + $params['user'] ?? '', + $params['password'] ?? '', + $driverOptions + ); + } catch (PDOException $exception) { + throw Exception::new($exception); + } - foreach ($this->_userDefinedFunctions as $fn => $data) { + foreach ($this->userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } - return $connection; + return new Connection($pdo); } /** * Constructs the Sqlite PDO DSN. * * @param mixed[] $params - * - * @return string The DSN. */ - protected function _constructPdoDsn(array $params) + private function constructPdoDsn(array $params): string { $dsn = 'sqlite:'; if (isset($params['path'])) { diff --git a/doctrine/dbal/src/Driver/PDO/Statement.php b/doctrine/dbal/src/Driver/PDO/Statement.php index 1461239e6..bb137708a 100644 --- a/doctrine/dbal/src/Driver/PDO/Statement.php +++ b/doctrine/dbal/src/Driver/PDO/Statement.php @@ -61,11 +61,14 @@ public function bindValue($param, $value, $type = ParameterType::STRING) * @param int $type * @param int|null $length * @param mixed $driverOptions The usage of the argument is deprecated. - * - * @return bool */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) - { + public function bindParam( + $param, + &$variable, + $type = ParameterType::STRING, + $length = null, + $driverOptions = null + ): bool { if (func_num_args() > 4) { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', @@ -77,7 +80,13 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le $type = $this->convertParamType($type); try { - return $this->stmt->bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); + return $this->stmt->bindParam( + $param, + $variable, + $type, + $length ?? 0, + ...array_slice(func_get_args(), 4) + ); } catch (PDOException $exception) { throw Exception::new($exception); } diff --git a/doctrine/dbal/src/Driver/SQLSrv/Connection.php b/doctrine/dbal/src/Driver/SQLSrv/Connection.php index e37ea9006..0295db7e5 100644 --- a/doctrine/dbal/src/Driver/SQLSrv/Connection.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Connection.php @@ -2,20 +2,18 @@ namespace Doctrine\DBAL\Driver\SQLSrv; -use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\SQLSrv\Exception\Error; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use function is_float; use function is_int; use function sprintf; use function sqlsrv_begin_transaction; use function sqlsrv_commit; -use function sqlsrv_configure; -use function sqlsrv_connect; use function sqlsrv_query; use function sqlsrv_rollback; use function sqlsrv_rows_affected; @@ -25,29 +23,16 @@ final class Connection implements ServerInfoAwareConnection { /** @var resource */ - protected $conn; + private $connection; /** * @internal The connection can be only instantiated by its driver. * - * @param string $serverName - * @param mixed[] $connectionOptions - * - * @throws Exception + * @param resource $connection */ - public function __construct($serverName, $connectionOptions) + public function __construct($connection) { - if (! sqlsrv_configure('WarningsReturnAsErrors', 0)) { - throw Error::new(); - } - - $conn = sqlsrv_connect($serverName, $connectionOptions); - - if ($conn === false) { - throw Error::new(); - } - - $this->conn = $conn; + $this->connection = $connection; } /** @@ -55,14 +40,14 @@ public function __construct($serverName, $connectionOptions) */ public function getServerVersion() { - $serverInfo = sqlsrv_server_info($this->conn); + $serverInfo = sqlsrv_server_info($this->connection); return $serverInfo['SQLServerVersion']; } public function prepare(string $sql): DriverStatement { - return new Statement($this->conn, $sql); + return new Statement($this->connection, $sql); } public function query(string $sql): ResultInterface @@ -88,7 +73,7 @@ public function quote($value, $type = ParameterType::STRING) public function exec(string $sql): int { - $stmt = sqlsrv_query($this->conn, $sql); + $stmt = sqlsrv_query($this->connection, $sql); if ($stmt === false) { throw Error::new(); @@ -109,6 +94,12 @@ public function exec(string $sql): int public function lastInsertId($name = null) { if ($name !== null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4687', + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + ); + $result = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') ->execute([$name]); } else { @@ -118,39 +109,38 @@ public function lastInsertId($name = null) return $result->fetchOne(); } - /** - * {@inheritDoc} - */ - public function beginTransaction() + public function beginTransaction(): bool { - if (! sqlsrv_begin_transaction($this->conn)) { + if (! sqlsrv_begin_transaction($this->connection)) { throw Error::new(); } return true; } - /** - * {@inheritDoc} - */ - public function commit() + public function commit(): bool { - if (! sqlsrv_commit($this->conn)) { + if (! sqlsrv_commit($this->connection)) { throw Error::new(); } return true; } - /** - * {@inheritDoc} - */ - public function rollBack() + public function rollBack(): bool { - if (! sqlsrv_rollback($this->conn)) { + if (! sqlsrv_rollback($this->connection)) { throw Error::new(); } return true; } + + /** + * @return resource + */ + public function getNativeConnection() + { + return $this->connection; + } } diff --git a/doctrine/dbal/src/Driver/SQLSrv/Driver.php b/doctrine/dbal/src/Driver/SQLSrv/Driver.php index efa9ccfe9..085b22412 100644 --- a/doctrine/dbal/src/Driver/SQLSrv/Driver.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Driver.php @@ -4,6 +4,10 @@ use Doctrine\DBAL\Driver\AbstractSQLServerDriver; use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost; +use Doctrine\DBAL\Driver\SQLSrv\Exception\Error; + +use function sqlsrv_configure; +use function sqlsrv_connect; /** * Driver for ext/sqlsrv. @@ -51,6 +55,16 @@ public function connect(array $params) $driverOptions['ReturnDatesAsStrings'] = 1; } - return new Connection($serverName, $driverOptions); + if (! sqlsrv_configure('WarningsReturnAsErrors', 0)) { + throw Error::new(); + } + + $connection = sqlsrv_connect($serverName, $driverOptions); + + if ($connection === false) { + throw Error::new(); + } + + return new Connection($connection); } } diff --git a/doctrine/dbal/src/Driver/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/SQLSrv/Statement.php index 8267bc0de..035567a35 100644 --- a/doctrine/dbal/src/Driver/SQLSrv/Statement.php +++ b/doctrine/dbal/src/Driver/SQLSrv/Statement.php @@ -47,14 +47,14 @@ final class Statement implements StatementInterface /** * References to the variables bound as statement parameters. * - * @var mixed + * @var array */ private $variables = []; /** * Bound parameter types. * - * @var int[] + * @var array */ private $types = []; @@ -84,7 +84,7 @@ public function __construct($conn, $sql) /** * {@inheritdoc} */ - public function bindValue($param, $value, $type = ParameterType::STRING) + public function bindValue($param, $value, $type = ParameterType::STRING): bool { assert(is_int($param)); @@ -97,7 +97,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) /** * {@inheritdoc} */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool { assert(is_int($param)); diff --git a/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php b/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php index 622f98c6c..5687ab0bb 100644 --- a/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php +++ b/doctrine/dbal/src/Driver/ServerInfoAwareConnection.php @@ -4,11 +4,14 @@ /** * Contract for a connection that is able to provide information about the server it is connected to. + * + * @deprecated The methods defined in this interface will be made part of the {@see Driver} interface + * in the next major release. */ interface ServerInfoAwareConnection extends Connection { /** - * Returns the version number of the database server connected to. + * Returns information about the version of the database server connected to. * * @return string * diff --git a/doctrine/dbal/src/Driver/Statement.php b/doctrine/dbal/src/Driver/Statement.php index 334634a8c..50fac842d 100644 --- a/doctrine/dbal/src/Driver/Statement.php +++ b/doctrine/dbal/src/Driver/Statement.php @@ -20,7 +20,7 @@ interface Statement * this will be a parameter name of the form :name. For a prepared statement * using question mark placeholders, this will be the 1-indexed position of the parameter. * @param mixed $value The value to bind to the parameter. - * @param int $type Explicit data type for the parameter using the {@link ParameterType} + * @param int $type Explicit data type for the parameter using the {@see ParameterType} * constants. * * @return bool TRUE on success or FALSE on failure. @@ -31,7 +31,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING); /** * Binds a PHP variable to a corresponding named (not supported by mysqli driver, see comment below) or question - * mark placeholder in the SQL statement that was use to prepare the statement. Unlike {@link bindValue()}, + * mark placeholder in the SQL statement that was use to prepare the statement. Unlike {@see bindValue()}, * the variable is bound as a reference and will only be evaluated at the time * that PDOStatement->execute() is called. * @@ -47,7 +47,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING); * this will be a parameter name of the form :name. For a prepared statement using * question mark placeholders, this will be the 1-indexed position of the parameter. * @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter. - * @param int $type Explicit data type for the parameter using the {@link ParameterType} + * @param int $type Explicit data type for the parameter using the {@see ParameterType} * constants. * @param int|null $length You must specify maxlength when using an OUT bind * so that PHP allocates enough memory to hold the returned value. @@ -62,7 +62,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le * Executes a prepared statement * * If the prepared statement included parameter markers, you must either: - * call {@link bindParam()} to bind PHP variables to the parameter markers: + * call {@see bindParam()} to bind PHP variables to the parameter markers: * bound variables pass their value as input and receive the output value, * if any, of their associated parameter markers or pass an array of input-only * parameter values. diff --git a/doctrine/dbal/src/DriverManager.php b/doctrine/dbal/src/DriverManager.php index 698e0438d..a2ed23611 100644 --- a/doctrine/dbal/src/DriverManager.php +++ b/doctrine/dbal/src/DriverManager.php @@ -24,7 +24,7 @@ use function substr; /** - * Factory for creating {@link Connection} instances. + * Factory for creating {@see Connection} instances. * * @psalm-type OverrideParams = array{ * charset?: string, @@ -40,10 +40,12 @@ * platform?: Platforms\AbstractPlatform, * port?: int, * user?: string, + * unix_socket?: string, * } * @psalm-type Params = array{ * charset?: string, * dbname?: string, + * defaultTableOptions?: array, * default_dbname?: string, * driver?: key-of, * driverClass?: class-string, @@ -60,10 +62,12 @@ * port?: int, * primary?: OverrideParams, * replica?: array, + * serverVersion?: string, * sharding?: array, * slaves?: array, * user?: string, * wrapperClass?: class-string, + * unix_socket?: string, * } */ final class DriverManager @@ -71,7 +75,7 @@ final class DriverManager /** * List of supported drivers and their mappings to the driver classes. * - * To add your own driver use the 'driverClass' parameter to {@link DriverManager::getConnection()}. + * To add your own driver use the 'driverClass' parameter to {@see DriverManager::getConnection()}. */ private const DRIVER_MAP = [ 'pdo_mysql' => PDO\MySQL\Driver::class, @@ -118,7 +122,7 @@ private function __construct() * * $params must contain at least one of the following. * - * Either 'driver' with one of the array keys of {@link DRIVER_MAP}, + * Either 'driver' with one of the array keys of {@see DRIVER_MAP}, * OR 'driverClass' that contains the full class name (with namespace) of the * driver class to instantiate. * @@ -141,9 +145,8 @@ private function __construct() * driverClass: * The driver class to use. * - * @param array $params - * @param Configuration|null $config The configuration to use. - * @param EventManager|null $eventManager The event manager to use. + * @param Configuration|null $config The configuration to use. + * @param EventManager|null $eventManager The event manager to use. * @psalm-param array{ * charset?: string, * dbname?: string, @@ -168,7 +171,6 @@ private function __construct() * user?: string, * wrapperClass?: class-string, * } $params - * @phpstan-param array $params * * @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection) * @@ -340,7 +342,7 @@ private static function parseDatabaseUrl(array $params): array * Parses the given connection URL and resolves the given connection parameters. * * Assumes that the connection URL scheme is already parsed and resolved into the given connection parameters - * via {@link parseDatabaseUrlScheme}. + * via {@see parseDatabaseUrlScheme}. * * @see parseDatabaseUrlScheme * @@ -394,7 +396,7 @@ private static function parseDatabaseUrlQuery(array $url, array $params): array /** * Parses the given regular connection URL and resolves the given connection parameters. * - * Assumes that the "path" URL part is already normalized via {@link normalizeDatabaseUrlPath}. + * Assumes that the "path" URL part is already normalized via {@see normalizeDatabaseUrlPath}. * * @see normalizeDatabaseUrlPath * @@ -413,7 +415,7 @@ private static function parseRegularDatabaseUrlPath(array $url, array $params): /** * Parses the given SQLite connection URL and resolves the given connection parameters. * - * Assumes that the "path" URL part is already normalized via {@link normalizeDatabaseUrlPath}. + * Assumes that the "path" URL part is already normalized via {@see normalizeDatabaseUrlPath}. * * @see normalizeDatabaseUrlPath * diff --git a/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php index e61a48d06..5a1160a95 100644 --- a/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaAlterTableAddColumnEventArgs.php @@ -12,7 +12,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for adding table columns are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for adding table columns are generated inside {@see AbstractPlatform}. */ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php index e9ebb66ce..e3fe778dc 100644 --- a/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaAlterTableChangeColumnEventArgs.php @@ -11,7 +11,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for changing table columns are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for changing table columns are generated inside {@see AbstractPlatform}. */ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php index 9c2b9b31e..d51b4a204 100644 --- a/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaAlterTableEventArgs.php @@ -10,7 +10,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for creating tables are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for creating tables are generated inside {@see AbstractPlatform}. */ class SchemaAlterTableEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php index d32af5975..47ed242bc 100644 --- a/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaAlterTableRemoveColumnEventArgs.php @@ -11,7 +11,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for removing table columns are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for removing table columns are generated inside {@see AbstractPlatform}. */ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php index 6d52b6c0d..2b2cb2201 100644 --- a/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaAlterTableRenameColumnEventArgs.php @@ -11,7 +11,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for renaming table columns are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for renaming table columns are generated inside {@see AbstractPlatform}. */ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php b/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php index 58efa7b50..997a90d1f 100644 --- a/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaColumnDefinitionEventArgs.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\Column; /** - * Event Arguments used when the portable column definition is generated inside {@link AbstractPlatform}. + * Event Arguments used when the portable column definition is generated inside {@see AbstractPlatform}. */ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php b/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php index 246d2de07..6ba1bc708 100644 --- a/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaCreateTableColumnEventArgs.php @@ -11,7 +11,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for creating table columns are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for creating table columns are generated inside {@see AbstractPlatform}. */ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php b/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php index e9829a645..d83f7a264 100644 --- a/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaCreateTableEventArgs.php @@ -10,7 +10,7 @@ use function is_array; /** - * Event Arguments used when SQL queries for creating tables are generated inside {@link AbstractPlatform}. + * Event Arguments used when SQL queries for creating tables are generated inside {@see AbstractPlatform}. */ class SchemaCreateTableEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php b/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php index 072e1efb9..3d5dd3c01 100644 --- a/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaDropTableEventArgs.php @@ -7,7 +7,7 @@ use InvalidArgumentException; /** - * Event Arguments used when the SQL query for dropping tables are generated inside {@link AbstractPlatform}. + * Event Arguments used when the SQL query for dropping tables are generated inside {@see AbstractPlatform}. */ class SchemaDropTableEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php b/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php index 82c17a26a..7e9f0db6d 100644 --- a/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php +++ b/doctrine/dbal/src/Event/SchemaIndexDefinitionEventArgs.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\Index; /** - * Event Arguments used when the portable index definition is generated inside {@link AbstractSchemaManager}. + * Event Arguments used when the portable index definition is generated inside {@see AbstractSchemaManager}. */ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs { diff --git a/doctrine/dbal/src/Event/TransactionBeginEventArgs.php b/doctrine/dbal/src/Event/TransactionBeginEventArgs.php new file mode 100644 index 000000000..946e8f2eb --- /dev/null +++ b/doctrine/dbal/src/Event/TransactionBeginEventArgs.php @@ -0,0 +1,9 @@ +connection = $connection; + } + + public function getConnection(): Connection + { + return $this->connection; + } +} diff --git a/doctrine/dbal/src/Event/TransactionRollBackEventArgs.php b/doctrine/dbal/src/Event/TransactionRollBackEventArgs.php new file mode 100644 index 000000000..607a5f94a --- /dev/null +++ b/doctrine/dbal/src/Event/TransactionRollBackEventArgs.php @@ -0,0 +1,9 @@ +originalTypes[$key]; - if ($type !== Connection::PARAM_INT_ARRAY && $type !== Connection::PARAM_STR_ARRAY) { + if ( + $type !== Connection::PARAM_INT_ARRAY + && $type !== Connection::PARAM_STR_ARRAY + && $type !== Connection::PARAM_ASCII_STR_ARRAY + ) { $this->appendTypedParameter([$value], $type); return; diff --git a/doctrine/dbal/src/Id/TableGenerator.php b/doctrine/dbal/src/Id/TableGenerator.php index 4058bcb6f..d4f97fce4 100644 --- a/doctrine/dbal/src/Id/TableGenerator.php +++ b/doctrine/dbal/src/Id/TableGenerator.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Exception; use Doctrine\DBAL\LockMode; +use Doctrine\Deprecations\Deprecation; use Throwable; use function array_change_key_case; @@ -51,6 +52,8 @@ * * If no row is present for a given sequence a new one will be created with the * default values 'value' = 1 and 'increment_by' = 1 + * + * @deprecated */ class TableGenerator { @@ -70,6 +73,12 @@ class TableGenerator */ public function __construct(Connection $conn, $generatorTableName = 'sequences') { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4681', + 'The TableGenerator class is is deprecated.', + ); + if ($conn->getDriver() instanceof Driver\PDO\SQLite\Driver) { throw new Exception('Cannot use TableGenerator with SQLite.'); } diff --git a/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php b/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php index 3ec22f37c..f47c9a914 100644 --- a/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php +++ b/doctrine/dbal/src/Id/TableGeneratorSchemaVisitor.php @@ -9,7 +9,11 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Visitor\Visitor; +use Doctrine\Deprecations\Deprecation; +/** + * @deprecated + */ class TableGeneratorSchemaVisitor implements Visitor { /** @var string */ @@ -20,6 +24,12 @@ class TableGeneratorSchemaVisitor implements Visitor */ public function __construct($generatorTableName = 'sequences') { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4681', + 'The TableGeneratorSchemaVisitor class is is deprecated.', + ); + $this->generatorTableName = $generatorTableName; } diff --git a/doctrine/dbal/src/Logging/Connection.php b/doctrine/dbal/src/Logging/Connection.php new file mode 100644 index 000000000..2175dc467 --- /dev/null +++ b/doctrine/dbal/src/Logging/Connection.php @@ -0,0 +1,85 @@ +logger = $logger; + } + + public function __destruct() + { + $this->logger->info('Disconnecting'); + } + + public function prepare(string $sql): DriverStatement + { + return new Statement( + parent::prepare($sql), + $this->logger, + $sql + ); + } + + public function query(string $sql): Result + { + $this->logger->debug('Executing query: {sql}', ['sql' => $sql]); + + return parent::query($sql); + } + + public function exec(string $sql): int + { + $this->logger->debug('Executing statement: {sql}', ['sql' => $sql]); + + return parent::exec($sql); + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + $this->logger->debug('Beginning transaction'); + + return parent::beginTransaction(); + } + + /** + * {@inheritDoc} + */ + public function commit() + { + $this->logger->debug('Committing transaction'); + + return parent::commit(); + } + + /** + * {@inheritDoc} + */ + public function rollBack() + { + $this->logger->debug('Rolling back transaction'); + + return parent::rollBack(); + } +} diff --git a/doctrine/dbal/src/Logging/DebugStack.php b/doctrine/dbal/src/Logging/DebugStack.php index 6a9fab5a9..24a2d68cf 100644 --- a/doctrine/dbal/src/Logging/DebugStack.php +++ b/doctrine/dbal/src/Logging/DebugStack.php @@ -2,10 +2,14 @@ namespace Doctrine\DBAL\Logging; +use Doctrine\Deprecations\Deprecation; + use function microtime; /** * Includes executed SQLs in a Debug Stack. + * + * @deprecated */ class DebugStack implements SQLLogger { @@ -29,6 +33,15 @@ class DebugStack implements SQLLogger /** @var int */ public $currentQuery = 0; + public function __construct() + { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4967', + 'DebugStack is deprecated.' + ); + } + /** * {@inheritdoc} */ diff --git a/doctrine/dbal/src/Logging/Driver.php b/doctrine/dbal/src/Logging/Driver.php new file mode 100644 index 000000000..533dcc05c --- /dev/null +++ b/doctrine/dbal/src/Logging/Driver.php @@ -0,0 +1,56 @@ +logger = $logger; + } + + /** + * {@inheritDoc} + */ + public function connect(array $params) + { + $this->logger->info('Connecting with parameters {params}', ['params' => $this->maskPassword($params)]); + + return new Connection( + parent::connect($params), + $this->logger + ); + } + + /** + * @param array $params Connection parameters + * + * @return array + */ + private function maskPassword(array $params): array + { + if (isset($params['password'])) { + $params['password'] = ''; + } + + if (isset($params['url'])) { + $params['url'] = ''; + } + + return $params; + } +} diff --git a/doctrine/dbal/src/Logging/LoggerChain.php b/doctrine/dbal/src/Logging/LoggerChain.php index 9b44dc0e3..c256dd72c 100644 --- a/doctrine/dbal/src/Logging/LoggerChain.php +++ b/doctrine/dbal/src/Logging/LoggerChain.php @@ -2,8 +2,12 @@ namespace Doctrine\DBAL\Logging; +use Doctrine\Deprecations\Deprecation; + /** * Chains multiple SQLLogger. + * + * @deprecated */ class LoggerChain implements SQLLogger { @@ -15,6 +19,12 @@ class LoggerChain implements SQLLogger */ public function __construct(iterable $loggers = []) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4967', + 'LoggerChain is deprecated' + ); + $this->loggers = $loggers; } diff --git a/doctrine/dbal/src/Logging/Middleware.php b/doctrine/dbal/src/Logging/Middleware.php new file mode 100644 index 000000000..4d5c6b061 --- /dev/null +++ b/doctrine/dbal/src/Logging/Middleware.php @@ -0,0 +1,25 @@ +logger = $logger; + } + + public function wrap(DriverInterface $driver): DriverInterface + { + return new Driver($driver, $this->logger); + } +} diff --git a/doctrine/dbal/src/Logging/SQLLogger.php b/doctrine/dbal/src/Logging/SQLLogger.php index a0bdf1bf6..dab4a3a7d 100644 --- a/doctrine/dbal/src/Logging/SQLLogger.php +++ b/doctrine/dbal/src/Logging/SQLLogger.php @@ -6,6 +6,9 @@ /** * Interface for SQL loggers. + * + * @deprecated Use {@see \Doctrine\DBAL\Logging\Middleware} or implement + * {@see \Doctrine\DBAL\Driver\Middleware} instead. */ interface SQLLogger { diff --git a/doctrine/dbal/src/Logging/Statement.php b/doctrine/dbal/src/Logging/Statement.php new file mode 100644 index 000000000..e993767aa --- /dev/null +++ b/doctrine/dbal/src/Logging/Statement.php @@ -0,0 +1,76 @@ +|array */ + private $params = []; + + /** @var array|array */ + private $types = []; + + /** + * @internal This statement can be only instantiated by its connection. + */ + public function __construct(StatementInterface $statement, LoggerInterface $logger, string $sql) + { + parent::__construct($statement); + + $this->logger = $logger; + $this->sql = $sql; + } + + /** + * {@inheritdoc} + */ + public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) + { + $this->params[$param] = &$variable; + $this->types[$param] = $type; + + return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); + } + + /** + * {@inheritdoc} + */ + public function bindValue($param, $value, $type = ParameterType::STRING) + { + $this->params[$param] = $value; + $this->types[$param] = $type; + + return parent::bindValue($param, $value, $type); + } + + /** + * {@inheritdoc} + */ + public function execute($params = null): ResultInterface + { + $this->logger->debug('Executing statement: {sql} (parameters: {params}, types: {types})', [ + 'sql' => $this->sql, + 'params' => $params ?? $this->params, + 'types' => $this->types, + ]); + + return parent::execute($params); + } +} diff --git a/doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php b/doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php new file mode 100644 index 000000000..39594c76d --- /dev/null +++ b/doctrine/dbal/src/Platforms/AbstractMySQLPlatform.php @@ -0,0 +1,1188 @@ + 0) { + $query .= sprintf(' OFFSET %d', $offset); + } + } elseif ($offset > 0) { + // 2^64-1 is the maximum of unsigned BIGINT, the biggest limit possible + $query .= sprintf(' LIMIT 18446744073709551615 OFFSET %d', $offset); + } + + return $query; + } + + /** + * {@inheritDoc} + */ + public function getIdentifierQuoteCharacter() + { + return '`'; + } + + /** + * {@inheritDoc} + */ + public function getRegexpExpression() + { + return 'RLIKE'; + } + + /** + * {@inheritDoc} + */ + public function getLocateExpression($str, $substr, $startPos = false) + { + if ($startPos === false) { + return 'LOCATE(' . $substr . ', ' . $str . ')'; + } + + return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; + } + + /** + * {@inheritDoc} + */ + public function getConcatExpression() + { + return sprintf('CONCAT(%s)', implode(', ', func_get_args())); + } + + /** + * {@inheritdoc} + */ + protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) + { + $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB'; + + return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')'; + } + + /** + * {@inheritDoc} + */ + public function getDateDiffExpression($date1, $date2) + { + return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; + } + + public function getCurrentDatabaseExpression(): string + { + return 'DATABASE()'; + } + + /** + * {@inheritDoc} + */ + public function getLengthExpression($column) + { + return 'CHAR_LENGTH(' . $column . ')'; + } + + /** + * {@inheritDoc} + */ + public function getListDatabasesSQL() + { + return 'SHOW DATABASES'; + } + + /** + * {@inheritDoc} + */ + public function getListTableConstraintsSQL($table) + { + return 'SHOW INDEX FROM ' . $table; + } + + /** + * {@inheritDoc} + * + * Two approaches to listing the table indexes. The information_schema is + * preferred, because it doesn't cause problems with SQL keywords such as "order" or "table". + */ + public function getListTableIndexesSQL($table, $database = null) + { + if ($database !== null) { + return 'SELECT NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, COLUMN_NAME AS Column_Name,' . + ' SUB_PART AS Sub_Part, INDEX_TYPE AS Index_Type' . + ' FROM information_schema.STATISTICS WHERE TABLE_NAME = ' . $this->quoteStringLiteral($table) . + ' AND TABLE_SCHEMA = ' . $this->quoteStringLiteral($database) . + ' ORDER BY SEQ_IN_INDEX ASC'; + } + + return 'SHOW INDEX FROM ' . $table; + } + + /** + * {@inheritDoc} + */ + public function getListViewsSQL($database) + { + return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $this->quoteStringLiteral($database); + } + + /** + * @param string $table + * @param string|null $database + * + * @return string + */ + public function getListTableForeignKeysSQL($table, $database = null) + { + // The schema name is passed multiple times as a literal in the WHERE clause instead of using a JOIN condition + // in order to avoid performance issues on MySQL older than 8.0 and the corresponding MariaDB versions + // caused by https://bugs.mysql.com/bug.php?id=81347 + return 'SELECT k.CONSTRAINT_NAME, k.COLUMN_NAME, k.REFERENCED_TABLE_NAME, ' . + 'k.REFERENCED_COLUMN_NAME /*!50116 , c.UPDATE_RULE, c.DELETE_RULE */ ' . + 'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k /*!50116 ' . + 'INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS c ON ' . + 'c.CONSTRAINT_NAME = k.CONSTRAINT_NAME AND ' . + 'c.TABLE_NAME = k.TABLE_NAME */ ' . + 'WHERE k.TABLE_NAME = ' . $this->quoteStringLiteral($table) . ' ' . + 'AND k.TABLE_SCHEMA = ' . $this->getDatabaseNameSQL($database) . ' /*!50116 ' . + 'AND c.CONSTRAINT_SCHEMA = ' . $this->getDatabaseNameSQL($database) . ' */' . + 'ORDER BY k.ORDINAL_POSITION'; + } + + /** + * {@inheritDoc} + */ + protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) + { + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); + } + + /** + * {@inheritdoc} + */ + protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) + { + return $fixed + ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' + : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; + } + + /** + * Gets the SQL snippet used to declare a CLOB column type. + * TINYTEXT : 2 ^ 8 - 1 = 255 + * TEXT : 2 ^ 16 - 1 = 65535 + * MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 + * LONGTEXT : 2 ^ 32 - 1 = 4294967295 + * + * {@inheritDoc} + */ + public function getClobTypeDeclarationSQL(array $column) + { + if (! empty($column['length']) && is_numeric($column['length'])) { + $length = $column['length']; + + if ($length <= static::LENGTH_LIMIT_TINYTEXT) { + return 'TINYTEXT'; + } + + if ($length <= static::LENGTH_LIMIT_TEXT) { + return 'TEXT'; + } + + if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) { + return 'MEDIUMTEXT'; + } + } + + return 'LONGTEXT'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTypeDeclarationSQL(array $column) + { + if (isset($column['version']) && $column['version'] === true) { + return 'TIMESTAMP'; + } + + return 'DATETIME'; + } + + /** + * {@inheritDoc} + */ + public function getDateTypeDeclarationSQL(array $column) + { + return 'DATE'; + } + + /** + * {@inheritDoc} + */ + public function getTimeTypeDeclarationSQL(array $column) + { + return 'TIME'; + } + + /** + * {@inheritDoc} + */ + public function getBooleanTypeDeclarationSQL(array $column) + { + return 'TINYINT(1)'; + } + + /** + * {@inheritDoc} + * + * @deprecated + * + * MySQL prefers "autoincrement" identity columns since sequences can only + * be emulated with a table. + */ + public function prefersIdentityColumns() + { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/1519', + 'AbstractMySQLPlatform::prefersIdentityColumns() is deprecated.' + ); + + return true; + } + + /** + * {@inheritDoc} + * + * MySQL supports this through AUTO_INCREMENT columns. + */ + public function supportsIdentityColumns() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function supportsInlineColumnComments() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function supportsColumnCollation() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function getListTablesSQL() + { + return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'"; + } + + /** + * {@inheritDoc} + */ + public function getListTableColumnsSQL($table, $database = null) + { + return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' . + 'COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, ' . + 'CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ' . + 'FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ' . $this->getDatabaseNameSQL($database) . + ' AND TABLE_NAME = ' . $this->quoteStringLiteral($table) . + ' ORDER BY ORDINAL_POSITION ASC'; + } + + public function getListTableMetadataSQL(string $table, ?string $database = null): string + { + return sprintf( + <<<'SQL' +SELECT t.ENGINE, + t.AUTO_INCREMENT, + t.TABLE_COMMENT, + t.CREATE_OPTIONS, + t.TABLE_COLLATION, + ccsa.CHARACTER_SET_NAME +FROM information_schema.TABLES t + INNER JOIN information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` ccsa + ON ccsa.COLLATION_NAME = t.TABLE_COLLATION +WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = %s AND TABLE_NAME = %s +SQL + , + $this->getDatabaseNameSQL($database), + $this->quoteStringLiteral($table) + ); + } + + /** + * {@inheritDoc} + */ + protected function _getCreateTableSQL($name, array $columns, array $options = []) + { + $queryFields = $this->getColumnDeclarationListSQL($columns); + + if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { + foreach ($options['uniqueConstraints'] as $constraintName => $definition) { + $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); + } + } + + // add all indexes + if (isset($options['indexes']) && ! empty($options['indexes'])) { + foreach ($options['indexes'] as $indexName => $definition) { + $queryFields .= ', ' . $this->getIndexDeclarationSQL($indexName, $definition); + } + } + + // attach all primary keys + if (isset($options['primary']) && ! empty($options['primary'])) { + $keyColumns = array_unique(array_values($options['primary'])); + $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; + } + + $query = 'CREATE '; + + if (! empty($options['temporary'])) { + $query .= 'TEMPORARY '; + } + + $query .= 'TABLE ' . $name . ' (' . $queryFields . ') '; + $query .= $this->buildTableOptions($options); + $query .= $this->buildPartitionOptions($options); + + $sql = [$query]; + $engine = 'INNODB'; + + if (isset($options['engine'])) { + $engine = strtoupper(trim($options['engine'])); + } + + // Propagate foreign key constraints only for InnoDB. + if (isset($options['foreignKeys']) && $engine === 'INNODB') { + foreach ((array) $options['foreignKeys'] as $definition) { + $sql[] = $this->getCreateForeignKeySQL($definition, $name); + } + } + + return $sql; + } + + /** + * {@inheritdoc} + */ + public function getDefaultValueDeclarationSQL($column) + { + // Unset the default value if the given column definition does not allow default values. + if ($column['type'] instanceof TextType || $column['type'] instanceof BlobType) { + $column['default'] = null; + } + + return parent::getDefaultValueDeclarationSQL($column); + } + + /** + * Build SQL for table options + * + * @param mixed[] $options + */ + private function buildTableOptions(array $options): string + { + if (isset($options['table_options'])) { + return $options['table_options']; + } + + $tableOptions = []; + + // Charset + if (! isset($options['charset'])) { + $options['charset'] = 'utf8'; + } + + $tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']); + + if (isset($options['collate'])) { + $options['collation'] = $options['collate']; + } + + // Collation + if (! isset($options['collation'])) { + $options['collation'] = $options['charset'] . '_unicode_ci'; + } + + $tableOptions[] = $this->getColumnCollationDeclarationSQL($options['collation']); + + // Engine + if (! isset($options['engine'])) { + $options['engine'] = 'InnoDB'; + } + + $tableOptions[] = sprintf('ENGINE = %s', $options['engine']); + + // Auto increment + if (isset($options['auto_increment'])) { + $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']); + } + + // Comment + if (isset($options['comment'])) { + $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($options['comment'])); + } + + // Row format + if (isset($options['row_format'])) { + $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']); + } + + return implode(' ', $tableOptions); + } + + /** + * Build SQL for partition options. + * + * @param mixed[] $options + */ + private function buildPartitionOptions(array $options): string + { + return isset($options['partition_options']) + ? ' ' . $options['partition_options'] + : ''; + } + + /** + * {@inheritDoc} + */ + public function getAlterTableSQL(TableDiff $diff) + { + $columnSql = []; + $queryParts = []; + $newName = $diff->getNewName(); + + if ($newName !== false) { + $queryParts[] = 'RENAME TO ' . $newName->getQuotedName($this); + } + + foreach ($diff->addedColumns as $column) { + if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { + continue; + } + + $columnArray = array_merge($column->toArray(), [ + 'comment' => $this->getColumnComment($column), + ]); + + $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); + } + + foreach ($diff->removedColumns as $column) { + if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { + continue; + } + + $queryParts[] = 'DROP ' . $column->getQuotedName($this); + } + + foreach ($diff->changedColumns as $columnDiff) { + if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { + continue; + } + + $column = $columnDiff->column; + $columnArray = $column->toArray(); + + // Don't propagate default value changes for unsupported column types. + if ( + $columnDiff->hasChanged('default') && + count($columnDiff->changedProperties) === 1 && + ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType) + ) { + continue; + } + + $columnArray['comment'] = $this->getColumnComment($column); + $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' + . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); + } + + foreach ($diff->renamedColumns as $oldColumnName => $column) { + if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { + continue; + } + + $oldColumnName = new Identifier($oldColumnName); + $columnArray = $column->toArray(); + $columnArray['comment'] = $this->getColumnComment($column); + $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' + . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); + } + + if (isset($diff->addedIndexes['primary'])) { + $keyColumns = array_unique(array_values($diff->addedIndexes['primary']->getColumns())); + $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; + unset($diff->addedIndexes['primary']); + } elseif (isset($diff->changedIndexes['primary'])) { + // Necessary in case the new primary key includes a new auto_increment column + foreach ($diff->changedIndexes['primary']->getColumns() as $columnName) { + if (isset($diff->addedColumns[$columnName]) && $diff->addedColumns[$columnName]->getAutoincrement()) { + $keyColumns = array_unique(array_values($diff->changedIndexes['primary']->getColumns())); + $queryParts[] = 'DROP PRIMARY KEY'; + $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; + unset($diff->changedIndexes['primary']); + break; + } + } + } + + $sql = []; + $tableSql = []; + + if (! $this->onSchemaAlterTable($diff, $tableSql)) { + if (count($queryParts) > 0) { + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' + . implode(', ', $queryParts); + } + + $sql = array_merge( + $this->getPreAlterTableIndexForeignKeySQL($diff), + $sql, + $this->getPostAlterTableIndexForeignKeySQL($diff) + ); + } + + return array_merge($sql, $tableSql, $columnSql); + } + + /** + * {@inheritDoc} + */ + protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) + { + $sql = []; + $table = $diff->getName($this)->getQuotedName($this); + + foreach ($diff->changedIndexes as $changedIndex) { + $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $changedIndex)); + } + + foreach ($diff->removedIndexes as $remKey => $remIndex) { + $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $remIndex)); + + foreach ($diff->addedIndexes as $addKey => $addIndex) { + if ($remIndex->getColumns() !== $addIndex->getColumns()) { + continue; + } + + $indexClause = 'INDEX ' . $addIndex->getName(); + + if ($addIndex->isPrimary()) { + $indexClause = 'PRIMARY KEY'; + } elseif ($addIndex->isUnique()) { + $indexClause = 'UNIQUE INDEX ' . $addIndex->getName(); + } + + $query = 'ALTER TABLE ' . $table . ' DROP INDEX ' . $remIndex->getName() . ', '; + $query .= 'ADD ' . $indexClause; + $query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex) . ')'; + + $sql[] = $query; + + unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]); + + break; + } + } + + $engine = 'INNODB'; + + if ($diff->fromTable instanceof Table && $diff->fromTable->hasOption('engine')) { + $engine = strtoupper(trim($diff->fromTable->getOption('engine'))); + } + + // Suppress foreign key constraint propagation on non-supporting engines. + if ($engine !== 'INNODB') { + $diff->addedForeignKeys = []; + $diff->changedForeignKeys = []; + $diff->removedForeignKeys = []; + } + + $sql = array_merge( + $sql, + $this->getPreAlterTableAlterIndexForeignKeySQL($diff), + parent::getPreAlterTableIndexForeignKeySQL($diff), + $this->getPreAlterTableRenameIndexForeignKeySQL($diff) + ); + + return $sql; + } + + /** + * @return string[] + * + * @throws Exception + */ + private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index): array + { + $sql = []; + + if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) { + return $sql; + } + + $tableName = $diff->getName($this)->getQuotedName($this); + + // Dropping primary keys requires to unset autoincrement attribute on the particular column first. + foreach ($index->getColumns() as $columnName) { + if (! $diff->fromTable->hasColumn($columnName)) { + continue; + } + + $column = $diff->fromTable->getColumn($columnName); + + if ($column->getAutoincrement() !== true) { + continue; + } + + $column->setAutoincrement(false); + + $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' . + $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); + + // original autoincrement information might be needed later on by other parts of the table alteration + $column->setAutoincrement(true); + } + + return $sql; + } + + /** + * @param TableDiff $diff The table diff to gather the SQL for. + * + * @return string[] + * + * @throws Exception + */ + private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff): array + { + $sql = []; + $table = $diff->getName($this)->getQuotedName($this); + + foreach ($diff->changedIndexes as $changedIndex) { + // Changed primary key + if (! $changedIndex->isPrimary() || ! ($diff->fromTable instanceof Table)) { + continue; + } + + foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName => $column) { + // Check if an autoincrement column was dropped from the primary key. + if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns(), true)) { + continue; + } + + // The autoincrement attribute needs to be removed from the dropped column + // before we can drop and recreate the primary key. + $column->setAutoincrement(false); + + $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' . + $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); + + // Restore the autoincrement attribute as it might be needed later on + // by other parts of the table alteration. + $column->setAutoincrement(true); + } + } + + return $sql; + } + + /** + * @param TableDiff $diff The table diff to gather the SQL for. + * + * @return string[] + */ + protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) + { + $sql = []; + $tableName = $diff->getName($this)->getQuotedName($this); + + foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { + if (in_array($foreignKey, $diff->changedForeignKeys, true)) { + continue; + } + + $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); + } + + return $sql; + } + + /** + * Returns the remaining foreign key constraints that require one of the renamed indexes. + * + * "Remaining" here refers to the diff between the foreign keys currently defined in the associated + * table and the foreign keys to be removed. + * + * @param TableDiff $diff The table diff to evaluate. + * + * @return ForeignKeyConstraint[] + */ + private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff): array + { + if (empty($diff->renamedIndexes) || ! $diff->fromTable instanceof Table) { + return []; + } + + $foreignKeys = []; + /** @var ForeignKeyConstraint[] $remainingForeignKeys */ + $remainingForeignKeys = array_diff_key( + $diff->fromTable->getForeignKeys(), + $diff->removedForeignKeys + ); + + foreach ($remainingForeignKeys as $foreignKey) { + foreach ($diff->renamedIndexes as $index) { + if ($foreignKey->intersectsIndexColumns($index)) { + $foreignKeys[] = $foreignKey; + + break; + } + } + } + + return $foreignKeys; + } + + /** + * {@inheritdoc} + */ + protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) + { + return array_merge( + parent::getPostAlterTableIndexForeignKeySQL($diff), + $this->getPostAlterTableRenameIndexForeignKeySQL($diff) + ); + } + + /** + * @param TableDiff $diff The table diff to gather the SQL for. + * + * @return string[] + */ + protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) + { + $sql = []; + $newName = $diff->getNewName(); + + if ($newName !== false) { + $tableName = $newName->getQuotedName($this); + } else { + $tableName = $diff->getName($this)->getQuotedName($this); + } + + foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { + if (in_array($foreignKey, $diff->changedForeignKeys, true)) { + continue; + } + + $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName); + } + + return $sql; + } + + /** + * {@inheritDoc} + */ + protected function getCreateIndexSQLFlags(Index $index) + { + $type = ''; + if ($index->isUnique()) { + $type .= 'UNIQUE '; + } elseif ($index->hasFlag('fulltext')) { + $type .= 'FULLTEXT '; + } elseif ($index->hasFlag('spatial')) { + $type .= 'SPATIAL '; + } + + return $type; + } + + /** + * {@inheritDoc} + */ + public function getIntegerTypeDeclarationSQL(array $column) + { + return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritDoc} + */ + public function getBigIntTypeDeclarationSQL(array $column) + { + return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritDoc} + */ + public function getSmallIntTypeDeclarationSQL(array $column) + { + return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritdoc} + */ + public function getFloatDeclarationSQL(array $column) + { + return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($column); + } + + /** + * {@inheritdoc} + */ + public function getDecimalTypeDeclarationSQL(array $column) + { + return parent::getDecimalTypeDeclarationSQL($column) . $this->getUnsignedDeclaration($column); + } + + /** + * Get unsigned declaration for a column. + * + * @param mixed[] $columnDef + */ + private function getUnsignedDeclaration(array $columnDef): string + { + return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : ''; + } + + /** + * {@inheritDoc} + */ + protected function _getCommonIntegerTypeDeclarationSQL(array $column) + { + $autoinc = ''; + if (! empty($column['autoincrement'])) { + $autoinc = ' AUTO_INCREMENT'; + } + + return $this->getUnsignedDeclaration($column) . $autoinc; + } + + /** + * {@inheritDoc} + */ + public function getColumnCharsetDeclarationSQL($charset) + { + return 'CHARACTER SET ' . $charset; + } + + /** + * {@inheritDoc} + */ + public function getColumnCollationDeclarationSQL($collation) + { + return 'COLLATE ' . $this->quoteSingleIdentifier($collation); + } + + /** + * {@inheritDoc} + */ + public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) + { + $query = ''; + if ($foreignKey->hasOption('match')) { + $query .= ' MATCH ' . $foreignKey->getOption('match'); + } + + $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); + + return $query; + } + + /** + * {@inheritDoc} + */ + public function getDropIndexSQL($index, $table = null) + { + if ($index instanceof Index) { + $indexName = $index->getQuotedName($this); + } elseif (is_string($index)) { + $indexName = $index; + } else { + throw new InvalidArgumentException( + __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' + ); + } + + if ($table instanceof Table) { + $table = $table->getQuotedName($this); + } elseif (! is_string($table)) { + throw new InvalidArgumentException( + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + ); + } + + if ($index instanceof Index && $index->isPrimary()) { + // MySQL primary keys are always named "PRIMARY", + // so we cannot use them in statements because of them being keyword. + return $this->getDropPrimaryKeySQL($table); + } + + return 'DROP INDEX ' . $indexName . ' ON ' . $table; + } + + /** + * @param string $table + * + * @return string + */ + protected function getDropPrimaryKeySQL($table) + { + return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; + } + + /** + * The `ALTER TABLE ... DROP CONSTRAINT` syntax is only available as of MySQL 8.0.19. + * + * @link https://dev.mysql.com/doc/refman/8.0/en/alter-table.html + */ + public function getDropUniqueConstraintSQL(string $name, string $tableName): string + { + return $this->getDropIndexSQL($name, $tableName); + } + + /** + * {@inheritDoc} + */ + public function getSetTransactionIsolationSQL($level) + { + return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4749', + 'AbstractMySQLPlatform::getName() is deprecated. Identify platforms by their class.' + ); + + return 'mysql'; + } + + /** + * {@inheritDoc} + */ + public function getReadLockSQL() + { + return 'LOCK IN SHARE MODE'; + } + + /** + * {@inheritDoc} + */ + protected function initializeDoctrineTypeMappings() + { + $this->doctrineTypeMapping = [ + 'bigint' => 'bigint', + 'binary' => 'binary', + 'blob' => 'blob', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'decimal' => 'decimal', + 'double' => 'float', + 'float' => 'float', + 'int' => 'integer', + 'integer' => 'integer', + 'longblob' => 'blob', + 'longtext' => 'text', + 'mediumblob' => 'blob', + 'mediumint' => 'integer', + 'mediumtext' => 'text', + 'numeric' => 'decimal', + 'real' => 'float', + 'set' => 'simple_array', + 'smallint' => 'smallint', + 'string' => 'string', + 'text' => 'text', + 'time' => 'time', + 'timestamp' => 'datetime', + 'tinyblob' => 'blob', + 'tinyint' => 'boolean', + 'tinytext' => 'text', + 'varbinary' => 'binary', + 'varchar' => 'string', + 'year' => 'date', + ]; + } + + /** + * {@inheritDoc} + */ + public function getVarcharMaxLength() + { + return 65535; + } + + /** + * {@inheritdoc} + */ + public function getBinaryMaxLength() + { + return 65535; + } + + /** + * {@inheritDoc} + * + * @deprecated Implement {@see createReservedKeywordsList()} instead. + */ + protected function getReservedKeywordsClass() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'AbstractMySQLPlatform::getReservedKeywordsClass() is deprecated,' + . ' use AbstractMySQLPlatform::createReservedKeywordsList() instead.' + ); + + return Keywords\MySQLKeywords::class; + } + + /** + * {@inheritDoc} + * + * MySQL commits a transaction implicitly when DROP TABLE is executed, however not + * if DROP TEMPORARY TABLE is executed. + */ + public function getDropTemporaryTableSQL($table) + { + if ($table instanceof Table) { + $table = $table->getQuotedName($this); + } elseif (! is_string($table)) { + throw new InvalidArgumentException( + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + ); + } + + return 'DROP TEMPORARY TABLE ' . $table; + } + + /** + * Gets the SQL Snippet used to declare a BLOB column type. + * TINYBLOB : 2 ^ 8 - 1 = 255 + * BLOB : 2 ^ 16 - 1 = 65535 + * MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 + * LONGBLOB : 2 ^ 32 - 1 = 4294967295 + * + * {@inheritDoc} + */ + public function getBlobTypeDeclarationSQL(array $column) + { + if (! empty($column['length']) && is_numeric($column['length'])) { + $length = $column['length']; + + if ($length <= static::LENGTH_LIMIT_TINYBLOB) { + return 'TINYBLOB'; + } + + if ($length <= static::LENGTH_LIMIT_BLOB) { + return 'BLOB'; + } + + if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) { + return 'MEDIUMBLOB'; + } + } + + return 'LONGBLOB'; + } + + /** + * {@inheritdoc} + */ + public function quoteStringLiteral($str) + { + $str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped + + return parent::quoteStringLiteral($str); + } + + /** + * {@inheritdoc} + */ + public function getDefaultTransactionIsolationLevel() + { + return TransactionIsolationLevel::REPEATABLE_READ; + } + + public function supportsColumnLengthIndexes(): bool + { + return true; + } + + private function getDatabaseNameSQL(?string $databaseName): string + { + if ($databaseName !== null) { + return $this->quoteStringLiteral($databaseName); + } + + return $this->getCurrentDatabaseExpression(); + } +} diff --git a/doctrine/dbal/src/Platforms/AbstractPlatform.php b/doctrine/dbal/src/Platforms/AbstractPlatform.php index f22fab5bc..e143c6dc5 100644 --- a/doctrine/dbal/src/Platforms/AbstractPlatform.php +++ b/doctrine/dbal/src/Platforms/AbstractPlatform.php @@ -80,6 +80,8 @@ abstract class AbstractPlatform * Contains a list of all columns that should generate parseable column comments for type-detection * in reverse engineering scenarios. * + * @deprecated This property is deprecated and will be removed in Doctrine DBAL 4.0. + * * @var string[]|null */ protected $doctrineTypeComments; @@ -94,10 +96,6 @@ abstract class AbstractPlatform */ protected $_keywords; - public function __construct() - { - } - /** * Sets the EventManager used by the Platform. * @@ -173,10 +171,8 @@ abstract protected function initializeDoctrineTypeMappings(); /** * Initializes Doctrine Type Mappings with the platform defaults * and with all additional type mappings. - * - * @return void */ - private function initializeAllDoctrineTypeMappings() + private function initializeAllDoctrineTypeMappings(): void { $this->initializeDoctrineTypeMappings(); @@ -341,6 +337,8 @@ abstract public function getBlobTypeDeclarationSQL(array $column); /** * Gets the name of the platform. * + * @deprecated Identify platforms by their class. + * * @return string */ abstract public function getName(); @@ -424,10 +422,19 @@ public function hasDoctrineTypeMappingFor($dbType) /** * Initializes the Doctrine Type comments instance variable for in_array() checks. * + * @deprecated This API will be removed in Doctrine DBAL 4.0. + * * @return void */ protected function initializeCommentedDoctrineTypes() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5058', + '%s is deprecated and will be removed in Doctrine DBAL 4.0.', + __METHOD__ + ); + $this->doctrineTypeComments = []; foreach (Type::getTypesMap() as $typeName => $className) { @@ -444,17 +451,24 @@ protected function initializeCommentedDoctrineTypes() /** * Is it necessary for the platform to add a parsable type comment to allow reverse engineering the given type? * + * @deprecated Use {@link Type::requiresSQLCommentHint()} instead. + * * @return bool */ public function isCommentedDoctrineType(Type $doctrineType) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5058', + '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', + __METHOD__ + ); + if ($this->doctrineTypeComments === null) { $this->initializeCommentedDoctrineTypes(); } - assert(is_array($this->doctrineTypeComments)); - - return in_array($doctrineType->getName(), $this->doctrineTypeComments, true); + return $doctrineType->requiresSQLCommentHint($this); } /** @@ -466,6 +480,13 @@ public function isCommentedDoctrineType(Type $doctrineType) */ public function markDoctrineTypeCommented($doctrineType) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5058', + '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', + __METHOD__ + ); + if ($this->doctrineTypeComments === null) { $this->initializeCommentedDoctrineTypes(); } @@ -494,7 +515,7 @@ protected function getColumnComment(Column $column) { $comment = $column->getComment(); - if ($this->isCommentedDoctrineType($column->getType())) { + if ($column->getType()->requiresSQLCommentHint($this)) { $comment .= $this->getDoctrineTypeComment($column->getType()); } @@ -514,78 +535,143 @@ public function getIdentifierQuoteCharacter() /** * Gets the string portion that starts an SQL comment. * + * @deprecated + * * @return string */ public function getSqlCommentStartString() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getSqlCommentStartString() is deprecated.' + ); + return '--'; } /** * Gets the string portion that ends an SQL comment. * + * @deprecated + * * @return string */ public function getSqlCommentEndString() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getSqlCommentEndString() is deprecated.' + ); + return "\n"; } /** * Gets the maximum length of a char column. + * + * @deprecated */ public function getCharMaxLength(): int { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/3263', + 'AbstractPlatform::getCharMaxLength() is deprecated.' + ); + return $this->getVarcharMaxLength(); } /** * Gets the maximum length of a varchar column. * + * @deprecated + * * @return int */ public function getVarcharMaxLength() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/3263', + 'AbstractPlatform::getVarcharMaxLength() is deprecated.' + ); + return 4000; } /** * Gets the default length of a varchar column. * + * @deprecated + * * @return int */ public function getVarcharDefaultLength() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/3263', + 'Relying on the default varchar column length is deprecated, specify the length explicitly.' + ); + return 255; } /** * Gets the maximum length of a binary column. * + * @deprecated + * * @return int */ public function getBinaryMaxLength() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/3263', + 'AbstractPlatform::getBinaryMaxLength() is deprecated.' + ); + return 4000; } /** * Gets the default length of a binary column. * + * @deprecated + * * @return int */ public function getBinaryDefaultLength() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/3263', + 'Relying on the default binary column length is deprecated, specify the length explicitly.' + ); + return 255; } /** * Gets all SQL wildcard characters of the platform. * + * @deprecated Use {@see AbstractPlatform::getLikeWildcardCharacters()} instead. + * * @return string[] */ public function getWildcards() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getWildcards() is deprecated.' + . ' Use AbstractPlatform::getLikeWildcardCharacters() instead.' + ); + return ['%', '_']; } @@ -604,12 +690,20 @@ public function getRegexpExpression() /** * Returns the SQL snippet to get the average value of a column. * + * @deprecated Use AVG() in SQL instead. + * * @param string $column The column to use. * * @return string Generated SQL including an AVG aggregate function. */ public function getAvgExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getAvgExpression() is deprecated. Use AVG() in SQL instead.' + ); + return 'AVG(' . $column . ')'; } @@ -618,48 +712,80 @@ public function getAvgExpression($column) * * If a '*' is used instead of a column the number of selected rows is returned. * + * @deprecated Use COUNT() in SQL instead. + * * @param string|int $column The column to use. * * @return string Generated SQL including a COUNT aggregate function. */ public function getCountExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getCountExpression() is deprecated. Use COUNT() in SQL instead.' + ); + return 'COUNT(' . $column . ')'; } /** * Returns the SQL snippet to get the highest value of a column. * + * @deprecated Use MAX() in SQL instead. + * * @param string $column The column to use. * * @return string Generated SQL including a MAX aggregate function. */ public function getMaxExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getMaxExpression() is deprecated. Use MAX() in SQL instead.' + ); + return 'MAX(' . $column . ')'; } /** * Returns the SQL snippet to get the lowest value of a column. * + * @deprecated Use MIN() in SQL instead. + * * @param string $column The column to use. * * @return string Generated SQL including a MIN aggregate function. */ public function getMinExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getMinExpression() is deprecated. Use MIN() in SQL instead.' + ); + return 'MIN(' . $column . ')'; } /** * Returns the SQL snippet to get the total sum of a column. * + * @deprecated Use SUM() in SQL instead. + * * @param string $column The column to use. * * @return string Generated SQL including a SUM aggregate function. */ public function getSumExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getSumExpression() is deprecated. Use SUM() in SQL instead.' + ); + return 'SUM(' . $column . ')'; } @@ -670,17 +796,25 @@ public function getSumExpression($column) * * Note: Not SQL92, but common functionality. * + * @deprecated + * * @param string $column * * @return string */ public function getMd5Expression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getMd5Expression() is deprecated.' + ); + return 'MD5(' . $column . ')'; } /** - * Returns the SQL snippet to get the length of a text column. + * Returns the SQL snippet to get the length of a text column in characters. * * @param string $column * @@ -694,25 +828,41 @@ public function getLengthExpression($column) /** * Returns the SQL snippet to get the squared value of a column. * + * @deprecated Use SQRT() in SQL instead. + * * @param string $column The column to use. * * @return string Generated SQL including an SQRT aggregate function. */ public function getSqrtExpression($column) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getSqrtExpression() is deprecated. Use SQRT() in SQL instead.' + ); + return 'SQRT(' . $column . ')'; } /** * Returns the SQL snippet to round a numeric column to the number of decimals specified. * - * @param string $column - * @param int $decimals + * @deprecated Use ROUND() in SQL instead. + * + * @param string $column + * @param string|int $decimals * * @return string */ public function getRoundExpression($column, $decimals = 0) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getRoundExpression() is deprecated. Use ROUND() in SQL instead.' + ); + return 'ROUND(' . $column . ', ' . $decimals . ')'; } @@ -770,24 +920,40 @@ public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = f /** * Returns the SQL snippet to trim trailing space characters from the expression. * + * @deprecated Use RTRIM() in SQL instead. + * * @param string $str Literal string or column name. * * @return string */ public function getRtrimExpression($str) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getRtrimExpression() is deprecated. Use RTRIM() in SQL instead.' + ); + return 'RTRIM(' . $str . ')'; } /** * Returns the SQL snippet to trim leading space characters from the expression. * + * @deprecated Use LTRIM() in SQL instead. + * * @param string $str Literal string or column name. * * @return string */ public function getLtrimExpression($str) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getLtrimExpression() is deprecated. Use LTRIM() in SQL instead.' + ); + return 'LTRIM(' . $str . ')'; } @@ -795,12 +961,20 @@ public function getLtrimExpression($str) * Returns the SQL snippet to change all characters from the expression to uppercase, * according to the current character set mapping. * + * @deprecated Use UPPER() in SQL instead. + * * @param string $str Literal string or column name. * * @return string */ public function getUpperExpression($str) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getUpperExpression() is deprecated. Use UPPER() in SQL instead.' + ); + return 'UPPER(' . $str . ')'; } @@ -808,21 +982,29 @@ public function getUpperExpression($str) * Returns the SQL snippet to change all characters from the expression to lowercase, * according to the current character set mapping. * + * @deprecated Use LOWER() in SQL instead. + * * @param string $str Literal string or column name. * * @return string */ public function getLowerExpression($str) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getLowerExpression() is deprecated. Use LOWER() in SQL instead.' + ); + return 'LOWER(' . $str . ')'; } /** * Returns the SQL snippet to get the position of the first occurrence of substring $substr in string $str. * - * @param string $str Literal string. - * @param string $substr Literal string to find. - * @param int|false $startPos Position to start at, beginning of string by default. + * @param string $str Literal string. + * @param string $substr Literal string to find. + * @param string|int|false $startPos Position to start at, beginning of string by default. * * @return string * @@ -836,10 +1018,18 @@ public function getLocateExpression($str, $substr, $startPos = false) /** * Returns the SQL snippet to get the current system date. * + * @deprecated Generate dates within the application. + * * @return string */ public function getNowExpression() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4753', + 'AbstractPlatform::getNowExpression() is deprecated. Generate dates within the application.' + ); + return 'NOW()'; } @@ -850,9 +1040,9 @@ public function getNowExpression() * * SQLite only supports the 2 parameter variant of this function. * - * @param string $string An sql string literal or column name/alias. - * @param int $start Where to start the substring portion. - * @param int|null $length The substring portion length. + * @param string $string An sql string literal or column name/alias. + * @param string|int $start Where to start the substring portion. + * @param string|int|null $length The substring portion length. * * @return string */ @@ -888,36 +1078,60 @@ public function getConcatExpression() * ->where($e->eq('id', $e->not('null')); * * + * @deprecated Use NOT() in SQL instead. + * * @param string $expression * * @return string The logical expression. */ public function getNotExpression($expression) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getNotExpression() is deprecated. Use NOT() in SQL instead.' + ); + return 'NOT(' . $expression . ')'; } /** * Returns the SQL that checks if an expression is null. * + * @deprecated Use IS NULL in SQL instead. + * * @param string $expression The expression that should be compared to null. * * @return string The logical expression. */ public function getIsNullExpression($expression) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getIsNullExpression() is deprecated. Use IS NULL in SQL instead.' + ); + return $expression . ' IS NULL'; } /** * Returns the SQL that checks if an expression is not null. * + * @deprecated Use IS NOT NULL in SQL instead. + * * @param string $expression The expression that should be compared to null. * * @return string The logical expression. */ public function getIsNotNullExpression($expression) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getIsNotNullExpression() is deprecated. Use IS NOT NULL in SQL instead.' + ); + return $expression . ' IS NOT NULL'; } @@ -930,6 +1144,8 @@ public function getIsNotNullExpression($expression) * http://www.w3schools.com/sql/sql_between.asp. If you want complete database * independence you should avoid using between(). * + * @deprecated Use BETWEEN in SQL instead. + * * @param string $expression The value to compare to. * @param string $value1 The lower value to compare with. * @param string $value2 The higher value to compare with. @@ -938,52 +1154,90 @@ public function getIsNotNullExpression($expression) */ public function getBetweenExpression($expression, $value1, $value2) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getBetweenExpression() is deprecated. Use BETWEEN in SQL instead.' + ); + return $expression . ' BETWEEN ' . $value1 . ' AND ' . $value2; } /** * Returns the SQL to get the arccosine of a value. * + * @deprecated Use ACOS() in SQL instead. + * * @param string $value * * @return string */ public function getAcosExpression($value) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getAcosExpression() is deprecated. Use ACOS() in SQL instead.' + ); + return 'ACOS(' . $value . ')'; } /** * Returns the SQL to get the sine of a value. * + * @deprecated Use SIN() in SQL instead. + * * @param string $value * * @return string */ public function getSinExpression($value) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getSinExpression() is deprecated. Use SIN() in SQL instead.' + ); + return 'SIN(' . $value . ')'; } /** * Returns the SQL to get the PI value. * + * @deprecated Use PI() in SQL instead. + * * @return string */ public function getPiExpression() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getPiExpression() is deprecated. Use PI() in SQL instead.' + ); + return 'PI()'; } /** * Returns the SQL to get the cosine of a value. * + * @deprecated Use COS() in SQL instead. + * * @param string $value * * @return string */ public function getCosExpression($value) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getCosExpression() is deprecated. Use COS() in SQL instead.' + ); + return 'COS(' . $value . ')'; } @@ -1309,6 +1563,7 @@ public function getForUpdateSQL() * * @param string $fromClause The FROM clause to append the hint for the given lock mode to * @param int $lockMode One of the Doctrine\DBAL\LockMode::* constants + * @psalm-param LockMode::* $lockMode */ public function appendLockHint(string $fromClause, int $lockMode): string { @@ -1349,26 +1604,6 @@ public function getWriteLockSQL() return $this->getForUpdateSQL(); } - /** - * Returns the SQL snippet to drop an existing database. - * - * @param string $name The name of the database that should be dropped. - * - * @return string - */ - public function getDropDatabaseSQL($name) - { - return 'DROP DATABASE ' . $name; - } - - /** - * Returns the SQL snippet to drop a schema. - */ - public function getDropSchemaSQL(string $schemaName): string - { - return 'DROP SCHEMA ' . $schemaName; - } - /** * Returns the SQL snippet to drop an existing table. * @@ -1425,8 +1660,8 @@ public function getDropTemporaryTableSQL($table) /** * Returns the SQL to drop an index from a table. * - * @param Index|string $index - * @param Table|string $table + * @param Index|string $index + * @param Table|string|null $table * * @return string * @@ -1448,6 +1683,8 @@ public function getDropIndexSQL($index, $table = null) /** * Returns the SQL to drop a constraint. * + * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. + * * @param Constraint|string $constraint * @param Table|string $table * @@ -1493,6 +1730,14 @@ public function getDropForeignKeySQL($foreignKey, $table) return 'ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $foreignKey; } + /** + * Returns the SQL to drop a unique constraint. + */ + public function getDropUniqueConstraintSQL(string $name, string $tableName): string + { + return $this->getDropConstraintSQL($name, $tableName); + } + /** * Returns the SQL statement(s) to create a table with the specified name, columns and constraints * on this platform. @@ -1566,23 +1811,13 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE } } - $name = $column->getQuotedName($this); - - $columnData = array_merge($column->toArray(), [ - 'name' => $name, - 'version' => $column->hasPlatformOption('version') ? $column->getPlatformOption('version') : false, - 'comment' => $this->getColumnComment($column), - ]); - - if ($columnData['type'] instanceof Types\StringType && $columnData['length'] === null) { - $columnData['length'] = 255; - } + $columnData = $this->columnToArray($column); if (in_array($column->getName(), $options['primary'], true)) { $columnData['primary'] = true; } - $columns[$name] = $columnData; + $columns[$columnData['name']] = $columnData; } if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaCreateTable)) { @@ -1746,9 +1981,34 @@ public function getAlterSequenceSQL(Sequence $sequence) throw Exception::notSupported(__METHOD__); } + /** + * Returns the SQL snippet to drop an existing sequence. + * + * @param Sequence|string $sequence + * + * @return string + * + * @throws Exception If not supported on this platform. + */ + public function getDropSequenceSQL($sequence) + { + if (! $this->supportsSequences()) { + throw Exception::notSupported(__METHOD__); + } + + if ($sequence instanceof Sequence) { + $sequence = $sequence->getQuotedName($this); + } + + return 'DROP SEQUENCE ' . $sequence; + } + /** * Returns the SQL to create a constraint on a table on this platform. * + * @deprecated Use {@see getCreateIndexSQL()}, {@see getCreateForeignKeySQL()} + * or {@see getCreateUniqueConstraintSQL()} instead. + * * @param Table|string $table * * @return string @@ -1873,7 +2133,33 @@ public function getCreatePrimaryKeySQL(Index $index, $table) */ public function getCreateSchemaSQL($schemaName) { - throw Exception::notSupported(__METHOD__); + if (! $this->supportsSchemas()) { + throw Exception::notSupported(__METHOD__); + } + + return 'CREATE SCHEMA ' . $schemaName; + } + + /** + * Returns the SQL to create a unique constraint on a table on this platform. + */ + public function getCreateUniqueConstraintSQL(UniqueConstraint $constraint, string $tableName): string + { + return $this->getCreateConstraintSQL($constraint, $tableName); + } + + /** + * Returns the SQL snippet to drop a schema. + * + * @throws Exception If not supported on this platform. + */ + public function getDropSchemaSQL(string $schemaName): string + { + if (! $this->supportsSchemas()) { + throw Exception::notSupported(__METHOD__); + } + + return 'DROP SCHEMA ' . $schemaName; } /** @@ -2312,7 +2598,7 @@ public function getDefaultValueDeclarationSQL($column) } if ($type instanceof Types\BooleanType) { - return " DEFAULT '" . $this->convertBooleans($default) . "'"; + return ' DEFAULT ' . $this->convertBooleans($default); } return ' DEFAULT ' . $this->quoteStringLiteral($default); @@ -2452,11 +2738,19 @@ public function getColumnsFieldDeclarationListSQL(array $columns): string * SQL error for any database that does not support temporary tables, or that * requires a different SQL command from "CREATE TEMPORARY TABLE". * + * @deprecated + * * @return string The string required to be placed between "CREATE" and "TABLE" * to generate a temporary table, if possible. */ public function getTemporaryTableSQL() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getTemporaryTableSQL() is deprecated.' + ); + return 'TEMPORARY'; } @@ -2573,11 +2867,19 @@ public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey * Obtains DBMS specific SQL code portion needed to set the UNIQUE constraint * of a column declaration to be used in statements like CREATE TABLE. * + * @deprecated Use UNIQUE in SQL instead. + * * @return string DBMS specific SQL code portion needed to set the UNIQUE constraint * of a column declaration. */ public function getUniqueFieldDeclarationSQL() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getUniqueFieldDeclarationSQL() is deprecated. Use UNIQUE in SQL instead.' + ); + return 'UNIQUE'; } @@ -2613,10 +2915,18 @@ public function getColumnCollationDeclarationSQL($collation) * Whether the platform prefers identity columns (eg. autoincrement) for ID generation. * Subclasses should override this method to return TRUE if they prefer identity columns. * + * @deprecated + * * @return bool */ public function prefersIdentityColumns() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/1519', + 'AbstractPlatform::prefersIdentityColumns() is deprecated.' + ); + return false; } @@ -2752,7 +3062,7 @@ public function getListDatabasesSQL() /** * Returns the SQL statement for retrieving the namespaces defined in the database. * - * @deprecated Use {@link AbstractSchemaManager::listSchemaNames()} instead. + * @deprecated Use {@see AbstractSchemaManager::listSchemaNames()} instead. * * @return string * @@ -2818,12 +3128,20 @@ public function getListTablesSQL() } /** + * @deprecated + * * @return string * * @throws Exception If not supported on this platform. */ public function getListUsersSQL() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::getListUsersSQL() is deprecated.' + ); + throw Exception::notSupported(__METHOD__); } @@ -2880,64 +3198,66 @@ public function getListTableForeignKeysSQL($table) * @param string $sql * * @return string - * - * @throws Exception If not supported on this platform. */ public function getCreateViewSQL($name, $sql) { - throw Exception::notSupported(__METHOD__); + return 'CREATE VIEW ' . $name . ' AS ' . $sql; } /** * @param string $name * * @return string - * - * @throws Exception If not supported on this platform. */ public function getDropViewSQL($name) { - throw Exception::notSupported(__METHOD__); + return 'DROP VIEW ' . $name; } /** - * Returns the SQL snippet to drop an existing sequence. - * - * @param Sequence|string $sequence + * @param string $sequence * * @return string * * @throws Exception If not supported on this platform. */ - public function getDropSequenceSQL($sequence) + public function getSequenceNextValSQL($sequence) { throw Exception::notSupported(__METHOD__); } /** - * @param string $sequence + * Returns the SQL to create a new database. + * + * @param string $name The name of the database that should be created. * * @return string * * @throws Exception If not supported on this platform. */ - public function getSequenceNextValSQL($sequence) + public function getCreateDatabaseSQL($name) { - throw Exception::notSupported(__METHOD__); + if (! $this->supportsCreateDropDatabase()) { + throw Exception::notSupported(__METHOD__); + } + + return 'CREATE DATABASE ' . $name; } /** - * Returns the SQL to create a new database. + * Returns the SQL snippet to drop an existing database. * - * @param string $name The name of the database that should be created. + * @param string $name The name of the database that should be dropped. * * @return string - * - * @throws Exception If not supported on this platform. */ - public function getCreateDatabaseSQL($name) + public function getDropDatabaseSQL($name) { - throw Exception::notSupported(__METHOD__); + if (! $this->supportsCreateDropDatabase()) { + throw Exception::notSupported(__METHOD__); + } + + return 'DROP DATABASE ' . $name; } /** @@ -3092,10 +3412,18 @@ public function getIdentitySequenceName($tableName, $columnName) /** * Whether the platform supports indexes. * + * @deprecated + * * @return bool */ public function supportsIndexes() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsIndexes() is deprecated.' + ); + return true; } @@ -3120,20 +3448,36 @@ public function supportsColumnLengthIndexes(): bool /** * Whether the platform supports altering tables. * + * @deprecated All platforms must implement altering tables. + * * @return bool */ public function supportsAlterTable() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsAlterTable() is deprecated. All platforms must implement altering tables.' + ); + return true; } /** * Whether the platform supports transactions. * + * @deprecated + * * @return bool */ public function supportsTransactions() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsTransactions() is deprecated.' + ); + return true; } @@ -3160,10 +3504,18 @@ public function supportsReleaseSavepoints() /** * Whether the platform supports primary key constraints. * + * @deprecated + * * @return bool */ public function supportsPrimaryConstraints() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsPrimaryConstraints() is deprecated.' + ); + return true; } @@ -3190,13 +3542,21 @@ public function supportsSchemas() /** * Whether this platform can emulate schemas. * + * @deprecated + * * Platforms that either support or emulate schemas don't automatically - * filter a schema for the namespaced elements in {@link AbstractManager::createSchema()}. + * filter a schema for the namespaced elements in {@see AbstractManager::createSchema()}. * * @return bool */ public function canEmulateSchemas() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4805', + 'AbstractPlatform::canEmulateSchemas() is deprecated.' + ); + return false; } @@ -3227,10 +3587,18 @@ public function supportsCreateDropDatabase() /** * Whether the platform supports getting the affected rows of a recent update/delete type query. * + * @deprecated + * * @return bool */ public function supportsGettingAffectedRows() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsGettingAffectedRows() is deprecated.' + ); + return true; } @@ -3277,10 +3645,18 @@ public function hasNativeJsonType() /** * Whether this platform supports views. * + * @deprecated All platforms must implement support for views. + * * @return bool */ public function supportsViews() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsViews() is deprecated. All platforms must implement support for views.' + ); + return true; } @@ -3345,11 +3721,9 @@ public function getTimeFormatString() * @param int|null $limit * @param int $offset * - * @return string - * * @throws Exception */ - final public function modifyLimitQuery($query, $limit, $offset = 0) + final public function modifyLimitQuery($query, $limit, $offset = 0): string { if ($offset < 0) { throw new Exception(sprintf( @@ -3384,11 +3758,11 @@ final public function modifyLimitQuery($query, $limit, $offset = 0) protected function doModifyLimitQuery($query, $limit, $offset) { if ($limit !== null) { - $query .= ' LIMIT ' . $limit; + $query .= sprintf(' LIMIT %d', $limit); } if ($offset > 0) { - $query .= ' OFFSET ' . $offset; + $query .= sprintf(' OFFSET %d', $offset); } return $query; @@ -3397,10 +3771,19 @@ protected function doModifyLimitQuery($query, $limit, $offset) /** * Whether the database platform support offsets in modify limit clauses. * + * @deprecated All platforms must implement support for offsets in modify limit clauses. + * * @return bool */ public function supportsLimitOffset() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/4724', + 'AbstractPlatform::supportsViews() is deprecated.' + . ' All platforms must implement support for offsets in modify limit clauses.' + ); + return true; } @@ -3496,11 +3879,9 @@ public function rollbackSavePoint($savepoint) /** * Returns the keyword list instance of this platform. * - * @return KeywordList - * * @throws Exception If no keyword list is specified. */ - final public function getReservedKeywordsList() + final public function getReservedKeywordsList(): KeywordList { // Check for an existing instantiation of the keywords class. if ($this->_keywords === null) { @@ -3532,7 +3913,7 @@ protected function createReservedKeywordsList(): KeywordList /** * Returns the class name of the reserved keywords list. * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. * * @return string * @psalm-return class-string @@ -3595,6 +3976,27 @@ final public function escapeStringForLike(string $inputString, string $escapeCha ); } + /** + * @return array An associative array with the name of the properties + * of the column being declared as array indexes. + */ + private function columnToArray(Column $column): array + { + $name = $column->getQuotedName($this); + + $columnData = array_merge($column->toArray(), [ + 'name' => $name, + 'version' => $column->hasPlatformOption('version') ? $column->getPlatformOption('version') : false, + 'comment' => $this->getColumnComment($column), + ]); + + if ($columnData['type'] instanceof Types\StringType && $columnData['length'] === null) { + $columnData['length'] = $this->getVarcharDefaultLength(); + } + + return $columnData; + } + /** * @internal */ @@ -3607,4 +4009,37 @@ protected function getLikeWildcardCharacters(): string { return '%_'; } + + /** + * Compares the definitions of the given columns in the context of this platform. + * + * @throws Exception + */ + public function columnsEqual(Column $column1, Column $column2): bool + { + $column1Array = $this->columnToArray($column1); + $column2Array = $this->columnToArray($column2); + + // ignore explicit columnDefinition since it's not set on the Column generated by the SchemaManager + unset($column1Array['columnDefinition']); + unset($column2Array['columnDefinition']); + + if ( + $this->getColumnDeclarationSQL('', $column1Array) + !== $this->getColumnDeclarationSQL('', $column2Array) + ) { + return false; + } + + // If the platform supports inline comments, all comparison is already done above + if ($this->supportsInlineColumnComments()) { + return true; + } + + if ($column1->getComment() !== $column2->getComment()) { + return false; + } + + return $column1->getType() === $column2->getType(); + } } diff --git a/doctrine/dbal/src/Platforms/DB2Platform.php b/doctrine/dbal/src/Platforms/DB2Platform.php index 036310545..979bb2c8f 100644 --- a/doctrine/dbal/src/Platforms/DB2Platform.php +++ b/doctrine/dbal/src/Platforms/DB2Platform.php @@ -69,7 +69,7 @@ public function getBlobTypeDeclarationSQL(array $column) /** * {@inheritDoc} */ - public function initializeDoctrineTypeMappings() + protected function initializeDoctrineTypeMappings() { $this->doctrineTypeMapping = [ 'bigint' => 'bigint', @@ -95,6 +95,13 @@ public function initializeDoctrineTypeMappings() */ public function isCommentedDoctrineType(Type $doctrineType) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/5058', + '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', + __METHOD__ + ); + if ($doctrineType->getName() === Types::BOOLEAN) { // We require a commented boolean type in order to distinguish between boolean and smallint // as both (have to) map to the same native type. @@ -135,6 +142,12 @@ public function getClobTypeDeclarationSQL(array $column) */ public function getName() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4749', + 'DB2Platform::getName() is deprecated. Identify platforms by their class.' + ); + return 'db2'; } @@ -396,38 +409,6 @@ public function getListTableForeignKeysSQL($table) ORDER BY fkcol.COLSEQ ASC'; } - /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getCreateDatabaseSQL($name) - { - return 'CREATE DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getDropDatabaseSQL($name) - { - return 'DROP DATABASE ' . $name; - } - /** * {@inheritDoc} */ @@ -436,14 +417,6 @@ public function supportsCreateDropDatabase() return false; } - /** - * {@inheritDoc} - */ - public function supportsReleaseSavepoints() - { - return false; - } - /** * {@inheritdoc} */ @@ -659,11 +632,9 @@ private function gatherAlterColumnSQL( /** * Returns the ALTER COLUMN SQL clauses for altering a column described by the given column diff. * - * @param ColumnDiff $columnDiff The column diff to evaluate. - * * @return string[] */ - private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) + private function getAlterColumnClausesSQL(ColumnDiff $columnDiff): array { $column = $columnDiff->column->toArray(); @@ -845,6 +816,14 @@ public function getSubstringExpression($string, $start, $length = null) return 'SUBSTR(' . $string . ', ' . $start . ', ' . $length . ')'; } + /** + * {@inheritDoc} + */ + public function getLengthExpression($column) + { + return 'LENGTH(' . $column . ', CODEUNITS32)'; + } + public function getCurrentDatabaseExpression(): string { return 'CURRENT_USER'; @@ -860,9 +839,17 @@ public function supportsIdentityColumns() /** * {@inheritDoc} + * + * @deprecated */ public function prefersIdentityColumns() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/1519', + 'DB2Platform::prefersIdentityColumns() is deprecated.' + ); + return true; } @@ -899,7 +886,7 @@ public function supportsSavepoints() /** * {@inheritDoc} * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass() { diff --git a/doctrine/dbal/src/Platforms/Keywords/KeywordList.php b/doctrine/dbal/src/Platforms/Keywords/KeywordList.php index 852a58aba..34b703f3e 100644 --- a/doctrine/dbal/src/Platforms/Keywords/KeywordList.php +++ b/doctrine/dbal/src/Platforms/Keywords/KeywordList.php @@ -8,6 +8,8 @@ /** * Abstract interface for a SQL reserved keyword dictionary. + * + * @psalm-consistent-constructor */ abstract class KeywordList { diff --git a/doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php b/doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php new file mode 100644 index 000000000..93c595f28 --- /dev/null +++ b/doctrine/dbal/src/Platforms/Keywords/MariaDBKeywords.php @@ -0,0 +1,267 @@ +doctrineTypeMapping['json'] = Types::JSON; + } +} diff --git a/doctrine/dbal/src/Platforms/MariaDb1027Platform.php b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php index bb8e0b88d..93c7d3488 100644 --- a/doctrine/dbal/src/Platforms/MariaDb1027Platform.php +++ b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php @@ -2,45 +2,14 @@ namespace Doctrine\DBAL\Platforms; -use Doctrine\DBAL\Types\Types; -use Doctrine\Deprecations\Deprecation; - /** * Provides the behavior, features and SQL dialect of the MariaDB 10.2 (10.2.7 GA) database platform. * * Note: Should not be used with versions prior to 10.2.7. + * + * @deprecated This class will be merged with {@see MariaDBPlatform} in 4.0 because support for MariaDB + * releases prior to 10.2.7 will be dropped. */ -class MariaDb1027Platform extends MySQLPlatform +class MariaDb1027Platform extends MariaDBPlatform { - /** - * {@inheritdoc} - * - * @link https://mariadb.com/kb/en/library/json-data-type/ - */ - public function getJsonTypeDeclarationSQL(array $column): string - { - return 'LONGTEXT'; - } - - /** - * @deprecated Implement {@link createReservedKeywordsList()} instead. - */ - protected function getReservedKeywordsClass(): string - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4510', - 'MariaDb1027Platform::getReservedKeywordsClass() is deprecated,' - . ' use MariaDb1027Platform::createReservedKeywordsList() instead.' - ); - - return Keywords\MariaDb102Keywords::class; - } - - protected function initializeDoctrineTypeMappings(): void - { - parent::initializeDoctrineTypeMappings(); - - $this->doctrineTypeMapping['json'] = Types::JSON; - } } diff --git a/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php b/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php new file mode 100644 index 000000000..4aa0faf6c --- /dev/null +++ b/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider.php @@ -0,0 +1,13 @@ + */ + private $cache = []; + + public function __construct(CollationMetadataProvider $collationMetadataProvider) + { + $this->collationMetadataProvider = $collationMetadataProvider; + } + + public function getCollationCharset(string $collation): ?string + { + if (array_key_exists($collation, $this->cache)) { + return $this->cache[$collation]; + } + + return $this->cache[$collation] = $this->collationMetadataProvider->getCollationCharset($collation); + } +} diff --git a/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php b/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php new file mode 100644 index 000000000..401c940e0 --- /dev/null +++ b/doctrine/dbal/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php @@ -0,0 +1,45 @@ +connection = $connection; + } + + /** + * @throws Exception + */ + public function getCollationCharset(string $collation): ?string + { + $charset = $this->connection->fetchOne( + <<<'SQL' +SELECT CHARACTER_SET_NAME +FROM information_schema.COLLATIONS +WHERE COLLATION_NAME = ?; +SQL + , + [$collation] + ); + + if ($charset !== false) { + return $charset; + } + + return null; + } +} diff --git a/doctrine/dbal/src/Platforms/MySQL/Comparator.php b/doctrine/dbal/src/Platforms/MySQL/Comparator.php new file mode 100644 index 000000000..74e7fe3ba --- /dev/null +++ b/doctrine/dbal/src/Platforms/MySQL/Comparator.php @@ -0,0 +1,87 @@ +collationMetadataProvider = $collationMetadataProvider; + } + + /** + * {@inheritDoc} + */ + public function diffTable(Table $fromTable, Table $toTable) + { + return parent::diffTable( + $this->normalizeColumns($fromTable), + $this->normalizeColumns($toTable) + ); + } + + private function normalizeColumns(Table $table): Table + { + $tableOptions = array_intersect_key($table->getOptions(), [ + 'charset' => null, + 'collation' => null, + ]); + + $table = clone $table; + + foreach ($table->getColumns() as $column) { + $originalOptions = $column->getPlatformOptions(); + $normalizedOptions = $this->normalizeOptions($originalOptions); + + $overrideOptions = array_diff_assoc($normalizedOptions, $tableOptions); + + if ($overrideOptions === $originalOptions) { + continue; + } + + $column->setPlatformOptions($overrideOptions); + } + + return $table; + } + + /** + * @param array $options + * + * @return array + */ + private function normalizeOptions(array $options): array + { + if (isset($options['collation']) && ! isset($options['charset'])) { + $charset = $this->collationMetadataProvider->getCollationCharset($options['collation']); + + if ($charset !== null) { + $options['charset'] = $charset; + } + } + + return $options; + } +} diff --git a/doctrine/dbal/src/Platforms/MySQL57Platform.php b/doctrine/dbal/src/Platforms/MySQL57Platform.php index f29204cf4..3975bf2ca 100644 --- a/doctrine/dbal/src/Platforms/MySQL57Platform.php +++ b/doctrine/dbal/src/Platforms/MySQL57Platform.php @@ -10,6 +10,9 @@ /** * Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform. + * + * @deprecated This class will be merged with {@see MySQLPlatform} in 4.0 because support for MySQL + * releases prior to 5.7 will be dropped. */ class MySQL57Platform extends MySQLPlatform { @@ -61,7 +64,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) /** * {@inheritdoc} * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass() { diff --git a/doctrine/dbal/src/Platforms/MySQL80Platform.php b/doctrine/dbal/src/Platforms/MySQL80Platform.php index 808e93449..536a79f4b 100644 --- a/doctrine/dbal/src/Platforms/MySQL80Platform.php +++ b/doctrine/dbal/src/Platforms/MySQL80Platform.php @@ -12,7 +12,7 @@ class MySQL80Platform extends MySQL57Platform /** * {@inheritdoc} * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass() { diff --git a/doctrine/dbal/src/Platforms/MySQLPlatform.php b/doctrine/dbal/src/Platforms/MySQLPlatform.php index 379616f22..ae2cc9f2b 100644 --- a/doctrine/dbal/src/Platforms/MySQLPlatform.php +++ b/doctrine/dbal/src/Platforms/MySQLPlatform.php @@ -2,1193 +2,10 @@ namespace Doctrine\DBAL\Platforms; -use Doctrine\DBAL\Exception; -use Doctrine\DBAL\Schema\ForeignKeyConstraint; -use Doctrine\DBAL\Schema\Identifier; -use Doctrine\DBAL\Schema\Index; -use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\DBAL\TransactionIsolationLevel; -use Doctrine\DBAL\Types\BlobType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\Deprecations\Deprecation; -use InvalidArgumentException; - -use function array_diff_key; -use function array_merge; -use function array_unique; -use function array_values; -use function count; -use function func_get_args; -use function implode; -use function in_array; -use function is_numeric; -use function is_string; -use function sprintf; -use function str_replace; -use function strtoupper; -use function trim; - /** - * The MySQLPlatform provides the behavior, features and SQL dialect of the - * MySQL database platform. This platform represents a MySQL 5.0 or greater platform that - * uses the InnoDB storage engine. + * Provides the behavior, features and SQL dialect of the Oracle MySQL database platform + * of the oldest supported version. */ -class MySQLPlatform extends AbstractPlatform +class MySQLPlatform extends AbstractMySQLPlatform { - public const LENGTH_LIMIT_TINYTEXT = 255; - public const LENGTH_LIMIT_TEXT = 65535; - public const LENGTH_LIMIT_MEDIUMTEXT = 16777215; - - public const LENGTH_LIMIT_TINYBLOB = 255; - public const LENGTH_LIMIT_BLOB = 65535; - public const LENGTH_LIMIT_MEDIUMBLOB = 16777215; - - /** - * {@inheritDoc} - */ - protected function doModifyLimitQuery($query, $limit, $offset) - { - if ($limit !== null) { - $query .= ' LIMIT ' . $limit; - - if ($offset > 0) { - $query .= ' OFFSET ' . $offset; - } - } elseif ($offset > 0) { - // 2^64-1 is the maximum of unsigned BIGINT, the biggest limit possible - $query .= ' LIMIT 18446744073709551615 OFFSET ' . $offset; - } - - return $query; - } - - /** - * {@inheritDoc} - */ - public function getIdentifierQuoteCharacter() - { - return '`'; - } - - /** - * {@inheritDoc} - */ - public function getRegexpExpression() - { - return 'RLIKE'; - } - - /** - * {@inheritDoc} - */ - public function getLocateExpression($str, $substr, $startPos = false) - { - if ($startPos === false) { - return 'LOCATE(' . $substr . ', ' . $str . ')'; - } - - return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; - } - - /** - * {@inheritDoc} - */ - public function getConcatExpression() - { - return sprintf('CONCAT(%s)', implode(', ', func_get_args())); - } - - /** - * {@inheritdoc} - */ - protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) - { - $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB'; - - return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')'; - } - - /** - * {@inheritDoc} - */ - public function getDateDiffExpression($date1, $date2) - { - return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; - } - - public function getCurrentDatabaseExpression(): string - { - return 'DATABASE()'; - } - - /** - * {@inheritDoc} - */ - public function getListDatabasesSQL() - { - return 'SHOW DATABASES'; - } - - /** - * {@inheritDoc} - */ - public function getListTableConstraintsSQL($table) - { - return 'SHOW INDEX FROM ' . $table; - } - - /** - * {@inheritDoc} - * - * Two approaches to listing the table indexes. The information_schema is - * preferred, because it doesn't cause problems with SQL keywords such as "order" or "table". - */ - public function getListTableIndexesSQL($table, $database = null) - { - if ($database !== null) { - $database = $this->quoteStringLiteral($database); - $table = $this->quoteStringLiteral($table); - - return 'SELECT NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, COLUMN_NAME AS Column_Name,' . - ' SUB_PART AS Sub_Part, INDEX_TYPE AS Index_Type' . - ' FROM information_schema.STATISTICS WHERE TABLE_NAME = ' . $table . - ' AND TABLE_SCHEMA = ' . $database . - ' ORDER BY SEQ_IN_INDEX ASC'; - } - - return 'SHOW INDEX FROM ' . $table; - } - - /** - * {@inheritDoc} - */ - public function getListViewsSQL($database) - { - $database = $this->quoteStringLiteral($database); - - return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $database; - } - - /** - * @param string $table - * @param string|null $database - * - * @return string - */ - public function getListTableForeignKeysSQL($table, $database = null) - { - $table = $this->quoteStringLiteral($table); - - if ($database !== null) { - $database = $this->quoteStringLiteral($database); - } - - $sql = 'SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ' . - 'k.`REFERENCED_COLUMN_NAME`, k.`ORDINAL_POSITION` /*!50116 , c.update_rule, c.delete_rule */ ' . - 'FROM information_schema.key_column_usage k /*!50116 ' . - 'INNER JOIN information_schema.referential_constraints c ON ' . - ' c.constraint_name = k.constraint_name AND ' . - ' c.table_name = ' . $table . ' */ WHERE k.table_name = ' . $table; - - $databaseNameSql = $database ?? 'DATABASE()'; - - return $sql . ' AND k.table_schema = ' . $databaseNameSql - . ' /*!50116 AND c.constraint_schema = ' . $databaseNameSql . ' */' - . ' AND k.`REFERENCED_COLUMN_NAME` is not NULL' - . ' ORDER BY k.`ORDINAL_POSITION`'; - } - - /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** - * {@inheritDoc} - */ - protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') - : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); - } - - /** - * {@inheritdoc} - */ - protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed - ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' - : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; - } - - /** - * Gets the SQL snippet used to declare a CLOB column type. - * TINYTEXT : 2 ^ 8 - 1 = 255 - * TEXT : 2 ^ 16 - 1 = 65535 - * MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 - * LONGTEXT : 2 ^ 32 - 1 = 4294967295 - * - * {@inheritDoc} - */ - public function getClobTypeDeclarationSQL(array $column) - { - if (! empty($column['length']) && is_numeric($column['length'])) { - $length = $column['length']; - - if ($length <= static::LENGTH_LIMIT_TINYTEXT) { - return 'TINYTEXT'; - } - - if ($length <= static::LENGTH_LIMIT_TEXT) { - return 'TEXT'; - } - - if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) { - return 'MEDIUMTEXT'; - } - } - - return 'LONGTEXT'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTypeDeclarationSQL(array $column) - { - if (isset($column['version']) && $column['version'] === true) { - return 'TIMESTAMP'; - } - - return 'DATETIME'; - } - - /** - * {@inheritDoc} - */ - public function getDateTypeDeclarationSQL(array $column) - { - return 'DATE'; - } - - /** - * {@inheritDoc} - */ - public function getTimeTypeDeclarationSQL(array $column) - { - return 'TIME'; - } - - /** - * {@inheritDoc} - */ - public function getBooleanTypeDeclarationSQL(array $column) - { - return 'TINYINT(1)'; - } - - /** - * {@inheritDoc} - * - * MySQL prefers "autoincrement" identity columns since sequences can only - * be emulated with a table. - */ - public function prefersIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - * - * MySQL supports this through AUTO_INCREMENT columns. - */ - public function supportsIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsInlineColumnComments() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsColumnCollation() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getListTablesSQL() - { - return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'"; - } - - /** - * {@inheritDoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - $table = $this->quoteStringLiteral($table); - - if ($database !== null) { - $database = $this->quoteStringLiteral($database); - } else { - $database = 'DATABASE()'; - } - - return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' . - 'COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, ' . - 'CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ' . - 'FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ' . $database . ' AND TABLE_NAME = ' . $table . - ' ORDER BY ORDINAL_POSITION ASC'; - } - - public function getListTableMetadataSQL(string $table, ?string $database = null): string - { - return sprintf( - <<<'SQL' -SELECT ENGINE, AUTO_INCREMENT, TABLE_COLLATION, TABLE_COMMENT, CREATE_OPTIONS -FROM information_schema.TABLES -WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = %s AND TABLE_NAME = %s -SQL - , - $database !== null ? $this->quoteStringLiteral($database) : 'DATABASE()', - $this->quoteStringLiteral($table) - ); - } - - /** - * {@inheritDoc} - */ - public function getCreateDatabaseSQL($name) - { - return 'CREATE DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getDropDatabaseSQL($name) - { - return 'DROP DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = []) - { - $queryFields = $this->getColumnDeclarationListSQL($columns); - - if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $constraintName => $definition) { - $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); - } - } - - // add all indexes - if (isset($options['indexes']) && ! empty($options['indexes'])) { - foreach ($options['indexes'] as $indexName => $definition) { - $queryFields .= ', ' . $this->getIndexDeclarationSQL($indexName, $definition); - } - } - - // attach all primary keys - if (isset($options['primary']) && ! empty($options['primary'])) { - $keyColumns = array_unique(array_values($options['primary'])); - $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; - } - - $query = 'CREATE '; - - if (! empty($options['temporary'])) { - $query .= 'TEMPORARY '; - } - - $query .= 'TABLE ' . $name . ' (' . $queryFields . ') '; - $query .= $this->buildTableOptions($options); - $query .= $this->buildPartitionOptions($options); - - $sql = [$query]; - $engine = 'INNODB'; - - if (isset($options['engine'])) { - $engine = strtoupper(trim($options['engine'])); - } - - // Propagate foreign key constraints only for InnoDB. - if (isset($options['foreignKeys']) && $engine === 'INNODB') { - foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $name); - } - } - - return $sql; - } - - /** - * {@inheritdoc} - */ - public function getDefaultValueDeclarationSQL($column) - { - // Unset the default value if the given column definition does not allow default values. - if ($column['type'] instanceof TextType || $column['type'] instanceof BlobType) { - $column['default'] = null; - } - - return parent::getDefaultValueDeclarationSQL($column); - } - - /** - * Build SQL for table options - * - * @param mixed[] $options - * - * @return string - */ - private function buildTableOptions(array $options) - { - if (isset($options['table_options'])) { - return $options['table_options']; - } - - $tableOptions = []; - - // Charset - if (! isset($options['charset'])) { - $options['charset'] = 'utf8'; - } - - $tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']); - - // Collate - if (! isset($options['collate'])) { - $options['collate'] = $options['charset'] . '_unicode_ci'; - } - - $tableOptions[] = $this->getColumnCollationDeclarationSQL($options['collate']); - - // Engine - if (! isset($options['engine'])) { - $options['engine'] = 'InnoDB'; - } - - $tableOptions[] = sprintf('ENGINE = %s', $options['engine']); - - // Auto increment - if (isset($options['auto_increment'])) { - $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']); - } - - // Comment - if (isset($options['comment'])) { - $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($options['comment'])); - } - - // Row format - if (isset($options['row_format'])) { - $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']); - } - - return implode(' ', $tableOptions); - } - - /** - * Build SQL for partition options. - * - * @param mixed[] $options - * - * @return string - */ - private function buildPartitionOptions(array $options) - { - return isset($options['partition_options']) - ? ' ' . $options['partition_options'] - : ''; - } - - /** - * {@inheritDoc} - */ - public function getAlterTableSQL(TableDiff $diff) - { - $columnSql = []; - $queryParts = []; - $newName = $diff->getNewName(); - - if ($newName !== false) { - $queryParts[] = 'RENAME TO ' . $newName->getQuotedName($this); - } - - foreach ($diff->addedColumns as $column) { - if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { - continue; - } - - $columnArray = array_merge($column->toArray(), [ - 'comment' => $this->getColumnComment($column), - ]); - - $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - foreach ($diff->removedColumns as $column) { - if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { - continue; - } - - $queryParts[] = 'DROP ' . $column->getQuotedName($this); - } - - foreach ($diff->changedColumns as $columnDiff) { - if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { - continue; - } - - $column = $columnDiff->column; - $columnArray = $column->toArray(); - - // Don't propagate default value changes for unsupported column types. - if ( - $columnDiff->hasChanged('default') && - count($columnDiff->changedProperties) === 1 && - ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType) - ) { - continue; - } - - $columnArray['comment'] = $this->getColumnComment($column); - $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' - . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - foreach ($diff->renamedColumns as $oldColumnName => $column) { - if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { - continue; - } - - $oldColumnName = new Identifier($oldColumnName); - $columnArray = $column->toArray(); - $columnArray['comment'] = $this->getColumnComment($column); - $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' - . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); - } - - if (isset($diff->addedIndexes['primary'])) { - $keyColumns = array_unique(array_values($diff->addedIndexes['primary']->getColumns())); - $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; - unset($diff->addedIndexes['primary']); - } elseif (isset($diff->changedIndexes['primary'])) { - // Necessary in case the new primary key includes a new auto_increment column - foreach ($diff->changedIndexes['primary']->getColumns() as $columnName) { - if (isset($diff->addedColumns[$columnName]) && $diff->addedColumns[$columnName]->getAutoincrement()) { - $keyColumns = array_unique(array_values($diff->changedIndexes['primary']->getColumns())); - $queryParts[] = 'DROP PRIMARY KEY'; - $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')'; - unset($diff->changedIndexes['primary']); - break; - } - } - } - - $sql = []; - $tableSql = []; - - if (! $this->onSchemaAlterTable($diff, $tableSql)) { - if (count($queryParts) > 0) { - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' - . implode(', ', $queryParts); - } - - $sql = array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - } - - return array_merge($sql, $tableSql, $columnSql); - } - - /** - * {@inheritDoc} - */ - protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) - { - $sql = []; - $table = $diff->getName($this)->getQuotedName($this); - - foreach ($diff->changedIndexes as $changedIndex) { - $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $changedIndex)); - } - - foreach ($diff->removedIndexes as $remKey => $remIndex) { - $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $remIndex)); - - foreach ($diff->addedIndexes as $addKey => $addIndex) { - if ($remIndex->getColumns() !== $addIndex->getColumns()) { - continue; - } - - $indexClause = 'INDEX ' . $addIndex->getName(); - - if ($addIndex->isPrimary()) { - $indexClause = 'PRIMARY KEY'; - } elseif ($addIndex->isUnique()) { - $indexClause = 'UNIQUE INDEX ' . $addIndex->getName(); - } - - $query = 'ALTER TABLE ' . $table . ' DROP INDEX ' . $remIndex->getName() . ', '; - $query .= 'ADD ' . $indexClause; - $query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex) . ')'; - - $sql[] = $query; - - unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]); - - break; - } - } - - $engine = 'INNODB'; - - if ($diff->fromTable instanceof Table && $diff->fromTable->hasOption('engine')) { - $engine = strtoupper(trim($diff->fromTable->getOption('engine'))); - } - - // Suppress foreign key constraint propagation on non-supporting engines. - if ($engine !== 'INNODB') { - $diff->addedForeignKeys = []; - $diff->changedForeignKeys = []; - $diff->removedForeignKeys = []; - } - - $sql = array_merge( - $sql, - $this->getPreAlterTableAlterIndexForeignKeySQL($diff), - parent::getPreAlterTableIndexForeignKeySQL($diff), - $this->getPreAlterTableRenameIndexForeignKeySQL($diff) - ); - - return $sql; - } - - /** - * @return string[] - * - * @throws Exception - */ - private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index) - { - $sql = []; - - if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) { - return $sql; - } - - $tableName = $diff->getName($this)->getQuotedName($this); - - // Dropping primary keys requires to unset autoincrement attribute on the particular column first. - foreach ($index->getColumns() as $columnName) { - if (! $diff->fromTable->hasColumn($columnName)) { - continue; - } - - $column = $diff->fromTable->getColumn($columnName); - - if ($column->getAutoincrement() !== true) { - continue; - } - - $column->setAutoincrement(false); - - $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' . - $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); - - // original autoincrement information might be needed later on by other parts of the table alteration - $column->setAutoincrement(true); - } - - return $sql; - } - - /** - * @param TableDiff $diff The table diff to gather the SQL for. - * - * @return string[] - * - * @throws Exception - */ - private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) - { - $sql = []; - $table = $diff->getName($this)->getQuotedName($this); - - foreach ($diff->changedIndexes as $changedIndex) { - // Changed primary key - if (! $changedIndex->isPrimary() || ! ($diff->fromTable instanceof Table)) { - continue; - } - - foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName => $column) { - // Check if an autoincrement column was dropped from the primary key. - if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns(), true)) { - continue; - } - - // The autoincrement attribute needs to be removed from the dropped column - // before we can drop and recreate the primary key. - $column->setAutoincrement(false); - - $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' . - $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); - - // Restore the autoincrement attribute as it might be needed later on - // by other parts of the table alteration. - $column->setAutoincrement(true); - } - } - - return $sql; - } - - /** - * @param TableDiff $diff The table diff to gather the SQL for. - * - * @return string[] - */ - protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) - { - $sql = []; - $tableName = $diff->getName($this)->getQuotedName($this); - - foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { - if (in_array($foreignKey, $diff->changedForeignKeys, true)) { - continue; - } - - $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); - } - - return $sql; - } - - /** - * Returns the remaining foreign key constraints that require one of the renamed indexes. - * - * "Remaining" here refers to the diff between the foreign keys currently defined in the associated - * table and the foreign keys to be removed. - * - * @param TableDiff $diff The table diff to evaluate. - * - * @return ForeignKeyConstraint[] - */ - private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff) - { - if (empty($diff->renamedIndexes) || ! $diff->fromTable instanceof Table) { - return []; - } - - $foreignKeys = []; - /** @var ForeignKeyConstraint[] $remainingForeignKeys */ - $remainingForeignKeys = array_diff_key( - $diff->fromTable->getForeignKeys(), - $diff->removedForeignKeys - ); - - foreach ($remainingForeignKeys as $foreignKey) { - foreach ($diff->renamedIndexes as $index) { - if ($foreignKey->intersectsIndexColumns($index)) { - $foreignKeys[] = $foreignKey; - - break; - } - } - } - - return $foreignKeys; - } - - /** - * {@inheritdoc} - */ - protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) - { - return array_merge( - parent::getPostAlterTableIndexForeignKeySQL($diff), - $this->getPostAlterTableRenameIndexForeignKeySQL($diff) - ); - } - - /** - * @param TableDiff $diff The table diff to gather the SQL for. - * - * @return string[] - */ - protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) - { - $sql = []; - $newName = $diff->getNewName(); - - if ($newName !== false) { - $tableName = $newName->getQuotedName($this); - } else { - $tableName = $diff->getName($this)->getQuotedName($this); - } - - foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { - if (in_array($foreignKey, $diff->changedForeignKeys, true)) { - continue; - } - - $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName); - } - - return $sql; - } - - /** - * {@inheritDoc} - */ - protected function getCreateIndexSQLFlags(Index $index) - { - $type = ''; - if ($index->isUnique()) { - $type .= 'UNIQUE '; - } elseif ($index->hasFlag('fulltext')) { - $type .= 'FULLTEXT '; - } elseif ($index->hasFlag('spatial')) { - $type .= 'SPATIAL '; - } - - return $type; - } - - /** - * {@inheritDoc} - */ - public function getIntegerTypeDeclarationSQL(array $column) - { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getBigIntTypeDeclarationSQL(array $column) - { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getSmallIntTypeDeclarationSQL(array $column) - { - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritdoc} - */ - public function getFloatDeclarationSQL(array $column) - { - return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($column); - } - - /** - * {@inheritdoc} - */ - public function getDecimalTypeDeclarationSQL(array $column) - { - return parent::getDecimalTypeDeclarationSQL($column) . $this->getUnsignedDeclaration($column); - } - - /** - * Get unsigned declaration for a column. - * - * @param mixed[] $columnDef - * - * @return string - */ - private function getUnsignedDeclaration(array $columnDef) - { - return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : ''; - } - - /** - * {@inheritDoc} - */ - protected function _getCommonIntegerTypeDeclarationSQL(array $column) - { - $autoinc = ''; - if (! empty($column['autoincrement'])) { - $autoinc = ' AUTO_INCREMENT'; - } - - return $this->getUnsignedDeclaration($column) . $autoinc; - } - - /** - * {@inheritDoc} - */ - public function getColumnCharsetDeclarationSQL($charset) - { - return 'CHARACTER SET ' . $charset; - } - - /** - * {@inheritDoc} - */ - public function getColumnCollationDeclarationSQL($collation) - { - return 'COLLATE ' . $this->quoteSingleIdentifier($collation); - } - - /** - * {@inheritDoc} - */ - public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) - { - $query = ''; - if ($foreignKey->hasOption('match')) { - $query .= ' MATCH ' . $foreignKey->getOption('match'); - } - - $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); - - return $query; - } - - /** - * {@inheritDoc} - */ - public function getDropIndexSQL($index, $table = null) - { - if ($index instanceof Index) { - $indexName = $index->getQuotedName($this); - } elseif (is_string($index)) { - $indexName = $index; - } else { - throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' - ); - } - - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } elseif (! is_string($table)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' - ); - } - - if ($index instanceof Index && $index->isPrimary()) { - // MySQL primary keys are always named "PRIMARY", - // so we cannot use them in statements because of them being keyword. - return $this->getDropPrimaryKeySQL($table); - } - - return 'DROP INDEX ' . $indexName . ' ON ' . $table; - } - - /** - * @param string $table - * - * @return string - */ - protected function getDropPrimaryKeySQL($table) - { - return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; - } - - /** - * {@inheritDoc} - */ - public function getSetTransactionIsolationSQL($level) - { - return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'mysql'; - } - - /** - * {@inheritDoc} - */ - public function getReadLockSQL() - { - return 'LOCK IN SHARE MODE'; - } - - /** - * {@inheritDoc} - */ - protected function initializeDoctrineTypeMappings() - { - $this->doctrineTypeMapping = [ - 'bigint' => 'bigint', - 'binary' => 'binary', - 'blob' => 'blob', - 'char' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'decimal' => 'decimal', - 'double' => 'float', - 'float' => 'float', - 'int' => 'integer', - 'integer' => 'integer', - 'longblob' => 'blob', - 'longtext' => 'text', - 'mediumblob' => 'blob', - 'mediumint' => 'integer', - 'mediumtext' => 'text', - 'numeric' => 'decimal', - 'real' => 'float', - 'set' => 'simple_array', - 'smallint' => 'smallint', - 'string' => 'string', - 'text' => 'text', - 'time' => 'time', - 'timestamp' => 'datetime', - 'tinyblob' => 'blob', - 'tinyint' => 'boolean', - 'tinytext' => 'text', - 'varbinary' => 'binary', - 'varchar' => 'string', - 'year' => 'date', - ]; - } - - /** - * {@inheritDoc} - */ - public function getVarcharMaxLength() - { - return 65535; - } - - /** - * {@inheritdoc} - */ - public function getBinaryMaxLength() - { - return 65535; - } - - /** - * {@inheritDoc} - * - * @deprecated Implement {@link createReservedKeywordsList()} instead. - */ - protected function getReservedKeywordsClass() - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4510', - 'MySQLPlatform::getReservedKeywordsClass() is deprecated,' - . ' use MySQLPlatform::createReservedKeywordsList() instead.' - ); - - return Keywords\MySQLKeywords::class; - } - - /** - * {@inheritDoc} - * - * MySQL commits a transaction implicitly when DROP TABLE is executed, however not - * if DROP TEMPORARY TABLE is executed. - */ - public function getDropTemporaryTableSQL($table) - { - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } elseif (! is_string($table)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' - ); - } - - return 'DROP TEMPORARY TABLE ' . $table; - } - - /** - * Gets the SQL Snippet used to declare a BLOB column type. - * TINYBLOB : 2 ^ 8 - 1 = 255 - * BLOB : 2 ^ 16 - 1 = 65535 - * MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 - * LONGBLOB : 2 ^ 32 - 1 = 4294967295 - * - * {@inheritDoc} - */ - public function getBlobTypeDeclarationSQL(array $column) - { - if (! empty($column['length']) && is_numeric($column['length'])) { - $length = $column['length']; - - if ($length <= static::LENGTH_LIMIT_TINYBLOB) { - return 'TINYBLOB'; - } - - if ($length <= static::LENGTH_LIMIT_BLOB) { - return 'BLOB'; - } - - if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) { - return 'MEDIUMBLOB'; - } - } - - return 'LONGBLOB'; - } - - /** - * {@inheritdoc} - */ - public function quoteStringLiteral($str) - { - $str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped aswell. - - return parent::quoteStringLiteral($str); - } - - /** - * {@inheritdoc} - */ - public function getDefaultTransactionIsolationLevel() - { - return TransactionIsolationLevel::REPEATABLE_READ; - } - - public function supportsColumnLengthIndexes(): bool - { - return true; - } } diff --git a/doctrine/dbal/src/Platforms/OraclePlatform.php b/doctrine/dbal/src/Platforms/OraclePlatform.php index 7be7621d3..7eabb7fa3 100644 --- a/doctrine/dbal/src/Platforms/OraclePlatform.php +++ b/doctrine/dbal/src/Platforms/OraclePlatform.php @@ -35,6 +35,8 @@ class OraclePlatform extends AbstractPlatform /** * Assertion for Oracle identifiers. * + * @deprecated + * * @link http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm * * @param string $identifier @@ -63,12 +65,20 @@ public function getSubstringExpression($string, $start, $length = null) } /** + * @deprecated Generate dates within the application. + * * @param string $type * * @return string */ public function getNowExpression($type = 'timestamp') { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4753', + 'OraclePlatform::getNowExpression() is deprecated. Generate dates within the application.' + ); + switch ($type) { case 'date': case 'time': @@ -167,6 +177,19 @@ public function getBitOrComparisonExpression($value1, $value2) . '+' . $value2 . ')'; } + /** + * {@inheritDoc} + */ + public function getCreatePrimaryKeySQL(Index $index, $table): string + { + if ($table instanceof Table) { + $table = $table->getQuotedName($this); + } + + return 'ALTER TABLE ' . $table . ' ADD CONSTRAINT ' . $index->getQuotedName($this) + . ' PRIMARY KEY (' . $this->getIndexFieldDeclarationListSQL($index) . ')'; + } + /** * {@inheritDoc} * @@ -195,10 +218,8 @@ public function getAlterSequenceSQL(Sequence $sequence) /** * Cache definition for sequences - * - * @return string */ - private function getSequenceCacheSQL(Sequence $sequence) + private function getSequenceCacheSQL(Sequence $sequence): string { if ($sequence->getCache() === 0) { return ' NOCACHE'; @@ -401,10 +422,8 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] $sql = array_merge($sql, $this->getCreateAutoincrementSql($columnName, $name)); } - if (isset($indexes) && ! empty($indexes)) { - foreach ($indexes as $index) { - $sql[] = $this->getCreateIndexSQL($index, $name); - } + foreach ($indexes as $index) { + $sql[] = $this->getCreateIndexSQL($index, $name); } return $sql; @@ -443,6 +462,7 @@ public function getListTableIndexesSQL($table, $database = null) SELECT ucon.constraint_type FROM user_constraints ucon WHERE ucon.index_name = uind_col.index_name + AND ucon.table_name = uind_col.table_name ) AS is_primary FROM user_ind_columns uind_col WHERE uind_col.table_name = " . $table . ' @@ -466,22 +486,8 @@ public function getListViewsSQL($database) } /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** + * @internal The method should be only used from within the OraclePlatform class hierarchy. + * * @param string $name * @param string $table * @param int $start @@ -549,6 +555,8 @@ public function getCreateAutoincrementSql($name, $table, $start = 1) } /** + * @internal The method should be only used from within the OracleSchemaManager class hierarchy. + * * Returns the SQL statements to drop the autoincrement for the given table name. * * @param string $table The table name to drop the autoincrement for. @@ -578,10 +586,8 @@ public function getDropAutoincrementSql($table) * to reflect Oracle's internal auto uppercasing strategy of unquoted identifiers. * * @param string $name The identifier to normalize. - * - * @return Identifier The normalized identifier. */ - private function normalizeIdentifier($name) + private function normalizeIdentifier($name): Identifier { $identifier = new Identifier($name); @@ -609,12 +615,8 @@ private function addSuffix(string $identifier, string $suffix): string * * Quotes the autoincrement primary key identifier name * if the given table name is quoted by intention. - * - * @param Identifier $table The table identifier to return the autoincrement primary key identifier name for. - * - * @return string */ - private function getAutoincrementIdentifierName(Identifier $table) + private function getAutoincrementIdentifierName(Identifier $table): string { $identifierName = $this->addSuffix($table->getName(), '_AI_PK'); @@ -710,18 +712,6 @@ public function getListTableColumnsSQL($table, $database = null) ); } - /** - * {@inheritDoc} - */ - public function getDropSequenceSQL($sequence) - { - if ($sequence instanceof Sequence) { - $sequence = $sequence->getQuotedName($this); - } - - return 'DROP SEQUENCE ' . $sequence; - } - /** * {@inheritDoc} */ @@ -783,6 +773,14 @@ public function getForeignKeyReferentialActionSQL($action) } } + /** + * {@inheritDoc} + */ + public function getCreateDatabaseSQL($name) + { + return 'CREATE USER ' . $name; + } + /** * {@inheritDoc} */ @@ -1008,6 +1006,12 @@ public function supportsCommentOnStatement() */ public function getName() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4749', + 'OraclePlatform::getName() is deprecated. Identify platforms by their class.' + ); + return 'oracle'; } @@ -1164,7 +1168,7 @@ public function releaseSavePoint($savepoint) /** * {@inheritDoc} * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass() { diff --git a/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php b/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php index c9ca509d0..a9419817a 100644 --- a/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php +++ b/doctrine/dbal/src/Platforms/PostgreSQL100Platform.php @@ -9,11 +9,14 @@ /** * Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform. + * + * @deprecated This class will be merged with {@see PostgreSQLPlatform} in 4.0 because support for Postgres + * releases prior to 10.0 will be dropped. */ class PostgreSQL100Platform extends PostgreSQL94Platform { /** - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass(): string { diff --git a/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php b/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php index bf21477c6..2c974c36d 100644 --- a/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php +++ b/doctrine/dbal/src/Platforms/PostgreSQL94Platform.php @@ -2,1306 +2,11 @@ namespace Doctrine\DBAL\Platforms; -use Doctrine\DBAL\Schema\Column; -use Doctrine\DBAL\Schema\ColumnDiff; -use Doctrine\DBAL\Schema\ForeignKeyConstraint; -use Doctrine\DBAL\Schema\Identifier; -use Doctrine\DBAL\Schema\Index; -use Doctrine\DBAL\Schema\Sequence; -use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\DBAL\Types\BigIntType; -use Doctrine\DBAL\Types\BinaryType; -use Doctrine\DBAL\Types\BlobType; -use Doctrine\DBAL\Types\IntegerType; -use Doctrine\DBAL\Types\Type; -use Doctrine\Deprecations\Deprecation; -use UnexpectedValueException; - -use function array_diff; -use function array_merge; -use function array_unique; -use function array_values; -use function count; -use function explode; -use function implode; -use function in_array; -use function is_array; -use function is_bool; -use function is_numeric; -use function is_string; -use function sprintf; -use function strpos; -use function strtolower; -use function trim; - /** * Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform. + * + * @deprecated Use {@see PostgreSQLPlatform} instead. */ -class PostgreSQL94Platform extends AbstractPlatform +class PostgreSQL94Platform extends PostgreSQLPlatform { - /** @var bool */ - private $useBooleanTrueFalseStrings = true; - - /** @var string[][] PostgreSQL booleans literals */ - private $booleanLiterals = [ - 'true' => [ - 't', - 'true', - 'y', - 'yes', - 'on', - '1', - ], - 'false' => [ - 'f', - 'false', - 'n', - 'no', - 'off', - '0', - ], - ]; - - /** - * PostgreSQL has different behavior with some drivers - * with regard to how booleans have to be handled. - * - * Enables use of 'true'/'false' or otherwise 1 and 0 instead. - * - * @param bool $flag - * - * @return void - */ - public function setUseBooleanTrueFalseStrings($flag) - { - $this->useBooleanTrueFalseStrings = (bool) $flag; - } - - /** - * {@inheritDoc} - */ - public function getSubstringExpression($string, $start, $length = null) - { - if ($length === null) { - return 'SUBSTRING(' . $string . ' FROM ' . $start . ')'; - } - - return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')'; - } - - /** - * {@inheritDoc} - */ - public function getNowExpression() - { - return 'LOCALTIMESTAMP(0)'; - } - - /** - * {@inheritDoc} - */ - public function getRegexpExpression() - { - return 'SIMILAR TO'; - } - - /** - * {@inheritDoc} - */ - public function getLocateExpression($str, $substr, $startPos = false) - { - if ($startPos !== false) { - $str = $this->getSubstringExpression($str, $startPos); - - return 'CASE WHEN (POSITION(' . $substr . ' IN ' . $str . ') = 0) THEN 0' - . ' ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . ($startPos - 1) . ') END'; - } - - return 'POSITION(' . $substr . ' IN ' . $str . ')'; - } - - /** - * {@inheritdoc} - */ - protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) - { - if ($unit === DateIntervalUnit::QUARTER) { - $interval *= 3; - $unit = DateIntervalUnit::MONTH; - } - - return '(' . $date . ' ' . $operator . ' (' . $interval . " || ' " . $unit . "')::interval)"; - } - - /** - * {@inheritDoc} - */ - public function getDateDiffExpression($date1, $date2) - { - return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))'; - } - - public function getCurrentDatabaseExpression(): string - { - return 'CURRENT_DATABASE()'; - } - - /** - * {@inheritDoc} - */ - public function supportsSequences() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsSchemas() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getDefaultSchemaName() - { - return 'public'; - } - - /** - * {@inheritDoc} - */ - public function supportsIdentityColumns() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function supportsPartialIndexes() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function usesSequenceEmulatedIdentityColumns() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getIdentitySequenceName($tableName, $columnName) - { - return $tableName . '_' . $columnName . '_seq'; - } - - /** - * {@inheritDoc} - */ - public function supportsCommentOnStatement() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function hasNativeGuidType() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getListDatabasesSQL() - { - return 'SELECT datname FROM pg_database'; - } - - /** - * {@inheritDoc} - * - * @deprecated Use {@link PostgreSQLSchemaManager::listSchemaNames()} instead. - */ - public function getListNamespacesSQL() - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4503', - 'PostgreSQL94Platform::getListNamespacesSQL() is deprecated,' - . ' use PostgreSQLSchemaManager::listSchemaNames() instead.' - ); - - return "SELECT schema_name AS nspname - FROM information_schema.schemata - WHERE schema_name NOT LIKE 'pg\_%' - AND schema_name != 'information_schema'"; - } - - /** - * {@inheritDoc} - */ - public function getListSequencesSQL($database) - { - return "SELECT sequence_name AS relname, - sequence_schema AS schemaname - FROM information_schema.sequences - WHERE sequence_schema NOT LIKE 'pg\_%' - AND sequence_schema != 'information_schema'"; - } - - /** - * {@inheritDoc} - */ - public function getListTablesSQL() - { - return "SELECT quote_ident(table_name) AS table_name, - table_schema AS schema_name - FROM information_schema.tables - WHERE table_schema NOT LIKE 'pg\_%' - AND table_schema != 'information_schema' - AND table_name != 'geometry_columns' - AND table_name != 'spatial_ref_sys' - AND table_type != 'VIEW'"; - } - - /** - * {@inheritDoc} - */ - public function getListViewsSQL($database) - { - return 'SELECT quote_ident(table_name) AS viewname, - table_schema AS schemaname, - view_definition AS definition - FROM information_schema.views - WHERE view_definition IS NOT NULL'; - } - - /** - * @param string $table - * @param string|null $database - * - * @return string - */ - public function getListTableForeignKeysSQL($table, $database = null) - { - return 'SELECT quote_ident(r.conname) as conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef - FROM pg_catalog.pg_constraint r - WHERE r.conrelid = - ( - SELECT c.oid - FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n - WHERE ' . $this->getTableWhereClause($table) . " AND n.oid = c.relnamespace - ) - AND r.contype = 'f'"; - } - - /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getListTableConstraintsSQL($table) - { - $table = new Identifier($table); - $table = $this->quoteStringLiteral($table->getName()); - - return sprintf( - <<<'SQL' -SELECT - quote_ident(relname) as relname -FROM - pg_class -WHERE oid IN ( - SELECT indexrelid - FROM pg_index, pg_class - WHERE pg_class.relname = %s - AND pg_class.oid = pg_index.indrelid - AND (indisunique = 't' OR indisprimary = 't') - ) -SQL - , - $table - ); - } - - /** - * {@inheritDoc} - * - * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html - */ - public function getListTableIndexesSQL($table, $database = null) - { - return 'SELECT quote_ident(relname) as relname, pg_index.indisunique, pg_index.indisprimary, - pg_index.indkey, pg_index.indrelid, - pg_get_expr(indpred, indrelid) AS where - FROM pg_class, pg_index - WHERE oid IN ( - SELECT indexrelid - FROM pg_index si, pg_class sc, pg_namespace sn - WHERE ' . $this->getTableWhereClause($table, 'sc', 'sn') . ' - AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid - ) AND pg_index.indexrelid = oid'; - } - - /** - * @param string $table - * @param string $classAlias - * @param string $namespaceAlias - * - * @return string - */ - private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n') - { - $whereClause = $namespaceAlias . ".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND "; - if (strpos($table, '.') !== false) { - [$schema, $table] = explode('.', $table); - $schema = $this->quoteStringLiteral($schema); - } else { - $schema = 'ANY(current_schemas(false))'; - } - - $table = new Identifier($table); - $table = $this->quoteStringLiteral($table->getName()); - - return $whereClause . sprintf( - '%s.relname = %s AND %s.nspname = %s', - $classAlias, - $table, - $namespaceAlias, - $schema - ); - } - - /** - * {@inheritDoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - return "SELECT - a.attnum, - quote_ident(a.attname) AS field, - t.typname AS type, - format_type(a.atttypid, a.atttypmod) AS complete_type, - (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation, - (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type, - (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM - pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type, - a.attnotnull AS isnotnull, - (SELECT 't' - FROM pg_index - WHERE c.oid = pg_index.indrelid - AND pg_index.indkey[0] = a.attnum - AND pg_index.indisprimary = 't' - ) AS pri, - (SELECT pg_get_expr(adbin, adrelid) - FROM pg_attrdef - WHERE c.oid = pg_attrdef.adrelid - AND pg_attrdef.adnum=a.attnum - ) AS default, - (SELECT pg_description.description - FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid - ) AS comment - FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n - WHERE " . $this->getTableWhereClause($table, 'c', 'n') . ' - AND a.attnum > 0 - AND a.attrelid = c.oid - AND a.atttypid = t.oid - AND n.oid = c.relnamespace - ORDER BY a.attnum'; - } - - /** - * {@inheritDoc} - */ - public function getCreateDatabaseSQL($name) - { - return 'CREATE DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) - { - $query = ''; - - if ($foreignKey->hasOption('match')) { - $query .= ' MATCH ' . $foreignKey->getOption('match'); - } - - $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); - - if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) { - $query .= ' DEFERRABLE'; - } else { - $query .= ' NOT DEFERRABLE'; - } - - if ( - ($foreignKey->hasOption('feferred') && $foreignKey->getOption('feferred') !== false) - || ($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false) - ) { - $query .= ' INITIALLY DEFERRED'; - } else { - $query .= ' INITIALLY IMMEDIATE'; - } - - return $query; - } - - /** - * {@inheritDoc} - */ - public function getAlterTableSQL(TableDiff $diff) - { - $sql = []; - $commentsSQL = []; - $columnSql = []; - - foreach ($diff->addedColumns as $column) { - if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { - continue; - } - - $query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - - $comment = $this->getColumnComment($column); - - if ($comment === null || $comment === '') { - continue; - } - - $commentsSQL[] = $this->getCommentOnColumnSQL( - $diff->getName($this)->getQuotedName($this), - $column->getQuotedName($this), - $comment - ); - } - - foreach ($diff->removedColumns as $column) { - if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { - continue; - } - - $query = 'DROP ' . $column->getQuotedName($this); - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - foreach ($diff->changedColumns as $columnDiff) { - if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { - continue; - } - - if ($this->isUnchangedBinaryColumn($columnDiff)) { - continue; - } - - $oldColumnName = $columnDiff->getOldColumnName()->getQuotedName($this); - $column = $columnDiff->column; - - if ( - $columnDiff->hasChanged('type') - || $columnDiff->hasChanged('precision') - || $columnDiff->hasChanged('scale') - || $columnDiff->hasChanged('fixed') - ) { - $type = $column->getType(); - - // SERIAL/BIGSERIAL are not "real" types and we can't alter a column to that type - $columnDefinition = $column->toArray(); - $columnDefinition['autoincrement'] = false; - - // here was a server version check before, but DBAL API does not support this anymore. - $query = 'ALTER ' . $oldColumnName . ' TYPE ' . $type->getSQLDeclaration($columnDefinition, $this); - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - if ($columnDiff->hasChanged('default') || $this->typeChangeBreaksDefaultValue($columnDiff)) { - $defaultClause = $column->getDefault() === null - ? ' DROP DEFAULT' - : ' SET' . $this->getDefaultValueDeclarationSQL($column->toArray()); - $query = 'ALTER ' . $oldColumnName . $defaultClause; - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - if ($columnDiff->hasChanged('notnull')) { - $query = 'ALTER ' . $oldColumnName . ' ' . ($column->getNotnull() ? 'SET' : 'DROP') . ' NOT NULL'; - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - if ($columnDiff->hasChanged('autoincrement')) { - if ($column->getAutoincrement()) { - // add autoincrement - $seqName = $this->getIdentitySequenceName($diff->name, $oldColumnName); - - $sql[] = 'CREATE SEQUENCE ' . $seqName; - $sql[] = "SELECT setval('" . $seqName . "', (SELECT MAX(" . $oldColumnName . ') FROM ' - . $diff->getName($this)->getQuotedName($this) . '))'; - $query = 'ALTER ' . $oldColumnName . " SET DEFAULT nextval('" . $seqName . "')"; - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } else { - // Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have - $query = 'ALTER ' . $oldColumnName . ' DROP DEFAULT'; - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - } - - $newComment = $this->getColumnComment($column); - $oldComment = $this->getOldColumnComment($columnDiff); - - if ( - $columnDiff->hasChanged('comment') - || ($columnDiff->fromColumn !== null && $oldComment !== $newComment) - ) { - $commentsSQL[] = $this->getCommentOnColumnSQL( - $diff->getName($this)->getQuotedName($this), - $column->getQuotedName($this), - $newComment - ); - } - - if (! $columnDiff->hasChanged('length')) { - continue; - } - - $query = 'ALTER ' . $oldColumnName . ' TYPE ' - . $column->getType()->getSQLDeclaration($column->toArray(), $this); - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - foreach ($diff->renamedColumns as $oldColumnName => $column) { - if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { - continue; - } - - $oldColumnName = new Identifier($oldColumnName); - - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . - ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this); - } - - $tableSql = []; - - if (! $this->onSchemaAlterTable($diff, $tableSql)) { - $sql = array_merge($sql, $commentsSQL); - - $newName = $diff->getNewName(); - - if ($newName !== false) { - $sql[] = sprintf( - 'ALTER TABLE %s RENAME TO %s', - $diff->getName($this)->getQuotedName($this), - $newName->getQuotedName($this) - ); - } - - $sql = array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - } - - return array_merge($sql, $tableSql, $columnSql); - } - - /** - * Checks whether a given column diff is a logically unchanged binary type column. - * - * Used to determine whether a column alteration for a binary type column can be skipped. - * Doctrine's {@link BinaryType} and {@link BlobType} are mapped to the same database column type on this platform - * as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator - * might detect differences for binary type columns which do not have to be propagated - * to database as there actually is no difference at database level. - * - * @param ColumnDiff $columnDiff The column diff to check against. - * - * @return bool True if the given column diff is an unchanged binary type column, false otherwise. - */ - private function isUnchangedBinaryColumn(ColumnDiff $columnDiff) - { - $columnType = $columnDiff->column->getType(); - - if (! $columnType instanceof BinaryType && ! $columnType instanceof BlobType) { - return false; - } - - $fromColumn = $columnDiff->fromColumn instanceof Column ? $columnDiff->fromColumn : null; - - if ($fromColumn !== null) { - $fromColumnType = $fromColumn->getType(); - - if (! $fromColumnType instanceof BinaryType && ! $fromColumnType instanceof BlobType) { - return false; - } - - return count(array_diff($columnDiff->changedProperties, ['type', 'length', 'fixed'])) === 0; - } - - if ($columnDiff->hasChanged('type')) { - return false; - } - - return count(array_diff($columnDiff->changedProperties, ['length', 'fixed'])) === 0; - } - - /** - * {@inheritdoc} - */ - protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) - { - if (strpos($tableName, '.') !== false) { - [$schema] = explode('.', $tableName); - $oldIndexName = $schema . '.' . $oldIndexName; - } - - return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)]; - } - - /** - * {@inheritdoc} - */ - public function getCommentOnColumnSQL($tableName, $columnName, $comment) - { - $tableName = new Identifier($tableName); - $columnName = new Identifier($columnName); - $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment); - - return sprintf( - 'COMMENT ON COLUMN %s.%s IS %s', - $tableName->getQuotedName($this), - $columnName->getQuotedName($this), - $comment - ); - } - - /** - * {@inheritDoc} - */ - public function getCreateSequenceSQL(Sequence $sequence) - { - return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize() . - ' MINVALUE ' . $sequence->getInitialValue() . - ' START ' . $sequence->getInitialValue() . - $this->getSequenceCacheSQL($sequence); - } - - /** - * {@inheritDoc} - */ - public function getAlterSequenceSQL(Sequence $sequence) - { - return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize() . - $this->getSequenceCacheSQL($sequence); - } - - /** - * Cache definition for sequences - * - * @return string - */ - private function getSequenceCacheSQL(Sequence $sequence) - { - if ($sequence->getCache() > 1) { - return ' CACHE ' . $sequence->getCache(); - } - - return ''; - } - - /** - * {@inheritDoc} - */ - public function getDropSequenceSQL($sequence) - { - if ($sequence instanceof Sequence) { - $sequence = $sequence->getQuotedName($this); - } - - return 'DROP SEQUENCE ' . $sequence . ' CASCADE'; - } - - /** - * {@inheritDoc} - */ - public function getCreateSchemaSQL($schemaName) - { - return 'CREATE SCHEMA ' . $schemaName; - } - - /** - * {@inheritDoc} - */ - public function getDropForeignKeySQL($foreignKey, $table) - { - return $this->getDropConstraintSQL($foreignKey, $table); - } - - /** - * {@inheritDoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = []) - { - $queryFields = $this->getColumnDeclarationListSQL($columns); - - if (isset($options['primary']) && ! empty($options['primary'])) { - $keyColumns = array_unique(array_values($options['primary'])); - $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; - } - - $query = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')'; - - $sql = [$query]; - - if (isset($options['indexes']) && ! empty($options['indexes'])) { - foreach ($options['indexes'] as $index) { - $sql[] = $this->getCreateIndexSQL($index, $name); - } - } - - if (isset($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $uniqueConstraint) { - $sql[] = $this->getCreateConstraintSQL($uniqueConstraint, $name); - } - } - - if (isset($options['foreignKeys'])) { - foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $name); - } - } - - return $sql; - } - - /** - * Converts a single boolean value. - * - * First converts the value to its native PHP boolean type - * and passes it to the given callback function to be reconverted - * into any custom representation. - * - * @param mixed $value The value to convert. - * @param callable $callback The callback function to use for converting the real boolean value. - * - * @return mixed - * - * @throws UnexpectedValueException - */ - private function convertSingleBooleanValue($value, $callback) - { - if ($value === null) { - return $callback(null); - } - - if (is_bool($value) || is_numeric($value)) { - return $callback((bool) $value); - } - - if (! is_string($value)) { - return $callback(true); - } - - /** - * Better safe than sorry: http://php.net/in_array#106319 - */ - if (in_array(strtolower(trim($value)), $this->booleanLiterals['false'], true)) { - return $callback(false); - } - - if (in_array(strtolower(trim($value)), $this->booleanLiterals['true'], true)) { - return $callback(true); - } - - throw new UnexpectedValueException("Unrecognized boolean literal '${value}'"); - } - - /** - * Converts one or multiple boolean values. - * - * First converts the value(s) to their native PHP boolean type - * and passes them to the given callback function to be reconverted - * into any custom representation. - * - * @param mixed $item The value(s) to convert. - * @param callable $callback The callback function to use for converting the real boolean value(s). - * - * @return mixed - */ - private function doConvertBooleans($item, $callback) - { - if (is_array($item)) { - foreach ($item as $key => $value) { - $item[$key] = $this->convertSingleBooleanValue($value, $callback); - } - - return $item; - } - - return $this->convertSingleBooleanValue($item, $callback); - } - - /** - * {@inheritDoc} - * - * Postgres wants boolean values converted to the strings 'true'/'false'. - */ - public function convertBooleans($item) - { - if (! $this->useBooleanTrueFalseStrings) { - return parent::convertBooleans($item); - } - - return $this->doConvertBooleans( - $item, - /** - * @param mixed $value - */ - static function ($value) { - if ($value === null) { - return 'NULL'; - } - - return $value === true ? 'true' : 'false'; - } - ); - } - - /** - * {@inheritDoc} - */ - public function convertBooleansToDatabaseValue($item) - { - if (! $this->useBooleanTrueFalseStrings) { - return parent::convertBooleansToDatabaseValue($item); - } - - return $this->doConvertBooleans( - $item, - /** - * @param mixed $value - */ - static function ($value): ?int { - return $value === null ? null : (int) $value; - } - ); - } - - /** - * {@inheritDoc} - */ - public function convertFromBoolean($item) - { - if ($item !== null && in_array(strtolower($item), $this->booleanLiterals['false'], true)) { - return false; - } - - return parent::convertFromBoolean($item); - } - - /** - * {@inheritDoc} - */ - public function getSequenceNextValSQL($sequence) - { - return "SELECT NEXTVAL('" . $sequence . "')"; - } - - /** - * {@inheritDoc} - */ - public function getSetTransactionIsolationSQL($level) - { - return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ' - . $this->_getTransactionIsolationLevelSQL($level); - } - - /** - * {@inheritDoc} - */ - public function getBooleanTypeDeclarationSQL(array $column) - { - return 'BOOLEAN'; - } - - /** - * {@inheritDoc} - */ - public function getIntegerTypeDeclarationSQL(array $column) - { - if (! empty($column['autoincrement'])) { - return 'SERIAL'; - } - - return 'INT'; - } - - /** - * {@inheritDoc} - */ - public function getBigIntTypeDeclarationSQL(array $column) - { - if (! empty($column['autoincrement'])) { - return 'BIGSERIAL'; - } - - return 'BIGINT'; - } - - /** - * {@inheritDoc} - */ - public function getSmallIntTypeDeclarationSQL(array $column) - { - if (! empty($column['autoincrement'])) { - return 'SMALLSERIAL'; - } - - return 'SMALLINT'; - } - - /** - * {@inheritDoc} - */ - public function getGuidTypeDeclarationSQL(array $column) - { - return 'UUID'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTypeDeclarationSQL(array $column) - { - return 'TIMESTAMP(0) WITHOUT TIME ZONE'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTzTypeDeclarationSQL(array $column) - { - return 'TIMESTAMP(0) WITH TIME ZONE'; - } - - /** - * {@inheritDoc} - */ - public function getDateTypeDeclarationSQL(array $column) - { - return 'DATE'; - } - - /** - * {@inheritDoc} - */ - public function getTimeTypeDeclarationSQL(array $column) - { - return 'TIME(0) WITHOUT TIME ZONE'; - } - - /** - * {@inheritDoc} - */ - protected function _getCommonIntegerTypeDeclarationSQL(array $column) - { - return ''; - } - - /** - * {@inheritDoc} - */ - protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') - : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); - } - - /** - * {@inheritdoc} - */ - protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) - { - return 'BYTEA'; - } - - /** - * {@inheritDoc} - */ - public function getClobTypeDeclarationSQL(array $column) - { - return 'TEXT'; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'postgresql'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTzFormatString() - { - return 'Y-m-d H:i:sO'; - } - - /** - * {@inheritDoc} - */ - public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) - { - return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)'; - } - - /** - * {@inheritDoc} - */ - public function getTruncateTableSQL($tableName, $cascade = false) - { - $tableIdentifier = new Identifier($tableName); - $sql = 'TRUNCATE ' . $tableIdentifier->getQuotedName($this); - - if ($cascade) { - $sql .= ' CASCADE'; - } - - return $sql; - } - - /** - * {@inheritDoc} - */ - public function getReadLockSQL() - { - return 'FOR SHARE'; - } - - /** - * {@inheritDoc} - */ - protected function initializeDoctrineTypeMappings() - { - $this->doctrineTypeMapping = [ - 'bigint' => 'bigint', - 'bigserial' => 'bigint', - 'bool' => 'boolean', - 'boolean' => 'boolean', - 'bpchar' => 'string', - 'bytea' => 'blob', - 'char' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'decimal' => 'decimal', - 'double' => 'float', - 'double precision' => 'float', - 'float' => 'float', - 'float4' => 'float', - 'float8' => 'float', - 'inet' => 'string', - 'int' => 'integer', - 'int2' => 'smallint', - 'int4' => 'integer', - 'int8' => 'bigint', - 'integer' => 'integer', - 'interval' => 'string', - 'json' => 'json', - 'jsonb' => 'json', - 'money' => 'decimal', - 'numeric' => 'decimal', - 'serial' => 'integer', - 'serial4' => 'integer', - 'serial8' => 'bigint', - 'real' => 'float', - 'smallint' => 'smallint', - 'text' => 'text', - 'time' => 'time', - 'timestamp' => 'datetime', - 'timestamptz' => 'datetimetz', - 'timetz' => 'time', - 'tsvector' => 'text', - 'uuid' => 'guid', - 'varchar' => 'string', - 'year' => 'date', - '_varchar' => 'string', - ]; - } - - /** - * {@inheritDoc} - */ - public function getVarcharMaxLength() - { - return 65535; - } - - /** - * {@inheritdoc} - */ - public function getBinaryMaxLength() - { - return 0; - } - - /** - * {@inheritdoc} - */ - public function getBinaryDefaultLength() - { - return 0; - } - - /** - * {@inheritdoc} - */ - public function hasNativeJsonType() - { - return true; - } - - /** - * {@inheritDoc} - * - * @deprecated Implement {@link createReservedKeywordsList()} instead. - */ - protected function getReservedKeywordsClass() - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4510', - 'PostgreSQL94Platform::getReservedKeywordsClass() is deprecated,' - . ' use PostgreSQL94Platform::createReservedKeywordsList() instead.' - ); - - return Keywords\PostgreSQL94Keywords::class; - } - - /** - * {@inheritDoc} - */ - public function getBlobTypeDeclarationSQL(array $column) - { - return 'BYTEA'; - } - - /** - * {@inheritdoc} - */ - public function getDefaultValueDeclarationSQL($column) - { - if ($this->isSerialColumn($column)) { - return ''; - } - - return parent::getDefaultValueDeclarationSQL($column); - } - - /** - * {@inheritdoc} - */ - public function supportsColumnCollation() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getColumnCollationDeclarationSQL($collation) - { - return 'COLLATE ' . $this->quoteSingleIdentifier($collation); - } - - /** - * {@inheritdoc} - */ - public function getJsonTypeDeclarationSQL(array $column) - { - if (! empty($column['jsonb'])) { - return 'JSONB'; - } - - return 'JSON'; - } - - /** - * @param mixed[] $column - */ - private function isSerialColumn(array $column): bool - { - return isset($column['type'], $column['autoincrement']) - && $column['autoincrement'] === true - && $this->isNumericType($column['type']); - } - - /** - * Check whether the type of a column is changed in a way that invalidates the default value for the column - */ - private function typeChangeBreaksDefaultValue(ColumnDiff $columnDiff): bool - { - if ($columnDiff->fromColumn === null) { - return $columnDiff->hasChanged('type'); - } - - $oldTypeIsNumeric = $this->isNumericType($columnDiff->fromColumn->getType()); - $newTypeIsNumeric = $this->isNumericType($columnDiff->column->getType()); - - // default should not be changed when switching between numeric types and the default comes from a sequence - return $columnDiff->hasChanged('type') - && ! ($oldTypeIsNumeric && $newTypeIsNumeric && $columnDiff->column->getAutoincrement()); - } - - private function isNumericType(Type $type): bool - { - return $type instanceof IntegerType || $type instanceof BigIntType; - } - - private function getOldColumnComment(ColumnDiff $columnDiff): ?string - { - return $columnDiff->fromColumn !== null ? $this->getColumnComment($columnDiff->fromColumn) : null; - } - - public function getListTableMetadataSQL(string $table, ?string $schema = null): string - { - if ($schema !== null) { - $table = $schema . '.' . $table; - } - - return sprintf( - <<<'SQL' -SELECT obj_description(%s::regclass) AS table_comment; -SQL - , - $this->quoteStringLiteral($table) - ); - } } diff --git a/doctrine/dbal/src/Platforms/PostgreSQLPlatform.php b/doctrine/dbal/src/Platforms/PostgreSQLPlatform.php new file mode 100644 index 000000000..477e08af9 --- /dev/null +++ b/doctrine/dbal/src/Platforms/PostgreSQLPlatform.php @@ -0,0 +1,1276 @@ + [ + 't', + 'true', + 'y', + 'yes', + 'on', + '1', + ], + 'false' => [ + 'f', + 'false', + 'n', + 'no', + 'off', + '0', + ], + ]; + + /** + * PostgreSQL has different behavior with some drivers + * with regard to how booleans have to be handled. + * + * Enables use of 'true'/'false' or otherwise 1 and 0 instead. + * + * @param bool $flag + * + * @return void + */ + public function setUseBooleanTrueFalseStrings($flag) + { + $this->useBooleanTrueFalseStrings = (bool) $flag; + } + + /** + * {@inheritDoc} + */ + public function getSubstringExpression($string, $start, $length = null) + { + if ($length === null) { + return 'SUBSTRING(' . $string . ' FROM ' . $start . ')'; + } + + return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')'; + } + + /** + * {@inheritDoc} + * + * @deprecated Generate dates within the application. + */ + public function getNowExpression() + { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4753', + 'PostgreSQLPlatform::getNowExpression() is deprecated. Generate dates within the application.' + ); + + return 'LOCALTIMESTAMP(0)'; + } + + /** + * {@inheritDoc} + */ + public function getRegexpExpression() + { + return 'SIMILAR TO'; + } + + /** + * {@inheritDoc} + */ + public function getLocateExpression($str, $substr, $startPos = false) + { + if ($startPos !== false) { + $str = $this->getSubstringExpression($str, $startPos); + + return 'CASE WHEN (POSITION(' . $substr . ' IN ' . $str . ') = 0) THEN 0' + . ' ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . $startPos . ' - 1) END'; + } + + return 'POSITION(' . $substr . ' IN ' . $str . ')'; + } + + /** + * {@inheritdoc} + */ + protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) + { + if ($unit === DateIntervalUnit::QUARTER) { + $interval *= 3; + $unit = DateIntervalUnit::MONTH; + } + + return '(' . $date . ' ' . $operator . ' (' . $interval . " || ' " . $unit . "')::interval)"; + } + + /** + * {@inheritDoc} + */ + public function getDateDiffExpression($date1, $date2) + { + return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))'; + } + + public function getCurrentDatabaseExpression(): string + { + return 'CURRENT_DATABASE()'; + } + + /** + * {@inheritDoc} + */ + public function supportsSequences() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function supportsSchemas() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getDefaultSchemaName() + { + return 'public'; + } + + /** + * {@inheritDoc} + */ + public function supportsIdentityColumns() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function supportsPartialIndexes() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function usesSequenceEmulatedIdentityColumns() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getIdentitySequenceName($tableName, $columnName) + { + return $tableName . '_' . $columnName . '_seq'; + } + + /** + * {@inheritDoc} + */ + public function supportsCommentOnStatement() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function hasNativeGuidType() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function getListDatabasesSQL() + { + return 'SELECT datname FROM pg_database'; + } + + /** + * {@inheritDoc} + * + * @deprecated Use {@see PostgreSQLSchemaManager::listSchemaNames()} instead. + */ + public function getListNamespacesSQL() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4503', + 'PostgreSQLPlatform::getListNamespacesSQL() is deprecated,' + . ' use PostgreSQLSchemaManager::listSchemaNames() instead.' + ); + + return "SELECT schema_name AS nspname + FROM information_schema.schemata + WHERE schema_name NOT LIKE 'pg\_%' + AND schema_name != 'information_schema'"; + } + + /** + * {@inheritDoc} + */ + public function getListSequencesSQL($database) + { + return "SELECT sequence_name AS relname, + sequence_schema AS schemaname + FROM information_schema.sequences + WHERE sequence_schema NOT LIKE 'pg\_%' + AND sequence_schema != 'information_schema'"; + } + + /** + * {@inheritDoc} + */ + public function getListTablesSQL() + { + return "SELECT quote_ident(table_name) AS table_name, + table_schema AS schema_name + FROM information_schema.tables + WHERE table_schema NOT LIKE 'pg\_%' + AND table_schema != 'information_schema' + AND table_name != 'geometry_columns' + AND table_name != 'spatial_ref_sys' + AND table_type != 'VIEW'"; + } + + /** + * {@inheritDoc} + */ + public function getListViewsSQL($database) + { + return 'SELECT quote_ident(table_name) AS viewname, + table_schema AS schemaname, + view_definition AS definition + FROM information_schema.views + WHERE view_definition IS NOT NULL'; + } + + /** + * @param string $table + * @param string|null $database + * + * @return string + */ + public function getListTableForeignKeysSQL($table, $database = null) + { + return 'SELECT quote_ident(r.conname) as conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef + FROM pg_catalog.pg_constraint r + WHERE r.conrelid = + ( + SELECT c.oid + FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n + WHERE ' . $this->getTableWhereClause($table) . " AND n.oid = c.relnamespace + ) + AND r.contype = 'f'"; + } + + /** + * {@inheritDoc} + */ + public function getListTableConstraintsSQL($table) + { + $table = new Identifier($table); + $table = $this->quoteStringLiteral($table->getName()); + + return sprintf( + <<<'SQL' +SELECT + quote_ident(relname) as relname +FROM + pg_class +WHERE oid IN ( + SELECT indexrelid + FROM pg_index, pg_class + WHERE pg_class.relname = %s + AND pg_class.oid = pg_index.indrelid + AND (indisunique = 't' OR indisprimary = 't') + ) +SQL + , + $table + ); + } + + /** + * {@inheritDoc} + * + * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html + */ + public function getListTableIndexesSQL($table, $database = null) + { + return 'SELECT quote_ident(relname) as relname, pg_index.indisunique, pg_index.indisprimary, + pg_index.indkey, pg_index.indrelid, + pg_get_expr(indpred, indrelid) AS where + FROM pg_class, pg_index + WHERE oid IN ( + SELECT indexrelid + FROM pg_index si, pg_class sc, pg_namespace sn + WHERE ' . $this->getTableWhereClause($table, 'sc', 'sn') . ' + AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid + ) AND pg_index.indexrelid = oid'; + } + + /** + * @param string $table + * @param string $classAlias + * @param string $namespaceAlias + */ + private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n'): string + { + $whereClause = $namespaceAlias . ".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND "; + if (strpos($table, '.') !== false) { + [$schema, $table] = explode('.', $table); + $schema = $this->quoteStringLiteral($schema); + } else { + $schema = 'ANY(current_schemas(false))'; + } + + $table = new Identifier($table); + $table = $this->quoteStringLiteral($table->getName()); + + return $whereClause . sprintf( + '%s.relname = %s AND %s.nspname = %s', + $classAlias, + $table, + $namespaceAlias, + $schema + ); + } + + /** + * {@inheritDoc} + */ + public function getListTableColumnsSQL($table, $database = null) + { + return "SELECT + a.attnum, + quote_ident(a.attname) AS field, + t.typname AS type, + format_type(a.atttypid, a.atttypmod) AS complete_type, + (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation, + (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type, + (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM + pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type, + a.attnotnull AS isnotnull, + (SELECT 't' + FROM pg_index + WHERE c.oid = pg_index.indrelid + AND pg_index.indkey[0] = a.attnum + AND pg_index.indisprimary = 't' + ) AS pri, + (SELECT pg_get_expr(adbin, adrelid) + FROM pg_attrdef + WHERE c.oid = pg_attrdef.adrelid + AND pg_attrdef.adnum=a.attnum + ) AS default, + (SELECT pg_description.description + FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid + ) AS comment + FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n + WHERE " . $this->getTableWhereClause($table, 'c', 'n') . ' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + AND n.oid = c.relnamespace + ORDER BY a.attnum'; + } + + /** + * {@inheritDoc} + */ + public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) + { + $query = ''; + + if ($foreignKey->hasOption('match')) { + $query .= ' MATCH ' . $foreignKey->getOption('match'); + } + + $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); + + if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) { + $query .= ' DEFERRABLE'; + } else { + $query .= ' NOT DEFERRABLE'; + } + + if ( + ($foreignKey->hasOption('feferred') && $foreignKey->getOption('feferred') !== false) + || ($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false) + ) { + $query .= ' INITIALLY DEFERRED'; + } else { + $query .= ' INITIALLY IMMEDIATE'; + } + + return $query; + } + + /** + * {@inheritDoc} + */ + public function getAlterTableSQL(TableDiff $diff) + { + $sql = []; + $commentsSQL = []; + $columnSql = []; + + foreach ($diff->addedColumns as $column) { + if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { + continue; + } + + $query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + + $comment = $this->getColumnComment($column); + + if ($comment === null || $comment === '') { + continue; + } + + $commentsSQL[] = $this->getCommentOnColumnSQL( + $diff->getName($this)->getQuotedName($this), + $column->getQuotedName($this), + $comment + ); + } + + foreach ($diff->removedColumns as $column) { + if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { + continue; + } + + $query = 'DROP ' . $column->getQuotedName($this); + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + foreach ($diff->changedColumns as $columnDiff) { + if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { + continue; + } + + if ($this->isUnchangedBinaryColumn($columnDiff)) { + continue; + } + + $oldColumnName = $columnDiff->getOldColumnName()->getQuotedName($this); + $column = $columnDiff->column; + + if ( + $columnDiff->hasChanged('type') + || $columnDiff->hasChanged('precision') + || $columnDiff->hasChanged('scale') + || $columnDiff->hasChanged('fixed') + ) { + $type = $column->getType(); + + // SERIAL/BIGSERIAL are not "real" types and we can't alter a column to that type + $columnDefinition = $column->toArray(); + $columnDefinition['autoincrement'] = false; + + // here was a server version check before, but DBAL API does not support this anymore. + $query = 'ALTER ' . $oldColumnName . ' TYPE ' . $type->getSQLDeclaration($columnDefinition, $this); + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + if ($columnDiff->hasChanged('default') || $this->typeChangeBreaksDefaultValue($columnDiff)) { + $defaultClause = $column->getDefault() === null + ? ' DROP DEFAULT' + : ' SET' . $this->getDefaultValueDeclarationSQL($column->toArray()); + $query = 'ALTER ' . $oldColumnName . $defaultClause; + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + if ($columnDiff->hasChanged('notnull')) { + $query = 'ALTER ' . $oldColumnName . ' ' . ($column->getNotnull() ? 'SET' : 'DROP') . ' NOT NULL'; + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + if ($columnDiff->hasChanged('autoincrement')) { + if ($column->getAutoincrement()) { + // add autoincrement + $seqName = $this->getIdentitySequenceName($diff->name, $oldColumnName); + + $sql[] = 'CREATE SEQUENCE ' . $seqName; + $sql[] = "SELECT setval('" . $seqName . "', (SELECT MAX(" . $oldColumnName . ') FROM ' + . $diff->getName($this)->getQuotedName($this) . '))'; + $query = 'ALTER ' . $oldColumnName . " SET DEFAULT nextval('" . $seqName . "')"; + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } else { + // Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have + $query = 'ALTER ' . $oldColumnName . ' DROP DEFAULT'; + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + } + + $newComment = $this->getColumnComment($column); + $oldComment = $this->getOldColumnComment($columnDiff); + + if ( + $columnDiff->hasChanged('comment') + || ($columnDiff->fromColumn !== null && $oldComment !== $newComment) + ) { + $commentsSQL[] = $this->getCommentOnColumnSQL( + $diff->getName($this)->getQuotedName($this), + $column->getQuotedName($this), + $newComment + ); + } + + if (! $columnDiff->hasChanged('length')) { + continue; + } + + $query = 'ALTER ' . $oldColumnName . ' TYPE ' + . $column->getType()->getSQLDeclaration($column->toArray(), $this); + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + foreach ($diff->renamedColumns as $oldColumnName => $column) { + if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { + continue; + } + + $oldColumnName = new Identifier($oldColumnName); + + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . + ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this); + } + + $tableSql = []; + + if (! $this->onSchemaAlterTable($diff, $tableSql)) { + $sql = array_merge($sql, $commentsSQL); + + $newName = $diff->getNewName(); + + if ($newName !== false) { + $sql[] = sprintf( + 'ALTER TABLE %s RENAME TO %s', + $diff->getName($this)->getQuotedName($this), + $newName->getQuotedName($this) + ); + } + + $sql = array_merge( + $this->getPreAlterTableIndexForeignKeySQL($diff), + $sql, + $this->getPostAlterTableIndexForeignKeySQL($diff) + ); + } + + return array_merge($sql, $tableSql, $columnSql); + } + + /** + * Checks whether a given column diff is a logically unchanged binary type column. + * + * Used to determine whether a column alteration for a binary type column can be skipped. + * Doctrine's {@see BinaryType} and {@see BlobType} are mapped to the same database column type on this platform + * as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator + * might detect differences for binary type columns which do not have to be propagated + * to database as there actually is no difference at database level. + */ + private function isUnchangedBinaryColumn(ColumnDiff $columnDiff): bool + { + $columnType = $columnDiff->column->getType(); + + if (! $columnType instanceof BinaryType && ! $columnType instanceof BlobType) { + return false; + } + + $fromColumn = $columnDiff->fromColumn instanceof Column ? $columnDiff->fromColumn : null; + + if ($fromColumn !== null) { + $fromColumnType = $fromColumn->getType(); + + if (! $fromColumnType instanceof BinaryType && ! $fromColumnType instanceof BlobType) { + return false; + } + + return count(array_diff($columnDiff->changedProperties, ['type', 'length', 'fixed'])) === 0; + } + + if ($columnDiff->hasChanged('type')) { + return false; + } + + return count(array_diff($columnDiff->changedProperties, ['length', 'fixed'])) === 0; + } + + /** + * {@inheritdoc} + */ + protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) + { + if (strpos($tableName, '.') !== false) { + [$schema] = explode('.', $tableName); + $oldIndexName = $schema . '.' . $oldIndexName; + } + + return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)]; + } + + /** + * {@inheritdoc} + */ + public function getCommentOnColumnSQL($tableName, $columnName, $comment) + { + $tableName = new Identifier($tableName); + $columnName = new Identifier($columnName); + $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment); + + return sprintf( + 'COMMENT ON COLUMN %s.%s IS %s', + $tableName->getQuotedName($this), + $columnName->getQuotedName($this), + $comment + ); + } + + /** + * {@inheritDoc} + */ + public function getCreateSequenceSQL(Sequence $sequence) + { + return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . + ' INCREMENT BY ' . $sequence->getAllocationSize() . + ' MINVALUE ' . $sequence->getInitialValue() . + ' START ' . $sequence->getInitialValue() . + $this->getSequenceCacheSQL($sequence); + } + + /** + * {@inheritDoc} + */ + public function getAlterSequenceSQL(Sequence $sequence) + { + return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . + ' INCREMENT BY ' . $sequence->getAllocationSize() . + $this->getSequenceCacheSQL($sequence); + } + + /** + * Cache definition for sequences + */ + private function getSequenceCacheSQL(Sequence $sequence): string + { + if ($sequence->getCache() > 1) { + return ' CACHE ' . $sequence->getCache(); + } + + return ''; + } + + /** + * {@inheritDoc} + */ + public function getDropSequenceSQL($sequence) + { + return parent::getDropSequenceSQL($sequence) . ' CASCADE'; + } + + /** + * {@inheritDoc} + */ + public function getDropForeignKeySQL($foreignKey, $table) + { + return $this->getDropConstraintSQL($foreignKey, $table); + } + + /** + * {@inheritDoc} + */ + protected function _getCreateTableSQL($name, array $columns, array $options = []) + { + $queryFields = $this->getColumnDeclarationListSQL($columns); + + if (isset($options['primary']) && ! empty($options['primary'])) { + $keyColumns = array_unique(array_values($options['primary'])); + $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; + } + + $query = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')'; + + $sql = [$query]; + + if (isset($options['indexes']) && ! empty($options['indexes'])) { + foreach ($options['indexes'] as $index) { + $sql[] = $this->getCreateIndexSQL($index, $name); + } + } + + if (isset($options['uniqueConstraints'])) { + foreach ($options['uniqueConstraints'] as $uniqueConstraint) { + $sql[] = $this->getCreateConstraintSQL($uniqueConstraint, $name); + } + } + + if (isset($options['foreignKeys'])) { + foreach ((array) $options['foreignKeys'] as $definition) { + $sql[] = $this->getCreateForeignKeySQL($definition, $name); + } + } + + return $sql; + } + + /** + * Converts a single boolean value. + * + * First converts the value to its native PHP boolean type + * and passes it to the given callback function to be reconverted + * into any custom representation. + * + * @param mixed $value The value to convert. + * @param callable $callback The callback function to use for converting the real boolean value. + * + * @return mixed + * + * @throws UnexpectedValueException + */ + private function convertSingleBooleanValue($value, $callback) + { + if ($value === null) { + return $callback(null); + } + + if (is_bool($value) || is_numeric($value)) { + return $callback((bool) $value); + } + + if (! is_string($value)) { + return $callback(true); + } + + /** + * Better safe than sorry: http://php.net/in_array#106319 + */ + if (in_array(strtolower(trim($value)), $this->booleanLiterals['false'], true)) { + return $callback(false); + } + + if (in_array(strtolower(trim($value)), $this->booleanLiterals['true'], true)) { + return $callback(true); + } + + throw new UnexpectedValueException(sprintf("Unrecognized boolean literal '%s'", $value)); + } + + /** + * Converts one or multiple boolean values. + * + * First converts the value(s) to their native PHP boolean type + * and passes them to the given callback function to be reconverted + * into any custom representation. + * + * @param mixed $item The value(s) to convert. + * @param callable $callback The callback function to use for converting the real boolean value(s). + * + * @return mixed + */ + private function doConvertBooleans($item, $callback) + { + if (is_array($item)) { + foreach ($item as $key => $value) { + $item[$key] = $this->convertSingleBooleanValue($value, $callback); + } + + return $item; + } + + return $this->convertSingleBooleanValue($item, $callback); + } + + /** + * {@inheritDoc} + * + * Postgres wants boolean values converted to the strings 'true'/'false'. + */ + public function convertBooleans($item) + { + if (! $this->useBooleanTrueFalseStrings) { + return parent::convertBooleans($item); + } + + return $this->doConvertBooleans( + $item, + /** + * @param mixed $value + */ + static function ($value) { + if ($value === null) { + return 'NULL'; + } + + return $value === true ? 'true' : 'false'; + } + ); + } + + /** + * {@inheritDoc} + */ + public function convertBooleansToDatabaseValue($item) + { + if (! $this->useBooleanTrueFalseStrings) { + return parent::convertBooleansToDatabaseValue($item); + } + + return $this->doConvertBooleans( + $item, + /** + * @param mixed $value + */ + static function ($value): ?int { + return $value === null ? null : (int) $value; + } + ); + } + + /** + * {@inheritDoc} + */ + public function convertFromBoolean($item) + { + if ($item !== null && in_array(strtolower($item), $this->booleanLiterals['false'], true)) { + return false; + } + + return parent::convertFromBoolean($item); + } + + /** + * {@inheritDoc} + */ + public function getSequenceNextValSQL($sequence) + { + return "SELECT NEXTVAL('" . $sequence . "')"; + } + + /** + * {@inheritDoc} + */ + public function getSetTransactionIsolationSQL($level) + { + return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ' + . $this->_getTransactionIsolationLevelSQL($level); + } + + /** + * {@inheritDoc} + */ + public function getBooleanTypeDeclarationSQL(array $column) + { + return 'BOOLEAN'; + } + + /** + * {@inheritDoc} + */ + public function getIntegerTypeDeclarationSQL(array $column) + { + if (! empty($column['autoincrement'])) { + return 'SERIAL'; + } + + return 'INT'; + } + + /** + * {@inheritDoc} + */ + public function getBigIntTypeDeclarationSQL(array $column) + { + if (! empty($column['autoincrement'])) { + return 'BIGSERIAL'; + } + + return 'BIGINT'; + } + + /** + * {@inheritDoc} + */ + public function getSmallIntTypeDeclarationSQL(array $column) + { + if (! empty($column['autoincrement'])) { + return 'SMALLSERIAL'; + } + + return 'SMALLINT'; + } + + /** + * {@inheritDoc} + */ + public function getGuidTypeDeclarationSQL(array $column) + { + return 'UUID'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTypeDeclarationSQL(array $column) + { + return 'TIMESTAMP(0) WITHOUT TIME ZONE'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTzTypeDeclarationSQL(array $column) + { + return 'TIMESTAMP(0) WITH TIME ZONE'; + } + + /** + * {@inheritDoc} + */ + public function getDateTypeDeclarationSQL(array $column) + { + return 'DATE'; + } + + /** + * {@inheritDoc} + */ + public function getTimeTypeDeclarationSQL(array $column) + { + return 'TIME(0) WITHOUT TIME ZONE'; + } + + /** + * {@inheritDoc} + */ + protected function _getCommonIntegerTypeDeclarationSQL(array $column) + { + return ''; + } + + /** + * {@inheritDoc} + */ + protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) + { + return $fixed ? ($length > 0 ? 'CHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); + } + + /** + * {@inheritdoc} + */ + protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) + { + return 'BYTEA'; + } + + /** + * {@inheritDoc} + */ + public function getClobTypeDeclarationSQL(array $column) + { + return 'TEXT'; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4749', + 'PostgreSQLPlatform::getName() is deprecated. Identify platforms by their class.' + ); + + return 'postgresql'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTzFormatString() + { + return 'Y-m-d H:i:sO'; + } + + /** + * {@inheritDoc} + */ + public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) + { + return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)'; + } + + /** + * {@inheritDoc} + */ + public function getTruncateTableSQL($tableName, $cascade = false) + { + $tableIdentifier = new Identifier($tableName); + $sql = 'TRUNCATE ' . $tableIdentifier->getQuotedName($this); + + if ($cascade) { + $sql .= ' CASCADE'; + } + + return $sql; + } + + /** + * {@inheritDoc} + */ + public function getReadLockSQL() + { + return 'FOR SHARE'; + } + + /** + * {@inheritDoc} + */ + protected function initializeDoctrineTypeMappings() + { + $this->doctrineTypeMapping = [ + 'bigint' => 'bigint', + 'bigserial' => 'bigint', + 'bool' => 'boolean', + 'boolean' => 'boolean', + 'bpchar' => 'string', + 'bytea' => 'blob', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'decimal' => 'decimal', + 'double' => 'float', + 'double precision' => 'float', + 'float' => 'float', + 'float4' => 'float', + 'float8' => 'float', + 'inet' => 'string', + 'int' => 'integer', + 'int2' => 'smallint', + 'int4' => 'integer', + 'int8' => 'bigint', + 'integer' => 'integer', + 'interval' => 'string', + 'json' => 'json', + 'jsonb' => 'json', + 'money' => 'decimal', + 'numeric' => 'decimal', + 'serial' => 'integer', + 'serial4' => 'integer', + 'serial8' => 'bigint', + 'real' => 'float', + 'smallint' => 'smallint', + 'text' => 'text', + 'time' => 'time', + 'timestamp' => 'datetime', + 'timestamptz' => 'datetimetz', + 'timetz' => 'time', + 'tsvector' => 'text', + 'uuid' => 'guid', + 'varchar' => 'string', + 'year' => 'date', + '_varchar' => 'string', + ]; + } + + /** + * {@inheritDoc} + */ + public function getVarcharMaxLength() + { + return 65535; + } + + /** + * {@inheritdoc} + */ + public function getBinaryMaxLength() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function getBinaryDefaultLength() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function hasNativeJsonType() + { + return true; + } + + /** + * {@inheritDoc} + * + * @deprecated Implement {@see createReservedKeywordsList()} instead. + */ + protected function getReservedKeywordsClass() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'PostgreSQLPlatform::getReservedKeywordsClass() is deprecated,' + . ' use PostgreSQLPlatform::createReservedKeywordsList() instead.' + ); + + return Keywords\PostgreSQL94Keywords::class; + } + + /** + * {@inheritDoc} + */ + public function getBlobTypeDeclarationSQL(array $column) + { + return 'BYTEA'; + } + + /** + * {@inheritdoc} + */ + public function getDefaultValueDeclarationSQL($column) + { + if ($this->isSerialColumn($column)) { + return ''; + } + + return parent::getDefaultValueDeclarationSQL($column); + } + + /** + * {@inheritdoc} + */ + public function supportsColumnCollation() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getColumnCollationDeclarationSQL($collation) + { + return 'COLLATE ' . $this->quoteSingleIdentifier($collation); + } + + /** + * {@inheritdoc} + */ + public function getJsonTypeDeclarationSQL(array $column) + { + if (! empty($column['jsonb'])) { + return 'JSONB'; + } + + return 'JSON'; + } + + /** + * @param mixed[] $column + */ + private function isSerialColumn(array $column): bool + { + return isset($column['type'], $column['autoincrement']) + && $column['autoincrement'] === true + && $this->isIntegerType($column['type']); + } + + /** + * Check whether the type of a column is changed in a way that invalidates the default value for the column + */ + private function typeChangeBreaksDefaultValue(ColumnDiff $columnDiff): bool + { + if ($columnDiff->fromColumn === null) { + return $columnDiff->hasChanged('type'); + } + + $oldTypeIsInteger = $this->isIntegerType($columnDiff->fromColumn->getType()); + $newTypeIsInteger = $this->isIntegerType($columnDiff->column->getType()); + + // default should not be changed when switching between integer types and the default comes from a sequence + return $columnDiff->hasChanged('type') + && ! ($oldTypeIsInteger && $newTypeIsInteger && $columnDiff->column->getAutoincrement()); + } + + private function isIntegerType(Type $type): bool + { + return $type instanceof PhpIntegerMappingType; + } + + private function getOldColumnComment(ColumnDiff $columnDiff): ?string + { + return $columnDiff->fromColumn !== null ? $this->getColumnComment($columnDiff->fromColumn) : null; + } + + public function getListTableMetadataSQL(string $table, ?string $schema = null): string + { + if ($schema !== null) { + $table = $schema . '.' . $table; + } + + return sprintf( + <<<'SQL' +SELECT obj_description(%s::regclass) AS table_comment; +SQL + , + $this->quoteStringLiteral($table) + ); + } +} diff --git a/doctrine/dbal/src/Platforms/SQLServer/Comparator.php b/doctrine/dbal/src/Platforms/SQLServer/Comparator.php new file mode 100644 index 000000000..0db1a6a57 --- /dev/null +++ b/doctrine/dbal/src/Platforms/SQLServer/Comparator.php @@ -0,0 +1,56 @@ +databaseCollation = $databaseCollation; + } + + /** + * {@inheritDoc} + */ + public function diffTable(Table $fromTable, Table $toTable) + { + $fromTable = clone $fromTable; + $toTable = clone $toTable; + + $this->normalizeColumns($fromTable); + $this->normalizeColumns($toTable); + + return parent::diffTable($fromTable, $toTable); + } + + private function normalizeColumns(Table $table): void + { + foreach ($table->getColumns() as $column) { + $options = $column->getPlatformOptions(); + + if (! isset($options['collation']) || $options['collation'] !== $this->databaseCollation) { + continue; + } + + unset($options['collation']); + $column->setPlatformOptions($options); + } + } +} diff --git a/doctrine/dbal/src/Platforms/SQLServer2012Platform.php b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php index 4db8f055c..a8ba2fa0b 100644 --- a/doctrine/dbal/src/Platforms/SQLServer2012Platform.php +++ b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php @@ -2,1729 +2,12 @@ namespace Doctrine\DBAL\Platforms; -use Doctrine\DBAL\Exception\InvalidLockMode; -use Doctrine\DBAL\LockMode; -use Doctrine\DBAL\Schema\Column; -use Doctrine\DBAL\Schema\ColumnDiff; -use Doctrine\DBAL\Schema\ForeignKeyConstraint; -use Doctrine\DBAL\Schema\Identifier; -use Doctrine\DBAL\Schema\Index; -use Doctrine\DBAL\Schema\Sequence; -use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\Deprecations\Deprecation; -use InvalidArgumentException; - -use function array_merge; -use function array_unique; -use function array_values; -use function count; -use function crc32; -use function dechex; -use function explode; -use function func_get_args; -use function implode; -use function is_array; -use function is_bool; -use function is_numeric; -use function is_string; -use function preg_match; -use function preg_match_all; -use function sprintf; -use function str_replace; -use function strpos; -use function strtoupper; -use function substr_count; - -use const PREG_OFFSET_CAPTURE; - /** - * Provides the behavior, features and SQL dialect of the Microsoft SQL Server 2012 database platform. + * Provides the behavior, features and SQL dialect of the Microsoft SQL Server database platform + * of the oldest supported version. + * + * @deprecated Use {@see SQLServerPlatform} instead. */ -class SQLServer2012Platform extends AbstractPlatform +class SQLServer2012Platform extends SQLServerPlatform { - /** - * {@inheritdoc} - */ - public function getCurrentDateSQL() - { - return $this->getConvertExpression('date', 'GETDATE()'); - } - - /** - * {@inheritdoc} - */ - public function getCurrentTimeSQL() - { - return $this->getConvertExpression('time', 'GETDATE()'); - } - - /** - * Returns an expression that converts an expression of one data type to another. - * - * @param string $dataType The target native data type. Alias data types cannot be used. - * @param string $expression The SQL expression to convert. - * - * @return string - */ - private function getConvertExpression($dataType, $expression) - { - return sprintf('CONVERT(%s, %s)', $dataType, $expression); - } - - /** - * {@inheritdoc} - */ - protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) - { - $factorClause = ''; - - if ($operator === '-') { - $factorClause = '-1 * '; - } - - return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')'; - } - - /** - * {@inheritDoc} - */ - public function getDateDiffExpression($date1, $date2) - { - return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')'; - } - - /** - * {@inheritDoc} - * - * Microsoft SQL Server prefers "autoincrement" identity columns - * since sequences can only be emulated with a table. - */ - public function prefersIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - * - * Microsoft SQL Server supports this through AUTO_INCREMENT columns. - */ - public function supportsIdentityColumns() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function supportsReleaseSavepoints() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function supportsSchemas() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getDefaultSchemaName() - { - return 'dbo'; - } - - /** - * {@inheritDoc} - */ - public function supportsColumnCollation() - { - return true; - } - - public function supportsSequences(): bool - { - return true; - } - - public function getAlterSequenceSQL(Sequence $sequence): string - { - return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . - ' INCREMENT BY ' . $sequence->getAllocationSize(); - } - - public function getCreateSequenceSQL(Sequence $sequence): string - { - return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . - ' START WITH ' . $sequence->getInitialValue() . - ' INCREMENT BY ' . $sequence->getAllocationSize() . - ' MINVALUE ' . $sequence->getInitialValue(); - } - - /** - * {@inheritdoc} - */ - public function getDropSequenceSQL($sequence): string - { - if ($sequence instanceof Sequence) { - $sequence = $sequence->getQuotedName($this); - } - - return 'DROP SEQUENCE ' . $sequence; - } - - /** - * {@inheritdoc} - */ - public function getListSequencesSQL($database) - { - return 'SELECT seq.name, - CAST( - seq.increment AS VARCHAR(MAX) - ) AS increment, -- CAST avoids driver error for sql_variant type - CAST( - seq.start_value AS VARCHAR(MAX) - ) AS start_value -- CAST avoids driver error for sql_variant type - FROM sys.sequences AS seq'; - } - - /** - * {@inheritdoc} - */ - public function getSequenceNextValSQL($sequence) - { - return 'SELECT NEXT VALUE FOR ' . $sequence; - } - - /** - * {@inheritDoc} - */ - public function hasNativeGuidType() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getCreateDatabaseSQL($name) - { - return 'CREATE DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getDropDatabaseSQL($name) - { - return 'DROP DATABASE ' . $name; - } - - /** - * {@inheritDoc} - */ - public function supportsCreateDropDatabase() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getCreateSchemaSQL($schemaName) - { - return 'CREATE SCHEMA ' . $schemaName; - } - - /** - * {@inheritDoc} - */ - public function getDropForeignKeySQL($foreignKey, $table) - { - if (! $foreignKey instanceof ForeignKeyConstraint) { - $foreignKey = new Identifier($foreignKey); - } - - if (! $table instanceof Table) { - $table = new Identifier($table); - } - - $foreignKey = $foreignKey->getQuotedName($this); - $table = $table->getQuotedName($this); - - return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey; - } - - /** - * {@inheritDoc} - */ - public function getDropIndexSQL($index, $table = null) - { - if ($index instanceof Index) { - $index = $index->getQuotedName($this); - } elseif (! is_string($index)) { - throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' - ); - } - - if (! isset($table)) { - return 'DROP INDEX ' . $index; - } - - if ($table instanceof Table) { - $table = $table->getQuotedName($this); - } - - return sprintf( - <<getCommentOnTableSQL($name, $tableComment); - } - - // @todo does other code breaks because of this? - // force primary keys to be not null - foreach ($columns as &$column) { - if (! empty($column['primary'])) { - $column['notnull'] = true; - } - - // Build default constraints SQL statements. - if (isset($column['default'])) { - $defaultConstraintsSql[] = 'ALTER TABLE ' . $name . - ' ADD' . $this->getDefaultConstraintDeclarationSQL($name, $column); - } - - if (empty($column['comment']) && ! is_numeric($column['comment'])) { - continue; - } - - $commentsSql[] = $this->getCreateColumnCommentSQL($name, $column['name'], $column['comment']); - } - - $columnListSql = $this->getColumnDeclarationListSQL($columns); - - if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $constraintName => $definition) { - $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); - } - } - - if (isset($options['primary']) && ! empty($options['primary'])) { - $flags = ''; - if (isset($options['primary_index']) && $options['primary_index']->hasFlag('nonclustered')) { - $flags = ' NONCLUSTERED'; - } - - $columnListSql .= ', PRIMARY KEY' . $flags - . ' (' . implode(', ', array_unique(array_values($options['primary']))) . ')'; - } - - $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; - - $check = $this->getCheckDeclarationSQL($columns); - if (! empty($check)) { - $query .= ', ' . $check; - } - - $query .= ')'; - - $sql = [$query]; - - if (isset($options['indexes']) && ! empty($options['indexes'])) { - foreach ($options['indexes'] as $index) { - $sql[] = $this->getCreateIndexSQL($index, $name); - } - } - - if (isset($options['foreignKeys'])) { - foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $name); - } - } - - return array_merge($sql, $commentsSql, $defaultConstraintsSql); - } - - /** - * {@inheritDoc} - */ - public function getCreatePrimaryKeySQL(Index $index, $table) - { - if ($table instanceof Table) { - $identifier = $table->getQuotedName($this); - } else { - $identifier = $table; - } - - $sql = 'ALTER TABLE ' . $identifier . ' ADD PRIMARY KEY'; - - if ($index->hasFlag('nonclustered')) { - $sql .= ' NONCLUSTERED'; - } - - return $sql . ' (' . $this->getIndexFieldDeclarationListSQL($index) . ')'; - } - - /** - * Returns the SQL statement for creating a column comment. - * - * SQL Server does not support native column comments, - * therefore the extended properties functionality is used - * as a workaround to store them. - * The property name used to store column comments is "MS_Description" - * which provides compatibility with SQL Server Management Studio, - * as column comments are stored in the same property there when - * specifying a column's "Description" attribute. - * - * @param string $tableName The quoted table name to which the column belongs. - * @param string $columnName The quoted column name to create the comment for. - * @param string|null $comment The column's comment. - * - * @return string - */ - protected function getCreateColumnCommentSQL($tableName, $columnName, $comment) - { - if (strpos($tableName, '.') !== false) { - [$schemaSQL, $tableSQL] = explode('.', $tableName); - $schemaSQL = $this->quoteStringLiteral($schemaSQL); - $tableSQL = $this->quoteStringLiteral($tableSQL); - } else { - $schemaSQL = "'dbo'"; - $tableSQL = $this->quoteStringLiteral($tableName); - } - - return $this->getAddExtendedPropertySQL( - 'MS_Description', - $comment, - 'SCHEMA', - $schemaSQL, - 'TABLE', - $tableSQL, - 'COLUMN', - $columnName - ); - } - - /** - * Returns the SQL snippet for declaring a default constraint. - * - * @param string $table Name of the table to return the default constraint declaration for. - * @param mixed[] $column Column definition. - * - * @return string - * - * @throws InvalidArgumentException - */ - public function getDefaultConstraintDeclarationSQL($table, array $column) - { - if (! isset($column['default'])) { - throw new InvalidArgumentException("Incomplete column definition. 'default' required."); - } - - $columnName = new Identifier($column['name']); - - return ' CONSTRAINT ' . - $this->generateDefaultConstraintName($table, $column['name']) . - $this->getDefaultValueDeclarationSQL($column) . - ' FOR ' . $columnName->getQuotedName($this); - } - - /** - * {@inheritDoc} - */ - public function getCreateIndexSQL(Index $index, $table) - { - $constraint = parent::getCreateIndexSQL($index, $table); - - if ($index->isUnique() && ! $index->isPrimary()) { - $constraint = $this->_appendUniqueConstraintDefinition($constraint, $index); - } - - return $constraint; - } - - /** - * {@inheritDoc} - */ - protected function getCreateIndexSQLFlags(Index $index) - { - $type = ''; - if ($index->isUnique()) { - $type .= 'UNIQUE '; - } - - if ($index->hasFlag('clustered')) { - $type .= 'CLUSTERED '; - } elseif ($index->hasFlag('nonclustered')) { - $type .= 'NONCLUSTERED '; - } - - return $type; - } - - /** - * Extend unique key constraint with required filters - * - * @param string $sql - * - * @return string - */ - private function _appendUniqueConstraintDefinition($sql, Index $index) - { - $fields = []; - - foreach ($index->getQuotedColumns($this) as $field) { - $fields[] = $field . ' IS NOT NULL'; - } - - return $sql . ' WHERE ' . implode(' AND ', $fields); - } - - /** - * {@inheritDoc} - */ - public function getAlterTableSQL(TableDiff $diff) - { - $queryParts = []; - $sql = []; - $columnSql = []; - $commentsSql = []; - - foreach ($diff->addedColumns as $column) { - if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { - continue; - } - - $columnDef = $column->toArray(); - $addColumnSql = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); - if (isset($columnDef['default'])) { - $addColumnSql .= ' CONSTRAINT ' . - $this->generateDefaultConstraintName($diff->name, $column->getQuotedName($this)) . - $this->getDefaultValueDeclarationSQL($columnDef); - } - - $queryParts[] = $addColumnSql; - - $comment = $this->getColumnComment($column); - - if (empty($comment) && ! is_numeric($comment)) { - continue; - } - - $commentsSql[] = $this->getCreateColumnCommentSQL( - $diff->name, - $column->getQuotedName($this), - $comment - ); - } - - foreach ($diff->removedColumns as $column) { - if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { - continue; - } - - $queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this); - } - - foreach ($diff->changedColumns as $columnDiff) { - if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { - continue; - } - - $column = $columnDiff->column; - $comment = $this->getColumnComment($column); - $hasComment = ! empty($comment) || is_numeric($comment); - - if ($columnDiff->fromColumn instanceof Column) { - $fromComment = $this->getColumnComment($columnDiff->fromColumn); - $hasFromComment = ! empty($fromComment) || is_numeric($fromComment); - - if ($hasFromComment && $hasComment && $fromComment !== $comment) { - $commentsSql[] = $this->getAlterColumnCommentSQL( - $diff->name, - $column->getQuotedName($this), - $comment - ); - } elseif ($hasFromComment && ! $hasComment) { - $commentsSql[] = $this->getDropColumnCommentSQL($diff->name, $column->getQuotedName($this)); - } elseif (! $hasFromComment && $hasComment) { - $commentsSql[] = $this->getCreateColumnCommentSQL( - $diff->name, - $column->getQuotedName($this), - $comment - ); - } - } - - // Do not add query part if only comment has changed. - if ($columnDiff->hasChanged('comment') && count($columnDiff->changedProperties) === 1) { - continue; - } - - $requireDropDefaultConstraint = $this->alterColumnRequiresDropDefaultConstraint($columnDiff); - - if ($requireDropDefaultConstraint) { - $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( - $diff->name, - $columnDiff->oldColumnName - ); - } - - $columnDef = $column->toArray(); - - $queryParts[] = 'ALTER COLUMN ' . - $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); - - if ( - ! isset($columnDef['default']) - || (! $requireDropDefaultConstraint && ! $columnDiff->hasChanged('default')) - ) { - continue; - } - - $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); - } - - foreach ($diff->renamedColumns as $oldColumnName => $column) { - if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { - continue; - } - - $oldColumnName = new Identifier($oldColumnName); - - $sql[] = "sp_rename '" . - $diff->getName($this)->getQuotedName($this) . '.' . $oldColumnName->getQuotedName($this) . - "', '" . $column->getQuotedName($this) . "', 'COLUMN'"; - - // Recreate default constraint with new column name if necessary (for future reference). - if ($column->getDefault() === null) { - continue; - } - - $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( - $diff->name, - $oldColumnName->getQuotedName($this) - ); - $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); - } - - $tableSql = []; - - if ($this->onSchemaAlterTable($diff, $tableSql)) { - return array_merge($tableSql, $columnSql); - } - - foreach ($queryParts as $query) { - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; - } - - $sql = array_merge($sql, $commentsSql); - - $newName = $diff->getNewName(); - - if ($newName !== false) { - $sql[] = "sp_rename '" . $diff->getName($this)->getQuotedName($this) . "', '" . $newName->getName() . "'"; - - /** - * Rename table's default constraints names - * to match the new table name. - * This is necessary to ensure that the default - * constraints can be referenced in future table - * alterations as the table name is encoded in - * default constraints' names. - */ - $sql[] = "DECLARE @sql NVARCHAR(MAX) = N''; " . - "SELECT @sql += N'EXEC sp_rename N''' + dc.name + ''', N''' " . - "+ REPLACE(dc.name, '" . $this->generateIdentifierName($diff->name) . "', " . - "'" . $this->generateIdentifierName($newName->getName()) . "') + ''', ''OBJECT'';' " . - 'FROM sys.default_constraints dc ' . - 'JOIN sys.tables tbl ON dc.parent_object_id = tbl.object_id ' . - "WHERE tbl.name = '" . $newName->getName() . "';" . - 'EXEC sp_executesql @sql'; - } - - $sql = array_merge( - $this->getPreAlterTableIndexForeignKeySQL($diff), - $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) - ); - - return array_merge($sql, $tableSql, $columnSql); - } - - /** - * Returns the SQL clause for adding a default constraint in an ALTER TABLE statement. - * - * @param string $tableName The name of the table to generate the clause for. - * @param Column $column The column to generate the clause for. - * - * @return string - */ - private function getAlterTableAddDefaultConstraintClause($tableName, Column $column) - { - $columnDef = $column->toArray(); - $columnDef['name'] = $column->getQuotedName($this); - - return 'ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $columnDef); - } - - /** - * Returns the SQL clause for dropping an existing default constraint in an ALTER TABLE statement. - * - * @param string $tableName The name of the table to generate the clause for. - * @param string $columnName The name of the column to generate the clause for. - * - * @return string - */ - private function getAlterTableDropDefaultConstraintClause($tableName, $columnName) - { - return 'DROP CONSTRAINT ' . $this->generateDefaultConstraintName($tableName, $columnName); - } - - /** - * Checks whether a column alteration requires dropping its default constraint first. - * - * Different to other database vendors SQL Server implements column default values - * as constraints and therefore changes in a column's default value as well as changes - * in a column's type require dropping the default constraint first before being to - * alter the particular column to the new definition. - * - * @param ColumnDiff $columnDiff The column diff to evaluate. - * - * @return bool True if the column alteration requires dropping its default constraint first, false otherwise. - */ - private function alterColumnRequiresDropDefaultConstraint(ColumnDiff $columnDiff) - { - // We can only decide whether to drop an existing default constraint - // if we know the original default value. - if (! $columnDiff->fromColumn instanceof Column) { - return false; - } - - // We only need to drop an existing default constraint if we know the - // column was defined with a default value before. - if ($columnDiff->fromColumn->getDefault() === null) { - return false; - } - - // We need to drop an existing default constraint if the column was - // defined with a default value before and it has changed. - if ($columnDiff->hasChanged('default')) { - return true; - } - - // We need to drop an existing default constraint if the column was - // defined with a default value before and the native column type has changed. - return $columnDiff->hasChanged('type') || $columnDiff->hasChanged('fixed'); - } - - /** - * Returns the SQL statement for altering a column comment. - * - * SQL Server does not support native column comments, - * therefore the extended properties functionality is used - * as a workaround to store them. - * The property name used to store column comments is "MS_Description" - * which provides compatibility with SQL Server Management Studio, - * as column comments are stored in the same property there when - * specifying a column's "Description" attribute. - * - * @param string $tableName The quoted table name to which the column belongs. - * @param string $columnName The quoted column name to alter the comment for. - * @param string|null $comment The column's comment. - * - * @return string - */ - protected function getAlterColumnCommentSQL($tableName, $columnName, $comment) - { - if (strpos($tableName, '.') !== false) { - [$schemaSQL, $tableSQL] = explode('.', $tableName); - $schemaSQL = $this->quoteStringLiteral($schemaSQL); - $tableSQL = $this->quoteStringLiteral($tableSQL); - } else { - $schemaSQL = "'dbo'"; - $tableSQL = $this->quoteStringLiteral($tableName); - } - - return $this->getUpdateExtendedPropertySQL( - 'MS_Description', - $comment, - 'SCHEMA', - $schemaSQL, - 'TABLE', - $tableSQL, - 'COLUMN', - $columnName - ); - } - - /** - * Returns the SQL statement for dropping a column comment. - * - * SQL Server does not support native column comments, - * therefore the extended properties functionality is used - * as a workaround to store them. - * The property name used to store column comments is "MS_Description" - * which provides compatibility with SQL Server Management Studio, - * as column comments are stored in the same property there when - * specifying a column's "Description" attribute. - * - * @param string $tableName The quoted table name to which the column belongs. - * @param string $columnName The quoted column name to drop the comment for. - * - * @return string - */ - protected function getDropColumnCommentSQL($tableName, $columnName) - { - if (strpos($tableName, '.') !== false) { - [$schemaSQL, $tableSQL] = explode('.', $tableName); - $schemaSQL = $this->quoteStringLiteral($schemaSQL); - $tableSQL = $this->quoteStringLiteral($tableSQL); - } else { - $schemaSQL = "'dbo'"; - $tableSQL = $this->quoteStringLiteral($tableName); - } - - return $this->getDropExtendedPropertySQL( - 'MS_Description', - 'SCHEMA', - $schemaSQL, - 'TABLE', - $tableSQL, - 'COLUMN', - $columnName - ); - } - - /** - * {@inheritdoc} - */ - protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) - { - return [sprintf( - "EXEC sp_rename N'%s.%s', N'%s', N'INDEX'", - $tableName, - $oldIndexName, - $index->getQuotedName($this) - ), - ]; - } - - /** - * Returns the SQL statement for adding an extended property to a database object. - * - * @link http://msdn.microsoft.com/en-us/library/ms180047%28v=sql.90%29.aspx - * - * @param string $name The name of the property to add. - * @param string|null $value The value of the property to add. - * @param string|null $level0Type The type of the object at level 0 the property belongs to. - * @param string|null $level0Name The name of the object at level 0 the property belongs to. - * @param string|null $level1Type The type of the object at level 1 the property belongs to. - * @param string|null $level1Name The name of the object at level 1 the property belongs to. - * @param string|null $level2Type The type of the object at level 2 the property belongs to. - * @param string|null $level2Name The name of the object at level 2 the property belongs to. - * - * @return string - */ - public function getAddExtendedPropertySQL( - $name, - $value = null, - $level0Type = null, - $level0Name = null, - $level1Type = null, - $level1Name = null, - $level2Type = null, - $level2Name = null - ) { - return 'EXEC sp_addextendedproperty ' . - 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . - 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; - } - - /** - * Returns the SQL statement for dropping an extended property from a database object. - * - * @link http://technet.microsoft.com/en-gb/library/ms178595%28v=sql.90%29.aspx - * - * @param string $name The name of the property to drop. - * @param string|null $level0Type The type of the object at level 0 the property belongs to. - * @param string|null $level0Name The name of the object at level 0 the property belongs to. - * @param string|null $level1Type The type of the object at level 1 the property belongs to. - * @param string|null $level1Name The name of the object at level 1 the property belongs to. - * @param string|null $level2Type The type of the object at level 2 the property belongs to. - * @param string|null $level2Name The name of the object at level 2 the property belongs to. - * - * @return string - */ - public function getDropExtendedPropertySQL( - $name, - $level0Type = null, - $level0Name = null, - $level1Type = null, - $level1Name = null, - $level2Type = null, - $level2Name = null - ) { - return 'EXEC sp_dropextendedproperty ' . - 'N' . $this->quoteStringLiteral($name) . ', ' . - 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; - } - - /** - * Returns the SQL statement for updating an extended property of a database object. - * - * @link http://msdn.microsoft.com/en-us/library/ms186885%28v=sql.90%29.aspx - * - * @param string $name The name of the property to update. - * @param string|null $value The value of the property to update. - * @param string|null $level0Type The type of the object at level 0 the property belongs to. - * @param string|null $level0Name The name of the object at level 0 the property belongs to. - * @param string|null $level1Type The type of the object at level 1 the property belongs to. - * @param string|null $level1Name The name of the object at level 1 the property belongs to. - * @param string|null $level2Type The type of the object at level 2 the property belongs to. - * @param string|null $level2Name The name of the object at level 2 the property belongs to. - * - * @return string - */ - public function getUpdateExtendedPropertySQL( - $name, - $value = null, - $level0Type = null, - $level0Name = null, - $level1Type = null, - $level1Name = null, - $level2Type = null, - $level2Name = null - ) { - return 'EXEC sp_updateextendedproperty ' . - 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . - 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . - 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; - } - - /** - * {@inheritDoc} - */ - public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) - { - return 'INSERT INTO ' . $quotedTableName . ' DEFAULT VALUES'; - } - - /** - * {@inheritDoc} - */ - public function getListTablesSQL() - { - // "sysdiagrams" table must be ignored as it's internal SQL Server table for Database Diagrams - // Category 2 must be ignored as it is "MS SQL Server 'pseudo-system' object[s]" for replication - return 'SELECT name, SCHEMA_NAME (uid) AS schema_name FROM sysobjects' - . " WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"; - } - - /** - * {@inheritDoc} - */ - public function getListTableColumnsSQL($table, $database = null) - { - return "SELECT col.name, - type.name AS type, - col.max_length AS length, - ~col.is_nullable AS notnull, - def.definition AS [default], - col.scale, - col.precision, - col.is_identity AS autoincrement, - col.collation_name AS collation, - CAST(prop.value AS NVARCHAR(MAX)) AS comment -- CAST avoids driver error for sql_variant type - FROM sys.columns AS col - JOIN sys.types AS type - ON col.user_type_id = type.user_type_id - JOIN sys.objects AS obj - ON col.object_id = obj.object_id - JOIN sys.schemas AS scm - ON obj.schema_id = scm.schema_id - LEFT JOIN sys.default_constraints def - ON col.default_object_id = def.object_id - AND col.object_id = def.parent_object_id - LEFT JOIN sys.extended_properties AS prop - ON obj.object_id = prop.major_id - AND col.column_id = prop.minor_id - AND prop.name = 'MS_Description' - WHERE obj.type = 'U' - AND " . $this->getTableWhereClause($table, 'scm.name', 'obj.name'); - } - - /** - * @param string $table - * @param string|null $database - * - * @return string - */ - public function getListTableForeignKeysSQL($table, $database = null) - { - return 'SELECT f.name AS ForeignKey, - SCHEMA_NAME (f.SCHEMA_ID) AS SchemaName, - OBJECT_NAME (f.parent_object_id) AS TableName, - COL_NAME (fc.parent_object_id,fc.parent_column_id) AS ColumnName, - SCHEMA_NAME (o.SCHEMA_ID) ReferenceSchemaName, - OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName, - COL_NAME(fc.referenced_object_id,fc.referenced_column_id) AS ReferenceColumnName, - f.delete_referential_action_desc, - f.update_referential_action_desc - FROM sys.foreign_keys AS f - INNER JOIN sys.foreign_key_columns AS fc - INNER JOIN sys.objects AS o ON o.OBJECT_ID = fc.referenced_object_id - ON f.OBJECT_ID = fc.constraint_object_id - WHERE ' . - $this->getTableWhereClause($table, 'SCHEMA_NAME (f.schema_id)', 'OBJECT_NAME (f.parent_object_id)') . - ' ORDER BY fc.constraint_column_id'; - } - - /** - * {@inheritDoc} - */ - public function getListTableIndexesSQL($table, $database = null) - { - return "SELECT idx.name AS key_name, - col.name AS column_name, - ~idx.is_unique AS non_unique, - idx.is_primary_key AS [primary], - CASE idx.type - WHEN '1' THEN 'clustered' - WHEN '2' THEN 'nonclustered' - ELSE NULL - END AS flags - FROM sys.tables AS tbl - JOIN sys.schemas AS scm ON tbl.schema_id = scm.schema_id - JOIN sys.indexes AS idx ON tbl.object_id = idx.object_id - JOIN sys.index_columns AS idxcol ON idx.object_id = idxcol.object_id AND idx.index_id = idxcol.index_id - JOIN sys.columns AS col ON idxcol.object_id = col.object_id AND idxcol.column_id = col.column_id - WHERE " . $this->getTableWhereClause($table, 'scm.name', 'tbl.name') . ' - ORDER BY idx.index_id ASC, idxcol.key_ordinal ASC'; - } - - /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getListViewsSQL($database) - { - return "SELECT name FROM sysobjects WHERE type = 'V' ORDER BY name"; - } - - /** - * Returns the where clause to filter schema and table name in a query. - * - * @param string $table The full qualified name of the table. - * @param string $schemaColumn The name of the column to compare the schema to in the where clause. - * @param string $tableColumn The name of the column to compare the table to in the where clause. - * - * @return string - */ - private function getTableWhereClause($table, $schemaColumn, $tableColumn) - { - if (strpos($table, '.') !== false) { - [$schema, $table] = explode('.', $table); - $schema = $this->quoteStringLiteral($schema); - $table = $this->quoteStringLiteral($table); - } else { - $schema = 'SCHEMA_NAME()'; - $table = $this->quoteStringLiteral($table); - } - - return sprintf('(%s = %s AND %s = %s)', $tableColumn, $table, $schemaColumn, $schema); - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - - /** - * {@inheritDoc} - */ - public function getLocateExpression($str, $substr, $startPos = false) - { - if ($startPos === false) { - return 'CHARINDEX(' . $substr . ', ' . $str . ')'; - } - - return 'CHARINDEX(' . $substr . ', ' . $str . ', ' . $startPos . ')'; - } - - /** - * {@inheritDoc} - */ - public function getModExpression($expression1, $expression2) - { - return $expression1 . ' % ' . $expression2; - } - - /** - * {@inheritDoc} - */ - public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) - { - if ($char === false) { - switch ($mode) { - case TrimMode::LEADING: - $trimFn = 'LTRIM'; - break; - - case TrimMode::TRAILING: - $trimFn = 'RTRIM'; - break; - - default: - return 'LTRIM(RTRIM(' . $str . '))'; - } - - return $trimFn . '(' . $str . ')'; - } - - $pattern = "'%[^' + " . $char . " + ']%'"; - - if ($mode === TrimMode::LEADING) { - return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)'; - } - - if ($mode === TrimMode::TRAILING) { - return 'reverse(stuff(reverse(' . $str . '), 1, ' - . 'patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))'; - } - - return 'reverse(stuff(reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)), 1, ' - . 'patindex(' . $pattern . ', reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str - . ') - 1, null))) - 1, null))'; - } - - /** - * {@inheritDoc} - */ - public function getConcatExpression() - { - return sprintf('CONCAT(%s)', implode(', ', func_get_args())); - } - - /** - * {@inheritDoc} - */ - public function getListDatabasesSQL() - { - return 'SELECT * FROM sys.databases'; - } - - /** - * {@inheritDoc} - * - * @deprecated Use {@link SQLServerSchemaManager::listSchemaNames()} instead. - */ - public function getListNamespacesSQL() - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4503', - 'SQLServer2012Platform::getListNamespacesSQL() is deprecated,' - . ' use SQLServerSchemaManager::listSchemaNames() instead.' - ); - - return "SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"; - } - - /** - * {@inheritDoc} - */ - public function getSubstringExpression($string, $start, $length = null) - { - if ($length !== null) { - return 'SUBSTRING(' . $string . ', ' . $start . ', ' . $length . ')'; - } - - return 'SUBSTRING(' . $string . ', ' . $start . ', LEN(' . $string . ') - ' . $start . ' + 1)'; - } - - /** - * {@inheritDoc} - */ - public function getLengthExpression($column) - { - return 'LEN(' . $column . ')'; - } - - public function getCurrentDatabaseExpression(): string - { - return 'DB_NAME()'; - } - - /** - * {@inheritDoc} - */ - public function getSetTransactionIsolationSQL($level) - { - return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); - } - - /** - * {@inheritDoc} - */ - public function getIntegerTypeDeclarationSQL(array $column) - { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getBigIntTypeDeclarationSQL(array $column) - { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getSmallIntTypeDeclarationSQL(array $column) - { - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); - } - - /** - * {@inheritDoc} - */ - public function getGuidTypeDeclarationSQL(array $column) - { - return 'UNIQUEIDENTIFIER'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTzTypeDeclarationSQL(array $column) - { - return 'DATETIMEOFFSET(6)'; - } - - /** - * {@inheritDoc} - */ - public function getAsciiStringTypeDeclarationSQL(array $column): string - { - $length = $column['length'] ?? null; - - if (! isset($column['fixed'])) { - return sprintf('VARCHAR(%d)', $length ?? 255); - } - - return sprintf('CHAR(%d)', $length ?? 255); - } - - /** - * {@inheritDoc} - */ - protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed - ? ($length > 0 ? 'NCHAR(' . $length . ')' : 'CHAR(255)') - : ($length > 0 ? 'NVARCHAR(' . $length . ')' : 'NVARCHAR(255)'); - } - - /** - * {@inheritdoc} - */ - protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) - { - return $fixed - ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' - : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; - } - - /** - * {@inheritdoc} - */ - public function getBinaryMaxLength() - { - return 8000; - } - - /** - * {@inheritDoc} - */ - public function getClobTypeDeclarationSQL(array $column) - { - return 'VARCHAR(MAX)'; - } - - /** - * {@inheritDoc} - */ - protected function _getCommonIntegerTypeDeclarationSQL(array $column) - { - return ! empty($column['autoincrement']) ? ' IDENTITY' : ''; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTypeDeclarationSQL(array $column) - { - // 3 - microseconds precision length - // http://msdn.microsoft.com/en-us/library/ms187819.aspx - return 'DATETIME2(6)'; - } - - /** - * {@inheritDoc} - */ - public function getDateTypeDeclarationSQL(array $column) - { - return 'DATE'; - } - - /** - * {@inheritDoc} - */ - public function getTimeTypeDeclarationSQL(array $column) - { - return 'TIME(0)'; - } - - /** - * {@inheritDoc} - */ - public function getBooleanTypeDeclarationSQL(array $column) - { - return 'BIT'; - } - - /** - * {@inheritDoc} - */ - protected function doModifyLimitQuery($query, $limit, $offset) - { - if ($limit === null && $offset <= 0) { - return $query; - } - - if ($this->shouldAddOrderBy($query)) { - if (preg_match('/^SELECT\s+DISTINCT/im', $query) > 0) { - // SQL Server won't let us order by a non-selected column in a DISTINCT query, - // so we have to do this madness. This says, order by the first column in the - // result. SQL Server's docs say that a nonordered query's result order is non- - // deterministic anyway, so this won't do anything that a bunch of update and - // deletes to the table wouldn't do anyway. - $query .= ' ORDER BY 1'; - } else { - // In another DBMS, we could do ORDER BY 0, but SQL Server gets angry if you - // use constant expressions in the order by list. - $query .= ' ORDER BY (SELECT 0)'; - } - } - - // This looks somewhat like MYSQL, but limit/offset are in inverse positions - // Supposedly SQL:2008 core standard. - // Per TSQL spec, FETCH NEXT n ROWS ONLY is not valid without OFFSET n ROWS. - $query .= sprintf(' OFFSET %d ROWS', $offset); - - if ($limit !== null) { - $query .= sprintf(' FETCH NEXT %d ROWS ONLY', $limit); - } - - return $query; - } - - /** - * {@inheritDoc} - */ - public function supportsLimitOffset() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function convertBooleans($item) - { - if (is_array($item)) { - foreach ($item as $key => $value) { - if (! is_bool($value) && ! is_numeric($value)) { - continue; - } - - $item[$key] = (int) (bool) $value; - } - } elseif (is_bool($item) || is_numeric($item)) { - $item = (int) (bool) $item; - } - - return $item; - } - - /** - * {@inheritDoc} - */ - public function getCreateTemporaryTableSnippetSQL() - { - return 'CREATE TABLE'; - } - - /** - * {@inheritDoc} - */ - public function getTemporaryTableName($tableName) - { - return '#' . $tableName; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeFormatString() - { - return 'Y-m-d H:i:s.u'; - } - - /** - * {@inheritDoc} - */ - public function getDateFormatString() - { - return 'Y-m-d'; - } - - /** - * {@inheritDoc} - */ - public function getTimeFormatString() - { - return 'H:i:s'; - } - - /** - * {@inheritDoc} - */ - public function getDateTimeTzFormatString() - { - return 'Y-m-d H:i:s.u P'; - } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'mssql'; - } - - /** - * {@inheritDoc} - */ - protected function initializeDoctrineTypeMappings() - { - $this->doctrineTypeMapping = [ - 'bigint' => 'bigint', - 'binary' => 'binary', - 'bit' => 'boolean', - 'blob' => 'blob', - 'char' => 'string', - 'date' => 'date', - 'datetime' => 'datetime', - 'datetime2' => 'datetime', - 'datetimeoffset' => 'datetimetz', - 'decimal' => 'decimal', - 'double' => 'float', - 'double precision' => 'float', - 'float' => 'float', - 'image' => 'blob', - 'int' => 'integer', - 'money' => 'integer', - 'nchar' => 'string', - 'ntext' => 'text', - 'numeric' => 'decimal', - 'nvarchar' => 'string', - 'real' => 'float', - 'smalldatetime' => 'datetime', - 'smallint' => 'smallint', - 'smallmoney' => 'integer', - 'text' => 'text', - 'time' => 'time', - 'tinyint' => 'smallint', - 'uniqueidentifier' => 'guid', - 'varbinary' => 'binary', - 'varchar' => 'string', - ]; - } - - /** - * {@inheritDoc} - */ - public function createSavePoint($savepoint) - { - return 'SAVE TRANSACTION ' . $savepoint; - } - - /** - * {@inheritDoc} - */ - public function releaseSavePoint($savepoint) - { - return ''; - } - - /** - * {@inheritDoc} - */ - public function rollbackSavePoint($savepoint) - { - return 'ROLLBACK TRANSACTION ' . $savepoint; - } - - /** - * {@inheritdoc} - */ - public function getForeignKeyReferentialActionSQL($action) - { - // RESTRICT is not supported, therefore falling back to NO ACTION. - if (strtoupper($action) === 'RESTRICT') { - return 'NO ACTION'; - } - - return parent::getForeignKeyReferentialActionSQL($action); - } - - public function appendLockHint(string $fromClause, int $lockMode): string - { - switch ($lockMode) { - case LockMode::NONE: - case LockMode::OPTIMISTIC: - return $fromClause; - - case LockMode::PESSIMISTIC_READ: - return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)'; - - case LockMode::PESSIMISTIC_WRITE: - return $fromClause . ' WITH (UPDLOCK, ROWLOCK)'; - - default: - throw InvalidLockMode::fromLockMode($lockMode); - } - } - - /** - * {@inheritDoc} - */ - public function getForUpdateSQL() - { - return ' '; - } - - /** - * {@inheritDoc} - * - * @deprecated Implement {@link createReservedKeywordsList()} instead. - */ - protected function getReservedKeywordsClass() - { - Deprecation::triggerIfCalledFromOutside( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/4510', - 'QLServer2012Platform::getReservedKeywordsClass() is deprecated,' - . ' use QLServer2012Platform::createReservedKeywordsList() instead.' - ); - - return Keywords\SQLServer2012Keywords::class; - } - - /** - * {@inheritDoc} - */ - public function quoteSingleIdentifier($str) - { - return '[' . str_replace(']', ']]', $str) . ']'; - } - - /** - * {@inheritDoc} - */ - public function getTruncateTableSQL($tableName, $cascade = false) - { - $tableIdentifier = new Identifier($tableName); - - return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this); - } - - /** - * {@inheritDoc} - */ - public function getBlobTypeDeclarationSQL(array $column) - { - return 'VARBINARY(MAX)'; - } - - /** - * {@inheritdoc} - * - * Modifies column declaration order as it differs in Microsoft SQL Server. - */ - public function getColumnDeclarationSQL($name, array $column) - { - if (isset($column['columnDefinition'])) { - $columnDef = $this->getCustomTypeDeclarationSQL($column); - } else { - $collation = ! empty($column['collation']) ? - ' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : ''; - - $notnull = ! empty($column['notnull']) ? ' NOT NULL' : ''; - - $unique = ! empty($column['unique']) ? - ' ' . $this->getUniqueFieldDeclarationSQL() : ''; - - $check = ! empty($column['check']) ? - ' ' . $column['check'] : ''; - - $typeDecl = $column['type']->getSQLDeclaration($column, $this); - $columnDef = $typeDecl . $collation . $notnull . $unique . $check; - } - - return $name . ' ' . $columnDef; - } - - protected function getLikeWildcardCharacters(): string - { - return parent::getLikeWildcardCharacters() . '[]^'; - } - - /** - * Returns a unique default constraint name for a table and column. - * - * @param string $table Name of the table to generate the unique default constraint name for. - * @param string $column Name of the column in the table to generate the unique default constraint name for. - * - * @return string - */ - private function generateDefaultConstraintName($table, $column) - { - return 'DF_' . $this->generateIdentifierName($table) . '_' . $this->generateIdentifierName($column); - } - - /** - * Returns a hash value for a given identifier. - * - * @param string $identifier Identifier to generate a hash value for. - * - * @return string - */ - private function generateIdentifierName($identifier) - { - // Always generate name for unquoted identifiers to ensure consistency. - $identifier = new Identifier($identifier); - - return strtoupper(dechex(crc32($identifier->getName()))); - } - - protected function getCommentOnTableSQL(string $tableName, ?string $comment): string - { - return sprintf( - <<<'SQL' - EXEC sys.sp_addextendedproperty @name=N'MS_Description', - @value=N%s, @level0type=N'SCHEMA', @level0name=N'dbo', - @level1type=N'TABLE', @level1name=N%s - SQL - , - $this->quoteStringLiteral((string) $comment), - $this->quoteStringLiteral($tableName) - ); - } - - public function getListTableMetadataSQL(string $table): string - { - return sprintf( - <<<'SQL' - SELECT - p.value AS [table_comment] - FROM - sys.tables AS tbl - INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1 - WHERE - (tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description') - SQL - , - $this->quoteStringLiteral($table) - ); - } - - /** - * @param string $query - */ - private function shouldAddOrderBy($query): bool - { - // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement - // but can be in a newline - $matches = []; - $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE); - if ($matchesCount === 0) { - return true; - } - - // ORDER BY instance may be in a subquery after ORDER BY - // e.g. SELECT col1 FROM test ORDER BY (SELECT col2 from test ORDER BY col2) - // if in the searched query ORDER BY clause was found where - // number of open parentheses after the occurrence of the clause is equal to - // number of closed brackets after the occurrence of the clause, - // it means that ORDER BY is included in the query being checked - while ($matchesCount > 0) { - $orderByPos = $matches[0][--$matchesCount][1]; - $openBracketsCount = substr_count($query, '(', $orderByPos); - $closedBracketsCount = substr_count($query, ')', $orderByPos); - if ($openBracketsCount === $closedBracketsCount) { - return false; - } - } - - return true; - } } diff --git a/doctrine/dbal/src/Platforms/SQLServerPlatform.php b/doctrine/dbal/src/Platforms/SQLServerPlatform.php new file mode 100644 index 000000000..732cb6363 --- /dev/null +++ b/doctrine/dbal/src/Platforms/SQLServerPlatform.php @@ -0,0 +1,1660 @@ +getConvertExpression('date', 'GETDATE()'); + } + + /** + * {@inheritdoc} + */ + public function getCurrentTimeSQL() + { + return $this->getConvertExpression('time', 'GETDATE()'); + } + + /** + * Returns an expression that converts an expression of one data type to another. + * + * @param string $dataType The target native data type. Alias data types cannot be used. + * @param string $expression The SQL expression to convert. + */ + private function getConvertExpression($dataType, $expression): string + { + return sprintf('CONVERT(%s, %s)', $dataType, $expression); + } + + /** + * {@inheritdoc} + */ + protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) + { + $factorClause = ''; + + if ($operator === '-') { + $factorClause = '-1 * '; + } + + return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')'; + } + + /** + * {@inheritDoc} + */ + public function getDateDiffExpression($date1, $date2) + { + return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')'; + } + + /** + * {@inheritDoc} + * + * Microsoft SQL Server prefers "autoincrement" identity columns + * since sequences can only be emulated with a table. + * + * @deprecated + */ + public function prefersIdentityColumns() + { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/1519', + 'SQLServerPlatform::prefersIdentityColumns() is deprecated.' + ); + + return true; + } + + /** + * {@inheritDoc} + * + * Microsoft SQL Server supports this through AUTO_INCREMENT columns. + */ + public function supportsIdentityColumns() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function supportsReleaseSavepoints() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function supportsSchemas() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function getDefaultSchemaName() + { + return 'dbo'; + } + + /** + * {@inheritDoc} + */ + public function supportsColumnCollation() + { + return true; + } + + public function supportsSequences(): bool + { + return true; + } + + public function getAlterSequenceSQL(Sequence $sequence): string + { + return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . + ' INCREMENT BY ' . $sequence->getAllocationSize(); + } + + public function getCreateSequenceSQL(Sequence $sequence): string + { + return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . + ' START WITH ' . $sequence->getInitialValue() . + ' INCREMENT BY ' . $sequence->getAllocationSize() . + ' MINVALUE ' . $sequence->getInitialValue(); + } + + /** + * {@inheritdoc} + */ + public function getListSequencesSQL($database) + { + return 'SELECT seq.name, + CAST( + seq.increment AS VARCHAR(MAX) + ) AS increment, -- CAST avoids driver error for sql_variant type + CAST( + seq.start_value AS VARCHAR(MAX) + ) AS start_value -- CAST avoids driver error for sql_variant type + FROM sys.sequences AS seq'; + } + + /** + * {@inheritdoc} + */ + public function getSequenceNextValSQL($sequence) + { + return 'SELECT NEXT VALUE FOR ' . $sequence; + } + + /** + * {@inheritDoc} + */ + public function hasNativeGuidType() + { + return true; + } + + /** + * {@inheritDoc} + */ + public function getDropForeignKeySQL($foreignKey, $table) + { + if (! $foreignKey instanceof ForeignKeyConstraint) { + $foreignKey = new Identifier($foreignKey); + } + + if (! $table instanceof Table) { + $table = new Identifier($table); + } + + $foreignKey = $foreignKey->getQuotedName($this); + $table = $table->getQuotedName($this); + + return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey; + } + + /** + * {@inheritDoc} + */ + public function getDropIndexSQL($index, $table = null) + { + if ($index instanceof Index) { + $index = $index->getQuotedName($this); + } elseif (! is_string($index)) { + throw new InvalidArgumentException( + __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' + ); + } + + if ($table instanceof Table) { + $table = $table->getQuotedName($this); + } elseif (! is_string($table)) { + throw new InvalidArgumentException( + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + ); + } + + return 'DROP INDEX ' . $index . ' ON ' . $table; + } + + /** + * {@inheritDoc} + */ + protected function _getCreateTableSQL($name, array $columns, array $options = []) + { + $defaultConstraintsSql = []; + $commentsSql = []; + + $tableComment = $options['comment'] ?? null; + if ($tableComment !== null) { + $commentsSql[] = $this->getCommentOnTableSQL($name, $tableComment); + } + + // @todo does other code breaks because of this? + // force primary keys to be not null + foreach ($columns as &$column) { + if (! empty($column['primary'])) { + $column['notnull'] = true; + } + + // Build default constraints SQL statements. + if (isset($column['default'])) { + $defaultConstraintsSql[] = 'ALTER TABLE ' . $name . + ' ADD' . $this->getDefaultConstraintDeclarationSQL($name, $column); + } + + if (empty($column['comment']) && ! is_numeric($column['comment'])) { + continue; + } + + $commentsSql[] = $this->getCreateColumnCommentSQL($name, $column['name'], $column['comment']); + } + + $columnListSql = $this->getColumnDeclarationListSQL($columns); + + if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { + foreach ($options['uniqueConstraints'] as $constraintName => $definition) { + $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($constraintName, $definition); + } + } + + if (isset($options['primary']) && ! empty($options['primary'])) { + $flags = ''; + if (isset($options['primary_index']) && $options['primary_index']->hasFlag('nonclustered')) { + $flags = ' NONCLUSTERED'; + } + + $columnListSql .= ', PRIMARY KEY' . $flags + . ' (' . implode(', ', array_unique(array_values($options['primary']))) . ')'; + } + + $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; + + $check = $this->getCheckDeclarationSQL($columns); + if (! empty($check)) { + $query .= ', ' . $check; + } + + $query .= ')'; + + $sql = [$query]; + + if (isset($options['indexes']) && ! empty($options['indexes'])) { + foreach ($options['indexes'] as $index) { + $sql[] = $this->getCreateIndexSQL($index, $name); + } + } + + if (isset($options['foreignKeys'])) { + foreach ((array) $options['foreignKeys'] as $definition) { + $sql[] = $this->getCreateForeignKeySQL($definition, $name); + } + } + + return array_merge($sql, $commentsSql, $defaultConstraintsSql); + } + + /** + * {@inheritDoc} + */ + public function getCreatePrimaryKeySQL(Index $index, $table) + { + if ($table instanceof Table) { + $identifier = $table->getQuotedName($this); + } else { + $identifier = $table; + } + + $sql = 'ALTER TABLE ' . $identifier . ' ADD PRIMARY KEY'; + + if ($index->hasFlag('nonclustered')) { + $sql .= ' NONCLUSTERED'; + } + + return $sql . ' (' . $this->getIndexFieldDeclarationListSQL($index) . ')'; + } + + /** + * Returns the SQL statement for creating a column comment. + * + * SQL Server does not support native column comments, + * therefore the extended properties functionality is used + * as a workaround to store them. + * The property name used to store column comments is "MS_Description" + * which provides compatibility with SQL Server Management Studio, + * as column comments are stored in the same property there when + * specifying a column's "Description" attribute. + * + * @param string $tableName The quoted table name to which the column belongs. + * @param string $columnName The quoted column name to create the comment for. + * @param string|null $comment The column's comment. + * + * @return string + */ + protected function getCreateColumnCommentSQL($tableName, $columnName, $comment) + { + if (strpos($tableName, '.') !== false) { + [$schemaSQL, $tableSQL] = explode('.', $tableName); + $schemaSQL = $this->quoteStringLiteral($schemaSQL); + $tableSQL = $this->quoteStringLiteral($tableSQL); + } else { + $schemaSQL = "'dbo'"; + $tableSQL = $this->quoteStringLiteral($tableName); + } + + return $this->getAddExtendedPropertySQL( + 'MS_Description', + $comment, + 'SCHEMA', + $schemaSQL, + 'TABLE', + $tableSQL, + 'COLUMN', + $columnName + ); + } + + /** + * Returns the SQL snippet for declaring a default constraint. + * + * @internal The method should be only used from within the SQLServerPlatform class hierarchy. + * + * @param string $table Name of the table to return the default constraint declaration for. + * @param mixed[] $column Column definition. + * + * @return string + * + * @throws InvalidArgumentException + */ + public function getDefaultConstraintDeclarationSQL($table, array $column) + { + if (! isset($column['default'])) { + throw new InvalidArgumentException("Incomplete column definition. 'default' required."); + } + + $columnName = new Identifier($column['name']); + + return ' CONSTRAINT ' . + $this->generateDefaultConstraintName($table, $column['name']) . + $this->getDefaultValueDeclarationSQL($column) . + ' FOR ' . $columnName->getQuotedName($this); + } + + /** + * {@inheritDoc} + */ + public function getCreateIndexSQL(Index $index, $table) + { + $constraint = parent::getCreateIndexSQL($index, $table); + + if ($index->isUnique() && ! $index->isPrimary()) { + $constraint = $this->_appendUniqueConstraintDefinition($constraint, $index); + } + + return $constraint; + } + + /** + * {@inheritDoc} + */ + protected function getCreateIndexSQLFlags(Index $index) + { + $type = ''; + if ($index->isUnique()) { + $type .= 'UNIQUE '; + } + + if ($index->hasFlag('clustered')) { + $type .= 'CLUSTERED '; + } elseif ($index->hasFlag('nonclustered')) { + $type .= 'NONCLUSTERED '; + } + + return $type; + } + + /** + * Extend unique key constraint with required filters + * + * @param string $sql + */ + private function _appendUniqueConstraintDefinition($sql, Index $index): string + { + $fields = []; + + foreach ($index->getQuotedColumns($this) as $field) { + $fields[] = $field . ' IS NOT NULL'; + } + + return $sql . ' WHERE ' . implode(' AND ', $fields); + } + + /** + * {@inheritDoc} + */ + public function getAlterTableSQL(TableDiff $diff) + { + $queryParts = []; + $sql = []; + $columnSql = []; + $commentsSql = []; + + foreach ($diff->addedColumns as $column) { + if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { + continue; + } + + $columnDef = $column->toArray(); + $addColumnSql = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); + if (isset($columnDef['default'])) { + $addColumnSql .= ' CONSTRAINT ' . + $this->generateDefaultConstraintName($diff->name, $column->getQuotedName($this)) . + $this->getDefaultValueDeclarationSQL($columnDef); + } + + $queryParts[] = $addColumnSql; + + $comment = $this->getColumnComment($column); + + if (empty($comment) && ! is_numeric($comment)) { + continue; + } + + $commentsSql[] = $this->getCreateColumnCommentSQL( + $diff->name, + $column->getQuotedName($this), + $comment + ); + } + + foreach ($diff->removedColumns as $column) { + if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) { + continue; + } + + $queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this); + } + + foreach ($diff->changedColumns as $columnDiff) { + if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { + continue; + } + + $column = $columnDiff->column; + $comment = $this->getColumnComment($column); + $hasComment = ! empty($comment) || is_numeric($comment); + + if ($columnDiff->fromColumn instanceof Column) { + $fromComment = $this->getColumnComment($columnDiff->fromColumn); + $hasFromComment = ! empty($fromComment) || is_numeric($fromComment); + + if ($hasFromComment && $hasComment && $fromComment !== $comment) { + $commentsSql[] = $this->getAlterColumnCommentSQL( + $diff->name, + $column->getQuotedName($this), + $comment + ); + } elseif ($hasFromComment && ! $hasComment) { + $commentsSql[] = $this->getDropColumnCommentSQL($diff->name, $column->getQuotedName($this)); + } elseif (! $hasFromComment && $hasComment) { + $commentsSql[] = $this->getCreateColumnCommentSQL( + $diff->name, + $column->getQuotedName($this), + $comment + ); + } + } + + // Do not add query part if only comment has changed. + if ($columnDiff->hasChanged('comment') && count($columnDiff->changedProperties) === 1) { + continue; + } + + $requireDropDefaultConstraint = $this->alterColumnRequiresDropDefaultConstraint($columnDiff); + + if ($requireDropDefaultConstraint) { + $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( + $diff->name, + $columnDiff->oldColumnName + ); + } + + $columnDef = $column->toArray(); + + $queryParts[] = 'ALTER COLUMN ' . + $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef); + + if ( + ! isset($columnDef['default']) + || (! $requireDropDefaultConstraint && ! $columnDiff->hasChanged('default')) + ) { + continue; + } + + $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); + } + + foreach ($diff->renamedColumns as $oldColumnName => $column) { + if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { + continue; + } + + $oldColumnName = new Identifier($oldColumnName); + + $sql[] = "sp_rename '" . + $diff->getName($this)->getQuotedName($this) . '.' . $oldColumnName->getQuotedName($this) . + "', '" . $column->getQuotedName($this) . "', 'COLUMN'"; + + // Recreate default constraint with new column name if necessary (for future reference). + if ($column->getDefault() === null) { + continue; + } + + $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( + $diff->name, + $oldColumnName->getQuotedName($this) + ); + $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); + } + + $tableSql = []; + + if ($this->onSchemaAlterTable($diff, $tableSql)) { + return array_merge($tableSql, $columnSql); + } + + foreach ($queryParts as $query) { + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; + } + + $sql = array_merge($sql, $commentsSql); + + $newName = $diff->getNewName(); + + if ($newName !== false) { + $sql[] = "sp_rename '" . $diff->getName($this)->getQuotedName($this) . "', '" . $newName->getName() . "'"; + + /** + * Rename table's default constraints names + * to match the new table name. + * This is necessary to ensure that the default + * constraints can be referenced in future table + * alterations as the table name is encoded in + * default constraints' names. + */ + $sql[] = "DECLARE @sql NVARCHAR(MAX) = N''; " . + "SELECT @sql += N'EXEC sp_rename N''' + dc.name + ''', N''' " . + "+ REPLACE(dc.name, '" . $this->generateIdentifierName($diff->name) . "', " . + "'" . $this->generateIdentifierName($newName->getName()) . "') + ''', ''OBJECT'';' " . + 'FROM sys.default_constraints dc ' . + 'JOIN sys.tables tbl ON dc.parent_object_id = tbl.object_id ' . + "WHERE tbl.name = '" . $newName->getName() . "';" . + 'EXEC sp_executesql @sql'; + } + + $sql = array_merge( + $this->getPreAlterTableIndexForeignKeySQL($diff), + $sql, + $this->getPostAlterTableIndexForeignKeySQL($diff) + ); + + return array_merge($sql, $tableSql, $columnSql); + } + + /** + * Returns the SQL clause for adding a default constraint in an ALTER TABLE statement. + * + * @param string $tableName The name of the table to generate the clause for. + * @param Column $column The column to generate the clause for. + */ + private function getAlterTableAddDefaultConstraintClause($tableName, Column $column): string + { + $columnDef = $column->toArray(); + $columnDef['name'] = $column->getQuotedName($this); + + return 'ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $columnDef); + } + + /** + * Returns the SQL clause for dropping an existing default constraint in an ALTER TABLE statement. + * + * @param string $tableName The name of the table to generate the clause for. + * @param string $columnName The name of the column to generate the clause for. + */ + private function getAlterTableDropDefaultConstraintClause($tableName, $columnName): string + { + return 'DROP CONSTRAINT ' . $this->generateDefaultConstraintName($tableName, $columnName); + } + + /** + * Checks whether a column alteration requires dropping its default constraint first. + * + * Different to other database vendors SQL Server implements column default values + * as constraints and therefore changes in a column's default value as well as changes + * in a column's type require dropping the default constraint first before being to + * alter the particular column to the new definition. + */ + private function alterColumnRequiresDropDefaultConstraint(ColumnDiff $columnDiff): bool + { + // We can only decide whether to drop an existing default constraint + // if we know the original default value. + if (! $columnDiff->fromColumn instanceof Column) { + return false; + } + + // We only need to drop an existing default constraint if we know the + // column was defined with a default value before. + if ($columnDiff->fromColumn->getDefault() === null) { + return false; + } + + // We need to drop an existing default constraint if the column was + // defined with a default value before and it has changed. + if ($columnDiff->hasChanged('default')) { + return true; + } + + // We need to drop an existing default constraint if the column was + // defined with a default value before and the native column type has changed. + return $columnDiff->hasChanged('type') || $columnDiff->hasChanged('fixed'); + } + + /** + * Returns the SQL statement for altering a column comment. + * + * SQL Server does not support native column comments, + * therefore the extended properties functionality is used + * as a workaround to store them. + * The property name used to store column comments is "MS_Description" + * which provides compatibility with SQL Server Management Studio, + * as column comments are stored in the same property there when + * specifying a column's "Description" attribute. + * + * @param string $tableName The quoted table name to which the column belongs. + * @param string $columnName The quoted column name to alter the comment for. + * @param string|null $comment The column's comment. + * + * @return string + */ + protected function getAlterColumnCommentSQL($tableName, $columnName, $comment) + { + if (strpos($tableName, '.') !== false) { + [$schemaSQL, $tableSQL] = explode('.', $tableName); + $schemaSQL = $this->quoteStringLiteral($schemaSQL); + $tableSQL = $this->quoteStringLiteral($tableSQL); + } else { + $schemaSQL = "'dbo'"; + $tableSQL = $this->quoteStringLiteral($tableName); + } + + return $this->getUpdateExtendedPropertySQL( + 'MS_Description', + $comment, + 'SCHEMA', + $schemaSQL, + 'TABLE', + $tableSQL, + 'COLUMN', + $columnName + ); + } + + /** + * Returns the SQL statement for dropping a column comment. + * + * SQL Server does not support native column comments, + * therefore the extended properties functionality is used + * as a workaround to store them. + * The property name used to store column comments is "MS_Description" + * which provides compatibility with SQL Server Management Studio, + * as column comments are stored in the same property there when + * specifying a column's "Description" attribute. + * + * @param string $tableName The quoted table name to which the column belongs. + * @param string $columnName The quoted column name to drop the comment for. + * + * @return string + */ + protected function getDropColumnCommentSQL($tableName, $columnName) + { + if (strpos($tableName, '.') !== false) { + [$schemaSQL, $tableSQL] = explode('.', $tableName); + $schemaSQL = $this->quoteStringLiteral($schemaSQL); + $tableSQL = $this->quoteStringLiteral($tableSQL); + } else { + $schemaSQL = "'dbo'"; + $tableSQL = $this->quoteStringLiteral($tableName); + } + + return $this->getDropExtendedPropertySQL( + 'MS_Description', + 'SCHEMA', + $schemaSQL, + 'TABLE', + $tableSQL, + 'COLUMN', + $columnName + ); + } + + /** + * {@inheritdoc} + */ + protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) + { + return [sprintf( + "EXEC sp_rename N'%s.%s', N'%s', N'INDEX'", + $tableName, + $oldIndexName, + $index->getQuotedName($this) + ), + ]; + } + + /** + * Returns the SQL statement for adding an extended property to a database object. + * + * @internal The method should be only used from within the SQLServerPlatform class hierarchy. + * + * @link http://msdn.microsoft.com/en-us/library/ms180047%28v=sql.90%29.aspx + * + * @param string $name The name of the property to add. + * @param string|null $value The value of the property to add. + * @param string|null $level0Type The type of the object at level 0 the property belongs to. + * @param string|null $level0Name The name of the object at level 0 the property belongs to. + * @param string|null $level1Type The type of the object at level 1 the property belongs to. + * @param string|null $level1Name The name of the object at level 1 the property belongs to. + * @param string|null $level2Type The type of the object at level 2 the property belongs to. + * @param string|null $level2Name The name of the object at level 2 the property belongs to. + * + * @return string + */ + public function getAddExtendedPropertySQL( + $name, + $value = null, + $level0Type = null, + $level0Name = null, + $level1Type = null, + $level1Name = null, + $level2Type = null, + $level2Name = null + ) { + return 'EXEC sp_addextendedproperty ' . + 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . + 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; + } + + /** + * Returns the SQL statement for dropping an extended property from a database object. + * + * @internal The method should be only used from within the SQLServerPlatform class hierarchy. + * + * @link http://technet.microsoft.com/en-gb/library/ms178595%28v=sql.90%29.aspx + * + * @param string $name The name of the property to drop. + * @param string|null $level0Type The type of the object at level 0 the property belongs to. + * @param string|null $level0Name The name of the object at level 0 the property belongs to. + * @param string|null $level1Type The type of the object at level 1 the property belongs to. + * @param string|null $level1Name The name of the object at level 1 the property belongs to. + * @param string|null $level2Type The type of the object at level 2 the property belongs to. + * @param string|null $level2Name The name of the object at level 2 the property belongs to. + * + * @return string + */ + public function getDropExtendedPropertySQL( + $name, + $level0Type = null, + $level0Name = null, + $level1Type = null, + $level1Name = null, + $level2Type = null, + $level2Name = null + ) { + return 'EXEC sp_dropextendedproperty ' . + 'N' . $this->quoteStringLiteral($name) . ', ' . + 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; + } + + /** + * Returns the SQL statement for updating an extended property of a database object. + * + * @internal The method should be only used from within the SQLServerPlatform class hierarchy. + * + * @link http://msdn.microsoft.com/en-us/library/ms186885%28v=sql.90%29.aspx + * + * @param string $name The name of the property to update. + * @param string|null $value The value of the property to update. + * @param string|null $level0Type The type of the object at level 0 the property belongs to. + * @param string|null $level0Name The name of the object at level 0 the property belongs to. + * @param string|null $level1Type The type of the object at level 1 the property belongs to. + * @param string|null $level1Name The name of the object at level 1 the property belongs to. + * @param string|null $level2Type The type of the object at level 2 the property belongs to. + * @param string|null $level2Name The name of the object at level 2 the property belongs to. + * + * @return string + */ + public function getUpdateExtendedPropertySQL( + $name, + $value = null, + $level0Type = null, + $level0Name = null, + $level1Type = null, + $level1Name = null, + $level2Type = null, + $level2Name = null + ) { + return 'EXEC sp_updateextendedproperty ' . + 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . + 'N' . $this->quoteStringLiteral((string) $level0Type) . ', ' . $level0Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level1Type) . ', ' . $level1Name . ', ' . + 'N' . $this->quoteStringLiteral((string) $level2Type) . ', ' . $level2Name; + } + + /** + * {@inheritDoc} + */ + public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) + { + return 'INSERT INTO ' . $quotedTableName . ' DEFAULT VALUES'; + } + + /** + * {@inheritDoc} + */ + public function getListTablesSQL() + { + // "sysdiagrams" table must be ignored as it's internal SQL Server table for Database Diagrams + // Category 2 must be ignored as it is "MS SQL Server 'pseudo-system' object[s]" for replication + return 'SELECT name, SCHEMA_NAME (uid) AS schema_name FROM sysobjects' + . " WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"; + } + + /** + * {@inheritDoc} + */ + public function getListTableColumnsSQL($table, $database = null) + { + return "SELECT col.name, + type.name AS type, + col.max_length AS length, + ~col.is_nullable AS notnull, + def.definition AS [default], + col.scale, + col.precision, + col.is_identity AS autoincrement, + col.collation_name AS collation, + CAST(prop.value AS NVARCHAR(MAX)) AS comment -- CAST avoids driver error for sql_variant type + FROM sys.columns AS col + JOIN sys.types AS type + ON col.user_type_id = type.user_type_id + JOIN sys.objects AS obj + ON col.object_id = obj.object_id + JOIN sys.schemas AS scm + ON obj.schema_id = scm.schema_id + LEFT JOIN sys.default_constraints def + ON col.default_object_id = def.object_id + AND col.object_id = def.parent_object_id + LEFT JOIN sys.extended_properties AS prop + ON obj.object_id = prop.major_id + AND col.column_id = prop.minor_id + AND prop.name = 'MS_Description' + WHERE obj.type = 'U' + AND " . $this->getTableWhereClause($table, 'scm.name', 'obj.name'); + } + + /** + * @param string $table + * @param string|null $database + * + * @return string + */ + public function getListTableForeignKeysSQL($table, $database = null) + { + return 'SELECT f.name AS ForeignKey, + SCHEMA_NAME (f.SCHEMA_ID) AS SchemaName, + OBJECT_NAME (f.parent_object_id) AS TableName, + COL_NAME (fc.parent_object_id,fc.parent_column_id) AS ColumnName, + SCHEMA_NAME (o.SCHEMA_ID) ReferenceSchemaName, + OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName, + COL_NAME(fc.referenced_object_id,fc.referenced_column_id) AS ReferenceColumnName, + f.delete_referential_action_desc, + f.update_referential_action_desc + FROM sys.foreign_keys AS f + INNER JOIN sys.foreign_key_columns AS fc + INNER JOIN sys.objects AS o ON o.OBJECT_ID = fc.referenced_object_id + ON f.OBJECT_ID = fc.constraint_object_id + WHERE ' . + $this->getTableWhereClause($table, 'SCHEMA_NAME (f.schema_id)', 'OBJECT_NAME (f.parent_object_id)') . + ' ORDER BY fc.constraint_column_id'; + } + + /** + * {@inheritDoc} + */ + public function getListTableIndexesSQL($table, $database = null) + { + return "SELECT idx.name AS key_name, + col.name AS column_name, + ~idx.is_unique AS non_unique, + idx.is_primary_key AS [primary], + CASE idx.type + WHEN '1' THEN 'clustered' + WHEN '2' THEN 'nonclustered' + ELSE NULL + END AS flags + FROM sys.tables AS tbl + JOIN sys.schemas AS scm ON tbl.schema_id = scm.schema_id + JOIN sys.indexes AS idx ON tbl.object_id = idx.object_id + JOIN sys.index_columns AS idxcol ON idx.object_id = idxcol.object_id AND idx.index_id = idxcol.index_id + JOIN sys.columns AS col ON idxcol.object_id = col.object_id AND idxcol.column_id = col.column_id + WHERE " . $this->getTableWhereClause($table, 'scm.name', 'tbl.name') . ' + ORDER BY idx.index_id ASC, idxcol.key_ordinal ASC'; + } + + /** + * {@inheritDoc} + */ + public function getListViewsSQL($database) + { + return "SELECT name, definition FROM sysobjects + INNER JOIN sys.sql_modules ON sysobjects.id = sys.sql_modules.object_id + WHERE type = 'V' ORDER BY name"; + } + + /** + * Returns the where clause to filter schema and table name in a query. + * + * @param string $table The full qualified name of the table. + * @param string $schemaColumn The name of the column to compare the schema to in the where clause. + * @param string $tableColumn The name of the column to compare the table to in the where clause. + */ + private function getTableWhereClause($table, $schemaColumn, $tableColumn): string + { + if (strpos($table, '.') !== false) { + [$schema, $table] = explode('.', $table); + $schema = $this->quoteStringLiteral($schema); + $table = $this->quoteStringLiteral($table); + } else { + $schema = 'SCHEMA_NAME()'; + $table = $this->quoteStringLiteral($table); + } + + return sprintf('(%s = %s AND %s = %s)', $tableColumn, $table, $schemaColumn, $schema); + } + + /** + * {@inheritDoc} + */ + public function getLocateExpression($str, $substr, $startPos = false) + { + if ($startPos === false) { + return 'CHARINDEX(' . $substr . ', ' . $str . ')'; + } + + return 'CHARINDEX(' . $substr . ', ' . $str . ', ' . $startPos . ')'; + } + + /** + * {@inheritDoc} + */ + public function getModExpression($expression1, $expression2) + { + return $expression1 . ' % ' . $expression2; + } + + /** + * {@inheritDoc} + */ + public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) + { + if ($char === false) { + switch ($mode) { + case TrimMode::LEADING: + $trimFn = 'LTRIM'; + break; + + case TrimMode::TRAILING: + $trimFn = 'RTRIM'; + break; + + default: + return 'LTRIM(RTRIM(' . $str . '))'; + } + + return $trimFn . '(' . $str . ')'; + } + + $pattern = "'%[^' + " . $char . " + ']%'"; + + if ($mode === TrimMode::LEADING) { + return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)'; + } + + if ($mode === TrimMode::TRAILING) { + return 'reverse(stuff(reverse(' . $str . '), 1, ' + . 'patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))'; + } + + return 'reverse(stuff(reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)), 1, ' + . 'patindex(' . $pattern . ', reverse(stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str + . ') - 1, null))) - 1, null))'; + } + + /** + * {@inheritDoc} + */ + public function getConcatExpression() + { + return sprintf('CONCAT(%s)', implode(', ', func_get_args())); + } + + /** + * {@inheritDoc} + */ + public function getListDatabasesSQL() + { + return 'SELECT * FROM sys.databases'; + } + + /** + * {@inheritDoc} + * + * @deprecated Use {@see SQLServerSchemaManager::listSchemaNames()} instead. + */ + public function getListNamespacesSQL() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4503', + 'SQLServerPlatform::getListNamespacesSQL() is deprecated,' + . ' use SQLServerSchemaManager::listSchemaNames() instead.' + ); + + return "SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"; + } + + /** + * {@inheritDoc} + */ + public function getSubstringExpression($string, $start, $length = null) + { + if ($length !== null) { + return 'SUBSTRING(' . $string . ', ' . $start . ', ' . $length . ')'; + } + + return 'SUBSTRING(' . $string . ', ' . $start . ', LEN(' . $string . ') - ' . $start . ' + 1)'; + } + + /** + * {@inheritDoc} + */ + public function getLengthExpression($column) + { + return 'LEN(' . $column . ')'; + } + + public function getCurrentDatabaseExpression(): string + { + return 'DB_NAME()'; + } + + /** + * {@inheritDoc} + */ + public function getSetTransactionIsolationSQL($level) + { + return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); + } + + /** + * {@inheritDoc} + */ + public function getIntegerTypeDeclarationSQL(array $column) + { + return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritDoc} + */ + public function getBigIntTypeDeclarationSQL(array $column) + { + return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritDoc} + */ + public function getSmallIntTypeDeclarationSQL(array $column) + { + return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column); + } + + /** + * {@inheritDoc} + */ + public function getGuidTypeDeclarationSQL(array $column) + { + return 'UNIQUEIDENTIFIER'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTzTypeDeclarationSQL(array $column) + { + return 'DATETIMEOFFSET(6)'; + } + + /** + * {@inheritDoc} + */ + public function getAsciiStringTypeDeclarationSQL(array $column): string + { + $length = $column['length'] ?? null; + + if (! isset($column['fixed'])) { + return sprintf('VARCHAR(%d)', $length ?? 255); + } + + return sprintf('CHAR(%d)', $length ?? 255); + } + + /** + * {@inheritDoc} + */ + protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) + { + return $fixed + ? ($length > 0 ? 'NCHAR(' . $length . ')' : 'CHAR(255)') + : ($length > 0 ? 'NVARCHAR(' . $length . ')' : 'NVARCHAR(255)'); + } + + /** + * {@inheritdoc} + */ + protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) + { + return $fixed + ? 'BINARY(' . ($length > 0 ? $length : 255) . ')' + : 'VARBINARY(' . ($length > 0 ? $length : 255) . ')'; + } + + /** + * {@inheritdoc} + */ + public function getBinaryMaxLength() + { + return 8000; + } + + /** + * {@inheritDoc} + */ + public function getClobTypeDeclarationSQL(array $column) + { + return 'VARCHAR(MAX)'; + } + + /** + * {@inheritDoc} + */ + protected function _getCommonIntegerTypeDeclarationSQL(array $column) + { + return ! empty($column['autoincrement']) ? ' IDENTITY' : ''; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTypeDeclarationSQL(array $column) + { + // 3 - microseconds precision length + // http://msdn.microsoft.com/en-us/library/ms187819.aspx + return 'DATETIME2(6)'; + } + + /** + * {@inheritDoc} + */ + public function getDateTypeDeclarationSQL(array $column) + { + return 'DATE'; + } + + /** + * {@inheritDoc} + */ + public function getTimeTypeDeclarationSQL(array $column) + { + return 'TIME(0)'; + } + + /** + * {@inheritDoc} + */ + public function getBooleanTypeDeclarationSQL(array $column) + { + return 'BIT'; + } + + /** + * {@inheritDoc} + */ + protected function doModifyLimitQuery($query, $limit, $offset) + { + if ($limit === null && $offset <= 0) { + return $query; + } + + if ($this->shouldAddOrderBy($query)) { + if (preg_match('/^SELECT\s+DISTINCT/im', $query) > 0) { + // SQL Server won't let us order by a non-selected column in a DISTINCT query, + // so we have to do this madness. This says, order by the first column in the + // result. SQL Server's docs say that a nonordered query's result order is non- + // deterministic anyway, so this won't do anything that a bunch of update and + // deletes to the table wouldn't do anyway. + $query .= ' ORDER BY 1'; + } else { + // In another DBMS, we could do ORDER BY 0, but SQL Server gets angry if you + // use constant expressions in the order by list. + $query .= ' ORDER BY (SELECT 0)'; + } + } + + // This looks somewhat like MYSQL, but limit/offset are in inverse positions + // Supposedly SQL:2008 core standard. + // Per TSQL spec, FETCH NEXT n ROWS ONLY is not valid without OFFSET n ROWS. + $query .= sprintf(' OFFSET %d ROWS', $offset); + + if ($limit !== null) { + $query .= sprintf(' FETCH NEXT %d ROWS ONLY', $limit); + } + + return $query; + } + + /** + * {@inheritDoc} + */ + public function convertBooleans($item) + { + if (is_array($item)) { + foreach ($item as $key => $value) { + if (! is_bool($value) && ! is_numeric($value)) { + continue; + } + + $item[$key] = (int) (bool) $value; + } + } elseif (is_bool($item) || is_numeric($item)) { + $item = (int) (bool) $item; + } + + return $item; + } + + /** + * {@inheritDoc} + */ + public function getCreateTemporaryTableSnippetSQL() + { + return 'CREATE TABLE'; + } + + /** + * {@inheritDoc} + */ + public function getTemporaryTableName($tableName) + { + return '#' . $tableName; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeFormatString() + { + return 'Y-m-d H:i:s.u'; + } + + /** + * {@inheritDoc} + */ + public function getDateFormatString() + { + return 'Y-m-d'; + } + + /** + * {@inheritDoc} + */ + public function getTimeFormatString() + { + return 'H:i:s'; + } + + /** + * {@inheritDoc} + */ + public function getDateTimeTzFormatString() + { + return 'Y-m-d H:i:s.u P'; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'mssql'; + } + + /** + * {@inheritDoc} + */ + protected function initializeDoctrineTypeMappings() + { + $this->doctrineTypeMapping = [ + 'bigint' => 'bigint', + 'binary' => 'binary', + 'bit' => 'boolean', + 'blob' => 'blob', + 'char' => 'string', + 'date' => 'date', + 'datetime' => 'datetime', + 'datetime2' => 'datetime', + 'datetimeoffset' => 'datetimetz', + 'decimal' => 'decimal', + 'double' => 'float', + 'double precision' => 'float', + 'float' => 'float', + 'image' => 'blob', + 'int' => 'integer', + 'money' => 'integer', + 'nchar' => 'string', + 'ntext' => 'text', + 'numeric' => 'decimal', + 'nvarchar' => 'string', + 'real' => 'float', + 'smalldatetime' => 'datetime', + 'smallint' => 'smallint', + 'smallmoney' => 'integer', + 'text' => 'text', + 'time' => 'time', + 'tinyint' => 'smallint', + 'uniqueidentifier' => 'guid', + 'varbinary' => 'binary', + 'varchar' => 'string', + ]; + } + + /** + * {@inheritDoc} + */ + public function createSavePoint($savepoint) + { + return 'SAVE TRANSACTION ' . $savepoint; + } + + /** + * {@inheritDoc} + */ + public function releaseSavePoint($savepoint) + { + return ''; + } + + /** + * {@inheritDoc} + */ + public function rollbackSavePoint($savepoint) + { + return 'ROLLBACK TRANSACTION ' . $savepoint; + } + + /** + * {@inheritdoc} + */ + public function getForeignKeyReferentialActionSQL($action) + { + // RESTRICT is not supported, therefore falling back to NO ACTION. + if (strtoupper($action) === 'RESTRICT') { + return 'NO ACTION'; + } + + return parent::getForeignKeyReferentialActionSQL($action); + } + + public function appendLockHint(string $fromClause, int $lockMode): string + { + switch ($lockMode) { + case LockMode::NONE: + case LockMode::OPTIMISTIC: + return $fromClause; + + case LockMode::PESSIMISTIC_READ: + return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)'; + + case LockMode::PESSIMISTIC_WRITE: + return $fromClause . ' WITH (UPDLOCK, ROWLOCK)'; + + default: + throw InvalidLockMode::fromLockMode($lockMode); + } + } + + /** + * {@inheritDoc} + */ + public function getForUpdateSQL() + { + return ' '; + } + + /** + * {@inheritDoc} + * + * @deprecated Implement {@see createReservedKeywordsList()} instead. + */ + protected function getReservedKeywordsClass() + { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4510', + 'SQLServerPlatform::getReservedKeywordsClass() is deprecated,' + . ' use SQLServerPlatform::createReservedKeywordsList() instead.' + ); + + return Keywords\SQLServer2012Keywords::class; + } + + /** + * {@inheritDoc} + */ + public function quoteSingleIdentifier($str) + { + return '[' . str_replace(']', ']]', $str) . ']'; + } + + /** + * {@inheritDoc} + */ + public function getTruncateTableSQL($tableName, $cascade = false) + { + $tableIdentifier = new Identifier($tableName); + + return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this); + } + + /** + * {@inheritDoc} + */ + public function getBlobTypeDeclarationSQL(array $column) + { + return 'VARBINARY(MAX)'; + } + + /** + * {@inheritdoc} + * + * Modifies column declaration order as it differs in Microsoft SQL Server. + */ + public function getColumnDeclarationSQL($name, array $column) + { + if (isset($column['columnDefinition'])) { + $columnDef = $this->getCustomTypeDeclarationSQL($column); + } else { + $collation = ! empty($column['collation']) ? + ' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : ''; + + $notnull = ! empty($column['notnull']) ? ' NOT NULL' : ''; + + $unique = ! empty($column['unique']) ? + ' ' . $this->getUniqueFieldDeclarationSQL() : ''; + + $check = ! empty($column['check']) ? + ' ' . $column['check'] : ''; + + $typeDecl = $column['type']->getSQLDeclaration($column, $this); + $columnDef = $typeDecl . $collation . $notnull . $unique . $check; + } + + return $name . ' ' . $columnDef; + } + + public function columnsEqual(Column $column1, Column $column2): bool + { + if (! parent::columnsEqual($column1, $column2)) { + return false; + } + + return $this->getDefaultValueDeclarationSQL($column1->toArray()) + === $this->getDefaultValueDeclarationSQL($column2->toArray()); + } + + protected function getLikeWildcardCharacters(): string + { + return parent::getLikeWildcardCharacters() . '[]^'; + } + + /** + * Returns a unique default constraint name for a table and column. + * + * @param string $table Name of the table to generate the unique default constraint name for. + * @param string $column Name of the column in the table to generate the unique default constraint name for. + */ + private function generateDefaultConstraintName($table, $column): string + { + return 'DF_' . $this->generateIdentifierName($table) . '_' . $this->generateIdentifierName($column); + } + + /** + * Returns a hash value for a given identifier. + * + * @param string $identifier Identifier to generate a hash value for. + */ + private function generateIdentifierName($identifier): string + { + // Always generate name for unquoted identifiers to ensure consistency. + $identifier = new Identifier($identifier); + + return strtoupper(dechex(crc32($identifier->getName()))); + } + + protected function getCommentOnTableSQL(string $tableName, ?string $comment): string + { + return sprintf( + <<<'SQL' + EXEC sys.sp_addextendedproperty @name=N'MS_Description', + @value=N%s, @level0type=N'SCHEMA', @level0name=N'dbo', + @level1type=N'TABLE', @level1name=N%s + SQL + , + $this->quoteStringLiteral((string) $comment), + $this->quoteStringLiteral($tableName) + ); + } + + public function getListTableMetadataSQL(string $table): string + { + return sprintf( + <<<'SQL' + SELECT + p.value AS [table_comment] + FROM + sys.tables AS tbl + INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1 + WHERE + (tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description') + SQL + , + $this->quoteStringLiteral($table) + ); + } + + /** + * @param string $query + */ + private function shouldAddOrderBy($query): bool + { + // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement + // but can be in a newline + $matches = []; + $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE); + if ($matchesCount === 0) { + return true; + } + + // ORDER BY instance may be in a subquery after ORDER BY + // e.g. SELECT col1 FROM test ORDER BY (SELECT col2 from test ORDER BY col2) + // if in the searched query ORDER BY clause was found where + // number of open parentheses after the occurrence of the clause is equal to + // number of closed brackets after the occurrence of the clause, + // it means that ORDER BY is included in the query being checked + while ($matchesCount > 0) { + $orderByPos = $matches[0][--$matchesCount][1]; + $openBracketsCount = substr_count($query, '(', $orderByPos); + $closedBracketsCount = substr_count($query, ')', $orderByPos); + if ($openBracketsCount === $closedBracketsCount) { + return false; + } + } + + return true; + } +} diff --git a/doctrine/dbal/src/Platforms/SQLite/Comparator.php b/doctrine/dbal/src/Platforms/SQLite/Comparator.php new file mode 100644 index 000000000..d27ee86d7 --- /dev/null +++ b/doctrine/dbal/src/Platforms/SQLite/Comparator.php @@ -0,0 +1,53 @@ +normalizeColumns($fromTable); + $this->normalizeColumns($toTable); + + return parent::diffTable($fromTable, $toTable); + } + + private function normalizeColumns(Table $table): void + { + foreach ($table->getColumns() as $column) { + $options = $column->getPlatformOptions(); + + if (! isset($options['collation']) || strcasecmp($options['collation'], 'binary') !== 0) { + continue; + } + + unset($options['collation']); + $column->setPlatformOptions($options); + } + } +} diff --git a/doctrine/dbal/src/Platforms/SqlitePlatform.php b/doctrine/dbal/src/Platforms/SqlitePlatform.php index 168182610..6d5adda49 100644 --- a/doctrine/dbal/src/Platforms/SqlitePlatform.php +++ b/doctrine/dbal/src/Platforms/SqlitePlatform.php @@ -2,6 +2,7 @@ namespace Doctrine\DBAL\Platforms; +use Doctrine\DBAL\Driver\API\SQLite\UserDefinedFunctions; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Constraint; @@ -27,7 +28,6 @@ use function sqrt; use function str_replace; use function strlen; -use function strpos; use function strtolower; use function trim; @@ -48,12 +48,20 @@ public function getRegexpExpression() } /** + * @deprecated Generate dates within the application. + * * @param string $type * * @return string */ public function getNowExpression($type = 'timestamp') { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4753', + 'SqlitePlatform::getNowExpression() is deprecated. Generate dates within the application.' + ); + switch ($type) { case 'time': return 'time(\'now\')'; @@ -197,9 +205,17 @@ public function getSetTransactionIsolationSQL($level) /** * {@inheritDoc} + * + * @deprecated */ public function prefersIdentityColumns() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pulls/1519', + 'SqlitePlatform::prefersIdentityColumns() is deprecated.' + ); + return true; } @@ -495,22 +511,6 @@ public function getListViewsSQL($database) return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL"; } - /** - * {@inheritDoc} - */ - public function getCreateViewSQL($name, $sql) - { - return 'CREATE VIEW ' . $name . ' AS ' . $sql; - } - - /** - * {@inheritDoc} - */ - public function getDropViewSQL($name) - { - return 'DROP VIEW ' . $name; - } - /** * {@inheritDoc} */ @@ -534,6 +534,14 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey return $query; } + /** + * {@inheritDoc} + */ + public function supportsCreateDropDatabase() + { + return false; + } + /** * {@inheritDoc} */ @@ -563,6 +571,12 @@ public function supportsInlineColumnComments() */ public function getName() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4749', + 'SqlitePlatform::getName() is deprecated. Identify platforms by their class.' + ); + return 'sqlite'; } @@ -580,6 +594,8 @@ public function getTruncateTableSQL($tableName, $cascade = false) /** * User-defined function for Sqlite that is used with PDO::sqliteCreateFunction(). * + * @deprecated The driver will use {@see sqrt()} in the next major release. + * * @param int|float $value * * @return float @@ -592,6 +608,8 @@ public static function udfSqrt($value) /** * User-defined function for Sqlite that implements MOD(a, b). * + * @deprecated The driver will use {@see UserDefinedFunctions::mod()} in the next major release. + * * @param int $a * @param int $b * @@ -599,10 +617,12 @@ public static function udfSqrt($value) */ public static function udfMod($a, $b) { - return $a % $b; + return UserDefinedFunctions::mod($a, $b); } /** + * @deprecated The driver will use {@see UserDefinedFunctions::locate()} in the next major release. + * * @param string $str * @param string $substr * @param int $offset @@ -611,19 +631,7 @@ public static function udfMod($a, $b) */ public static function udfLocate($str, $substr, $offset = 0) { - // SQL's LOCATE function works on 1-based positions, while PHP's strpos works on 0-based positions. - // So we have to make them compatible if an offset is given. - if ($offset > 0) { - $offset -= 1; - } - - $pos = strpos($str, $substr, $offset); - - if ($pos !== false) { - return $pos + 1; - } - - return 0; + return UserDefinedFunctions::locate($str, $substr, $offset); } /** @@ -691,7 +699,7 @@ protected function initializeDoctrineTypeMappings() /** * {@inheritDoc} * - * @deprecated Implement {@link createReservedKeywordsList()} instead. + * @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass() { @@ -765,7 +773,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) protected function doModifyLimitQuery($query, $limit, $offset) { if ($limit === null && $offset > 0) { - return $query . ' LIMIT -1 OFFSET ' . $offset; + return sprintf('%s LIMIT -1 OFFSET %d', $query, $offset); } return parent::doModifyLimitQuery($query, $limit, $offset); @@ -792,6 +800,8 @@ public function getTemporaryTableName($tableName) /** * {@inheritDoc} * + * @deprecated + * * Sqlite Platform emulates schema by underscoring each dot and generating tables * into the default database. * @@ -800,6 +810,12 @@ public function getTemporaryTableName($tableName) */ public function canEmulateSchemas() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4805', + 'SqlitePlatform::canEmulateSchemas() is deprecated.' + ); + return true; } @@ -837,6 +853,8 @@ public function getDropForeignKeySQL($foreignKey, $table) /** * {@inheritDoc} + * + * @deprecated */ public function getCreateConstraintSQL(Constraint $constraint, $table) { @@ -1130,7 +1148,7 @@ private function getSimpleAlterTableSQL(TableDiff $diff) /** * @return string[] */ - private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable) + private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable): array { $columns = []; @@ -1170,7 +1188,7 @@ private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable) /** * @return Index[] */ - private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable) + private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): array { $indexes = $fromTable->getIndexes(); $columnNames = $this->getColumnNamesInAlteredTable($diff, $fromTable); @@ -1238,7 +1256,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable) /** * @return ForeignKeyConstraint[] */ - private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) + private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable): array { $foreignKeys = $fromTable->getForeignKeys(); $columnNames = $this->getColumnNamesInAlteredTable($diff, $fromTable); @@ -1302,7 +1320,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) /** * @return Index[] */ - private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $fromTable) + private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $fromTable): array { $primaryIndex = []; diff --git a/doctrine/dbal/src/Portability/Connection.php b/doctrine/dbal/src/Portability/Connection.php index a56397924..a22ab92ff 100644 --- a/doctrine/dbal/src/Portability/Connection.php +++ b/doctrine/dbal/src/Portability/Connection.php @@ -3,14 +3,14 @@ namespace Doctrine\DBAL\Portability; use Doctrine\DBAL\Driver\Connection as ConnectionInterface; +use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware; use Doctrine\DBAL\Driver\Result as DriverResult; use Doctrine\DBAL\Driver\Statement as DriverStatement; -use Doctrine\DBAL\ParameterType; /** * Portability wrapper for a Connection. */ -final class Connection implements ConnectionInterface +final class Connection extends AbstractConnectionMiddleware { public const PORTABILITY_ALL = 255; public const PORTABILITY_NONE = 0; @@ -18,22 +18,20 @@ final class Connection implements ConnectionInterface public const PORTABILITY_EMPTY_TO_NULL = 4; public const PORTABILITY_FIX_CASE = 8; - /** @var ConnectionInterface */ - private $connection; - /** @var Converter */ private $converter; public function __construct(ConnectionInterface $connection, Converter $converter) { - $this->connection = $connection; - $this->converter = $converter; + parent::__construct($connection); + + $this->converter = $converter; } public function prepare(string $sql): DriverStatement { return new Statement( - $this->connection->prepare($sql), + parent::prepare($sql), $this->converter ); } @@ -41,53 +39,8 @@ public function prepare(string $sql): DriverStatement public function query(string $sql): DriverResult { return new Result( - $this->connection->query($sql), + parent::query($sql), $this->converter ); } - - /** - * {@inheritDoc} - */ - public function quote($value, $type = ParameterType::STRING) - { - return $this->connection->quote($value, $type); - } - - public function exec(string $sql): int - { - return $this->connection->exec($sql); - } - - /** - * {@inheritDoc} - */ - public function lastInsertId($name = null) - { - return $this->connection->lastInsertId($name); - } - - /** - * {@inheritDoc} - */ - public function beginTransaction() - { - return $this->connection->beginTransaction(); - } - - /** - * {@inheritDoc} - */ - public function commit() - { - return $this->connection->commit(); - } - - /** - * {@inheritDoc} - */ - public function rollBack() - { - return $this->connection->rollBack(); - } } diff --git a/doctrine/dbal/src/Portability/Converter.php b/doctrine/dbal/src/Portability/Converter.php index 5763c2603..eb76eb782 100644 --- a/doctrine/dbal/src/Portability/Converter.php +++ b/doctrine/dbal/src/Portability/Converter.php @@ -34,7 +34,7 @@ final class Converter * @param bool $convertEmptyStringToNull Whether each empty string should be converted to NULL * @param bool $rightTrimString Whether each string should right-trimmed * @param int|null $case Convert the case of the column names - * (one of {@link CASE_LOWER} and {@link CASE_UPPER}) + * (one of {@see CASE_LOWER} and {@see CASE_UPPER}) */ public function __construct(bool $convertEmptyStringToNull, bool $rightTrimString, ?int $case) { diff --git a/doctrine/dbal/src/Portability/Driver.php b/doctrine/dbal/src/Portability/Driver.php index 5ae410cd0..6d4484f9f 100644 --- a/doctrine/dbal/src/Portability/Driver.php +++ b/doctrine/dbal/src/Portability/Driver.php @@ -3,20 +3,18 @@ namespace Doctrine\DBAL\Portability; use Doctrine\DBAL\ColumnCase; -use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\DBAL\Driver as DriverInterface; -use Doctrine\DBAL\Driver\API\ExceptionConverter; -use Doctrine\DBAL\Driver\PDO; -use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; +use LogicException; +use PDO; + +use function method_exists; use const CASE_LOWER; use const CASE_UPPER; -final class Driver implements DriverInterface +final class Driver extends AbstractDriverMiddleware { - /** @var DriverInterface */ - private $driver; - /** @var int */ private $mode; @@ -25,9 +23,10 @@ final class Driver implements DriverInterface public function __construct(DriverInterface $driver, int $mode, int $case) { - $this->driver = $driver; - $this->mode = $mode; - $this->case = $case; + parent::__construct($driver); + + $this->mode = $mode; + $this->case = $case; } /** @@ -35,20 +34,27 @@ public function __construct(DriverInterface $driver, int $mode, int $case) */ public function connect(array $params) { - $connection = $this->driver->connect($params); + $connection = parent::connect($params); $portability = (new OptimizeFlags())( $this->getDatabasePlatform(), $this->mode ); - $case = 0; + $case = null; if ($this->case !== 0 && ($portability & Connection::PORTABILITY_FIX_CASE) !== 0) { - if ($connection instanceof PDO\Connection) { - // make use of c-level support for case handling + $nativeConnection = null; + if (method_exists($connection, 'getNativeConnection')) { + try { + $nativeConnection = $connection->getNativeConnection(); + } catch (LogicException $e) { + } + } + + if ($nativeConnection instanceof PDO) { $portability &= ~Connection::PORTABILITY_FIX_CASE; - $connection->getWrappedConnection()->setAttribute(\PDO::ATTR_CASE, $this->case); + $nativeConnection->setAttribute(PDO::ATTR_CASE, $this->case); } else { $case = $this->case === ColumnCase::LOWER ? CASE_LOWER : CASE_UPPER; } @@ -57,7 +63,7 @@ public function connect(array $params) $convertEmptyStringToNull = ($portability & Connection::PORTABILITY_EMPTY_TO_NULL) !== 0; $rightTrimString = ($portability & Connection::PORTABILITY_RTRIM) !== 0; - if (! $convertEmptyStringToNull && ! $rightTrimString && $case === 0) { + if (! $convertEmptyStringToNull && ! $rightTrimString && $case === null) { return $connection; } @@ -66,25 +72,4 @@ public function connect(array $params) new Converter($convertEmptyStringToNull, $rightTrimString, $case) ); } - - /** - * {@inheritDoc} - */ - public function getDatabasePlatform() - { - return $this->driver->getDatabasePlatform(); - } - - /** - * {@inheritDoc} - */ - public function getSchemaManager(DBALConnection $conn, AbstractPlatform $platform) - { - return $this->driver->getSchemaManager($conn, $platform); - } - - public function getExceptionConverter(): ExceptionConverter - { - return $this->driver->getExceptionConverter(); - } } diff --git a/doctrine/dbal/src/Portability/OptimizeFlags.php b/doctrine/dbal/src/Portability/OptimizeFlags.php index 742eb93fb..13367c92a 100644 --- a/doctrine/dbal/src/Portability/OptimizeFlags.php +++ b/doctrine/dbal/src/Portability/OptimizeFlags.php @@ -7,9 +7,9 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\OraclePlatform; -use Doctrine\DBAL\Platforms\PostgreSQL94Platform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; -use Doctrine\DBAL\Platforms\SQLServer2012Platform; +use Doctrine\DBAL\Platforms\SQLServerPlatform; final class OptimizeFlags { @@ -20,11 +20,11 @@ final class OptimizeFlags * @var array */ private static $platforms = [ - DB2Platform::class => 0, - OraclePlatform::class => Connection::PORTABILITY_EMPTY_TO_NULL, - PostgreSQL94Platform::class => 0, - SqlitePlatform::class => 0, - SQLServer2012Platform::class => 0, + DB2Platform::class => 0, + OraclePlatform::class => Connection::PORTABILITY_EMPTY_TO_NULL, + PostgreSQLPlatform::class => 0, + SqlitePlatform::class => 0, + SQLServerPlatform::class => 0, ]; public function __invoke(AbstractPlatform $platform, int $flags): int diff --git a/doctrine/dbal/src/Portability/Result.php b/doctrine/dbal/src/Portability/Result.php index 1fa91ab48..d8440b663 100644 --- a/doctrine/dbal/src/Portability/Result.php +++ b/doctrine/dbal/src/Portability/Result.php @@ -4,13 +4,11 @@ namespace Doctrine\DBAL\Portability; +use Doctrine\DBAL\Driver\Middleware\AbstractResultMiddleware; use Doctrine\DBAL\Driver\Result as ResultInterface; -final class Result implements ResultInterface +final class Result extends AbstractResultMiddleware { - /** @var ResultInterface */ - private $result; - /** @var Converter */ private $converter; @@ -19,7 +17,8 @@ final class Result implements ResultInterface */ public function __construct(ResultInterface $result, Converter $converter) { - $this->result = $result; + parent::__construct($result); + $this->converter = $converter; } @@ -29,7 +28,7 @@ public function __construct(ResultInterface $result, Converter $converter) public function fetchNumeric() { return $this->converter->convertNumeric( - $this->result->fetchNumeric() + parent::fetchNumeric() ); } @@ -39,7 +38,7 @@ public function fetchNumeric() public function fetchAssociative() { return $this->converter->convertAssociative( - $this->result->fetchAssociative() + parent::fetchAssociative() ); } @@ -49,7 +48,7 @@ public function fetchAssociative() public function fetchOne() { return $this->converter->convertOne( - $this->result->fetchOne() + parent::fetchOne() ); } @@ -59,7 +58,7 @@ public function fetchOne() public function fetchAllNumeric(): array { return $this->converter->convertAllNumeric( - $this->result->fetchAllNumeric() + parent::fetchAllNumeric() ); } @@ -69,7 +68,7 @@ public function fetchAllNumeric(): array public function fetchAllAssociative(): array { return $this->converter->convertAllAssociative( - $this->result->fetchAllAssociative() + parent::fetchAllAssociative() ); } @@ -79,22 +78,7 @@ public function fetchAllAssociative(): array public function fetchFirstColumn(): array { return $this->converter->convertFirstColumn( - $this->result->fetchFirstColumn() + parent::fetchFirstColumn() ); } - - public function rowCount(): int - { - return $this->result->rowCount(); - } - - public function columnCount(): int - { - return $this->result->columnCount(); - } - - public function free(): void - { - $this->result->free(); - } } diff --git a/doctrine/dbal/src/Portability/Statement.php b/doctrine/dbal/src/Portability/Statement.php index f3f94e413..b104cf78a 100644 --- a/doctrine/dbal/src/Portability/Statement.php +++ b/doctrine/dbal/src/Portability/Statement.php @@ -2,18 +2,15 @@ namespace Doctrine\DBAL\Portability; +use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware; use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\Statement as DriverStatement; -use Doctrine\DBAL\ParameterType; /** * Portability wrapper for a Statement. */ -final class Statement implements DriverStatement +final class Statement extends AbstractStatementMiddleware { - /** @var DriverStatement */ - private $stmt; - /** @var Converter */ private $converter; @@ -22,24 +19,9 @@ final class Statement implements DriverStatement */ public function __construct(DriverStatement $stmt, Converter $converter) { - $this->stmt = $stmt; - $this->converter = $converter; - } - - /** - * {@inheritdoc} - */ - public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null) - { - return $this->stmt->bindParam($param, $variable, $type, $length); - } + parent::__construct($stmt); - /** - * {@inheritdoc} - */ - public function bindValue($param, $value, $type = ParameterType::STRING) - { - return $this->stmt->bindValue($param, $value, $type); + $this->converter = $converter; } /** @@ -48,7 +30,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) public function execute($params = null): ResultInterface { return new Result( - $this->stmt->execute($params), + parent::execute($params), $this->converter ); } diff --git a/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php b/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php index 8cb531503..1ce11b7b9 100644 --- a/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php +++ b/doctrine/dbal/src/Query/Expression/ExpressionBuilder.php @@ -308,7 +308,10 @@ public function notIn($x, $y) } /** - * Quotes a given input parameter. + * Builds an SQL literal from a given input parameter. + * + * The usage of this method is discouraged. Use prepared statements + * or {@see AbstractPlatform::quoteStringLiteral()} instead. * * @param mixed $input The parameter to be quoted. * @param int|null $type The type of the parameter. diff --git a/doctrine/dbal/src/Query/QueryBuilder.php b/doctrine/dbal/src/Query/QueryBuilder.php index 6d74d0105..d256b74a6 100644 --- a/doctrine/dbal/src/Query/QueryBuilder.php +++ b/doctrine/dbal/src/Query/QueryBuilder.php @@ -327,9 +327,9 @@ public function executeStatement(): int /** * Executes this query using the bound parameters and their types. * - * @deprecated Use {@link executeQuery()} or {@link executeStatement()} instead. + * @deprecated Use {@see executeQuery()} or {@see executeStatement()} instead. * - * @return Result|int + * @return Result|int|string * * @throws Exception */ @@ -1315,11 +1315,9 @@ public function resetQueryPart($queryPartName) } /** - * @return string - * * @throws QueryException */ - private function getSQLForSelect() + private function getSQLForSelect(): string { $query = 'SELECT ' . ($this->sqlParts['distinct'] ? 'DISTINCT ' : '') . implode(', ', $this->sqlParts['select']); @@ -1346,7 +1344,7 @@ private function getSQLForSelect() * * @throws QueryException */ - private function getFromClauses() + private function getFromClauses(): array { $fromClauses = []; $knownAliases = []; @@ -1385,20 +1383,15 @@ private function verifyAllAliasesAreKnown(array $knownAliases): void } } - /** - * @return bool - */ - private function isLimitQuery() + private function isLimitQuery(): bool { return $this->maxResults !== null || $this->firstResult !== 0; } /** * Converts this instance into an INSERT string in SQL. - * - * @return string */ - private function getSQLForInsert() + private function getSQLForInsert(): string { return 'INSERT INTO ' . $this->sqlParts['from']['table'] . ' (' . implode(', ', array_keys($this->sqlParts['values'])) . ')' . @@ -1407,10 +1400,8 @@ private function getSQLForInsert() /** * Converts this instance into an UPDATE string in SQL. - * - * @return string */ - private function getSQLForUpdate() + private function getSQLForUpdate(): string { $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); @@ -1422,10 +1413,8 @@ private function getSQLForUpdate() /** * Converts this instance into a DELETE string in SQL. - * - * @return string */ - private function getSQLForDelete() + private function getSQLForDelete(): string { $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); @@ -1448,18 +1437,18 @@ public function __toString() /** * Creates a new named parameter and bind the value $value to it. * - * This method provides a shortcut for {@link Statement::bindValue()} + * This method provides a shortcut for {@see Statement::bindValue()} * when using prepared statements. * * The parameter $value specifies the value that you want to bind. If - * $placeholder is not provided bindValue() will automatically create a - * placeholder for you. An automatic placeholder will be of the name - * ':dcValue1', ':dcValue2' etc. + * $placeholder is not provided createNamedParameter() will automatically + * create a placeholder for you. An automatic placeholder will be of the + * name ':dcValue1', ':dcValue2' etc. * * Example: * * $value = 2; - * $q->eq( 'id', $q->bindValue( $value ) ); + * $q->eq( 'id', $q->createNamedParameter( $value ) ); * $stmt = $q->executeQuery(); // executed with 'id = 2' * * @@ -1517,11 +1506,9 @@ public function createPositionalParameter($value, $type = ParameterType::STRING) * @param string $fromAlias * @param array $knownAliases * - * @return string - * * @throws QueryException */ - private function getSQLForJoins($fromAlias, array &$knownAliases) + private function getSQLForJoins($fromAlias, array &$knownAliases): string { $sql = ''; diff --git a/doctrine/dbal/src/Result.php b/doctrine/dbal/src/Result.php index 59c1065a0..dce821c6e 100644 --- a/doctrine/dbal/src/Result.php +++ b/doctrine/dbal/src/Result.php @@ -22,7 +22,7 @@ class Result private $connection; /** - * @internal The result can be only instantiated by {@link Connection} or {@link Statement}. + * @internal The result can be only instantiated by {@see Connection} or {@see Statement}. */ public function __construct(DriverResult $result, Connection $connection) { @@ -170,12 +170,8 @@ public function fetchFirstColumn(): array */ public function iterateNumeric(): Traversable { - try { - while (($row = $this->result->fetchNumeric()) !== false) { - yield $row; - } - } catch (DriverException $e) { - throw $this->connection->convertException($e); + while (($row = $this->fetchNumeric()) !== false) { + yield $row; } } @@ -186,12 +182,8 @@ public function iterateNumeric(): Traversable */ public function iterateAssociative(): Traversable { - try { - while (($row = $this->result->fetchAssociative()) !== false) { - yield $row; - } - } catch (DriverException $e) { - throw $this->connection->convertException($e); + while (($row = $this->fetchAssociative()) !== false) { + yield $row; } } @@ -231,12 +223,8 @@ public function iterateAssociativeIndexed(): Traversable */ public function iterateColumn(): Traversable { - try { - while (($value = $this->result->fetchOne()) !== false) { - yield $value; - } - } catch (DriverException $e) { - throw $this->connection->convertException($e); + while (($value = $this->fetchOne()) !== false) { + yield $value; } } @@ -287,11 +275,13 @@ private function ensureHasKeyValue(): void * @deprecated This API is deprecated and will be removed after 2022 * * @return mixed + * + * @throws Exception */ public function fetch(int $mode = FetchMode::ASSOCIATIVE) { if (func_num_args() > 1) { - throw new LogicException('Only invocations with one argument are still supported by this legecy API.'); + throw new LogicException('Only invocations with one argument are still supported by this legacy API.'); } if ($mode === FetchMode::ASSOCIATIVE) { @@ -315,11 +305,13 @@ public function fetch(int $mode = FetchMode::ASSOCIATIVE) * @deprecated This API is deprecated and will be removed after 2022 * * @return list + * + * @throws Exception */ public function fetchAll(int $mode = FetchMode::ASSOCIATIVE): array { if (func_num_args() > 1) { - throw new LogicException('Only invocations with one argument are still supported by this legecy API.'); + throw new LogicException('Only invocations with one argument are still supported by this legacy API.'); } if ($mode === FetchMode::ASSOCIATIVE) { diff --git a/doctrine/dbal/src/SQL/Parser.php b/doctrine/dbal/src/SQL/Parser.php index f1ad6617f..b3747e0c0 100644 --- a/doctrine/dbal/src/SQL/Parser.php +++ b/doctrine/dbal/src/SQL/Parser.php @@ -70,7 +70,7 @@ public function __construct(bool $mySQLStringEscaping) self::OTHER, ]); - $this->sqlPattern = sprintf('(%s)+', implode('|', $patterns)); + $this->sqlPattern = sprintf('(%s)', implode('|', $patterns)); } /** diff --git a/doctrine/dbal/src/Schema/AbstractAsset.php b/doctrine/dbal/src/Schema/AbstractAsset.php index e6b383a65..69e337602 100644 --- a/doctrine/dbal/src/Schema/AbstractAsset.php +++ b/doctrine/dbal/src/Schema/AbstractAsset.php @@ -3,6 +3,7 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\Deprecations\Deprecation; use function array_map; use function crc32; @@ -110,12 +111,21 @@ public function getShortestName($defaultNamespaceName) * Every non-namespaced element is prefixed with the default namespace * name which is passed as argument to this method. * + * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. + * * @param string $defaultNamespaceName * * @return string */ public function getFullQualifiedName($defaultNamespaceName) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4814', + 'AbstractAsset::getFullQualifiedName() is deprecated.' + . ' Use AbstractAsset::getNamespaceName() and ::getName() instead.' + ); + $name = $this->getName(); if ($this->_namespace === null) { $name = $defaultNamespaceName . '.' . $name; diff --git a/doctrine/dbal/src/Schema/AbstractSchemaManager.php b/doctrine/dbal/src/Schema/AbstractSchemaManager.php index 50b9facee..e44580b54 100644 --- a/doctrine/dbal/src/Schema/AbstractSchemaManager.php +++ b/doctrine/dbal/src/Schema/AbstractSchemaManager.php @@ -28,6 +28,8 @@ /** * Base class for schema managers. Schema managers are used to inspect and/or * modify the database schema/structure. + * + * @template T of AbstractPlatform */ abstract class AbstractSchemaManager { @@ -41,10 +43,13 @@ abstract class AbstractSchemaManager /** * Holds instance of the database platform used for this schema manager. * - * @var AbstractPlatform + * @var T */ protected $_platform; + /** + * @param T $platform + */ public function __construct(Connection $connection, AbstractPlatform $platform) { $this->_conn = $connection; @@ -54,7 +59,7 @@ public function __construct(Connection $connection, AbstractPlatform $platform) /** * Returns the associated platform. * - * @return AbstractPlatform + * @return T */ public function getDatabasePlatform() { @@ -71,10 +76,18 @@ public function getDatabasePlatform() * $result = $sm->tryMethod('dropView', 'view_name'); * * + * @deprecated + * * @return mixed */ public function tryMethod() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::tryMethod() is deprecated.' + ); + $args = func_get_args(); $method = $args[0]; unset($args[0]); @@ -109,7 +122,7 @@ public function listDatabases() /** * Returns a list of all namespaces in the current database. * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. * * @return string[] * @@ -419,6 +432,8 @@ public function dropIndex($index, $table) /** * Drops the constraint from the given table. * + * @deprecated Use {@see dropIndex()}, {@see dropForeignKey()} or {@see dropUniqueConstraint()} instead. + * * @param Table|string $table The name of the table. * * @return void @@ -459,6 +474,16 @@ public function dropSequence($name) $this->_execSql($this->_platform->getDropSequenceSQL($name)); } + /** + * Drops the unique constraint from the given table. + * + * @throws Exception + */ + public function dropUniqueConstraint(string $name, string $tableName): void + { + $this->_execSql($this->_platform->getDropUniqueConstraintSQL($name, $tableName)); + } + /** * Drops a view. * @@ -519,6 +544,8 @@ public function createSequence($sequence) /** * Creates a constraint on a table. * + * @deprecated Use {@see createIndex()}, {@see createForeignKey()} or {@see createUniqueConstraint()} instead. + * * @param Table|string $table * * @return void @@ -559,6 +586,16 @@ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) $this->_execSql($this->_platform->getCreateForeignKeySQL($foreignKey, $table)); } + /** + * Creates a unique constraint on a table. + * + * @throws Exception + */ + public function createUniqueConstraint(UniqueConstraint $uniqueConstraint, string $tableName): void + { + $this->_execSql($this->_platform->getCreateUniqueConstraintSQL($uniqueConstraint, $tableName)); + } + /** * Creates a new view. * @@ -576,6 +613,10 @@ public function createView(View $view) /** * Drops and creates a constraint. * + * @deprecated Use {@see dropIndex()} and {@see createIndex()}, + * {@see dropForeignKey()} and {@see createForeignKey()} + * or {@see dropUniqueConstraint()} and {@see createUniqueConstraint()} instead. + * * @see dropConstraint() * @see createConstraint() * @@ -587,6 +628,16 @@ public function createView(View $view) */ public function dropAndCreateConstraint(Constraint $constraint, $table) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateConstraint() is deprecated.' + . ' Use AbstractSchemaManager::dropIndex() and AbstractSchemaManager::createIndex(),' + . ' AbstractSchemaManager::dropForeignKey() and AbstractSchemaManager::createForeignKey()' + . ' or AbstractSchemaManager::dropUniqueConstraint()' + . ' and AbstractSchemaManager::createUniqueConstraint() instead.' + ); + $this->tryMethod('dropConstraint', $constraint, $table); $this->createConstraint($constraint, $table); } @@ -594,6 +645,8 @@ public function dropAndCreateConstraint(Constraint $constraint, $table) /** * Drops and creates a new index on a table. * + * @deprecated Use {@see dropIndex()} and {@see createIndex()} instead. + * * @param Table|string $table The name of the table on which the index is to be created. * * @return void @@ -602,6 +655,13 @@ public function dropAndCreateConstraint(Constraint $constraint, $table) */ public function dropAndCreateIndex(Index $index, $table) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateIndex() is deprecated.' + . ' Use AbstractSchemaManager::dropIndex() and AbstractSchemaManager::createIndex() instead.' + ); + $this->tryMethod('dropIndex', $index->getQuotedName($this->_platform), $table); $this->createIndex($index, $table); } @@ -609,6 +669,8 @@ public function dropAndCreateIndex(Index $index, $table) /** * Drops and creates a new foreign key. * + * @deprecated Use {@see dropForeignKey()} and {@see createForeignKey()} instead. + * * @param ForeignKeyConstraint $foreignKey An associative array that defines properties * of the foreign key to be created. * @param Table|string $table The name of the table on which the foreign key is to be created. @@ -619,6 +681,13 @@ public function dropAndCreateIndex(Index $index, $table) */ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateForeignKey() is deprecated.' + . ' Use AbstractSchemaManager::dropForeignKey() and AbstractSchemaManager::createForeignKey() instead.' + ); + $this->tryMethod('dropForeignKey', $foreignKey, $table); $this->createForeignKey($foreignKey, $table); } @@ -626,12 +695,21 @@ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table /** * Drops and create a new sequence. * + * @deprecated Use {@see dropSequence()} and {@see createSequence()} instead. + * * @return void * * @throws Exception */ public function dropAndCreateSequence(Sequence $sequence) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateSequence() is deprecated.' + . ' Use AbstractSchemaManager::dropSequence() and AbstractSchemaManager::createSequence() instead.' + ); + $this->tryMethod('dropSequence', $sequence->getQuotedName($this->_platform)); $this->createSequence($sequence); } @@ -639,12 +717,21 @@ public function dropAndCreateSequence(Sequence $sequence) /** * Drops and creates a new table. * + * @deprecated Use {@see dropTable()} and {@see createTable()} instead. + * * @return void * * @throws Exception */ public function dropAndCreateTable(Table $table) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateTable() is deprecated.' + . ' Use AbstractSchemaManager::dropTable() and AbstractSchemaManager::createTable() instead.' + ); + $this->tryMethod('dropTable', $table->getQuotedName($this->_platform)); $this->createTable($table); } @@ -652,6 +739,8 @@ public function dropAndCreateTable(Table $table) /** * Drops and creates a new database. * + * @deprecated Use {@see dropDatabase()} and {@see createDatabase()} instead. + * * @param string $database The name of the database to create. * * @return void @@ -660,6 +749,13 @@ public function dropAndCreateTable(Table $table) */ public function dropAndCreateDatabase($database) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateDatabase() is deprecated.' + . ' Use AbstractSchemaManager::dropDatabase() and AbstractSchemaManager::createDatabase() instead.' + ); + $this->tryMethod('dropDatabase', $database); $this->createDatabase($database); } @@ -667,16 +763,48 @@ public function dropAndCreateDatabase($database) /** * Drops and creates a new view. * + * @deprecated Use {@see dropView()} and {@see createView()} instead. + * * @return void * * @throws Exception */ public function dropAndCreateView(View $view) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'AbstractSchemaManager::dropAndCreateView() is deprecated.' + . ' Use AbstractSchemaManager::dropView() and AbstractSchemaManager::createView() instead.' + ); + $this->tryMethod('dropView', $view->getQuotedName($this->_platform)); $this->createView($view); } + /** + * Alters an existing schema. + * + * @throws Exception + */ + public function alterSchema(SchemaDiff $schemaDiff): void + { + $this->_execSql($schemaDiff->toSql($this->_platform)); + } + + /** + * Migrates an existing schema to a new schema. + * + * @throws Exception + */ + public function migrateSchema(Schema $toSchema): void + { + $schemaDiff = $this->createComparator() + ->compareSchemas($this->createSchema(), $toSchema); + + $this->alterSchema($schemaDiff); + } + /* alterTable() Methods */ /** @@ -733,7 +861,7 @@ protected function _getPortableDatabasesList($databases) /** * Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition. * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. * * @param array> $namespaces The list of namespace names * in the native DBMS data definition. @@ -771,7 +899,7 @@ protected function _getPortableDatabaseDefinition($database) /** * Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition. * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. * * @param array $namespace The native DBMS namespace definition. * @@ -789,37 +917,6 @@ protected function getPortableNamespaceDefinition(array $namespace) return $namespace; } - /** - * @param mixed[][] $triggers - * - * @return mixed[][] - */ - protected function _getPortableTriggersList($triggers) - { - $list = []; - foreach ($triggers as $value) { - $value = $this->_getPortableTriggerDefinition($value); - - if (! $value) { - continue; - } - - $list[] = $value; - } - - return $list; - } - - /** - * @param mixed[] $trigger - * - * @return mixed - */ - protected function _getPortableTriggerDefinition($trigger) - { - return $trigger; - } - /** * @param mixed[][] $sequences * @@ -1175,12 +1272,20 @@ public function createSchemaConfig() * For databases that don't support subschema/namespaces this method * returns the name of the currently connected database. * + * @deprecated + * * @return string[] * * @throws Exception */ public function getSchemaSearchPaths() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4821', + 'AbstractSchemaManager::getSchemaSearchPaths() is deprecated.' + ); + $database = $this->_conn->getDatabase(); if ($database !== null) { @@ -1194,6 +1299,8 @@ public function getSchemaSearchPaths() * Given a table comment this method tries to extract a typehint for Doctrine Type, or returns * the type given as default. * + * @internal This method should be only used from within the AbstractSchemaManager class hierarchy. + * * @param string|null $comment * @param string $currentType * @@ -1209,6 +1316,8 @@ public function extractDoctrineTypeFromComment($comment, $currentType) } /** + * @internal This method should be only used from within the AbstractSchemaManager class hierarchy. + * * @param string|null $comment * @param string|null $type * @@ -1222,4 +1331,9 @@ public function removeDoctrineTypeFromComment($comment, $type) return str_replace('(DC2Type:' . $type . ')', '', $comment); } + + public function createComparator(): Comparator + { + return new Comparator($this->getDatabasePlatform()); + } } diff --git a/doctrine/dbal/src/Schema/ColumnDiff.php b/doctrine/dbal/src/Schema/ColumnDiff.php index c9c2a52bc..83402fd0f 100644 --- a/doctrine/dbal/src/Schema/ColumnDiff.php +++ b/doctrine/dbal/src/Schema/ColumnDiff.php @@ -2,6 +2,8 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\Deprecations\Deprecation; + use function in_array; /** @@ -31,6 +33,15 @@ public function __construct( array $changedProperties = [], ?Column $fromColumn = null ) { + if ($fromColumn === null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4785', + 'Not passing the $fromColumn to %s is deprecated.', + __METHOD__ + ); + } + $this->oldColumnName = $oldColumnName; $this->column = $column; $this->changedProperties = $changedProperties; diff --git a/doctrine/dbal/src/Schema/Comparator.php b/doctrine/dbal/src/Schema/Comparator.php index 7ddf5238d..9c18fe67a 100644 --- a/doctrine/dbal/src/Schema/Comparator.php +++ b/doctrine/dbal/src/Schema/Comparator.php @@ -2,7 +2,11 @@ namespace Doctrine\DBAL\Schema; +use BadMethodCallException; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types; +use Doctrine\Deprecations\Deprecation; use function array_intersect_key; use function array_key_exists; @@ -13,38 +17,76 @@ use function assert; use function count; use function get_class; +use function sprintf; use function strtolower; /** * Compares two Schemas and return an instance of SchemaDiff. + * + * @method SchemaDiff compareSchemas(Schema $fromSchema, Schema $toSchema) */ class Comparator { + /** @var AbstractPlatform|null */ + private $platform; + /** - * @return SchemaDiff - * - * @throws SchemaException + * @internal The comparator can be only instantiated by a schema manager. + */ + public function __construct(?AbstractPlatform $platform = null) + { + if ($platform === null) { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4746', + 'Not passing a $platform to %s is deprecated.' + . ' Use AbstractSchemaManager::createComparator() to instantiate the comparator.', + __METHOD__ + ); + } + + $this->platform = $platform; + } + + /** + * @param list $args + */ + public function __call(string $method, array $args): SchemaDiff + { + if ($method !== 'compareSchemas') { + throw new BadMethodCallException(sprintf('Unknown method "%s"', $method)); + } + + return $this->doCompareSchemas(...$args); + } + + /** + * @param list $args */ - public static function compareSchemas(Schema $fromSchema, Schema $toSchema) + public static function __callStatic(string $method, array $args): SchemaDiff { - $c = new self(); + if ($method !== 'compareSchemas') { + throw new BadMethodCallException(sprintf('Unknown method "%s"', $method)); + } - return $c->compare($fromSchema, $toSchema); + $comparator = new self(); + + return $comparator->doCompareSchemas(...$args); } /** * Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema. * - * The returned differences are returned in such a way that they contain the - * operations to change the schema stored in $fromSchema to the schema that is - * stored in $toSchema. + * This method should be called non-statically since it will be declared as non-static in the next major release. * * @return SchemaDiff * * @throws SchemaException */ - public function compare(Schema $fromSchema, Schema $toSchema) - { + private function doCompareSchemas( + Schema $fromSchema, + Schema $toSchema + ) { $diff = new SchemaDiff(); $diff->fromSchema = $fromSchema; @@ -161,13 +203,29 @@ public function compare(Schema $fromSchema, Schema $toSchema) return $diff; } + /** + * @deprecated Use non-static call to {@see compareSchemas()} instead. + * + * @return SchemaDiff + * + * @throws SchemaException + */ + public function compare(Schema $fromSchema, Schema $toSchema) + { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4707', + 'Method compare() is deprecated. Use a non-static call to compareSchemas() instead.' + ); + + return $this->compareSchemas($fromSchema, $toSchema); + } + /** * @param Schema $schema * @param Sequence $sequence - * - * @return bool */ - private function isAutoIncrementSequenceInSchema($schema, $sequence) + private function isAutoIncrementSequenceInSchema($schema, $sequence): bool { foreach ($schema->getTables() as $table) { if ($sequence->isAutoIncrementsFor($table)) { @@ -197,7 +255,7 @@ public function diffSequence(Sequence $sequence1, Sequence $sequence2) * * @return TableDiff|false * - * @throws SchemaException + * @throws Exception */ public function diffTable(Table $fromTable, Table $toTable) { @@ -227,17 +285,26 @@ public function diffTable(Table $fromTable, Table $toTable) continue; } + $toColumn = $toTable->getColumn($columnName); + // See if column has changed properties in "to" table. - $changedProperties = $this->diffColumn($column, $toTable->getColumn($columnName)); + $changedProperties = $this->diffColumn($column, $toColumn); - if (count($changedProperties) === 0) { + if ($this->platform !== null) { + if ($this->columnsEqual($column, $toColumn)) { + continue; + } + } elseif (count($changedProperties) === 0) { continue; } - $columnDiff = new ColumnDiff($column->getName(), $toTable->getColumn($columnName), $changedProperties); + $tableDifferences->changedColumns[$column->getName()] = new ColumnDiff( + $column->getName(), + $toColumn, + $changedProperties, + $column + ); - $columnDiff->fromColumn = $column; - $tableDifferences->changedColumns[$column->getName()] = $columnDiff; $changes++; } @@ -315,15 +382,13 @@ public function diffTable(Table $fromTable, Table $toTable) /** * Try to find columns that only changed their name, rename operations maybe cheaper than add/drop * however ambiguities between different possibilities should not lead to renaming at all. - * - * @return void */ - private function detectColumnRenamings(TableDiff $tableDifferences) + private function detectColumnRenamings(TableDiff $tableDifferences): void { $renameCandidates = []; foreach ($tableDifferences->addedColumns as $addedColumnName => $addedColumn) { foreach ($tableDifferences->removedColumns as $removedColumn) { - if (count($this->diffColumn($addedColumn, $removedColumn)) !== 0) { + if (! $this->columnsEqual($addedColumn, $removedColumn)) { continue; } @@ -337,7 +402,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences) } [$removedColumn, $addedColumn] = $candidateColumns[0]; - $removedColumnName = strtolower($removedColumn->getName()); + $removedColumnName = $removedColumn->getName(); $addedColumnName = strtolower($addedColumn->getName()); if (isset($tableDifferences->renamedColumns[$removedColumnName])) { @@ -347,7 +412,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences) $tableDifferences->renamedColumns[$removedColumnName] = $addedColumn; unset( $tableDifferences->addedColumns[$addedColumnName], - $tableDifferences->removedColumns[$removedColumnName] + $tableDifferences->removedColumns[strtolower($removedColumnName)] ); } } @@ -355,10 +420,8 @@ private function detectColumnRenamings(TableDiff $tableDifferences) /** * Try to find indexes that only changed their name, rename operations maybe cheaper than add/drop * however ambiguities between different possibilities should not lead to renaming at all. - * - * @return void */ - private function detectIndexRenamings(TableDiff $tableDifferences) + private function detectIndexRenamings(TableDiff $tableDifferences): void { $renameCandidates = []; @@ -429,11 +492,25 @@ public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint return $key1->onDelete() !== $key2->onDelete(); } + /** + * Compares the definitions of the given columns + * + * @throws Exception + */ + public function columnsEqual(Column $column1, Column $column2): bool + { + if ($this->platform === null) { + return $this->diffColumn($column1, $column2) === []; + } + + return $this->platform->columnsEqual($column1, $column2); + } + /** * Returns the difference between the columns * - * If there are differences this method returns $field2, otherwise the - * boolean false. + * If there are differences this method returns the changed properties as a + * string array, otherwise an empty array gets returned. * * @return string[] */ diff --git a/doctrine/dbal/src/Schema/Constraint.php b/doctrine/dbal/src/Schema/Constraint.php index 65e239ec1..85338c783 100644 --- a/doctrine/dbal/src/Schema/Constraint.php +++ b/doctrine/dbal/src/Schema/Constraint.php @@ -6,6 +6,8 @@ /** * Marker interface for constraints. + * + * @deprecated Use {@see ForeignKeyConstraint}, {@see Index} or {@see UniqueConstraint} instead. */ interface Constraint { diff --git a/doctrine/dbal/src/Schema/DB2SchemaManager.php b/doctrine/dbal/src/Schema/DB2SchemaManager.php index 82c287e00..e06baf36e 100644 --- a/doctrine/dbal/src/Schema/DB2SchemaManager.php +++ b/doctrine/dbal/src/Schema/DB2SchemaManager.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Types\Types; use function array_change_key_case; -use function assert; use function preg_match; use function str_replace; use function strpos; @@ -19,6 +18,8 @@ /** * IBM Db2 Schema Manager. + * + * @extends AbstractSchemaManager */ class DB2SchemaManager extends AbstractSchemaManager { @@ -235,9 +236,7 @@ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); - $platform = $this->_platform; - assert($platform instanceof DB2Platform); - $sql = $platform->getListTableCommentsSQL($name); + $sql = $this->_platform->getListTableCommentsSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); diff --git a/doctrine/dbal/src/Schema/ForeignKeyConstraint.php b/doctrine/dbal/src/Schema/ForeignKeyConstraint.php index 976188754..852ad0a31 100644 --- a/doctrine/dbal/src/Schema/ForeignKeyConstraint.php +++ b/doctrine/dbal/src/Schema/ForeignKeyConstraint.php @@ -105,6 +105,8 @@ private function createIdentifierMap(array $names): array * Returns the name of the referencing table * the foreign key constraint is associated with. * + * @deprecated Use the table that contains the foreign key as part of its {@see Table::$_fkConstraints} instead. + * * @return string */ public function getLocalTableName() @@ -116,6 +118,8 @@ public function getLocalTableName() * Sets the Table instance of the referencing table * the foreign key constraint is associated with. * + * @deprecated Use the table that contains the foreign key as part of its {@see Table::$_fkConstraints} instead. + * * @param Table $table Instance of the referencing table. * * @return void @@ -126,6 +130,8 @@ public function setLocalTable(Table $table) } /** + * @deprecated Use the table that contains the foreign key as part of its {@see Table::$_fkConstraints} instead. + * * @return Table */ public function getLocalTable() @@ -190,6 +196,8 @@ public function getUnquotedForeignColumns() /** * {@inheritdoc} * + * @deprecated Use {@see getLocalColumns()} instead. + * * @see getLocalColumns */ public function getColumns() @@ -205,6 +213,8 @@ public function getColumns() * is a keyword reserved by the platform. * Otherwise the plain unquoted value as inserted is returned. * + * @deprecated Use {@see getQuotedLocalColumns()} instead. + * * @see getQuotedLocalColumns * * @param AbstractPlatform $platform The platform to use for quotation. @@ -357,10 +367,8 @@ public function onDelete() * on the referenced table the foreign key constraint is associated with. * * @param string $event Name of the database operation/event to return the referential action for. - * - * @return string|null */ - private function onEvent($event) + private function onEvent($event): ?string { if (isset($this->_options[$event])) { $onEvent = strtoupper($this->_options[$event]); diff --git a/doctrine/dbal/src/Schema/Index.php b/doctrine/dbal/src/Schema/Index.php index 508aa4031..fd088a309 100644 --- a/doctrine/dbal/src/Schema/Index.php +++ b/doctrine/dbal/src/Schema/Index.php @@ -336,10 +336,8 @@ public function getOptions() /** * Return whether the two indexes have the same partial index - * - * @return bool */ - private function samePartialIndex(Index $other) + private function samePartialIndex(Index $other): bool { if ( $this->hasOption('where') diff --git a/doctrine/dbal/src/Schema/MySQLSchemaManager.php b/doctrine/dbal/src/Schema/MySQLSchemaManager.php index 4d54f7159..81ba4cab6 100644 --- a/doctrine/dbal/src/Schema/MySQLSchemaManager.php +++ b/doctrine/dbal/src/Schema/MySQLSchemaManager.php @@ -2,13 +2,15 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\MariaDb1027Platform; -use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Platforms\MySQL; +use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider\CachingCollationMetadataProvider; +use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider\ConnectionCollationMetadataProvider; use Doctrine\DBAL\Types\Type; use function array_change_key_case; use function array_shift; -use function array_values; use function assert; use function explode; use function is_string; @@ -22,6 +24,8 @@ /** * Schema manager for the MySQL RDBMS. + * + * @extends AbstractSchemaManager */ class MySQLSchemaManager extends AbstractSchemaManager { @@ -166,27 +170,27 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; case 'tinytext': - $length = MySQLPlatform::LENGTH_LIMIT_TINYTEXT; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_TINYTEXT; break; case 'text': - $length = MySQLPlatform::LENGTH_LIMIT_TEXT; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_TEXT; break; case 'mediumtext': - $length = MySQLPlatform::LENGTH_LIMIT_MEDIUMTEXT; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_MEDIUMTEXT; break; case 'tinyblob': - $length = MySQLPlatform::LENGTH_LIMIT_TINYBLOB; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_TINYBLOB; break; case 'blob': - $length = MySQLPlatform::LENGTH_LIMIT_BLOB; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_BLOB; break; case 'mediumblob': - $length = MySQLPlatform::LENGTH_LIMIT_MEDIUMBLOB; + $length = AbstractMySQLPlatform::LENGTH_LIMIT_MEDIUMBLOB; break; case 'tinyint': @@ -312,9 +316,9 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $result = []; foreach ($list as $constraint) { $result[] = new ForeignKeyConstraint( - array_values($constraint['local']), + $constraint['local'], $constraint['foreignTable'], - array_values($constraint['foreign']), + $constraint['foreign'], $constraint['name'], [ 'onDelete' => $constraint['onDelete'], @@ -333,9 +337,7 @@ public function listTableDetails($name) { $table = parent::listTableDetails($name); - $platform = $this->_platform; - assert($platform instanceof MySQLPlatform); - $sql = $platform->getListTableMetadataSQL($name); + $sql = $this->_platform->getListTableMetadataSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); @@ -349,6 +351,8 @@ public function listTableDetails($name) $table->addOption('collation', $tableOptions['TABLE_COLLATION']); } + $table->addOption('charset', $tableOptions['CHARACTER_SET_NAME']); + if ($tableOptions['AUTO_INCREMENT'] !== null) { $table->addOption('autoincrement', $tableOptions['AUTO_INCREMENT']); } @@ -359,6 +363,16 @@ public function listTableDetails($name) return $table; } + public function createComparator(): Comparator + { + return new MySQL\Comparator( + $this->getDatabasePlatform(), + new CachingCollationMetadataProvider( + new ConnectionCollationMetadataProvider($this->_conn) + ) + ); + } + /** * @return string[]|true[] */ diff --git a/doctrine/dbal/src/Schema/OracleSchemaManager.php b/doctrine/dbal/src/Schema/OracleSchemaManager.php index 13c885243..762492e72 100644 --- a/doctrine/dbal/src/Schema/OracleSchemaManager.php +++ b/doctrine/dbal/src/Schema/OracleSchemaManager.php @@ -8,7 +8,6 @@ use function array_change_key_case; use function array_values; -use function assert; use function is_string; use function preg_match; use function str_replace; @@ -20,6 +19,8 @@ /** * Oracle Schema Manager. + * + * @extends AbstractSchemaManager */ class OracleSchemaManager extends AbstractSchemaManager { @@ -257,7 +258,7 @@ protected function _getPortableDatabaseDefinition($database) */ public function createDatabase($database) { - $statement = 'CREATE USER ' . $database; + $statement = $this->_platform->getCreateDatabaseSQL($database); $params = $this->_conn->getParams(); @@ -282,8 +283,6 @@ public function createDatabase($database) */ public function dropAutoincrement($table) { - assert($this->_platform instanceof OraclePlatform); - $sql = $this->_platform->getDropAutoincrementSql($table); foreach ($sql as $query) { $this->_conn->executeStatement($query); @@ -309,10 +308,8 @@ public function dropTable($name) * and thus make references to the particular identifier work. * * @param string $identifier The identifier to quote. - * - * @return string The quoted identifier. */ - private function getQuotedIdentifierName($identifier) + private function getQuotedIdentifierName($identifier): string { if (preg_match('/[a-z]/', $identifier) === 1) { return $this->_platform->quoteIdentifier($identifier); @@ -328,14 +325,13 @@ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); - $platform = $this->_platform; - assert($platform instanceof OraclePlatform); - $sql = $platform->getListTableCommentsSQL($name); + $sql = $this->_platform->getListTableCommentsSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); if ($tableOptions !== false) { - $table->addOption('comment', $tableOptions['COMMENTS']); + $tableOptions = array_change_key_case($tableOptions, CASE_LOWER); + $table->addOption('comment', $tableOptions['comments']); } return $table; diff --git a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php index abc06af47..03239bde5 100644 --- a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php +++ b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php @@ -3,7 +3,7 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Exception; -use Doctrine\DBAL\Platforms\PostgreSQL94Platform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Doctrine\Deprecations\Deprecation; @@ -29,6 +29,8 @@ /** * PostgreSQL Schema Manager. + * + * @extends AbstractSchemaManager */ class PostgreSQLSchemaManager extends AbstractSchemaManager { @@ -38,7 +40,7 @@ class PostgreSQLSchemaManager extends AbstractSchemaManager /** * Gets all the existing schema names. * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. * * @return string[] * @@ -73,9 +75,17 @@ public function listSchemaNames(): array /** * {@inheritDoc} + * + * @deprecated */ public function getSchemaSearchPaths() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4821', + 'PostgreSQLSchemaManager::getSchemaSearchPaths() is deprecated.' + ); + $params = $this->_conn->getParams(); $searchPaths = $this->_conn->fetchOne('SHOW search_path'); @@ -98,6 +108,8 @@ public function getSchemaSearchPaths() * @internal The method should be only used from within the PostgreSQLSchemaManager class hierarchy. * * @return string[] + * + * @throws Exception */ public function getExistingSchemaSearchPaths() { @@ -110,6 +122,20 @@ public function getExistingSchemaSearchPaths() return $this->existingSchemaPaths; } + /** + * Returns the name of the current schema. + * + * @return string|null + * + * @throws Exception + */ + protected function getCurrentSchema() + { + $schemas = $this->getExistingSchemaSearchPaths(); + + return array_shift($schemas); + } + /** * Sets or resets the order of the existing schemas in the current search path of the user. * @@ -118,6 +144,8 @@ public function getExistingSchemaSearchPaths() * @internal The method should be only used from within the PostgreSQLSchemaManager class hierarchy. * * @return void + * + * @throws Exception */ public function determineExistingSchemaSearchPaths() { @@ -175,14 +203,6 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) ); } - /** - * {@inheritdoc} - */ - protected function _getPortableTriggerDefinition($trigger) - { - return $trigger['trigger_name']; - } - /** * {@inheritdoc} */ @@ -207,10 +227,9 @@ protected function _getPortableUserDefinition($user) */ protected function _getPortableTableDefinition($table) { - $schemas = $this->getExistingSchemaSearchPaths(); - $firstSchema = array_shift($schemas); + $currentSchema = $this->getCurrentSchema(); - if ($table['schema_name'] === $firstSchema) { + if ($table['schema_name'] === $currentSchema) { return $table['table_name']; } @@ -293,7 +312,7 @@ protected function _getPortableSequencesList($sequences) /** * {@inheritdoc} * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. */ protected function getPortableNamespaceDefinition(array $namespace) { @@ -458,7 +477,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) if ( preg_match( - '([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', + '([A-Za-z]+\(([0-9]+),([0-9]+)\))', $tableColumn['complete_type'], $match ) === 1 @@ -552,9 +571,7 @@ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); - $platform = $this->_platform; - assert($platform instanceof PostgreSQL94Platform); - $sql = $platform->getListTableMetadataSQL($name); + $sql = $this->_platform->getListTableMetadataSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); diff --git a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php index f1836fc52..8a8713f09 100644 --- a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php +++ b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php @@ -3,7 +3,8 @@ namespace Doctrine\DBAL\Schema; use Doctrine\DBAL\Exception; -use Doctrine\DBAL\Platforms\SQLServer2012Platform; +use Doctrine\DBAL\Platforms\SQLServer; +use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\DBAL\Types\Type; use Doctrine\Deprecations\Deprecation; @@ -18,9 +19,14 @@ /** * SQL Server Schema Manager. + * + * @extends AbstractSchemaManager */ class SQLServerSchemaManager extends AbstractSchemaManager { + /** @var string|null */ + private $databaseCollation; + /** * {@inheritDoc} */ @@ -221,7 +227,7 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} * - * @deprecated Use {@link listSchemaNames()} instead. + * @deprecated Use {@see listSchemaNames()} instead. */ protected function getPortableNamespaceDefinition(array $namespace) { @@ -241,7 +247,7 @@ protected function getPortableNamespaceDefinition(array $namespace) protected function _getPortableViewDefinition($view) { // @todo - return new View($view['name'], ''); + return new View($view['name'], $view['definition']); } /** @@ -271,13 +277,12 @@ public function alterTable(TableDiff $tableDiff) { if (count($tableDiff->removedColumns) > 0) { foreach ($tableDiff->removedColumns as $col) { - $columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName()); - foreach ($this->_conn->fetchAllAssociative($columnConstraintSql) as $constraint) { + foreach ($this->getColumnConstraints($tableDiff->name, $col->getName()) as $constraint) { $this->_conn->executeStatement( sprintf( 'ALTER TABLE %s DROP CONSTRAINT %s', $tableDiff->name, - $constraint['Name'] + $constraint ) ); } @@ -288,22 +293,32 @@ public function alterTable(TableDiff $tableDiff) } /** - * Returns the SQL to retrieve the constraints for a given column. + * Returns the names of the constraints for a given column. * - * @param string $table - * @param string $column + * @return iterable * - * @return string + * @throws Exception */ - private function getColumnConstraintSQL($table, $column) + private function getColumnConstraints(string $table, string $column): iterable { - return "SELECT sysobjects.[Name] - FROM sysobjects INNER JOIN (SELECT [Name],[ID] FROM sysobjects WHERE XType = 'U') AS Tab - ON Tab.[ID] = sysobjects.[Parent_Obj] - INNER JOIN sys.default_constraints DefCons ON DefCons.[object_id] = sysobjects.[ID] - INNER JOIN syscolumns Col ON Col.[ColID] = DefCons.[parent_column_id] AND Col.[ID] = Tab.[ID] - WHERE Col.[Name] = " . $this->_conn->quote($column) . ' AND Tab.[Name] = ' . $this->_conn->quote($table) . ' - ORDER BY Col.[Name]'; + return $this->_conn->iterateColumn( + <<<'SQL' +SELECT o.name +FROM sys.objects o + INNER JOIN sys.objects t + ON t.object_id = o.parent_object_id + AND t.type = 'U' + INNER JOIN sys.default_constraints dc + ON dc.object_id = o.object_id + INNER JOIN sys.columns c + ON c.column_id = dc.parent_column_id + AND c.object_id = t.object_id +WHERE t.name = ? + AND c.name = ? +SQL + , + [$table, $column] + ); } /** @@ -315,9 +330,7 @@ public function listTableDetails($name): Table { $table = parent::listTableDetails($name); - $platform = $this->_platform; - assert($platform instanceof SQLServer2012Platform); - $sql = $platform->getListTableMetadataSQL($name); + $sql = $this->_platform->getListTableMetadataSQL($name); $tableOptions = $this->_conn->fetchAssociative($sql); @@ -327,4 +340,32 @@ public function listTableDetails($name): Table return $table; } + + /** + * @throws Exception + */ + public function createComparator(): Comparator + { + return new SQLServer\Comparator($this->getDatabasePlatform(), $this->getDatabaseCollation()); + } + + /** + * @throws Exception + */ + private function getDatabaseCollation(): string + { + if ($this->databaseCollation === null) { + $databaseCollation = $this->_conn->fetchOne( + 'SELECT collation_name FROM sys.databases WHERE name = ' + . $this->_platform->getCurrentDatabaseExpression(), + ); + + // a database is always selected, even if omitted in the connection parameters + assert(is_string($databaseCollation)); + + $this->databaseCollation = $databaseCollation; + } + + return $this->databaseCollation; + } } diff --git a/doctrine/dbal/src/Schema/Schema.php b/doctrine/dbal/src/Schema/Schema.php index 08eb26833..9be9e3508 100644 --- a/doctrine/dbal/src/Schema/Schema.php +++ b/doctrine/dbal/src/Schema/Schema.php @@ -7,6 +7,7 @@ use Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector; use Doctrine\DBAL\Schema\Visitor\NamespaceVisitor; use Doctrine\DBAL\Schema\Visitor\Visitor; +use Doctrine\Deprecations\Deprecation; use function array_keys; use function strpos; @@ -88,10 +89,18 @@ public function __construct( } /** + * @deprecated + * * @return bool */ public function hasExplicitForeignKeyIndexes() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'Schema::hasExplicitForeignKeyIndexes() is deprecated.' + ); + return $this->_schemaConfig->hasExplicitForeignKeyIndexes(); } @@ -103,7 +112,7 @@ public function hasExplicitForeignKeyIndexes() protected function _addTable(Table $table) { $namespaceName = $table->getNamespaceName(); - $tableName = $table->getFullQualifiedName($this->getName()); + $tableName = $this->normalizeName($table); if (isset($this->_tables[$tableName])) { throw SchemaException::tableAlreadyExists($tableName); @@ -129,7 +138,7 @@ protected function _addTable(Table $table) protected function _addSequence(Sequence $sequence) { $namespaceName = $sequence->getNamespaceName(); - $seqName = $sequence->getFullQualifiedName($this->getName()); + $seqName = $this->normalizeName($sequence); if (isset($this->_sequences[$seqName])) { throw SchemaException::sequenceAlreadyExists($seqName); @@ -185,10 +194,8 @@ public function getTable($name) /** * @param string $name - * - * @return string */ - private function getFullQualifiedAssetName($name) + private function getFullQualifiedAssetName($name): string { $name = $this->getUnquotedAssetName($name); @@ -199,14 +206,17 @@ private function getFullQualifiedAssetName($name) return strtolower($name); } + private function normalizeName(AbstractAsset $asset): string + { + return $asset->getFullQualifiedName($this->getName()); + } + /** * Returns the unquoted representation of a given asset name. * * @param string $assetName Quoted or unquoted representation of an asset name. - * - * @return string */ - private function getUnquotedAssetName($assetName) + private function getUnquotedAssetName($assetName): string { if ($this->isIdentifierQuoted($assetName)) { return $this->trimQuotes($assetName); @@ -246,10 +256,20 @@ public function hasTable($name) /** * Gets all table names, prefixed with a schema name, even the default one if present. * + * @deprecated Use {@see getTables()} and {@see Table::getName()} instead. + * * @return string[] */ public function getTableNames() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4800', + 'Schema::getTableNames() is deprecated.' + . ' Use Schema::getTables() and Table::getName() instead.', + __METHOD__ + ); + return array_keys($this->_tables); } @@ -431,27 +451,29 @@ public function toDropSql(AbstractPlatform $platform) } /** + * @deprecated + * * @return string[] * * @throws SchemaException */ public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) { - $comparator = new Comparator(); - $schemaDiff = $comparator->compare($this, $toSchema); + $schemaDiff = (new Comparator())->compareSchemas($this, $toSchema); return $schemaDiff->toSql($platform); } /** + * @deprecated + * * @return string[] * * @throws SchemaException */ public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform) { - $comparator = new Comparator(); - $schemaDiff = $comparator->compare($fromSchema, $this); + $schemaDiff = (new Comparator())->compareSchemas($fromSchema, $this); return $schemaDiff->toSql($platform); } diff --git a/doctrine/dbal/src/Schema/SchemaConfig.php b/doctrine/dbal/src/Schema/SchemaConfig.php index 56d49c4a7..92e0701f0 100644 --- a/doctrine/dbal/src/Schema/SchemaConfig.php +++ b/doctrine/dbal/src/Schema/SchemaConfig.php @@ -2,12 +2,18 @@ namespace Doctrine\DBAL\Schema; +use Doctrine\Deprecations\Deprecation; + /** * Configuration for a Schema. */ class SchemaConfig { - /** @var bool */ + /** + * @deprecated + * + * @var bool + */ protected $hasExplicitForeignKeyIndexes = false; /** @var int */ @@ -20,20 +26,36 @@ class SchemaConfig protected $defaultTableOptions = []; /** + * @deprecated + * * @return bool */ public function hasExplicitForeignKeyIndexes() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'SchemaConfig::hasExplicitForeignKeyIndexes() is deprecated.' + ); + return $this->hasExplicitForeignKeyIndexes; } /** + * @deprecated + * * @param bool $flag * * @return void */ public function setExplicitForeignKeyIndexes($flag) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4822', + 'SchemaConfig::setExplicitForeignKeyIndexes() is deprecated.' + ); + $this->hasExplicitForeignKeyIndexes = (bool) $flag; } diff --git a/doctrine/dbal/src/Schema/SchemaDiff.php b/doctrine/dbal/src/Schema/SchemaDiff.php index 67fb9bb9d..50d0d12fc 100644 --- a/doctrine/dbal/src/Schema/SchemaDiff.php +++ b/doctrine/dbal/src/Schema/SchemaDiff.php @@ -7,7 +7,10 @@ use function array_merge; /** - * Schema Diff. + * Differences between two schemas. + * + * The object contains the operations to change the schema stored in $fromSchema + * to a target schema. */ class SchemaDiff { diff --git a/doctrine/dbal/src/Schema/SqliteSchemaManager.php b/doctrine/dbal/src/Schema/SqliteSchemaManager.php index 140ebb3c0..3e0e5cfec 100644 --- a/doctrine/dbal/src/Schema/SqliteSchemaManager.php +++ b/doctrine/dbal/src/Schema/SqliteSchemaManager.php @@ -4,15 +4,17 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\SQLite; +use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Types\StringType; use Doctrine\DBAL\Types\TextType; use Doctrine\DBAL\Types\Type; +use Doctrine\Deprecations\Deprecation; use function array_change_key_case; use function array_map; use function array_merge; use function array_reverse; -use function array_values; use function explode; use function file_exists; use function preg_match; @@ -20,7 +22,6 @@ use function preg_quote; use function preg_replace; use function rtrim; -use function sprintf; use function str_replace; use function strpos; use function strtolower; @@ -32,14 +33,24 @@ /** * Sqlite SchemaManager. + * + * @extends AbstractSchemaManager */ class SqliteSchemaManager extends AbstractSchemaManager { /** * {@inheritdoc} + * + * @deprecated Delete the database file using the filesystem. */ public function dropDatabase($database) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4963', + 'SqliteSchemaManager::dropDatabase() is deprecated. Delete the database file using the filesystem.' + ); + if (! file_exists($database)) { return; } @@ -49,9 +60,18 @@ public function dropDatabase($database) /** * {@inheritdoc} + * + * @deprecated The engine will create the database file automatically. */ public function createDatabase($database) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/issues/4963', + 'SqliteSchemaManager::createDatabase() is deprecated.' + . ' The engine will create the database file automatically.' + ); + $params = $this->_conn->getParams(); $params['path'] = $database; @@ -86,9 +106,18 @@ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) /** * {@inheritdoc} + * + * @deprecated Use {@see dropForeignKey()} and {@see createForeignKey()} instead. */ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table) { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4897', + 'SqliteSchemaManager::dropAndCreateForeignKey() is deprecated.' + . ' Use SqliteSchemaManager::dropForeignKey() and SqliteSchemaManager::createForeignKey() instead.' + ); + $tableDiff = $this->getTableDiffForAlterForeignKey($table); $tableDiff->changedForeignKeys[] = $foreignKey; @@ -126,7 +155,7 @@ public function listTableForeignKeys($table, $database = null) '# (?:CONSTRAINT\s+([^\s]+)\s+)? (?:FOREIGN\s+KEY[^\)]+\)\s*)? - REFERENCES\s+[^\s]+\s+(?:\([^\)]+\))? + REFERENCES\s+[^\s]+\s+(?:\([^)]+\))? (?: [^,]*? (NOT\s+DEFERRABLE|DEFERRABLE) @@ -175,10 +204,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $indexBuffer = []; // fetch primary - $indexArray = $this->_conn->fetchAllAssociative(sprintf( - 'PRAGMA TABLE_INFO (%s)', - $this->_conn->quote($tableName) - )); + $indexArray = $this->_conn->fetchAllAssociative('SELECT * FROM PRAGMA_TABLE_INFO (?)', [$tableName]); usort( $indexArray, @@ -221,10 +247,7 @@ static function (array $a, array $b): int { $idx['primary'] = false; $idx['non_unique'] = ! $tableIndex['unique']; - $indexArray = $this->_conn->fetchAllAssociative(sprintf( - 'PRAGMA INDEX_INFO (%s)', - $this->_conn->quote($keyName) - )); + $indexArray = $this->_conn->fetchAllAssociative('SELECT * FROM PRAGMA_INDEX_INFO (?)', [$keyName]); foreach ($indexArray as $indexColumnRow) { $idx['column_name'] = $indexColumnRow['name']; @@ -431,9 +454,9 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) $result = []; foreach ($list as $constraint) { $result[] = new ForeignKeyConstraint( - array_values($constraint['local']), + $constraint['local'], $constraint['foreignTable'], - array_values($constraint['foreign']), + $constraint['foreign'], $constraint['name'], [ 'onDelete' => $constraint['onDelete'], @@ -450,22 +473,12 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) /** * @param Table|string $table * - * @return TableDiff - * * @throws Exception */ - private function getTableDiffForAlterForeignKey($table) + private function getTableDiffForAlterForeignKey($table): TableDiff { if (! $table instanceof Table) { - $tableDetails = $this->tryMethod('listTableDetails', $table); - - if ($tableDetails === false) { - throw new Exception( - sprintf('Sqlite schema manager requires to modify foreign keys table definition "%s".', $table) - ); - } - - $table = $tableDetails; + $table = $this->listTableDetails($table); } $tableDiff = new TableDiff($table->getName()); @@ -569,11 +582,24 @@ public function listTableDetails($name): Table return $table; } + public function createComparator(): Comparator + { + return new SQLite\Comparator($this->getDatabasePlatform()); + } + /** * {@inheritDoc} + * + * @deprecated */ public function getSchemaSearchPaths() { + Deprecation::triggerIfCalledFromOutside( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4821', + 'SqliteSchemaManager::getSchemaSearchPaths() is deprecated.' + ); + // SQLite does not support schemas or databases return []; } diff --git a/doctrine/dbal/src/Schema/Table.php b/doctrine/dbal/src/Schema/Table.php index d330d03f4..4f591eb63 100644 --- a/doctrine/dbal/src/Schema/Table.php +++ b/doctrine/dbal/src/Schema/Table.php @@ -314,8 +314,6 @@ public function columnsAreIndexed(array $columnNames) * @param string[] $flags * @param mixed[] $options * - * @return Index - * * @throws SchemaException */ private function _createIndex( @@ -325,7 +323,7 @@ private function _createIndex( $isPrimary, array $flags = [], array $options = [] - ) { + ): Index { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) { throw SchemaException::indexNameInvalid($indexName); } diff --git a/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php b/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php index c08fb6fec..730dff77a 100644 --- a/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php +++ b/doctrine/dbal/src/Schema/Visitor/CreateSchemaSqlCollector.php @@ -91,8 +91,8 @@ public function getQueries() { return array_merge( $this->createNamespaceQueries, - $this->createTableQueries, $this->createSequenceQueries, + $this->createTableQueries, $this->createFkConstraintQueries ); } diff --git a/doctrine/dbal/src/Schema/Visitor/Graphviz.php b/doctrine/dbal/src/Schema/Visitor/Graphviz.php index 299ff0e7f..5af4678f1 100644 --- a/doctrine/dbal/src/Schema/Visitor/Graphviz.php +++ b/doctrine/dbal/src/Schema/Visitor/Graphviz.php @@ -13,6 +13,8 @@ /** * Create a Graphviz output of a Schema. + * + * @deprecated */ class Graphviz extends AbstractVisitor { @@ -62,10 +64,7 @@ public function acceptTable(Table $table) ); } - /** - * @return string - */ - private function createTableLabel(Table $table) + private function createTableLabel(Table $table): string { // Start the table $label = '<'; @@ -107,10 +106,8 @@ private function createTableLabel(Table $table) /** * @param string $name * @param string[] $options - * - * @return string */ - private function createNode($name, $options) + private function createNode($name, $options): string { $node = $name . ' ['; foreach ($options as $key => $value) { @@ -126,10 +123,8 @@ private function createNode($name, $options) * @param string $node1 * @param string $node2 * @param string[] $options - * - * @return string */ - private function createNodeRelation($node1, $node2, $options) + private function createNodeRelation($node1, $node2, $options): string { $relation = $node1 . ' -> ' . $node2 . ' ['; foreach ($options as $key => $value) { diff --git a/doctrine/dbal/src/Statement.php b/doctrine/dbal/src/Statement.php index b7183fa30..782feee26 100644 --- a/doctrine/dbal/src/Statement.php +++ b/doctrine/dbal/src/Statement.php @@ -2,8 +2,6 @@ namespace Doctrine\DBAL; -use Doctrine\DBAL\Driver\Exception; -use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; use Doctrine\Deprecations\Deprecation; @@ -40,7 +38,7 @@ class Statement /** * The underlying driver statement. * - * @var DriverStatement + * @var Driver\Statement */ protected $stmt; @@ -61,26 +59,19 @@ class Statement /** * Creates a new Statement for the given SQL and Connection. * - * @internal The statement can be only instantiated by {@link Connection}. + * @internal The statement can be only instantiated by {@see Connection}. * - * @param string $sql The SQL of the statement. - * @param Connection $conn The connection on which the statement should be executed. + * @param Connection $conn The connection for handling statement errors. + * @param Driver\Statement $statement The underlying driver-level statement. + * @param string $sql The SQL of the statement. * * @throws Exception */ - public function __construct($sql, Connection $conn) + public function __construct(Connection $conn, Driver\Statement $statement, string $sql) { - $driverConnection = $conn->getWrappedConnection(); - - try { - $stmt = $driverConnection->prepare($sql); - } catch (Exception $ex) { - throw $conn->convertExceptionDuringQuery($ex, $sql); - } - - $this->sql = $sql; - $this->stmt = $stmt; $this->conn = $conn; + $this->stmt = $statement; + $this->sql = $sql; $this->platform = $conn->getDatabasePlatform(); } @@ -122,7 +113,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) try { return $this->stmt->bindValue($param, $value, $bindingType); - } catch (Exception $e) { + } catch (Driver\Exception $e) { throw $this->conn->convertException($e); } } @@ -153,7 +144,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le } return $this->stmt->bindParam($param, $variable, $type); - } catch (Exception $e) { + } catch (Driver\Exception $e) { throw $this->conn->convertException($e); } } @@ -189,7 +180,7 @@ public function execute($params = null): Result $this->stmt->execute($params), $this->conn ); - } catch (Exception $ex) { + } catch (Driver\Exception $ex) { throw $this->conn->convertExceptionDuringQuery($ex, $this->sql, $this->params, $this->types); } finally { if ($logger !== null) { @@ -233,7 +224,7 @@ public function executeStatement(array $params = []): int /** * Gets the wrapped driver statement. * - * @return DriverStatement + * @return Driver\Statement */ public function getWrappedStatement() { diff --git a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php index 875f2a20b..a91372061 100644 --- a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php @@ -5,19 +5,19 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Tools\Console\ConnectionProvider; -use Doctrine\DBAL\Tools\Dumper; -use LogicException; use RuntimeException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use function array_keys; use function assert; use function is_bool; -use function is_numeric; use function is_string; +use function sprintf; use function stripos; /** @@ -44,7 +44,7 @@ protected function configure() ->setDefinition([ new InputOption('connection', null, InputOption::VALUE_REQUIRED, 'The named database connection'), new InputArgument('sql', InputArgument::REQUIRED, 'The SQL statement to execute.'), - new InputOption('depth', null, InputOption::VALUE_REQUIRED, 'Dumping depth of result set.', '7'), + new InputOption('depth', null, InputOption::VALUE_REQUIRED, 'Dumping depth of result set (deprecated).'), new InputOption('force-fetch', null, InputOption::VALUE_NONE, 'Forces fetching the result.'), ]) ->setHelp(<<getConnection($input); + $io = new SymfonyStyle($input, $output); $sql = $input->getArgument('sql'); @@ -75,23 +76,19 @@ protected function execute(InputInterface $input, OutputInterface $output) assert(is_string($sql)); - $depth = $input->getOption('depth'); - - if (! is_numeric($depth)) { - throw new LogicException("Option 'depth' must contains an integer value"); + if ($input->getOption('depth') !== null) { + $io->warning('Parameter "depth" is deprecated and has no effect anymore.'); } $forceFetch = $input->getOption('force-fetch'); assert(is_bool($forceFetch)); if (stripos($sql, 'select') === 0 || $forceFetch) { - $resultSet = $conn->fetchAllAssociative($sql); + $this->runQuery($io, $conn, $sql); } else { - $resultSet = $conn->executeStatement($sql); + $this->runStatement($io, $conn, $sql); } - $output->write(Dumper::dump($resultSet, (int) $depth)); - return 0; } @@ -106,4 +103,27 @@ private function getConnection(InputInterface $input): Connection return $this->connectionProvider->getDefaultConnection(); } + + /** + * @throws Exception + */ + private function runQuery(SymfonyStyle $io, Connection $conn, string $sql): void + { + $resultSet = $conn->fetchAllAssociative($sql); + if ($resultSet === []) { + $io->success('The query yielded an empty result set.'); + + return; + } + + $io->table(array_keys($resultSet[0]), $resultSet); + } + + /** + * @throws Exception + */ + private function runStatement(SymfonyStyle $io, Connection $conn, string $sql): void + { + $io->success(sprintf('%d rows affected.', $conn->executeStatement($sql))); + } } diff --git a/doctrine/dbal/src/Tools/Console/ConsoleRunner.php b/doctrine/dbal/src/Tools/Console/ConsoleRunner.php index 1cc315dee..823a1e80a 100644 --- a/doctrine/dbal/src/Tools/Console/ConsoleRunner.php +++ b/doctrine/dbal/src/Tools/Console/ConsoleRunner.php @@ -2,13 +2,15 @@ namespace Doctrine\DBAL\Tools\Console; +use Composer\InstalledVersions; use Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand; use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand; use Exception; -use PackageVersions\Versions; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; +use function assert; + /** * Handles running the Console Tools inside Symfony Console context. */ @@ -25,7 +27,10 @@ class ConsoleRunner */ public static function run(ConnectionProvider $connectionProvider, $commands = []) { - $cli = new Application('Doctrine Command Line Interface', Versions::getVersion('doctrine/dbal')); + $version = InstalledVersions::getVersion('doctrine/dbal'); + assert($version !== null); + + $cli = new Application('Doctrine Command Line Interface', $version); $cli->setCatchExceptions(true); self::addCommands($cli, $connectionProvider); @@ -47,6 +52,8 @@ public static function addCommands(Application $cli, ConnectionProvider $connect /** * Prints the instructions to create a configuration file * + * @deprecated This method will be removed without replacement. + * * @return void */ public static function printCliConfigTemplate() diff --git a/doctrine/dbal/src/Tools/Dumper.php b/doctrine/dbal/src/Tools/Dumper.php deleted file mode 100644 index 23dc7a059..000000000 --- a/doctrine/dbal/src/Tools/Dumper.php +++ /dev/null @@ -1,181 +0,0 @@ -toArray(); - } - - if ($maxDepth === 0) { - return is_object($var) ? get_class($var) - : (is_array($var) ? 'Array(' . count($var) . ')' : $var); - } - - if (is_array($var)) { - $return = []; - - foreach ($var as $k => $v) { - $return[$k] = self::export($v, $maxDepth - 1); - } - - return $return; - } - - if (! $isObj) { - return $var; - } - - $return = new stdClass(); - if ($var instanceof DateTimeInterface) { - $return->__CLASS__ = get_class($var); - $return->date = $var->format('c'); - $return->timezone = $var->getTimezone()->getName(); - - return $return; - } - - $return->__CLASS__ = self::getClass($var); - - if ($var instanceof Proxy) { - $return->__IS_PROXY__ = true; - $return->__PROXY_INITIALIZED__ = $var->__isInitialized(); - } - - if ($var instanceof ArrayObject || $var instanceof ArrayIterator) { - $return->__STORAGE__ = self::export($var->getArrayCopy(), $maxDepth - 1); - } - - return self::fillReturnWithClassAttributes($var, $return, $maxDepth); - } - - /** - * Fill the $return variable with class attributes - * Based on obj2array function from {@see https://secure.php.net/manual/en/function.get-object-vars.php#47075} - * - * @param object $var - * - * @return mixed - */ - private static function fillReturnWithClassAttributes($var, stdClass $return, int $maxDepth) - { - $clone = (array) $var; - - foreach (array_keys($clone) as $key) { - $aux = explode("\0", $key); - $name = end($aux); - if ($aux[0] === '') { - $name .= ':' . ($aux[1] === '*' ? 'protected' : $aux[1] . ':private'); - } - - $return->$name = self::export($clone[$key], $maxDepth - 1); - } - - return $return; - } - - /** - * @param object $object - */ - private static function getClass($object): string - { - $class = get_class($object); - - if (! class_exists(Proxy::class)) { - return $class; - } - - $pos = strrpos($class, '\\' . Proxy::MARKER . '\\'); - - if ($pos === false) { - return $class; - } - - return substr($class, $pos + strlen(Proxy::MARKER) + 2); - } -} diff --git a/doctrine/dbal/src/Types/ArrayType.php b/doctrine/dbal/src/Types/ArrayType.php index 3137e03f3..b3d9d3c56 100644 --- a/doctrine/dbal/src/Types/ArrayType.php +++ b/doctrine/dbal/src/Types/ArrayType.php @@ -11,6 +11,9 @@ use function stream_get_contents; use function unserialize; +use const E_DEPRECATED; +use const E_USER_DEPRECATED; + /** * Type that maps a PHP array to a clob SQL type. */ @@ -45,6 +48,10 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $value = is_resource($value) ? stream_get_contents($value) : $value; set_error_handler(function (int $code, string $message): bool { + if ($code === E_DEPRECATED || $code === E_USER_DEPRECATED) { + return false; + } + throw ConversionException::conversionFailedUnserialization($this->getName(), $message); }); diff --git a/doctrine/dbal/src/Types/AsciiStringType.php b/doctrine/dbal/src/Types/AsciiStringType.php index e79757486..ab1e0e061 100644 --- a/doctrine/dbal/src/Types/AsciiStringType.php +++ b/doctrine/dbal/src/Types/AsciiStringType.php @@ -12,15 +12,12 @@ final class AsciiStringType extends StringType /** * {@inheritdoc} */ - public function getSQLDeclaration(array $column, AbstractPlatform $platform) + public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { return $platform->getAsciiStringTypeDeclarationSQL($column); } - /** - * {@inheritdoc} - */ - public function getBindingType() + public function getBindingType(): int { return ParameterType::ASCII; } diff --git a/doctrine/dbal/src/Types/BooleanType.php b/doctrine/dbal/src/Types/BooleanType.php index f6e4df3b2..68a80ef3f 100644 --- a/doctrine/dbal/src/Types/BooleanType.php +++ b/doctrine/dbal/src/Types/BooleanType.php @@ -4,6 +4,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Platforms\DB2Platform; /** * Type that maps an SQL boolean to a PHP boolean. @@ -49,4 +50,14 @@ public function getBindingType() { return ParameterType::BOOLEAN; } + + /** + * @return bool + */ + public function requiresSQLCommentHint(AbstractPlatform $platform) + { + // We require a commented boolean type in order to distinguish between + // boolean and smallint as both (have to) map to the same native type. + return $platform instanceof DB2Platform; + } } diff --git a/doctrine/dbal/src/Types/ConversionException.php b/doctrine/dbal/src/Types/ConversionException.php index f1a18742e..278734b9b 100644 --- a/doctrine/dbal/src/Types/ConversionException.php +++ b/doctrine/dbal/src/Types/ConversionException.php @@ -5,6 +5,8 @@ use Doctrine\DBAL\Exception; use Throwable; +use function func_get_arg; +use function func_num_args; use function get_class; use function gettype; use function implode; @@ -25,7 +27,7 @@ class ConversionException extends Exception /** * Thrown when a Database to Doctrine Type Conversion fails. * - * @param string $value + * @param mixed $value * @param string $toType * * @return ConversionException @@ -41,7 +43,7 @@ public static function conversionFailed($value, $toType, ?Throwable $previous = * Thrown when a Database to Doctrine Type Conversion fails and we can make a statement * about the expected format. * - * @param string $value + * @param mixed $value * @param string $toType * @param string $expectedFormat * @@ -98,7 +100,7 @@ public static function conversionFailedInvalidType( * * @return ConversionException */ - public static function conversionFailedSerialization($value, $format, $error) + public static function conversionFailedSerialization($value, $format, $error /*, ?Throwable $previous = null */) { $actualType = is_object($value) ? get_class($value) : gettype($value); @@ -107,7 +109,7 @@ public static function conversionFailedSerialization($value, $format, $error) $actualType, $format, $error - )); + ), 0, func_num_args() >= 4 ? func_get_arg(3) : null); } public static function conversionFailedUnserialization(string $format, string $error): self diff --git a/doctrine/dbal/src/Types/DecimalType.php b/doctrine/dbal/src/Types/DecimalType.php index f75d3db2c..c70067f2b 100644 --- a/doctrine/dbal/src/Types/DecimalType.php +++ b/doctrine/dbal/src/Types/DecimalType.php @@ -5,6 +5,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use function is_float; +use function is_int; use const PHP_VERSION_ID; @@ -34,9 +35,9 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) */ public function convertToPHPValue($value, AbstractPlatform $platform) { - // Some drivers starting from PHP 8.1 can represent decimals as float + // Some drivers starting from PHP 8.1 can represent decimals as float/int // See also: https://github.com/doctrine/dbal/pull/4818 - if (PHP_VERSION_ID >= 80100 && is_float($value)) { + if (PHP_VERSION_ID >= 80100 && (is_float($value) || is_int($value))) { return (string) $value; } diff --git a/doctrine/dbal/src/Types/JsonType.php b/doctrine/dbal/src/Types/JsonType.php index d17b7f51e..d28b8b79f 100644 --- a/doctrine/dbal/src/Types/JsonType.php +++ b/doctrine/dbal/src/Types/JsonType.php @@ -3,15 +3,15 @@ namespace Doctrine\DBAL\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; +use JsonException; use function is_resource; use function json_decode; use function json_encode; -use function json_last_error; -use function json_last_error_msg; use function stream_get_contents; -use const JSON_ERROR_NONE; +use const JSON_PRESERVE_ZERO_FRACTION; +use const JSON_THROW_ON_ERROR; /** * Type generating json objects values @@ -35,13 +35,11 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) return null; } - $encoded = json_encode($value); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw ConversionException::conversionFailedSerialization($value, 'json', json_last_error_msg()); + try { + return json_encode($value, JSON_THROW_ON_ERROR | JSON_PRESERVE_ZERO_FRACTION); + } catch (JsonException $e) { + throw ConversionException::conversionFailedSerialization($value, 'json', $e->getMessage(), $e); } - - return $encoded; } /** @@ -57,13 +55,11 @@ public function convertToPHPValue($value, AbstractPlatform $platform) $value = stream_get_contents($value); } - $val = json_decode($value, true); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw ConversionException::conversionFailed($value, $this->getName()); + try { + return json_decode($value, true, 512, JSON_THROW_ON_ERROR); + } catch (JsonException $e) { + throw ConversionException::conversionFailed($value, $this->getName(), $e); } - - return $val; } /** diff --git a/doctrine/dbal/src/Types/Type.php b/doctrine/dbal/src/Types/Type.php index 03e5b8248..c2ae2be5a 100644 --- a/doctrine/dbal/src/Types/Type.php +++ b/doctrine/dbal/src/Types/Type.php @@ -12,7 +12,7 @@ /** * The base class for so-called Doctrine mapping types. * - * A Type object is obtained by calling the static {@link getType()} method. + * A Type object is obtained by calling the static {@see getType()} method. */ abstract class Type { @@ -189,7 +189,7 @@ public static function overrideType($name, $className) * Gets the (preferred) binding type for values of this type that * can be used when binding parameters to prepared statements. * - * This method should return one of the {@link ParameterType} constants. + * This method should return one of the {@see ParameterType} constants. * * @return int */ @@ -202,7 +202,7 @@ public function getBindingType() * Gets the types array map which holds all registered types and the corresponding * type class * - * @return string[] + * @return array */ public static function getTypesMap() { @@ -218,10 +218,13 @@ static function (Type $type): string { * Does working with this column require SQL conversion functions? * * This is a metadata function that is required for example in the ORM. - * Usage of {@link convertToDatabaseValueSQL} and - * {@link convertToPHPValueSQL} works for any type and mostly + * Usage of {@see convertToDatabaseValueSQL} and + * {@see convertToPHPValueSQL} works for any type and mostly * does nothing. This method can additionally be used for optimization purposes. * + * @deprecated Consumers should call {@see convertToDatabaseValueSQL} and {@see convertToPHPValueSQL} + * regardless of the type. + * * @return bool */ public function canRequireSQLConversion() diff --git a/doctrine/dbal/src/VersionAwarePlatformDriver.php b/doctrine/dbal/src/VersionAwarePlatformDriver.php index b3ec8b843..ffcfcd636 100644 --- a/doctrine/dbal/src/VersionAwarePlatformDriver.php +++ b/doctrine/dbal/src/VersionAwarePlatformDriver.php @@ -11,6 +11,8 @@ * support the correct features and SQL syntax of each version. * This interface should be implemented by drivers that are capable to do this * distinction. + * + * @deprecated All drivers will have to be aware of the server version in the next major release. */ interface VersionAwarePlatformDriver extends Driver { diff --git a/doctrine/deprecations/.gitignore b/doctrine/deprecations/.gitignore deleted file mode 100644 index 2ee7dedc1..000000000 --- a/doctrine/deprecations/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor -.phpcs-cache -composer.lock diff --git a/composer/package-versions-deprecated/LICENSE b/doctrine/deprecations/LICENSE similarity index 96% rename from composer/package-versions-deprecated/LICENSE rename to doctrine/deprecations/LICENSE index a90b0792c..156905cdd 100644 --- a/composer/package-versions-deprecated/LICENSE +++ b/doctrine/deprecations/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016 Marco Pivetta +Copyright (c) 2020-2021 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 diff --git a/doctrine/deprecations/README.md b/doctrine/deprecations/README.md index d66822214..22f0cced3 100644 --- a/doctrine/deprecations/README.md +++ b/doctrine/deprecations/README.md @@ -137,6 +137,13 @@ class MyTest extends TestCase triggerTheCodeWithDeprecation(); } + + public function testSomethingDeprecationFixed() + { + $this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); + + triggerTheCodeWithoutDeprecation(); + } } ``` diff --git a/doctrine/deprecations/composer.json b/doctrine/deprecations/composer.json index 5cc7ac13d..c79e38cdc 100644 --- a/doctrine/deprecations/composer.json +++ b/doctrine/deprecations/composer.json @@ -8,9 +8,9 @@ "php": "^7.1|^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0", - "doctrine/coding-standard": "^6.0|^7.0|^8.0" + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3", + "doctrine/coding-standard": "^9" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -23,5 +23,10 @@ "DeprecationTests\\": "test_fixtures/src", "Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo" } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/doctrine/deprecations/phpcs.xml b/doctrine/deprecations/phpcs.xml index 4e0cc21fd..f115e43dd 100644 --- a/doctrine/deprecations/phpcs.xml +++ b/doctrine/deprecations/phpcs.xml @@ -9,6 +9,8 @@ + + lib tests diff --git a/doctrine/deprecations/phpunit.xml.dist b/doctrine/deprecations/phpunit.xml.dist deleted file mode 100644 index 4740c0604..000000000 --- a/doctrine/deprecations/phpunit.xml.dist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests - - - diff --git a/doctrine/deprecations/test_fixtures/src/Foo.php b/doctrine/deprecations/test_fixtures/src/Foo.php deleted file mode 100644 index c4b8ebece..000000000 --- a/doctrine/deprecations/test_fixtures/src/Foo.php +++ /dev/null @@ -1,22 +0,0 @@ -oldFunc(); - } - - public static function triggerDependencyWithDeprecationFromInside(): void - { - $bar = new Bar(); - $bar->newFunc(); - } -} diff --git a/doctrine/deprecations/test_fixtures/src/RootDeprecation.php b/doctrine/deprecations/test_fixtures/src/RootDeprecation.php deleted file mode 100644 index feccd4865..000000000 --- a/doctrine/deprecations/test_fixtures/src/RootDeprecation.php +++ /dev/null @@ -1,20 +0,0 @@ - + + + + + + + + diff --git a/doctrine/event-manager/lib/Doctrine/Common/EventArgs.php b/doctrine/event-manager/src/EventArgs.php similarity index 97% rename from doctrine/event-manager/lib/Doctrine/Common/EventArgs.php rename to doctrine/event-manager/src/EventArgs.php index 9b9cc0565..4795ba6be 100644 --- a/doctrine/event-manager/lib/Doctrine/Common/EventArgs.php +++ b/doctrine/event-manager/src/EventArgs.php @@ -16,7 +16,7 @@ class EventArgs /** * Single instance of EventArgs. * - * @var EventArgs + * @var EventArgs|null */ private static $_emptyEventArgsInstance; diff --git a/doctrine/event-manager/lib/Doctrine/Common/EventManager.php b/doctrine/event-manager/src/EventManager.php similarity index 72% rename from doctrine/event-manager/lib/Doctrine/Common/EventManager.php rename to doctrine/event-manager/src/EventManager.php index a0860e37e..6d841be27 100644 --- a/doctrine/event-manager/lib/Doctrine/Common/EventManager.php +++ b/doctrine/event-manager/src/EventManager.php @@ -2,6 +2,8 @@ namespace Doctrine\Common; +use Doctrine\Deprecations\Deprecation; + use function spl_object_hash; /** @@ -15,9 +17,9 @@ class EventManager * Map of registered listeners. * => * - * @var object[][] + * @var array */ - private $_listeners = []; + private $listeners = []; /** * Dispatches an event to all registered listeners. @@ -31,27 +33,49 @@ class EventManager */ public function dispatchEvent($eventName, ?EventArgs $eventArgs = null) { - if (! isset($this->_listeners[$eventName])) { + if (! isset($this->listeners[$eventName])) { return; } $eventArgs = $eventArgs ?? EventArgs::getEmptyInstance(); - foreach ($this->_listeners[$eventName] as $listener) { + foreach ($this->listeners[$eventName] as $listener) { $listener->$eventName($eventArgs); } } /** - * Gets the listeners of a specific event or all listeners. + * Gets the listeners of a specific event. * * @param string|null $event The name of the event. * - * @return object[]|object[][] The event listeners for the specified event, or all event listeners. + * @return object[]|array The event listeners for the specified event, or all event listeners. + * @psalm-return ($event is null ? array : object[]) */ public function getListeners($event = null) { - return $event ? $this->_listeners[$event] : $this->_listeners; + 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] ?? []; + } + + /** + * Gets all listeners keyed by event name. + * + * @return array The event listeners for the specified event, or all event listeners. + */ + public function getAllListeners(): array + { + return $this->listeners; } /** @@ -63,7 +87,7 @@ public function getListeners($event = null) */ public function hasListeners($event) { - return ! empty($this->_listeners[$event]); + return ! empty($this->listeners[$event]); } /** @@ -82,7 +106,7 @@ public function addEventListener($events, $listener) foreach ((array) $events as $event) { // Overrides listener if a previous one was associated already // Prevents duplicate listeners on same event (same instance only) - $this->_listeners[$event][$hash] = $listener; + $this->listeners[$event][$hash] = $listener; } } @@ -100,7 +124,7 @@ public function removeEventListener($events, $listener) $hash = spl_object_hash($listener); foreach ((array) $events as $event) { - unset($this->_listeners[$event][$hash]); + unset($this->listeners[$event][$hash]); } } diff --git a/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.php b/doctrine/event-manager/src/EventSubscriber.php similarity index 86% rename from doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.php rename to doctrine/event-manager/src/EventSubscriber.php index 7d5e2ea3f..89cef558a 100644 --- a/doctrine/event-manager/lib/Doctrine/Common/EventSubscriber.php +++ b/doctrine/event-manager/src/EventSubscriber.php @@ -5,7 +5,7 @@ namespace Doctrine\Common; /** - * An EventSubscriber knows himself what events he is interested in. + * An EventSubscriber knows what events it is interested in. * If an EventSubscriber is added to an EventManager, the manager invokes * {@link getSubscribedEvents} and registers the subscriber as a listener for all * returned events. diff --git a/psr/cache/LICENSE.txt b/psr/cache/LICENSE.txt new file mode 100644 index 000000000..b1c2c97b9 --- /dev/null +++ b/psr/cache/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2015 PHP Framework Interoperability Group + +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/psr/cache/README.md b/psr/cache/README.md new file mode 100644 index 000000000..c8706ceea --- /dev/null +++ b/psr/cache/README.md @@ -0,0 +1,9 @@ +PSR Cache +========= + +This repository holds all interfaces defined by +[PSR-6](http://www.php-fig.org/psr/psr-6/). + +Note that this is not a Cache implementation of its own. It is merely an +interface that describes a Cache implementation. See the specification for more +details. diff --git a/psr/cache/composer.json b/psr/cache/composer.json new file mode 100644 index 000000000..e828fec94 --- /dev/null +++ b/psr/cache/composer.json @@ -0,0 +1,25 @@ +{ + "name": "psr/cache", + "description": "Common interface for caching libraries", + "keywords": ["psr", "psr-6", "cache"], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/psr/cache/src/CacheException.php b/psr/cache/src/CacheException.php new file mode 100644 index 000000000..e27f22f8d --- /dev/null +++ b/psr/cache/src/CacheException.php @@ -0,0 +1,10 @@ + Date: Mon, 21 Nov 2022 16:39:29 +0100 Subject: [PATCH 2/3] Update gitignore, ignore all common files that we do not ship MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .gitignore | 201 ++++++++--------------------------------------------- 1 file changed, 29 insertions(+), 172 deletions(-) diff --git a/.gitignore b/.gitignore index 7cadd463c..9752370b2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,65 +12,42 @@ bin **/CHANGELOG.md # ignore coc **/CODE_OF_CONDUCT.md +# ignore composer.json +*/*/composer.json +# ignore README.md and UPGRADE.md +*/*/README.md +*/*/UPGRADE.md +# ignore codestyle tools config +*/*/psalm.xml +*/*/phpcs.xml +*/*/.phpcs.xml +*/*/.scrutinizer.yml +*/*/phpunit.xml +*/*/phpunit.xml.dist +# ignore gitignores +*/*/.gitignore +# ignore docs and tests +*/*/tests aws/aws-sdk-php/.changes -bantu/ini-get-wrapper/tests - -/brick/math/random-tests.php -/brick/math/psalm*.xmls - -deepdiver/zipstreamer/tests - -deepdiver1975/tarstreamer/.gitignore -deepdiver1975/tarstreamer/.travis.yml -deepdiver1975/tarstreamer/.scrutinizer.yml -deepdiver1975/tarstreamer/composer.json -deepdiver1975/tarstreamer/tests - -doctrine/annotations/tests -doctrine/annotations/.travis.yml -doctrine/cache/tests -doctrine/cache/.travis.yml -doctrine/cache/composer.json -doctrine/cache/README.md -doctrine/collections/tests -doctrine/collections/.travis.yml -doctrine/collections/README.md -doctrine/collections/composer.json -doctrine/common/tests -doctrine/common/.travis.yml -doctrine/common/composer.json -doctrine/deprecations/tests -doctrine/dbal/tests -doctrine/dbal/docs -doctrine/dbal/psalm.xml -doctrine/dbal/run-all.sh +brick/math/random-tests.php +brick/math/psalm*.xmls + +doctrine/cache/UPGRADE-1.11.md doctrine/dbal/.doctrine-project.json -doctrine/dbal/.travis.yml -doctrine/dbal/.gitignore doctrine/dbal/.gitattributes doctrine/dbal/.gitmodules doctrine/dbal/build.* -doctrine/dbal/phpcs.xml.dist -doctrine/dbal/phpunit.xml.dist -doctrine/inflector/tests -doctrine/lexer/composer.json +doctrine/dbal/docs +doctrine/dbal/run-all.sh +doctrine/event-manager/phpstan.neon.dist doctrine/lexer/LICENSE fusonic/linq/examples/ -fusonic/linq/tests/ -fusonic/linq/composer.json -fusonic/linq/.gitignore -fusonic/linq/README.md fusonic/opengraph/examples/ fusonic/opengraph/.gitattributes -fusonic/opengraph/.gitignore -fusonic/opengraph/.scrutinizer.yml -fusonic/opengraph/composer.json -fusonic/opengraph/phpunit.xml -fusonic/opengraph/README.md giggsey/libphonenumber-for-php/METADATA-VERSION.txt @@ -78,57 +55,27 @@ giggsey/locale/CLDR-VERSION.txt guzzlehttp/guzzle/build/ guzzlehttp/guzzle/docs/ -guzzlehttp/guzzle/tests/ -guzzlehttp/guzzle/.gitignore -guzzlehttp/guzzle/CHANGELOG.md -guzzlehttp/guzzle/composer.json guzzlehttp/guzzle/MAKEFILE -guzzlehttp/guzzle/phpunit.xml.dist -guzzlehttp/guzzle/README.md guzzlehttp/guzzle/UPGRADING.md + guzzlehttp/ringphp/docs/ -guzzlehttp/ringphp/tests/ -guzzlehttp/ringphp/.gitignore -guzzlehttp/ringphp/CHANGELOG.md guzzlehttp/ringphp/Makefile guzzlehttp/ringphp/README.rst -guzzlehttp/ringphp/composer.json -guzzlehttp/ringphp/phpunit.xml.dist -guzzlehttp/streams/tests/ -guzzlehttp/streams/.gitignore -guzzlehttp/streams/.travis.yml + guzzlehttp/streams/CHANGELOG.rst guzzlehttp/streams/Makefile guzzlehttp/streams/README.rst -guzzlehttp/streams/composer.json -guzzlehttp/streams/phpunit.xml.dist -icewind/streams/tests -icewind/streams/README.md icewind/streams/LICENCE -icewind/streams/composer.json + icewind/searchdav/.github/ -icewind/searchdav/.scrutinizer.yml -icewind/searchdav/tests -icewind/searchdav/README.md -icewind/searchdav/composer.json - -ircmaxell/password-compat/.travis.yml -ircmaxell/password-compat/README.md -ircmaxell/password-compat/phpunit.xml.dist + ircmaxell/password-compat/test/ ircmaxell/password-compat/version-test.php ircmaxell/random-lib/test/ -ircmaxell/random-lib/.gitignore -ircmaxell/random-lib/.travis.yml ircmaxell/random-lib/LICENSE -ircmaxell/random-lib/README.md -ircmaxell/random-lib/composer.json ircmaxell/random-lib/composer.lock -ircmaxell/random-lib/phpunit.xml.dist - -ircmaxell/security-lib/tests justinrainbow/json-schema/demo @@ -139,173 +86,83 @@ league/flysystem/SECURITY.md league/flysystem/deprecations.md mexitek/phpcolors/demo -mexitek/phpcolors/tests -mexitek/phpcolors/.gitignore -mexitek/phpcolors/.phpcs.xml -mexitek/phpcolors/composer.json -mexitek/phpcolors/README.md mikey179/vfsstream -mlocati/ip-lib/README.md -mlocati/ip-lib/composer.json - -mtdowling/jmespath.php/tests - -nextcloud/lognormalizer/.gitignore -nextcloud/lognormalizer/.travis.yml -nextcloud/lognormalizer/.scrutinizer.yml -nextcloud/lognormalizer/CHANGELOG.md -nextcloud/lognormalizer/README.md -nextcloud/lognormalizer/composer.json -nextcloud/lognormalizer/phpunit.xml -nextcloud/lognormalizer/tests - nikic/php-parser/bin/ nikic/php-parser/doc/ nikic/php-parser/test/ nikic/php-parser/test_old/ nikic/php-parser/grammar/analyze.php nikic/php-parser/grammar/rebuildParser.php -nikic/php-parser/.gitignore -nikic/php-parser/CHANGELOG.md -nikic/php-parser/README.md nikic/php-parser/UPGRADE-1.0.md nikic/php-parser/UPGRADE-2.0.md nikic/php-parser/UPGRADE-3.0.md nikic/php-parser/UPGRADE-4.0.md -nikic/php-parser/composer.json nikic/php-parser/grammar/parser.template nikic/php-parser/grammar/php5.y nikic/php-parser/grammar/php7.y nikic/php-parser/grammar/rebuildParsers.php nikic/php-parser/grammar/tokens.template nikic/php-parser/grammar/tokens.y -nikic/php-parser/phpunit.xml.dist - -patchwork/jsqueeze/tests -patchwork/jsqueeze/phpunit.xml.dist pear/archive_tar/.travis.sh -pear/archive_tar/.travis.yml -pear/archive_tar/tests/ pear/archive_tar/docs/ pear/archive_tar/scripts/ pear/archive_tar/sync-php4 -pear/console_getopt/tests/ - -pear/pear_exception/tests/ - phpseclib/phpseclib/.git* phpseclib/phpseclib/*.yml -phpseclib/phpseclib/phpunit.xml.dist phpseclib/phpseclib/build/ -phpseclib/phpseclib/tests/ phpseclib/phpseclib/travis/ phpseclib/phpseclib/BACKERS.md -phpseclib/phpseclib/CHANGELOG.md -phpseclib/phpseclib/README.md -phpseclib/phpseclib/composer.json phpseclib/phpseclib/composer.lock -phpseclib/phpseclib/phpunit.xml - -php-http/guzzle6-adapter/CHANGELOG.md -php-http/guzzle6-adapter/README.md - -php-http/httplug/CHANGELOG.md -php-http/httplug/README.md - -php-http/promise/CHANGELOG.md -php-http/promise/README.md php-opencloud/openstack/doc -php-opencloud/openstack/tests php-opencloud/openstack/samples pimple/pimple/ext -pimple/pimple/.gitignore -pimple/pimple/.travis.yml pimple/pimple/CHANGELOG -pimple/pimple/composer.json pimple/pimple/LICENSE -pimple/pimple/phpunit.xml.dist pimple/pimple/README.rst pimple/pimple/src/Pimple/Tests -psr/http-client/CHANGELOG.md -psr/http-client/README.md - psr/log/Psr/Log/Test/ -rackspace/php-opencloud/tests rackspace/php-opencloud/doc rackspace/php-opencloud/docs rackspace/php-opencloud/samples -react/promise/tests/ -react/promise/.gitignore -react/promise/CHANGELOG.md -react/promise/composer.json -react/promise/phpunit.xml.dist -react/promise/README.md - sabre/dav/examples -sabre/dav/tests -sabre/event/tests + sabre/http/examples -sabre/http/tests + sabre/uri/.gitattributes -sabre/uri/tests -sabre/vobject/CHANGELOG.md -sabre/vobject/tests -sabre/xml/tests scssphp/scssphp/example -stecman/symfony-console-completion/tests -stecman/symfony-console-completion/.gitignore -stecman/symfony-console-completion/.travis.yml -stecman/symfony-console-completion/composer.json -stecman/symfony-console-completion/phpunit.xml.dist -stecman/symfony-console-completion/README.md - -swiftmailer/swiftmailer/.travis.yml -swiftmailer/swiftmailer/phpunit.xml.dist swiftmailer/swiftmailer/doc/ swiftmailer/swiftmailer/notes/ -swiftmailer/swiftmailer/tests/ swiftmailer/swiftmailer/.gitattributes -swiftmailer/swiftmailer/.gitignore swiftmailer/swiftmailer/CHANGES swiftmailer/swiftmailer/README swiftmailer/swiftmailer/VERSION swiftmailer/swiftmailer/LICENSE -swiftmailer/swiftmailer/composer.json symfony/*/Test symfony/debug/Tests symfony/console/Symfony/Component/Console/Tests -symfony/console/Symfony/Component/Console/.gitignore -symfony/console/Symfony/Component/Console/composer.json symfony/console/Tests symfony/routing/Tests/ -symfony/routing/phpunit.xml.dist -symfony/routing/.gitignore symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ - symfony/event-dispatcher/Symfony/EventDispatcher/Debug/Routing/Tests/ -symfony/event-dispatcher/Symfony/EventDispatcher/Debug/phpunit.xml.dist -symfony/event-dispatcher/Symfony/EventDispatcher/Debug/.gitignore symfony/event-dispatcher/Tests symfony/finder/Tests symfony/process/Symfony/Component/Process/Routing/Tests/ -symfony/process/Symfony/Component/Process/phpunit.xml.dist symfony/process/Symfony/Component/Process/Tests -symfony/process/Symfony/Component/Process/.gitignore symfony/process/Tests From a7f6e97c703fb0e042a590a8253d48aef50ea02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 21 Nov 2022 17:11:24 +0100 Subject: [PATCH 3/3] Remove files ignored by gitignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .gitignore | 2 +- aws/aws-crt-php/.gitignore | 210 --- aws/aws-crt-php/README.md | 80 -- aws/aws-crt-php/composer.json | 34 - aws/aws-crt-php/tests/000_CoreTest.php | 22 - aws/aws-crt-php/tests/CrcTest.php | 90 -- aws/aws-crt-php/tests/CredentialsTest.php | 46 - aws/aws-crt-php/tests/ErrorTest.php | 21 - aws/aws-crt-php/tests/EventLoopGroupTest.php | 25 - aws/aws-crt-php/tests/HttpMessageTest.php | 95 -- aws/aws-crt-php/tests/LogTest.php | 23 - aws/aws-crt-php/tests/SigningTest.php | 176 --- aws/aws-crt-php/tests/StreamTest.php | 34 - aws/aws-crt-php/tests/common.inc | 34 - aws/aws-sdk-php/composer.json | 72 - bantu/ini-get-wrapper/.gitignore | 3 - bantu/ini-get-wrapper/.scrutinizer.yml | 7 - bantu/ini-get-wrapper/README.md | 21 - bantu/ini-get-wrapper/composer.json | 15 - bantu/ini-get-wrapper/phpunit.xml.dist | 11 - beberlei/assert/composer.json | 64 - brick/math/composer.json | 35 - christophwurst/id3parser/.gitignore | 1 - christophwurst/id3parser/README.md | 29 - christophwurst/id3parser/composer.json | 15 - cweagans/composer-patches/.gitignore | 1 - cweagans/composer-patches/README.md | 205 --- cweagans/composer-patches/composer.json | 30 - cweagans/composer-patches/phpunit.xml.dist | 18 - .../composer-patches/tests/PatchEventTest.php | 39 - deepdiver/zipstreamer/.gitignore | 3 - deepdiver/zipstreamer/README.md | 19 - deepdiver/zipstreamer/composer.json | 47 - doctrine/cache/UPGRADE-1.11.md | 27 - doctrine/dbal/README.md | 34 - doctrine/dbal/composer.json | 71 - doctrine/deprecations/README.md | 154 -- doctrine/deprecations/composer.json | 32 - doctrine/deprecations/phpcs.xml | 22 - doctrine/event-manager/README.md | 13 - doctrine/event-manager/UPGRADE.md | 7 - doctrine/event-manager/composer.json | 69 - doctrine/event-manager/phpstan.neon.dist | 5 - doctrine/event-manager/psalm.xml | 15 - doctrine/lexer/README.md | 9 - doctrine/lexer/psalm.xml | 15 - egulias/email-validator/composer.json | 38 - fgrosse/phpasn1/CHANGELOG.md | 51 - fgrosse/phpasn1/README.md | 167 --- fgrosse/phpasn1/composer.json | 49 - giggsey/libphonenumber-for-php/README.md | 263 ---- giggsey/libphonenumber-for-php/composer.json | 85 -- giggsey/locale/README.md | 22 - giggsey/locale/composer.json | 56 - guzzlehttp/promises/CHANGELOG.md | 110 -- guzzlehttp/promises/README.md | 546 ------- guzzlehttp/promises/composer.json | 58 - guzzlehttp/psr7/CHANGELOG.md | 396 ------ guzzlehttp/psr7/README.md | 872 ------------ guzzlehttp/psr7/composer.json | 96 -- guzzlehttp/uri-template/CHANGELOG.md | 27 - guzzlehttp/uri-template/README.md | 29 - guzzlehttp/uri-template/composer.json | 61 - icewind/searchdav/.gitignore | 5 - icewind/searchdav/psalm.xml | 15 - icewind/streams/.gitignore | 6 - justinrainbow/json-schema/.php_cs.dist | 33 - justinrainbow/json-schema/README.md | 206 --- justinrainbow/json-schema/composer.json | 76 - justinrainbow/json-schema/phpunit.xml.dist | 26 - laravel/serializable-closure/README.md | 71 - laravel/serializable-closure/composer.json | 51 - league/uri-interfaces/composer.json | 55 - league/uri/composer.json | 110 -- microsoft/azure-storage-blob/README.md | 174 --- microsoft/azure-storage-blob/composer.json | 22 - microsoft/azure-storage-common/README.md | 9 - microsoft/azure-storage-common/composer.json | 22 - mtdowling/jmespath.php/composer.json | 39 - opis/closure/README.md | 92 -- opis/closure/composer.json | 44 - pear/archive_tar/.gitignore | 15 - pear/archive_tar/README.md | 34 - pear/archive_tar/composer.json | 54 - pear/console_getopt/.gitignore | 6 - pear/console_getopt/composer.json | 35 - pear/pear-core-minimal/composer.json | 32 - pear/pear_exception/composer.json | 41 - php-ds/php-ds/CHANGELOG.md | 33 - php-ds/php-ds/README.md | 39 - php-ds/php-ds/composer.json | 32 - php-http/guzzle7-adapter/CHANGELOG.md | 18 - php-http/guzzle7-adapter/README.md | 45 - php-http/guzzle7-adapter/composer.json | 43 - php-http/guzzle7-adapter/psalm.xml | 16 - php-http/httplug/composer.json | 45 - php-http/promise/composer.json | 38 - php-opencloud/openstack/.gitignore | 9 - php-opencloud/openstack/.php_cs.dist | 23 - php-opencloud/openstack/.scrutinizer.yml | 10 - php-opencloud/openstack/CODE_OF_CONDUCT.md | 51 - php-opencloud/openstack/README.md | 76 - php-opencloud/openstack/composer.json | 53 - php-opencloud/openstack/phpunit.xml.dist | 26 - psr/cache/README.md | 9 - psr/cache/composer.json | 25 - psr/container/.gitignore | 3 - psr/container/README.md | 13 - psr/container/composer.json | 22 - psr/event-dispatcher/.gitignore | 2 - psr/event-dispatcher/README.md | 6 - psr/event-dispatcher/composer.json | 26 - psr/http-client/composer.json | 27 - psr/http-factory/.gitignore | 2 - psr/http-factory/README.md | 10 - psr/http-factory/composer.json | 35 - psr/http-message/CHANGELOG.md | 36 - psr/http-message/README.md | 13 - psr/http-message/composer.json | 26 - psr/log/README.md | 58 - psr/log/composer.json | 26 - punic/punic/README.md | 20 - punic/punic/composer.json | 48 - ralouphie/getallheaders/README.md | 27 - ralouphie/getallheaders/composer.json | 26 - ramsey/collection/README.md | 84 -- ramsey/collection/composer.json | 105 -- ramsey/uuid/CHANGELOG.md | 1262 ----------------- ramsey/uuid/README.md | 79 -- ramsey/uuid/composer.json | 101 -- sabre/dav/README.md | 39 - sabre/dav/composer.json | 90 -- sabre/event/composer.json | 69 - sabre/http/.gitignore | 8 - sabre/http/CHANGELOG.md | 360 ----- sabre/http/README.md | 747 ---------- sabre/http/composer.json | 64 - sabre/uri/.gitignore | 8 - sabre/uri/composer.json | 60 - sabre/vobject/README.md | 55 - sabre/vobject/composer.json | 107 -- sabre/xml/README.md | 25 - sabre/xml/composer.json | 67 - scssphp/scssphp/README.md | 71 - scssphp/scssphp/composer.json | 108 -- spomky-labs/base64url/composer.json | 35 - spomky-labs/cbor-php/CODE_OF_CONDUCT.md | 46 - spomky-labs/cbor-php/composer.json | 41 - swiftmailer/swiftmailer/.php_cs.dist | 21 - swiftmailer/swiftmailer/README.md | 25 - symfony/console/CHANGELOG.md | 162 --- symfony/console/README.md | 20 - symfony/console/composer.json | 57 - symfony/css-selector/README.md | 20 - symfony/css-selector/composer.json | 33 - symfony/deprecation-contracts/.gitignore | 3 - symfony/deprecation-contracts/README.md | 26 - symfony/deprecation-contracts/composer.json | 35 - symfony/dom-crawler/README.md | 13 - symfony/dom-crawler/composer.json | 42 - symfony/event-dispatcher-contracts/.gitignore | 3 - symfony/event-dispatcher-contracts/README.md | 9 - .../event-dispatcher-contracts/composer.json | 38 - symfony/event-dispatcher/CHANGELOG.md | 67 - symfony/event-dispatcher/README.md | 15 - symfony/event-dispatcher/composer.json | 51 - symfony/http-foundation/README.md | 28 - symfony/http-foundation/composer.json | 40 - symfony/polyfill-ctype/README.md | 12 - symfony/polyfill-ctype/composer.json | 38 - symfony/polyfill-iconv/README.md | 14 - symfony/polyfill-iconv/composer.json | 41 - symfony/polyfill-intl-grapheme/README.md | 31 - symfony/polyfill-intl-grapheme/composer.json | 38 - symfony/polyfill-intl-idn/README.md | 12 - symfony/polyfill-intl-idn/composer.json | 44 - symfony/polyfill-intl-normalizer/README.md | 14 - .../polyfill-intl-normalizer/composer.json | 39 - symfony/polyfill-mbstring/README.md | 13 - symfony/polyfill-mbstring/composer.json | 41 - symfony/polyfill-php72/README.md | 35 - symfony/polyfill-php72/composer.json | 35 - symfony/polyfill-php73/README.md | 18 - symfony/polyfill-php73/composer.json | 36 - symfony/polyfill-php80/README.md | 25 - symfony/polyfill-php80/composer.json | 40 - symfony/process/CHANGELOG.md | 96 -- symfony/process/README.md | 13 - symfony/process/composer.json | 29 - symfony/routing/CHANGELOG.md | 259 ---- symfony/routing/README.md | 51 - symfony/routing/composer.json | 50 - symfony/service-contracts/.gitignore | 3 - symfony/service-contracts/README.md | 9 - symfony/service-contracts/composer.json | 38 - symfony/translation-contracts/.gitignore | 3 - symfony/translation-contracts/README.md | 9 - symfony/translation-contracts/composer.json | 37 - symfony/translation/CHANGELOG.md | 133 -- symfony/translation/README.md | 33 - symfony/translation/composer.json | 56 - thecodingmachine/safe/README.md | 178 --- thecodingmachine/safe/composer.json | 123 -- web-auth/cose-lib/composer.json | 31 - web-auth/metadata-service/composer.json | 39 - web-auth/webauthn-lib/composer.json | 49 - 206 files changed, 1 insertion(+), 13319 deletions(-) delete mode 100644 aws/aws-crt-php/.gitignore delete mode 100644 aws/aws-crt-php/README.md delete mode 100644 aws/aws-crt-php/composer.json delete mode 100644 aws/aws-crt-php/tests/000_CoreTest.php delete mode 100644 aws/aws-crt-php/tests/CrcTest.php delete mode 100644 aws/aws-crt-php/tests/CredentialsTest.php delete mode 100644 aws/aws-crt-php/tests/ErrorTest.php delete mode 100644 aws/aws-crt-php/tests/EventLoopGroupTest.php delete mode 100644 aws/aws-crt-php/tests/HttpMessageTest.php delete mode 100644 aws/aws-crt-php/tests/LogTest.php delete mode 100644 aws/aws-crt-php/tests/SigningTest.php delete mode 100644 aws/aws-crt-php/tests/StreamTest.php delete mode 100644 aws/aws-crt-php/tests/common.inc delete mode 100644 aws/aws-sdk-php/composer.json delete mode 100644 bantu/ini-get-wrapper/.gitignore delete mode 100644 bantu/ini-get-wrapper/.scrutinizer.yml delete mode 100644 bantu/ini-get-wrapper/README.md delete mode 100644 bantu/ini-get-wrapper/composer.json delete mode 100644 bantu/ini-get-wrapper/phpunit.xml.dist delete mode 100644 beberlei/assert/composer.json delete mode 100644 brick/math/composer.json delete mode 100644 christophwurst/id3parser/.gitignore delete mode 100644 christophwurst/id3parser/README.md delete mode 100644 christophwurst/id3parser/composer.json delete mode 100644 cweagans/composer-patches/.gitignore delete mode 100644 cweagans/composer-patches/README.md delete mode 100644 cweagans/composer-patches/composer.json delete mode 100644 cweagans/composer-patches/phpunit.xml.dist delete mode 100644 cweagans/composer-patches/tests/PatchEventTest.php delete mode 100644 deepdiver/zipstreamer/.gitignore delete mode 100644 deepdiver/zipstreamer/README.md delete mode 100644 deepdiver/zipstreamer/composer.json delete mode 100644 doctrine/cache/UPGRADE-1.11.md delete mode 100644 doctrine/dbal/README.md delete mode 100644 doctrine/dbal/composer.json delete mode 100644 doctrine/deprecations/README.md delete mode 100644 doctrine/deprecations/composer.json delete mode 100644 doctrine/deprecations/phpcs.xml delete mode 100644 doctrine/event-manager/README.md delete mode 100644 doctrine/event-manager/UPGRADE.md delete mode 100644 doctrine/event-manager/composer.json delete mode 100644 doctrine/event-manager/phpstan.neon.dist delete mode 100644 doctrine/event-manager/psalm.xml delete mode 100644 doctrine/lexer/README.md delete mode 100644 doctrine/lexer/psalm.xml delete mode 100644 egulias/email-validator/composer.json delete mode 100644 fgrosse/phpasn1/CHANGELOG.md delete mode 100644 fgrosse/phpasn1/README.md delete mode 100644 fgrosse/phpasn1/composer.json delete mode 100644 giggsey/libphonenumber-for-php/README.md delete mode 100644 giggsey/libphonenumber-for-php/composer.json delete mode 100644 giggsey/locale/README.md delete mode 100644 giggsey/locale/composer.json delete mode 100644 guzzlehttp/promises/CHANGELOG.md delete mode 100644 guzzlehttp/promises/README.md delete mode 100644 guzzlehttp/promises/composer.json delete mode 100644 guzzlehttp/psr7/CHANGELOG.md delete mode 100644 guzzlehttp/psr7/README.md delete mode 100644 guzzlehttp/psr7/composer.json delete mode 100644 guzzlehttp/uri-template/CHANGELOG.md delete mode 100644 guzzlehttp/uri-template/README.md delete mode 100644 guzzlehttp/uri-template/composer.json delete mode 100644 icewind/searchdav/.gitignore delete mode 100644 icewind/searchdav/psalm.xml delete mode 100644 icewind/streams/.gitignore delete mode 100644 justinrainbow/json-schema/.php_cs.dist delete mode 100644 justinrainbow/json-schema/README.md delete mode 100644 justinrainbow/json-schema/composer.json delete mode 100644 justinrainbow/json-schema/phpunit.xml.dist delete mode 100644 laravel/serializable-closure/README.md delete mode 100644 laravel/serializable-closure/composer.json delete mode 100644 league/uri-interfaces/composer.json delete mode 100644 league/uri/composer.json delete mode 100644 microsoft/azure-storage-blob/README.md delete mode 100644 microsoft/azure-storage-blob/composer.json delete mode 100644 microsoft/azure-storage-common/README.md delete mode 100644 microsoft/azure-storage-common/composer.json delete mode 100644 mtdowling/jmespath.php/composer.json delete mode 100644 opis/closure/README.md delete mode 100644 opis/closure/composer.json delete mode 100644 pear/archive_tar/.gitignore delete mode 100644 pear/archive_tar/README.md delete mode 100644 pear/archive_tar/composer.json delete mode 100644 pear/console_getopt/.gitignore delete mode 100644 pear/console_getopt/composer.json delete mode 100644 pear/pear-core-minimal/composer.json delete mode 100644 pear/pear_exception/composer.json delete mode 100644 php-ds/php-ds/CHANGELOG.md delete mode 100644 php-ds/php-ds/README.md delete mode 100644 php-ds/php-ds/composer.json delete mode 100644 php-http/guzzle7-adapter/CHANGELOG.md delete mode 100644 php-http/guzzle7-adapter/README.md delete mode 100644 php-http/guzzle7-adapter/composer.json delete mode 100644 php-http/guzzle7-adapter/psalm.xml delete mode 100644 php-http/httplug/composer.json delete mode 100644 php-http/promise/composer.json delete mode 100644 php-opencloud/openstack/.gitignore delete mode 100644 php-opencloud/openstack/.php_cs.dist delete mode 100644 php-opencloud/openstack/.scrutinizer.yml delete mode 100644 php-opencloud/openstack/CODE_OF_CONDUCT.md delete mode 100644 php-opencloud/openstack/README.md delete mode 100644 php-opencloud/openstack/composer.json delete mode 100644 php-opencloud/openstack/phpunit.xml.dist delete mode 100644 psr/cache/README.md delete mode 100644 psr/cache/composer.json delete mode 100644 psr/container/.gitignore delete mode 100644 psr/container/README.md delete mode 100644 psr/container/composer.json delete mode 100644 psr/event-dispatcher/.gitignore delete mode 100644 psr/event-dispatcher/README.md delete mode 100644 psr/event-dispatcher/composer.json delete mode 100644 psr/http-client/composer.json delete mode 100644 psr/http-factory/.gitignore delete mode 100644 psr/http-factory/README.md delete mode 100644 psr/http-factory/composer.json delete mode 100644 psr/http-message/CHANGELOG.md delete mode 100644 psr/http-message/README.md delete mode 100644 psr/http-message/composer.json delete mode 100644 psr/log/README.md delete mode 100644 psr/log/composer.json delete mode 100644 punic/punic/README.md delete mode 100644 punic/punic/composer.json delete mode 100644 ralouphie/getallheaders/README.md delete mode 100644 ralouphie/getallheaders/composer.json delete mode 100644 ramsey/collection/README.md delete mode 100644 ramsey/collection/composer.json delete mode 100644 ramsey/uuid/CHANGELOG.md delete mode 100644 ramsey/uuid/README.md delete mode 100644 ramsey/uuid/composer.json delete mode 100644 sabre/dav/README.md delete mode 100644 sabre/dav/composer.json delete mode 100644 sabre/event/composer.json delete mode 100644 sabre/http/.gitignore delete mode 100644 sabre/http/CHANGELOG.md delete mode 100644 sabre/http/README.md delete mode 100644 sabre/http/composer.json delete mode 100644 sabre/uri/.gitignore delete mode 100644 sabre/uri/composer.json delete mode 100644 sabre/vobject/README.md delete mode 100644 sabre/vobject/composer.json delete mode 100644 sabre/xml/README.md delete mode 100644 sabre/xml/composer.json delete mode 100644 scssphp/scssphp/README.md delete mode 100644 scssphp/scssphp/composer.json delete mode 100644 spomky-labs/base64url/composer.json delete mode 100644 spomky-labs/cbor-php/CODE_OF_CONDUCT.md delete mode 100644 spomky-labs/cbor-php/composer.json delete mode 100644 swiftmailer/swiftmailer/.php_cs.dist delete mode 100644 swiftmailer/swiftmailer/README.md delete mode 100644 symfony/console/CHANGELOG.md delete mode 100644 symfony/console/README.md delete mode 100644 symfony/console/composer.json delete mode 100644 symfony/css-selector/README.md delete mode 100644 symfony/css-selector/composer.json delete mode 100644 symfony/deprecation-contracts/.gitignore delete mode 100644 symfony/deprecation-contracts/README.md delete mode 100644 symfony/deprecation-contracts/composer.json delete mode 100644 symfony/dom-crawler/README.md delete mode 100644 symfony/dom-crawler/composer.json delete mode 100644 symfony/event-dispatcher-contracts/.gitignore delete mode 100644 symfony/event-dispatcher-contracts/README.md delete mode 100644 symfony/event-dispatcher-contracts/composer.json delete mode 100644 symfony/event-dispatcher/CHANGELOG.md delete mode 100644 symfony/event-dispatcher/README.md delete mode 100644 symfony/event-dispatcher/composer.json delete mode 100644 symfony/http-foundation/README.md delete mode 100644 symfony/http-foundation/composer.json delete mode 100644 symfony/polyfill-ctype/README.md delete mode 100644 symfony/polyfill-ctype/composer.json delete mode 100644 symfony/polyfill-iconv/README.md delete mode 100644 symfony/polyfill-iconv/composer.json delete mode 100644 symfony/polyfill-intl-grapheme/README.md delete mode 100644 symfony/polyfill-intl-grapheme/composer.json delete mode 100644 symfony/polyfill-intl-idn/README.md delete mode 100644 symfony/polyfill-intl-idn/composer.json delete mode 100644 symfony/polyfill-intl-normalizer/README.md delete mode 100644 symfony/polyfill-intl-normalizer/composer.json delete mode 100644 symfony/polyfill-mbstring/README.md delete mode 100644 symfony/polyfill-mbstring/composer.json delete mode 100644 symfony/polyfill-php72/README.md delete mode 100644 symfony/polyfill-php72/composer.json delete mode 100644 symfony/polyfill-php73/README.md delete mode 100644 symfony/polyfill-php73/composer.json delete mode 100644 symfony/polyfill-php80/README.md delete mode 100644 symfony/polyfill-php80/composer.json delete mode 100644 symfony/process/CHANGELOG.md delete mode 100644 symfony/process/README.md delete mode 100644 symfony/process/composer.json delete mode 100644 symfony/routing/CHANGELOG.md delete mode 100644 symfony/routing/README.md delete mode 100644 symfony/routing/composer.json delete mode 100644 symfony/service-contracts/.gitignore delete mode 100644 symfony/service-contracts/README.md delete mode 100644 symfony/service-contracts/composer.json delete mode 100644 symfony/translation-contracts/.gitignore delete mode 100644 symfony/translation-contracts/README.md delete mode 100644 symfony/translation-contracts/composer.json delete mode 100644 symfony/translation/CHANGELOG.md delete mode 100644 symfony/translation/README.md delete mode 100644 symfony/translation/composer.json delete mode 100644 thecodingmachine/safe/README.md delete mode 100644 thecodingmachine/safe/composer.json delete mode 100644 web-auth/cose-lib/composer.json delete mode 100644 web-auth/metadata-service/composer.json delete mode 100644 web-auth/webauthn-lib/composer.json diff --git a/.gitignore b/.gitignore index 9752370b2..1053d2818 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ bin # ignore demo files **/.travis.yml # ignore .github files -**/.github +**/*/.github # ignore changelogs **/CHANGELOG.md # ignore coc diff --git a/aws/aws-crt-php/.gitignore b/aws/aws-crt-php/.gitignore deleted file mode 100644 index 7b7b8bf8f..000000000 --- a/aws/aws-crt-php/.gitignore +++ /dev/null @@ -1,210 +0,0 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm -# Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm - -### Autotools ### -# http://www.gnu.org/software/automake - -Makefile.in -/ar-lib -/mdate-sh -/py-compile -/test-driver -/ylwrap -.deps/ - -# http://www.gnu.org/software/autoconf - -autom4te.cache -/autoscan.log -/autoscan-*.log -/aclocal.m4 -/compile -/config.guess -/config.h.in -/config.log -/config.status -/config.sub -/configure -/configure.scan -/depcomp -/install-sh -/missing -/stamp-h1 - -# https://www.gnu.org/software/libtool/ - -/ltmain.sh - -# http://www.gnu.org/software/texinfo - -/texinfo.tex - -# http://www.gnu.org/software/m4/ - -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 - -# Generated Makefile -# (meta build system like autotools, -# can automatically generate from config.status script -# (which is called by configure script)) -Makefile - -### Autotools Patch ### - -### CMake ### -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps - -### CMake Patch ### -# External projects -*-prefix/ - -### PhpStorm ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf -.idea/ -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### PhpStorm Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -# End of https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm - -.deps -.libs/ -build/ -configure.in -configure.ac -mkinstalldirs -run-tests.php -Makefile.global -acinclude.m4 -libtool -modules/ -*.lo -config.h -config.nice -*.la -Makefile* -!Makefile.am -!Makefile.frag -!Makefile.frag.w32 -/vendor/ -.idea/ -.DS_Store -composer.lock -PHP-Parser*/ -src/*.so -src/*.dylib -src/*.dll - -# ignoring output of package.xml as it needs to be generated from ./prepare_release.sh in each publishing -package.xml -*.tgz diff --git a/aws/aws-crt-php/README.md b/aws/aws-crt-php/README.md deleted file mode 100644 index d942eb030..000000000 --- a/aws/aws-crt-php/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# AWS Common Runtime PHP bindings - -## Requirements -* PHP 5.5+ on UNIX platforms, 7.2+ on Windows -* CMake 3.x -* GCC 4.4+, clang 3.8+ on UNIX, Visual Studio 2017 build tools on Windows -* Tests require [Composer](https://getcomposer.org) - -## Building on UNIX -```sh -$ git clone --recursive https://github.com/awslabs/aws-crt-php.git -$ cd aws-crt-php -$ phpize -$ ./configure -$ make && make test -``` - -## Building on Windows -* First, ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows: - * https://github.com/microsoft/php-sdk-binary-tools - * https://medium.com/@erinus/how-to-build-php-on-windows-a7ad0a87862a - * https://medium.com/@erinus/how-to-build-php-extension-on-windows-d1667290f809 - -```bat -""" From VS2017 Command Prompt -> C:\php-sdk\phpsdk-vc15-x64.bat - -C:\php-sdk\ -$ phpsdk_buildtree php- - -C:\php-sdk\php-\vc15\x64\ -$ git clone https://github.com/php/php-src.git && cd php-src - -""" This only has to be done once, the first time you set this all up -C:\php-sdk\php-\vc15\x64\php-src -$ phpsdk_deps --update --branch - -C:\php-sdk\php-\vc15\x64\php-src -$ git clone --recursive https://github.com/awslabs/aws-crt-php.git ..\pecl\awscrt - -C:\php-sdk\php-\vc15\x64\php-src -$ buildconf - -C:\php-sdk\php-\vc15\x64\php-src -$ configure --enable-cli --with-openssl --enable-awscrt=shared - -C:\php-sdk\php-\vc15\x64\php-src -$ nmake - -C:\php-sdk\php-\vc15\x64\php-src -$ nmake test-awscrt -``` - -## Debugging -Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful. - -Note: You must use a debug build of PHP to debug native extensions. -See the [PHP Internals Book](https://www.phpinternalsbook.com/php7/build_system/building_php.html) for more info - -```shell -# PHP 8 example -$ phpbrew install --stdout -j 8 8.0 +default -- CFLAGS=-Wno-error --disable-cgi --enable-debug -# PHP 5.5 example -$ phpbrew install --stdout -j 8 5.5 +default -openssl -mbstring -- CFLAGS="-w -Wno-error" --enable-debug --with-zlib=/usr/local/opt/zlib -$ phpbrew switch php-8.0.6 # or whatever version is current, it'll be at the end of the build output -$ phpize -$ ./configure -$ make CMAKE_BUILD_TYPE=Debug -``` - -Ensure that the php you launch from your debugger is the result of `which php`, not just -the system default php. - -## Security - -See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. - -## License - -This project is licensed under the Apache-2.0 License. diff --git a/aws/aws-crt-php/composer.json b/aws/aws-crt-php/composer.json deleted file mode 100644 index 4b96140e7..000000000 --- a/aws/aws-crt-php/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "aws/aws-crt-php", - "homepage": "http://aws.amazon.com/sdkforphp", - "description": "AWS Common Runtime for PHP", - "keywords": ["aws","amazon","sdk","crt"], - "type": "library", - "authors": [ - { - "name": "AWS SDK Common Runtime Team", - "email": "aws-sdk-common-runtime@amazon.com" - } - ], - "config": { - "platform": {"php": "5.6"} - }, - "minimum-stability": "alpha", - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit":"^4.8.35|^5.4.3" - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "scripts": { - "test": "./run_tests", - "test-extension": "@test", - "test-win": "run_tests" - }, - "license": "Apache-2.0" -} diff --git a/aws/aws-crt-php/tests/000_CoreTest.php b/aws/aws-crt-php/tests/000_CoreTest.php deleted file mode 100644 index e9e068ab8..000000000 --- a/aws/aws-crt-php/tests/000_CoreTest.php +++ /dev/null @@ -1,22 +0,0 @@ -assertTrue(CRT::isAvailable()); - } - - // We have done nothing to necessitate loading the CRT, it should not be loaded - public function testIsLoaded() { - $this->assertTrue(!CRT::isLoaded()); - } -} \ No newline at end of file diff --git a/aws/aws-crt-php/tests/CrcTest.php b/aws/aws-crt-php/tests/CrcTest.php deleted file mode 100644 index 56c50385e..000000000 --- a/aws/aws-crt-php/tests/CrcTest.php +++ /dev/null @@ -1,90 +0,0 @@ -assertEquals($output, $expected); - } - - public function testCrc32ZeroesIterated() { - $output = 0; - for ($i = 0; $i < 32; $i++) { - $output = CRT::crc32("\x00", $output); - } - $expected = 0x190A55AD; - $this->assertEquals($output, $expected); - } - - public function testCrc32ValuesOneShot() { - $input = implode(array_map("chr", range(0, 31))); - $output = CRT::crc32($input); - $expected = 0x91267E8A; - $this->assertEquals($output, $expected); - } - - public function testCrc32ValuesIterated() { - $output = 0; - foreach (range(0, 31) as $n) { - $output = CRT::crc32(chr($n), $output); - } - $expected = 0x91267E8A; - $this->assertEquals($output, $expected); - } - - public function testCrc32LargeBuffer() { - $input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); - $output = CRT::crc32($input); - $expected = 0xA738EA1C; - $this->assertEquals($output, $expected); - } - - public function testCrc32cZeroesOneShot() { - $input = implode(array_map("chr", array_fill(0, 32, 0))); - $output = CRT::crc32c($input); - $expected = 0x8A9136AA; - $this->assertEquals($output, $expected); - } - - public function testCrc32cZeroesIterated() { - $output = 0; - for ($i = 0; $i < 32; $i++) { - $output = CRT::crc32c("\x00", $output); - } - $expected = 0x8A9136AA; - $this->assertEquals($output, $expected); - } - - public function testCrc32cValuesOneShot() { - $input = implode(array_map("chr", range(0, 31))); - $output = CRT::crc32c($input); - $expected = 0x46DD794E; - $this->assertEquals($output, $expected); - } - - public function testCrc32cValuesIterated() { - $output = 0; - foreach (range(0, 31) as $n) { - $output = CRT::crc32c(chr($n), $output); - } - $expected = 0x46DD794E; - $this->assertEquals($output, $expected); - } - - public function testCrc32cLargeBuffer() { - $input = implode(array_map("chr", array_fill(0, 1 << 20, 0))); - $output = CRT::crc32c($input); - $expected = 0x14298C12; - $this->assertEquals($output, $expected); - } - -} diff --git a/aws/aws-crt-php/tests/CredentialsTest.php b/aws/aws-crt-php/tests/CredentialsTest.php deleted file mode 100644 index 32a9c4268..000000000 --- a/aws/aws-crt-php/tests/CredentialsTest.php +++ /dev/null @@ -1,46 +0,0 @@ -expectException(InvalidArgumentException::class); - $creds = new AwsCredentials(AwsCredentials::defaults()); - $this->assertNotNull($creds, "Failed to create default/empty credentials"); - $creds = null; - } - - private function getCredentialsConfig() { - $options = AwsCredentials::defaults(); - $options['access_key_id'] = 'TESTAWSACCESSKEYID'; - $options['secret_access_key'] = 'TESTSECRETaccesskeyThatDefinitelyDoesntWork'; - $options['session_token'] = 'ThisIsMyTestSessionTokenIMadeItUpMyself'; - $options['expiration_timepoint_seconds'] = 42; - return $options; - } - - public function testCredentialsLifetime() { - $options = $this->getCredentialsConfig(); - $creds = new AwsCredentials($options); - $this->assertNotNull($creds, "Failed to create Credentials with options"); - $this->assertEquals($creds->access_key_id, $options['access_key_id']); - $this->assertEquals($creds->secret_access_key, $options['secret_access_key']); - $this->assertEquals($creds->session_token, $options['session_token']); - $this->assertEquals($creds->expiration_timepoint_seconds, $options['expiration_timepoint_seconds']); - $creds = null; - } - - public function testStaticCredentialsProviderLifetime() { - $options = $this->getCredentialsConfig(); - $provider = new StaticCredentialsProvider($options); - $this->assertNotNull($provider, "Failed to create StaticCredentialsProvider"); - $provider = null; - } -} diff --git a/aws/aws-crt-php/tests/ErrorTest.php b/aws/aws-crt-php/tests/ErrorTest.php deleted file mode 100644 index e84d1edbf..000000000 --- a/aws/aws-crt-php/tests/ErrorTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertEquals(0, CRT::last_error()); - } - - public function testCanResolveErrorName() { - $this->assertEquals("AWS_ERROR_SUCCESS", CRT::error_name(0)); - } - - public function testCanResolveErrorStr() { - $this->assertEquals("Success.", CRT::error_str(0)); - } -} diff --git a/aws/aws-crt-php/tests/EventLoopGroupTest.php b/aws/aws-crt-php/tests/EventLoopGroupTest.php deleted file mode 100644 index 6a52c69c0..000000000 --- a/aws/aws-crt-php/tests/EventLoopGroupTest.php +++ /dev/null @@ -1,25 +0,0 @@ -assertNotNull($elg, "Failed to create default EventLoopGroup"); - $elg = null; - } - - public function testConstructionWithOptions() { - $options = EventLoopGroup::defaults(); - $options['num_threads'] = 1; - $elg = new EventLoopGroup($options); - $this->assertNotNull($elg, "Failed to create EventLoopGroup with 1 thread"); - $elg = null; - } -} diff --git a/aws/aws-crt-php/tests/HttpMessageTest.php b/aws/aws-crt-php/tests/HttpMessageTest.php deleted file mode 100644 index eec18b622..000000000 --- a/aws/aws-crt-php/tests/HttpMessageTest.php +++ /dev/null @@ -1,95 +0,0 @@ -assertSame(0, $headers->count()); - } - - public function testHeadersMarshalling() { - $headers_array = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $headers = new Headers($headers_array); - $this->assertSame(2, $headers->count()); - $this->assertSame($headers_array['host'], $headers->get('host')); - $this->assertSame($headers_array['test'], $headers->get('test')); - $buffer = Headers::marshall($headers); - $headers_copy = Headers::unmarshall($buffer); - $this->assertSame(2, $headers_copy->count()); - $this->assertSame($headers_array['host'], $headers_copy->get('host')); - $this->assertSame($headers_array['test'], $headers_copy->get('test')); - } - - private function assertMessagesMatch($a, $b) { - $this->assertSame($a->method(), $b->method()); - $this->assertSame($a->path(), $b->path()); - $this->assertSame($a->query(), $b->query()); - $this->assertSame($a->headers()->toArray(), $b->headers()->toArray()); - } - - public function testRequestMarshalling() { - $headers = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = []; - - $msg = new Request($method, $path, $query, $headers); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } - - public function testRequestMarshallingWithQueryParams() { - $headers = [ - "host" => "s3.amazonaws.com", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = [ - 'request' => '1', - 'test' => 'true', - 'answer' => '42', - 'foo' => 'bar', - ]; - - $msg = new Request($method, $path, $query, $headers); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } - - public function testResponseMarshalling() { - $headers = [ - "content-length" => "42", - "test" => "this is a test header value" - ]; - $method = "GET"; - $path = "/index.php"; - $query = [ - 'response' => '1' - ]; - - $msg = new Response($method, $path, $query, $headers, 200); - $msg_buf = Request::marshall($msg); - $msg_copy = Request::unmarshall($msg_buf); - - $this->assertMessagesMatch($msg, $msg_copy); - } -} diff --git a/aws/aws-crt-php/tests/LogTest.php b/aws/aws-crt-php/tests/LogTest.php deleted file mode 100644 index 8beff342f..000000000 --- a/aws/aws-crt-php/tests/LogTest.php +++ /dev/null @@ -1,23 +0,0 @@ -assertNotNull($log_stream); - Log::toStream($log_stream); - Log::setLogLevel(Log::TRACE); - Log::log(Log::TRACE, "THIS IS A TEST"); - $this->assertTrue(rewind($log_stream)); - $log_contents = stream_get_contents($log_stream, -1, 0); - $this->assertStringEndsWith("THIS IS A TEST", trim($log_contents)); - Log::stop(); - } -} diff --git a/aws/aws-crt-php/tests/SigningTest.php b/aws/aws-crt-php/tests/SigningTest.php deleted file mode 100644 index 77399abda..000000000 --- a/aws/aws-crt-php/tests/SigningTest.php +++ /dev/null @@ -1,176 +0,0 @@ -assertNotNull($config, "Failed to create default SigningConfigAWS"); - $config = null; - } - - public function testConfigAWSConstructionWithOptions() { - $options = SigningConfigAWS::defaults(); - $options['service'] = 'CRT'; - $options['region'] = 'CRT'; - $config = new SigningConfigAWS($options); - $this->assertNotNull($config, "Failed to create SigningConfigAWS with custom options"); - $config = null; - } - - public function testSignableFromHttpRequestLifetime() { - $request = new Request('GET', '/'); - $signable = Signable::fromHttpRequest($request); - $this->assertNotNull($signable, "Failed to create Signable from HTTP::Request"); - $signable = null; - } - - public function testSignableFromChunkLifetime() { - $chunk = "THIS IS A TEST CHUNK IT CONTAINS MULTITUDES"; - $stream = fopen("php://memory", 'r+'); - fputs($stream, $chunk); - rewind($stream); - $signable = Signable::fromChunk($stream); - $this->assertNotNull($signable, "Failed to create Signable from chunk stream"); - $signable = null; - } - - public function testSignableFromCanonicalRequestLifetime() { - $canonical_request = "THIS IS A CANONICAL_REQUEST. IT IS DEEPLY CANONICAL"; - $signable = Signable::fromCanonicalRequest($canonical_request); - $this->assertNotNull($signable, "Failed to create Signable from canonical request"); - $signable = null; - } - - const SIGV4TEST_ACCESS_KEY_ID = 'AKIDEXAMPLE'; - const SIGV4TEST_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'; - const SIGV4TEST_SESSION_TOKEN = null; - const SIGV4TEST_SERVICE = 'service'; - const SIGV4TEST_REGION = 'us-east-1'; - private static function SIGV4TEST_DATE() { - return mktime(12, 36, 0, 8, 30, 2015); - } - - public function testShouldSignHeader() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - 'should_sign_header' => function($header) { - return strtolower($header) != 'x-do-not-sign'; - } - ]); - $http_request = new Request('GET', '/', [], [ - 'Host' => 'example.amazonaws.com', - 'X-Do-Not-Sign' => 'DO NOT SIGN THIS']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - // This signature value is computed without the X-Do-Not-Sign header above - $headers = $http_request->headers(); - $this->assertEquals( - 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', - $headers->get('Authorization')); - } - - public function testSigv4HeaderSigning() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - ]); - $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - $headers = $http_request->headers(); - $this->assertEquals( - 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31', - $headers->get('Authorization')); - $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); - } - - public function testSigV4aHeaderSigning() { - $credentials_provider = new StaticCredentialsProvider([ - 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, - 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY, - 'session_token' => self::SIGV4TEST_SESSION_TOKEN, - ]); - $signing_config = new SigningConfigAWS([ - 'algorithm' => SigningAlgorithm::SIGv4_ASYMMETRIC, - 'signature_type' => SignatureType::HTTP_REQUEST_HEADERS, - 'credentials_provider' => $credentials_provider, - 'region' => self::SIGV4TEST_REGION, - 'service' => self::SIGV4TEST_SERVICE, - 'date' => self::SIGV4TEST_DATE(), - ]); - - $http_request = new Request('GET', '/', [], ['Host' => 'example.amazonaws.com']); - $this->assertNotNull($http_request, "Unable to create HttpRequest for signing"); - $signable = Signable::fromHttpRequest($http_request); - $this->assertNotNull($signable, "Unable to create signable from HttpRequest"); - - Signing::signRequestAws( - $signable, $signing_config, - function($signing_result, $error_code) use (&$http_request) { - $this->assertEquals(0, $error_code); - $signing_result->applyToHttpRequest($http_request); - } - ); - - $headers = $http_request->headers(); - $auth_header_value = $headers->get('Authorization'); - $this->assertNotNull($auth_header_value); - $this->assertStringStartsWith( - 'AWS4-ECDSA-P256-SHA256 Credential=AKIDEXAMPLE/20150830/service/aws4_request, SignedHeaders=host;x-amz-date;x-amz-region-set, Signature=', - $auth_header_value); - $this->assertEquals('20150830T123600Z', $headers->get('X-Amz-Date')); - } -} diff --git a/aws/aws-crt-php/tests/StreamTest.php b/aws/aws-crt-php/tests/StreamTest.php deleted file mode 100644 index f8a116a6a..000000000 --- a/aws/aws-crt-php/tests/StreamTest.php +++ /dev/null @@ -1,34 +0,0 @@ -getMemoryStream(); - $stream = new InputStream($mem_stream); - $this->assertNotNull($stream, "Failed to create InputStream from PHP memory stream"); - $this->assertEquals(strlen(self::MEM_STREAM_CONTENTS), $stream->length(), "Stream length doesn't match source buffer"); - $this->assertEquals(self::MEM_STREAM_CONTENTS, $stream->read(), "Stream doesn't match source buffer"); - $this->assertTrue($stream->eof(), "Stream is not EOF after reading"); - $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_BEGIN), "Unable to rewind stream"); - $this->assertFalse($stream->eof(), "Stream is EOF after rewinding"); - $this->assertEquals(0, $stream->seek(0, InputStream::SEEK_END), "Unable to seek to end of stream"); - $this->assertTrue($stream->eof(), "Stream is not EOF after seeking to end"); - $stream = null; - } -} diff --git a/aws/aws-crt-php/tests/common.inc b/aws/aws-crt-php/tests/common.inc deleted file mode 100644 index 1a7e8f8d4..000000000 --- a/aws/aws-crt-php/tests/common.inc +++ /dev/null @@ -1,34 +0,0 @@ -fail("Test left an error on the stack: " . CRT::error_name(CRT::last_error())); - } - } - - // Shim missing calls in older versions of PHPUnit - public function __call($name, $arguments) { - // shim expectException -> setExpectedException for PHPUnit 4.8.x - if ($name == 'expectException') { - $this->setExpectedException($arguments[0]); - } - } -} diff --git a/aws/aws-sdk-php/composer.json b/aws/aws-sdk-php/composer.json deleted file mode 100644 index d481a12a9..000000000 --- a/aws/aws-sdk-php/composer.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "aws/aws-sdk-php", - "homepage": "http://aws.amazon.com/sdkforphp", - "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", - "keywords": ["aws","amazon","sdk","s3","ec2","dynamodb","cloud","glacier"], - "type": "library", - "license": "Apache-2.0", - "authors": [ - { - "name": "Amazon Web Services", - "homepage": "http://aws.amazon.com" - } - ], - "support": { - "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", - "issues": "https://github.com/aws/aws-sdk-php/issues" - }, - "require": { - "php": ">=5.5", - "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", - "guzzlehttp/psr7": "^1.8.5 || ^2.3", - "guzzlehttp/promises": "^1.4.0", - "mtdowling/jmespath.php": "^2.6", - "ext-pcre": "*", - "ext-json": "*", - "ext-simplexml": "*", - "aws/aws-crt-php": "^1.0.2" - }, - "require-dev": { - "composer/composer" : "^1.10.22", - "ext-openssl": "*", - "ext-dom": "*", - "ext-pcntl": "*", - "ext-sockets": "*", - "phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5", - "behat/behat": "~3.0", - "doctrine/cache": "~1.4", - "aws/aws-php-sns-message-validator": "~1.0", - "nette/neon": "^2.3", - "andrewsville/php-token-reflection": "^1.4", - "psr/cache": "^1.0", - "psr/simple-cache": "^1.0", - "paragonie/random_compat": ">= 2", - "sebastian/comparator": "^1.2.3 || ^4.0", - "yoast/phpunit-polyfills": "^1.0", - "dms/phpunit-arraysubset-asserts": "^0.4.0" - }, - "suggest": { - "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", - "ext-curl": "To send requests using cURL", - "ext-sockets": "To use client-side monitoring", - "doctrine/cache": "To use the DoctrineCacheAdapter", - "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications" - }, - "autoload": { - "psr-4": { - "Aws\\": "src/" - }, - "files": ["src/functions.php"] - }, - "autoload-dev": { - "psr-4": { - "Aws\\Test\\": "tests/" - }, - "classmap": ["build/"] - }, - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - } -} diff --git a/bantu/ini-get-wrapper/.gitignore b/bantu/ini-get-wrapper/.gitignore deleted file mode 100644 index 8bfd83242..000000000 --- a/bantu/ini-get-wrapper/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/composer.lock -/composer.phar -/vendor diff --git a/bantu/ini-get-wrapper/.scrutinizer.yml b/bantu/ini-get-wrapper/.scrutinizer.yml deleted file mode 100644 index c6629ea4d..000000000 --- a/bantu/ini-get-wrapper/.scrutinizer.yml +++ /dev/null @@ -1,7 +0,0 @@ -imports: - - php - -tools: - php_code_sniffer: - config: - standard: "PSR2" diff --git a/bantu/ini-get-wrapper/README.md b/bantu/ini-get-wrapper/README.md deleted file mode 100644 index 389283b99..000000000 --- a/bantu/ini-get-wrapper/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Usage - -```php -require __DIR__ . '/vendor/autoload.php'; -$ini = new bantu\IniGetWrapper\IniGetWrapper; -var_dump( - $ini->getString('does-not-exist'), - $ini->getString('default_mimetype'), - $ini->getBool('display_errors'), - $ini->getNumeric('precision'), - $ini->getBytes('memory_limit') -); -``` - -``` -NULL -string(9) "text/html" -bool(false) -int(14) -int(134217728) -``` diff --git a/bantu/ini-get-wrapper/composer.json b/bantu/ini-get-wrapper/composer.json deleted file mode 100644 index 2cda55a0b..000000000 --- a/bantu/ini-get-wrapper/composer.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bantu/ini-get-wrapper", - "type": "library", - "description": "Convenience wrapper around ini_get()", - "license": "MIT", - "require-dev": { - "phpunit/phpunit": "3.7.*" - }, - "autoload": { - "psr-4": { "bantu\\IniGetWrapper\\": "src/" } - }, - "autoload-dev": { - "psr-4": { "bantu\\IniGetWrapper\\": "tests/" } - } -} diff --git a/bantu/ini-get-wrapper/phpunit.xml.dist b/bantu/ini-get-wrapper/phpunit.xml.dist deleted file mode 100644 index d86753158..000000000 --- a/bantu/ini-get-wrapper/phpunit.xml.dist +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - ./tests/ - - - diff --git a/beberlei/assert/composer.json b/beberlei/assert/composer.json deleted file mode 100644 index 1485a0084..000000000 --- a/beberlei/assert/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "beberlei/assert", - "description": "Thin assertion library for input validation in business models.", - "authors": [ - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de", - "role": "Lead Developer" - }, - { - "name": "Richard Quadling", - "email": "rquadling@gmail.com", - "role": "Collaborator" - } - ], - "license": "BSD-2-Clause", - "keywords": [ - "assert", - "assertion", - "validation" - ], - "config": { - "sort-packages": true - }, - "require": { - "php": "^7.0 || ^8.0", - "ext-simplexml": "*", - "ext-mbstring": "*", - "ext-ctype": "*", - "ext-json": "*" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "*", - "phpstan/phpstan": "*", - "phpunit/phpunit": ">=6.0.0", - "yoast/phpunit-polyfills": "^0.1.0" - }, - "autoload": { - "psr-4": { - "Assert\\": "lib/Assert" - }, - "files": [ - "lib/Assert/functions.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Assert\\Tests\\": "tests/Assert/Tests" - }, - "files": [ - "tests/Assert/Tests/Fixtures/functions.php" - ] - }, - "scripts": { - "assert:generate-docs": "php bin/generate_method_docs.php", - "assert:cs-lint": "php-cs-fixer fix --diff -vvv --dry-run", - "assert:cs-fix": "php-cs-fixer fix . -vvv || true", - "assert:sa-code": "vendor/bin/phpstan analyse --configuration=phpstan-code.neon --no-progress --ansi -l 7 bin lib", - "assert:sa-tests": "vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests" - }, - "suggest": { - "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" - } -} diff --git a/brick/math/composer.json b/brick/math/composer.json deleted file mode 100644 index c89955d12..000000000 --- a/brick/math/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "brick/math", - "description": "Arbitrary-precision arithmetic library", - "type": "library", - "keywords": [ - "Brick", - "Math", - "Arbitrary-precision", - "Arithmetic", - "BigInteger", - "BigDecimal", - "BigRational", - "Bignum" - ], - "license": "MIT", - "require": { - "php": "^7.1 || ^8.0", - "ext-json": "*" - }, - "require-dev": { - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", - "php-coveralls/php-coveralls": "^2.2", - "vimeo/psalm": "4.3.2" - }, - "autoload": { - "psr-4": { - "Brick\\Math\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Brick\\Math\\Tests\\": "tests/" - } - } -} diff --git a/christophwurst/id3parser/.gitignore b/christophwurst/id3parser/.gitignore deleted file mode 100644 index 9f11b755a..000000000 --- a/christophwurst/id3parser/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea/ diff --git a/christophwurst/id3parser/README.md b/christophwurst/id3parser/README.md deleted file mode 100644 index 62af96e7b..000000000 --- a/christophwurst/id3parser/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# ID3 Parser - -This is a pure ID3 parser based upon [getID3](https://github.com/JamesHeinrich/getID3). It supports the following ID3 -versions inside MP3 files: - -- ID3v1 (v1.0 & v1.1) -- ID3v2 (v2.2, v2.3 & v2.4) - -## Usage - -```php -analyze('/tmp/myfile.mp3')); -``` - -## Why should I use this package over getID3 directly? - -getID3 has evolved to a state where it is having a lot of other features such as parsing a ton of other file formats and -for some of it, it is even invoking external programs on the server. For example it is nowadays even supporting SVG files. - -Such a big parsing library can easily be haunted by security related bugs as for example [CVE-2014-2053](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2053) -and some other vulnerabilities have proven. This library takes the ID3 parsing code from getID3 and strips all other -functions. - -In cases where reading the ID3v2 tags is sufficient this library is likely to be a more secure approach, if you need any -of the advanced features of getID3 however you're likely to be unhappy with this library. diff --git a/christophwurst/id3parser/composer.json b/christophwurst/id3parser/composer.json deleted file mode 100644 index 951911ce4..000000000 --- a/christophwurst/id3parser/composer.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "christophwurst/id3parser", - "description": "An ID3 parser", - "homepage" : "https://github.com/ChristophWurst/ID3Parser/", - "require" : { - "php" : ">=5.4.0" - }, - "license": "GPL-3.0-or-later", - "keywords": ["php","tags","codecs"], - "autoload" : { - "psr-4" : { - "ID3Parser\\" : "src/" - } - } -} diff --git a/cweagans/composer-patches/.gitignore b/cweagans/composer-patches/.gitignore deleted file mode 100644 index 48b8bf907..000000000 --- a/cweagans/composer-patches/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ diff --git a/cweagans/composer-patches/README.md b/cweagans/composer-patches/README.md deleted file mode 100644 index 87f9dc0c7..000000000 --- a/cweagans/composer-patches/README.md +++ /dev/null @@ -1,205 +0,0 @@ -# composer-patches - -Simple patches plugin for Composer. Applies a patch from a local or remote file to any package required with composer. - -Note that the 1.x versions of Composer Patches are supported on a best-effort -basis due to the imminent release of 2.0.0. You may still be interested in -using 1.x if you need Composer to cooperate with earlier PHP versions. No new -features will be added to 1.x releases, but any security or bug fixes will -still be accepted. - -## Usage - -Example composer.json: - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches": { - "drupal/drupal": { - "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch" - } - } - } -} - -``` - -## Using an external patch file - -Instead of a patches key in your root composer.json, use a patches-file key. - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches-file": "local/path/to/your/composer.patches.json" - } -} - -``` - -Then your `composer.patches.json` should look like this: - -``` -{ - "patches": { - "vendor/project": { - "Patch title": "http://example.com/url/to/patch.patch" - } - } -} -``` - -## Allowing patches to be applied from dependencies - -If your project doesn't supply any patches of its own, but you still want to accept patches from dependencies, you must have the following in your composer file: - -```json -{ - "require": { - "cweagans/composer-patches": "^1.5.0" - }, - "extra": { - "enable-patching": true - } -} -``` - -If you do have a `patches` section in your composer file that defines your own set of patches then the `enable-patching` setting will be ignored and patches from dependencies will always be applied. - -## Ignoring patches - -There may be situations in which you want to ignore a patch supplied by a dependency. For example: - -- You use a different more recent version of a dependency, and now a patch isn't applying. -- You have a more up to date patch than the dependency, and want to use yours instead of theirs. -- A dependency's patch adds a feature to a project that you don't need. -- Your patches conflict with a dependency's patches. - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2", - "drupal/lightning": "~8.1" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches": { - "drupal/drupal": { - "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch" - } - }, - "patches-ignore": { - "drupal/lightning": { - "drupal/panelizer": { - "This patch has known conflicts with our Quick Edit integration": "https://www.drupal.org/files/issues/2664682-49.patch" - } - } - } - } -} -``` - -## Allowing to force the patch level (-pX) - -Some situations require to force the patchLevel used to apply patches on a particular package. -Its useful for packages like drupal/core which packages only a subdir of the original upstream project on which patches are based. - -```json -{ - "extra": { - "patchLevel": { - "drupal/core": "-p2" - } - } -} -``` - -## Using patches from HTTP URLs - -Composer [blocks](https://getcomposer.org/doc/06-config.md#secure-http) you from downloading anything from HTTP URLs, you can disable this for your project by adding a `secure-http` setting in the config section of your `composer.json`. Note that the `config` section should be under the root of your `composer.json`. - -```json -{ - "config": { - "secure-http": false - } -} -``` - -However, it's always advised to setup HTTPS to prevent MITM code injection. - -## Patches containing modifications to composer.json files - -Because patching occurs _after_ Composer calculates dependencies and installs packages, changes to an underlying dependency's `composer.json` file introduced in a patch will have _no effect_ on installed packages. - -If you need to modify a dependency's `composer.json` or its underlying dependencies, you cannot use this plugin. Instead, you must do one of the following: -- Work to get the underlying issue resolved in the upstream package. -- Fork the package and [specify your fork as the package repository](https://getcomposer.org/doc/05-repositories.md#vcs) in your root `composer.json` -- Specify compatible package version requirements in your root `composer.json` - -## Error handling - -If a patch cannot be applied (hunk failed, different line endings, etc.) a message will be shown and the patch will be skipped. - -To enforce throwing an error and stopping package installation/update immediately, you have two available options: - -1. Add `"composer-exit-on-patch-failure": true` option to the `extra` section of your composer.json file. -1. Export `COMPOSER_EXIT_ON_PATCH_FAILURE=1` - -By default, failed patches are skipped. - -## Patches reporting - -When a patch is applied, the plugin writes a report-file `PATCHES.txt` to a patching directory (e.g. `./patch-me/PATCHES.txt`), -which contains a list of applied patches. - -If you want to avoid this behavior, add a specific key to the `extra` section: -```json -"extra": { - "composer-patches-skip-reporting": true -} -``` - -Or provide an environment variable `COMPOSER_PATCHES_SKIP_REPORTING` with a config. - -## Patching composer.json in dependencies - -This doesn't work like you'd want. By the time you're running `composer install`, -the metadata from your dependencies' composer.json has already been aggregated by -packagist (or whatever metadata repo you're using). Unfortunately, this means that -you cannot e.g. patch a dependency to be compatible with an earlier version of PHP -or change the framework version that a plugin depends on. - -@anotherjames over at @computerminds wrote an article about how to work around -that particular problem for a Drupal 8 -> Drupal 9 upgrade: - -[Apply Drupal 9 compatibility patches with Composer](https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-patches-composer) ([archive](https://web.archive.org/web/20210124171010/https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-patches-composer)) - -## Difference between this and netresearch/composer-patches-plugin - -- This plugin is much more simple to use and maintain -- This plugin doesn't require you to specify which package version you're patching -- This plugin is easy to use with Drupal modules (which don't use semantic versioning). -- This plugin will gather patches from all dependencies and apply them as if they were in the root composer.json - -## Credits - -A ton of this code is adapted or taken straight from https://github.com/jpstacey/composer-patcher, which is abandoned in favor of https://github.com/netresearch/composer-patches-plugin, which is (IMHO) overly complex and difficult to use. diff --git a/cweagans/composer-patches/composer.json b/cweagans/composer-patches/composer.json deleted file mode 100644 index 1565b02f5..000000000 --- a/cweagans/composer-patches/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "cweagans/composer-patches", - "description": "Provides a way to patch Composer packages.", - "minimum-stability": "dev", - "license": "BSD-3-Clause", - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" - }, - "authors": [ - { - "name": "Cameron Eagans", - "email": "me@cweagans.net" - } - ], - "require": { - "php": ">=5.3.0", - "composer-plugin-api": "^1.0 || ^2.0" - }, - "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" - }, - "autoload": { - "psr-4": {"cweagans\\Composer\\": "src"} - }, - "autoload-dev": { - "psr-4": {"cweagans\\Composer\\Tests\\": "tests"} - } -} diff --git a/cweagans/composer-patches/phpunit.xml.dist b/cweagans/composer-patches/phpunit.xml.dist deleted file mode 100644 index 62409b3b4..000000000 --- a/cweagans/composer-patches/phpunit.xml.dist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ./tests/ - - - - - - src/ - - - vendor/ - - - diff --git a/cweagans/composer-patches/tests/PatchEventTest.php b/cweagans/composer-patches/tests/PatchEventTest.php deleted file mode 100644 index 0f6adb7a3..000000000 --- a/cweagans/composer-patches/tests/PatchEventTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals($event_name, $patch_event->getName()); - $this->assertEquals($package, $patch_event->getPackage()); - $this->assertEquals($url, $patch_event->getUrl()); - $this->assertEquals($description, $patch_event->getDescription()); - } - - public function patchEventDataProvider() { - $prophecy = $this->prophesize('Composer\Package\PackageInterface'); - $package = $prophecy->reveal(); - - return array( - array(PatchEvents::PRE_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), - array(PatchEvents::POST_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), - ); - } - -} diff --git a/deepdiver/zipstreamer/.gitignore b/deepdiver/zipstreamer/.gitignore deleted file mode 100644 index 44a9f6e10..000000000 --- a/deepdiver/zipstreamer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/composer.phar -/vendor/ -/composer.lock diff --git a/deepdiver/zipstreamer/README.md b/deepdiver/zipstreamer/README.md deleted file mode 100644 index 901bb470f..000000000 --- a/deepdiver/zipstreamer/README.md +++ /dev/null @@ -1,19 +0,0 @@ -PHPZipStreamer -============== - -Simple Class to create zip files on the fly and stream directly to the HTTP -client as the content is added (without using temporary files). - -Copyright (C) 2013-2016 Nicolai Ehemann (en@enlightened.de) and contributors - -Contributors (in order of first contribution): -* André Rothe (arothe@zks.uni-leipzig.de) -* Lukas Reschke (lukas@owncloud.com) -* Others (who do not want to be mentioned) - -See MANUAL.md for a short intro to using ZipStreamer. - -Project page / issue tracker on https://github.com/McNetic/PHPZipStreamer. -Please report bugs / feature requests there. - -Licensed under the GNU GPL. See COPYING for more information. diff --git a/deepdiver/zipstreamer/composer.json b/deepdiver/zipstreamer/composer.json deleted file mode 100644 index bdab47283..000000000 --- a/deepdiver/zipstreamer/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "deepdiver/zipstreamer", - "type": "library", - "description": "Stream zip files without i/o overhead", - "keywords": ["zip", "stream"], - "homepage": "https://github.com/DeepDiver1975/PHPZipStreamer", - "license": "GPL-3.0+", - "version": "2.0.0", - "authors": [ { - "name": "Nicolai Ehemann", - "email": "en@enlightened.de", - "role": "Author/Maintainer" - },{ - "name": "André Rothe", - "email": "arothe@zks.uni-leipzig.de", - "role": "Contributor" - },{ - "name": "Lukas Reschke", - "email": "lukas@owncloud.com", - "role": "Contributor" - },{ - "name": "Thomas Müller", - "email": "thomas.mueller@tmit.eu", - "role": "Contributor" - },{ - "name": "Roeland Jago Douma", - "email": "roeland@famdouma.nl", - "role": "Contributor" - } - ], - "repositories": [ { - "type": "vcs", - "url": "https://github.com/DeepDiver1975/PHPZipStreamer" - } - ], - "require": { - "php": ">=5.6.0" - }, - "autoload": { - "psr-4": { - "ZipStreamer\\": "src/" - } - }, - "require-dev": { - "phpunit/phpunit": "^5.7" - } -} diff --git a/doctrine/cache/UPGRADE-1.11.md b/doctrine/cache/UPGRADE-1.11.md deleted file mode 100644 index 6c5ddb559..000000000 --- a/doctrine/cache/UPGRADE-1.11.md +++ /dev/null @@ -1,27 +0,0 @@ -# Upgrade to 1.11 - -doctrine/cache will no longer be maintained and all cache implementations have -been marked as deprecated. These implementations will be removed in 2.0, which -will only contain interfaces to provide a lightweight package for backward -compatibility. - -There are two new classes to use in the `Doctrine\Common\Cache\Psr6` namespace: -* The `CacheAdapter` class allows using any Doctrine Cache as PSR-6 cache. This - is useful to provide a forward compatibility layer in libraries that accept - Doctrine cache implementations and switch to PSR-6. -* The `DoctrineProvider` class allows using any PSR-6 cache as Doctrine cache. - This implementation is designed for libraries that leak the cache and want to - switch to allowing PSR-6 implementations. This class is design to be used - during the transition phase of sunsetting doctrine/cache support. - -A full example to setup a filesystem based PSR-6 cache with symfony/cache -using the `DoctrineProvider` to convert back to Doctrine's `Cache` interface: - -```php -use Doctrine\Common\Cache\Psr6\DoctrineProvider; -use Symfony\Component\Cache\Adapter\FilesystemAdapter; - -$cachePool = new FilesystemAdapter(); -$cache = DoctrineProvider::wrap($cachePool); -// $cache instanceof \Doctrine\Common\Cache\Cache -``` diff --git a/doctrine/dbal/README.md b/doctrine/dbal/README.md deleted file mode 100644 index 21888b6f1..000000000 --- a/doctrine/dbal/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Doctrine DBAL - -| [4.0-dev][4.0] | [3.3][3.3] | -|:-----------------------------------------------:|:---------------------------------------------------:| -| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.3 image]][GA 3.3] | -| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.3 image]][AppVeyor 3.3] | -| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.3 image]][CodeCov 3.3] | -| N/A | [![Code Coverage][TypeCov 3.3 image]][TypeCov 3.3] | - -Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features for database schema introspection and schema management. - -## More resources: - -* [Website](http://www.doctrine-project.org/projects/dbal.html) -* [Documentation](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/) -* [Issue Tracker](https://github.com/doctrine/dbal/issues) - - [Coverage image]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x/graph/badge.svg - [4.0]: https://github.com/doctrine/dbal/tree/4.0.x - [CodeCov 4.0]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x - [AppVeyor 4.0]: https://ci.appveyor.com/project/doctrine/dbal/branch/4.0.x - [AppVeyor 4.0 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/4.0.x?svg=true - [GA 4.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x - [GA 4.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg - - [Coverage 3.3 image]: https://codecov.io/gh/doctrine/dbal/branch/3.3.x/graph/badge.svg - [3.3]: https://github.com/doctrine/dbal/tree/3.3.x - [CodeCov 3.3]: https://codecov.io/gh/doctrine/dbal/branch/3.3.x - [AppVeyor 3.3]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.3.x - [AppVeyor 3.3 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.3.x?svg=true - [GA 3.3]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.3.x - [GA 3.3 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.3.x - [TypeCov 3.3]: https://shepherd.dev/github/doctrine/dbal - [TypeCov 3.3 image]: https://shepherd.dev/github/doctrine/dbal/coverage.svg diff --git a/doctrine/dbal/composer.json b/doctrine/dbal/composer.json deleted file mode 100644 index 12e78d22c..000000000 --- a/doctrine/dbal/composer.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "doctrine/dbal", - "type": "library", - "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", - "keywords": [ - "abstraction", - "database", - "dbal", - "db2", - "mariadb", - "mssql", - "mysql", - "pgsql", - "postgresql", - "oci8", - "oracle", - "pdo", - "queryobject", - "sasql", - "sql", - "sqlite", - "sqlserver", - "sqlsrv" - ], - "homepage": "https://www.doctrine-project.org/projects/dbal.html", - "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"} - ], - "require": { - "php": "^7.3 || ^8.0", - "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", - "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1.0", - "psr/cache": "^1|^2|^3", - "psr/log": "^1|^2|^3" - }, - "require-dev": { - "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2022.1", - "phpstan/phpstan": "1.8.2", - "phpstan/phpstan-strict-rules": "^1.3", - "phpunit/phpunit": "9.5.21", - "psalm/plugin-phpunit": "0.17.0", - "squizlabs/php_codesniffer": "3.7.1", - "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.24.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "bin": ["bin/doctrine-dbal"], - "config": { - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, - "composer/package-versions-deprecated": true - } - }, - "autoload": { - "psr-4": { "Doctrine\\DBAL\\": "src" } - }, - "autoload-dev": { - "psr-4": { "Doctrine\\DBAL\\Tests\\": "tests" } - } -} diff --git a/doctrine/deprecations/README.md b/doctrine/deprecations/README.md deleted file mode 100644 index 22f0cced3..000000000 --- a/doctrine/deprecations/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# Doctrine Deprecations - -A small (side-effect free by default) layer on top of -`trigger_error(E_USER_DEPRECATED)` or PSR-3 logging. - -- no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under -- options to avoid having to rely on error handlers global state by using PSR-3 logging -- deduplicate deprecation messages to avoid excessive triggering and reduce overhead - -We recommend to collect Deprecations using a PSR logger instead of relying on -the global error handler. - -## Usage from consumer perspective: - -Enable Doctrine deprecations to be sent to a PSR3 logger: - -```php -\Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger); -``` - -Enable Doctrine deprecations to be sent as `@trigger_error($message, E_USER_DEPRECATED)` -messages. - -```php -\Doctrine\Deprecations\Deprecation::enableWithTriggerError(); -``` - -If you only want to enable deprecation tracking, without logging or calling `trigger_error` then call: - -```php -\Doctrine\Deprecations\Deprecation::enableTrackingDeprecations(); -``` - -Tracking is enabled with all three modes and provides access to all triggered -deprecations and their individual count: - -```php -$deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations(); - -foreach ($deprecations as $identifier => $count) { - echo $identifier . " was triggered " . $count . " times\n"; -} -``` - -### Suppressing Specific Deprecations - -Disable triggering about specific deprecations: - -```php -\Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier"); -``` - -Disable all deprecations from a package - -```php -\Doctrine\Deprecations\Deprecation::ignorePackage("doctrine/orm"); -``` - -### Other Operations - -When used within PHPUnit or other tools that could collect multiple instances of the same deprecations -the deduplication can be disabled: - -```php -\Doctrine\Deprecations\Deprecation::withoutDeduplication(); -``` - -Disable deprecation tracking again: - -```php -\Doctrine\Deprecations\Deprecation::disable(); -``` - -## Usage from a library/producer perspective: - -When you want to unconditionally trigger a deprecation even when called -from the library itself then the `trigger` method is the way to go: - -```php -\Doctrine\Deprecations\Deprecation::trigger( - "doctrine/orm", - "https://link/to/deprecations-description", - "message" -); -``` - -If variable arguments are provided at the end, they are used with `sprintf` on -the message. - -```php -\Doctrine\Deprecations\Deprecation::trigger( - "doctrine/orm", - "https://github.com/doctrine/orm/issue/1234", - "message %s %d", - "foo", - 1234 -); -``` - -When you want to trigger a deprecation only when it is called by a function -outside of the current package, but not trigger when the package itself is the cause, -then use: - -```php -\Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside( - "doctrine/orm", - "https://link/to/deprecations-description", - "message" -); -``` - -Based on the issue link each deprecation message is only triggered once per -request. - -A limited stacktrace is included in the deprecation message to find the -offending location. - -Note: A producer/library should never call `Deprecation::enableWith` methods -and leave the decision how to handle deprecations to application and -frameworks. - -## Usage in PHPUnit tests - -There is a `VerifyDeprecations` trait that you can use to make assertions on -the occurrence of deprecations within a test. - -```php -use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; - -class MyTest extends TestCase -{ - use VerifyDeprecations; - - public function testSomethingDeprecation() - { - $this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); - - triggerTheCodeWithDeprecation(); - } - - public function testSomethingDeprecationFixed() - { - $this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); - - triggerTheCodeWithoutDeprecation(); - } -} -``` - -## What is a deprecation identifier? - -An identifier for deprecations is just a link to any resource, most often a -Github Issue or Pull Request explaining the deprecation and potentially its -alternative. diff --git a/doctrine/deprecations/composer.json b/doctrine/deprecations/composer.json deleted file mode 100644 index c79e38cdc..000000000 --- a/doctrine/deprecations/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "doctrine/deprecations", - "type": "library", - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "license": "MIT", - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3", - "doctrine/coding-standard": "^9" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "autoload": { - "psr-4": {"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"} - }, - "autoload-dev": { - "psr-4": { - "DeprecationTests\\": "test_fixtures/src", - "Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo" - } - }, - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } - } -} diff --git a/doctrine/deprecations/phpcs.xml b/doctrine/deprecations/phpcs.xml deleted file mode 100644 index f115e43dd..000000000 --- a/doctrine/deprecations/phpcs.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - lib - tests - - - - - - diff --git a/doctrine/event-manager/README.md b/doctrine/event-manager/README.md deleted file mode 100644 index 5b36f546f..000000000 --- a/doctrine/event-manager/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Doctrine Event Manager - -[![Build Status](https://github.com/doctrine/event-manager/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/event-manager/actions) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/quality-score.png?b=1.2.x)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=1.2.x) -[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/event-manager/badges/coverage.png?b=1.2.x)](https://scrutinizer-ci.com/g/doctrine/event-manager/?branch=1.2.x) - -The Doctrine Event Manager is a library that provides a simple event system. - -## More resources: - -* [Website](https://www.doctrine-project.org/) -* [Documentation](https://www.doctrine-project.org/projects/doctrine-event-manager/en/latest/) -* [Downloads](https://github.com/doctrine/event-manager/releases) diff --git a/doctrine/event-manager/UPGRADE.md b/doctrine/event-manager/UPGRADE.md deleted file mode 100644 index c8c8038f8..000000000 --- a/doctrine/event-manager/UPGRADE.md +++ /dev/null @@ -1,7 +0,0 @@ -# Upgrade to 1.2 - -## Deprecated calling `EventManager::getListeners()` without an event name - -When calling `EventManager::getListeners()` without an event name, all -listeners were returned, keyed by event name. A new method `getAllListeners()` -has been added to provide this functionality. It should be used instead. diff --git a/doctrine/event-manager/composer.json b/doctrine/event-manager/composer.json deleted file mode 100644 index deeb7e03c..000000000 --- a/doctrine/event-manager/composer.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "doctrine/event-manager", - "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", - "license": "MIT", - "type": "library", - "keywords": [ - "events", - "event", - "event dispatcher", - "event manager", - "event system" - ], - "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" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "require": { - "php": "^7.1 || ^8.0", - "doctrine/deprecations": "^0.5.3 || ^1" - }, - "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" - }, - "conflict": { - "doctrine/common": "<2.9" - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Doctrine\\Tests\\Common\\": "tests" - } - }, - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - }, - "sort-packages": true - } -} diff --git a/doctrine/event-manager/phpstan.neon.dist b/doctrine/event-manager/phpstan.neon.dist deleted file mode 100644 index 1517ec8c4..000000000 --- a/doctrine/event-manager/phpstan.neon.dist +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - level: 9 - paths: - - src/ - - tests/ diff --git a/doctrine/event-manager/psalm.xml b/doctrine/event-manager/psalm.xml deleted file mode 100644 index 4e9226bdb..000000000 --- a/doctrine/event-manager/psalm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/doctrine/lexer/README.md b/doctrine/lexer/README.md deleted file mode 100644 index 784f2a271..000000000 --- a/doctrine/lexer/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Doctrine Lexer - -[![Build Status](https://github.com/doctrine/lexer/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/lexer/actions) - -Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. - -This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). - -https://www.doctrine-project.org/projects/lexer.html diff --git a/doctrine/lexer/psalm.xml b/doctrine/lexer/psalm.xml deleted file mode 100644 index f331e50c1..000000000 --- a/doctrine/lexer/psalm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/egulias/email-validator/composer.json b/egulias/email-validator/composer.json deleted file mode 100644 index d598d1b62..000000000 --- a/egulias/email-validator/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "egulias/email-validator", - "description": "A library for validating emails against several RFCs", - "homepage": "https://github.com/egulias/EmailValidator", - "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"], - "license": "MIT", - "authors": [ - {"name": "Eduardo Gulias Davis"} - ], - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "require": { - "php": ">=7.2", - "doctrine/lexer": "^1.2", - "symfony/polyfill-intl-idn": "^1.15" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^8.5.8|^9.3.3", - "vimeo/psalm": "^4" - }, - "suggest": { - "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" - }, - "autoload": { - "psr-4": { - "Egulias\\EmailValidator\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Egulias\\EmailValidator\\Tests\\": "tests" - } - } -} diff --git a/fgrosse/phpasn1/CHANGELOG.md b/fgrosse/phpasn1/CHANGELOG.md deleted file mode 100644 index 5a5f5caee..000000000 --- a/fgrosse/phpasn1/CHANGELOG.md +++ /dev/null @@ -1,51 +0,0 @@ -#### v2.3.0 (2021-04) -* Allow creating an unsigned CSR and adding the signature later - https://github.com/fgrosse/PHPASN1/pull/82 - -#### v2.2.0 (2020-08) -* support polyfills for bcmath and gmp, and add a composer.json - suggestion for the `phpseclib/bcmath_polyfill` for servers unable - to install PHP the gmp or bcmath extensions. - -#### v.2.1.1 & &v.2.0.2 (2018-12) -* add stricter validation around some structures, highlighed - by wycheproof test suite - -#### v.2.1.0 (2018-03) -* add support for `bcmath` extension (making `gmp` optional)
- https://github.com/fgrosse/PHPASN1/pull/68 - -#### v.2.0.1 & v.1.5.3 (2017-12) -* add .gitattributes file to prevent examples and tests to be installed via composer when --prefer-dist was set - -#### v.2.0.0 (2017-08) -* rename `FG\ASN1\Object` to `FG\ASN1\ASNObject` because `Object` is a special class name in the next major PHP release - - when you upgrade you have to adapt all corresponding `use` and `extends` statements as well as type hints and all - usages of `Object::fromBinary(…)`. -* generally drop PHP 5.6 support - -#### v.1.5.2 (2016-10-29) -* allow empty octet strings - -#### v.1.5.1 (2015-10-02) -* add keywords to composer.json (this is a version on its own so the keywords are found on a stable version at packagist.org) - -#### v.1.5.0 (2015-10-30) -* fix a bug that would prevent you from decoding context specific tags on multiple objects [#57](https://github.com/fgrosse/PHPASN1/issues/57) - - `ExplicitlyTaggedObject::__construct` does now accept multiple objects to be tagged with a single tag - - `ExplicitlyTaggedObject::getContent` will now always return an array (even if only one object is tagged) - -#### v.1.4.2 (2015-09-29) -* fix a bug that would prevent you from decoding empty tagged objects [#57](https://github.com/fgrosse/PHPASN1/issues/57) - -#### v.1.4.1 -* improve exception messages and general error handling [#55](https://github.com/fgrosse/PHPASN1/pull/55) - -#### v.1.4.0 -* **require PHP 5.6** -* support big integers (closes #1 and #37) -* enforce one code style via [styleci.io][9] -* track code coverage via [coveralls.io][10] -* replace obsolete `FG\ASN1\Exception\GeneralException` with `\Exception` -* `Construct` (`Sequence`, `Set`) does now implement `ArrayAccess`, `Countable` and `Iterator` so its easier to use -* add [`TemplateParser`][11] diff --git a/fgrosse/phpasn1/README.md b/fgrosse/phpasn1/README.md deleted file mode 100644 index 3931010ab..000000000 --- a/fgrosse/phpasn1/README.md +++ /dev/null @@ -1,167 +0,0 @@ -PHPASN1 -======= - -[![Build Status](https://secure.travis-ci.org/fgrosse/PHPASN1.png?branch=master)](http://travis-ci.org/fgrosse/PHPASN1) -[![PHP 7 ready](http://php7ready.timesplinter.ch/fgrosse/PHPASN1/badge.svg)](https://travis-ci.org/fgrosse/PHPASN1) -[![Coverage Status](https://coveralls.io/repos/fgrosse/PHPASN1/badge.svg?branch=master&service=github)](https://coveralls.io/github/fgrosse/PHPASN1?branch=master) - -[![Latest Stable Version](https://poser.pugx.org/fgrosse/phpasn1/v/stable.png)](https://packagist.org/packages/fgrosse/phpasn1) -[![Total Downloads](https://poser.pugx.org/fgrosse/phpasn1/downloads.png)](https://packagist.org/packages/fgrosse/phpasn1) -[![Latest Unstable Version](https://poser.pugx.org/fgrosse/phpasn1/v/unstable.png)](https://packagist.org/packages/fgrosse/phpasn1) -[![License](https://poser.pugx.org/fgrosse/phpasn1/license.png)](https://packagist.org/packages/fgrosse/phpasn1) - -A PHP Framework that allows you to encode and decode arbitrary [ASN.1][3] structures -using the [ITU-T X.690 Encoding Rules][4]. -This encoding is very frequently used in [X.509 PKI environments][5] or the communication between heterogeneous computer systems. - -The API allows you to encode ASN.1 structures to create binary data such as certificate -signing requests (CSR), X.509 certificates or certificate revocation lists (CRL). -PHPASN1 can also read [BER encoded][6] binary data into separate PHP objects that can be manipulated by the user and reencoded afterwards. - -The **changelog** can now be found at [CHANGELOG.md](CHANGELOG.md). - -## Dependencies - -PHPASN1 requires at least `PHP 7.0` and either the `gmp` or `bcmath` extension. -Support for older PHP versions (i.e. PHP 5.6) was dropped starting with `v2.0`. -If you must use an outdated PHP version consider using [PHPASN v1.5][13]. - -For the loading of object identifier names directly from the web [curl][7] is used. - -## Installation - -The preferred way to install this library is to rely on [Composer][2]: - -```bash -$ composer require fgrosse/phpasn1 -``` - -## Usage - -### Encoding ASN.1 Structures - -PHPASN1 offers you a class for each of the implemented ASN.1 universal types. -The constructors should be pretty self explanatory so you should have no big trouble getting started. -All data will be encoded using [DER encoding][8] - -```php -use FG\ASN1\OID; -use FG\ASN1\Universal\Integer; -use FG\ASN1\Universal\Boolean; -use FG\ASN1\Universal\Enumerated; -use FG\ASN1\Universal\IA5String; -use FG\ASN1\Universal\ObjectIdentifier; -use FG\ASN1\Universal\PrintableString; -use FG\ASN1\Universal\Sequence; -use FG\ASN1\Universal\Set; -use FG\ASN1\Universal\NullObject; - -$integer = new Integer(123456); -$boolean = new Boolean(true); -$enum = new Enumerated(1); -$ia5String = new IA5String('Hello world'); - -$asnNull = new NullObject(); -$objectIdentifier1 = new ObjectIdentifier('1.2.250.1.16.9'); -$objectIdentifier2 = new ObjectIdentifier(OID::RSA_ENCRYPTION); -$printableString = new PrintableString('Foo bar'); - -$sequence = new Sequence($integer, $boolean, $enum, $ia5String); -$set = new Set($sequence, $asnNull, $objectIdentifier1, $objectIdentifier2, $printableString); - -$myBinary = $sequence->getBinary(); -$myBinary .= $set->getBinary(); - -echo base64_encode($myBinary); -``` - - -### Decoding binary data - -Decoding BER encoded binary data is just as easy as encoding it: - -```php -use FG\ASN1\ASNObject; - -$base64String = ... -$binaryData = base64_decode($base64String); -$asnObject = ASNObject::fromBinary($binaryData); - - -// do stuff -``` - -If you already know exactly how your expected data should look like you can use the `FG\ASN1\TemplateParser`: - -```php -use FG\ASN1\TemplateParser; - -// first define your template -$template = [ - Identifier::SEQUENCE => [ - Identifier::SET => [ - Identifier::OBJECT_IDENTIFIER, - Identifier::SEQUENCE => [ - Identifier::INTEGER, - Identifier::BITSTRING, - ] - ] - ] -]; - -// if your binary data is not matching the template you provided this will throw an `\Exception`: -$parser = new TemplateParser(); -$object = $parser->parseBinary($data, $template); - -// there is also a convenience function if you parse binary data from base64: -$object = $parser->parseBase64($data, $template); -``` - -You can use this function to make sure your data has exactly the format you are expecting. - -### Navigating decoded data - -All constructed classes (i.e. `Sequence` and `Set`) can be navigated by array access or using an iterator. -You can find examples -[here](https://github.com/fgrosse/PHPASN1/blob/f6442cadda9d36f3518c737e32f28300a588b777/tests/ASN1/Universal/SequenceTest.php#L148-148), -[here](https://github.com/fgrosse/PHPASN1/blob/f6442cadda9d36f3518c737e32f28300a588b777/tests/ASN1/Universal/SequenceTest.php#L121) and -[here](https://github.com/fgrosse/PHPASN1/blob/f6442cadda9d36f3518c737e32f28300a588b777/tests/ASN1/TemplateParserTest.php#L45). - - -### Give me more examples! - -To see some example usage of the API classes or some generated output check out the [examples](https://github.com/fgrosse/PHPASN1/tree/master/examples). - - -### How do I contribute? - -If you found an issue or have a question submit a github issue with detailed information. - -In case you already know what caused the issue and feel in the mood to fix it, your code contributions are always welcome. Just fork the repository, implement your changes and make sure that you covered everything with tests. -Afterwards submit a pull request via github and be a little patient :) I usually try to comment and/or merge as soon as possible. - -#### Mailing list - -New features or questions can be discussed in [this google group/mailing list][12]. - -### Thanks - -To [all contributors][1] so far! - -## License - -This library is distributed under the [MIT License](LICENSE). - -[1]: https://github.com/fgrosse/PHPASN1/graphs/contributors -[2]: https://getcomposer.org/ -[3]: http://www.itu.int/ITU-T/asn1/ -[4]: http://www.itu.int/ITU-T/recommendations/rec.aspx?rec=x.690 -[5]: http://en.wikipedia.org/wiki/X.509 -[6]: http://en.wikipedia.org/wiki/X.690#BER_encoding -[7]: http://php.net/manual/en/book.curl.php -[8]: http://en.wikipedia.org/wiki/X.690#DER_encoding -[9]: https://styleci.io -[10]: https://coveralls.io/github/fgrosse/PHPASN1 -[11]: https://github.com/fgrosse/PHPASN1/blob/master/tests/ASN1/TemplateParserTest.php#L16 -[12]: https://groups.google.com/d/forum/phpasn1 -[13]: https://packagist.org/packages/fgrosse/phpasn1#1.5.2 diff --git a/fgrosse/phpasn1/composer.json b/fgrosse/phpasn1/composer.json deleted file mode 100644 index 01ffadaed..000000000 --- a/fgrosse/phpasn1/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "fgrosse/phpasn1", - "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", - "type": "library", - "homepage": "https://github.com/FGrosse/PHPASN1", - "license": "MIT", - "authors": [ - { - "name": "Friedrich Große", - "email": "friedrich.grosse@gmail.com", - "homepage": "https://github.com/FGrosse", - "role": "Author" - }, - { - "name": "All contributors", - "homepage": "https://github.com/FGrosse/PHPASN1/contributors" - } - ], - "keywords": [ "x690", "x.690", "x.509", "x509", "asn1", "asn.1", "ber", "der", "binary", "encoding", "decoding" ], - - "require": { - "php": ">=7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~6.3", - "satooshi/php-coveralls": "~2.0" - }, - "suggest": { - "ext-gmp": "GMP is the preferred extension for big integer calculations", - "ext-bcmath": "BCmath is the fallback extension for big integer calculations", - "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available", - "ext-curl": "For loading OID information from the web if they have not bee defined statically" - }, - "autoload": { - "psr-4": { - "FG\\": "lib/" - } - }, - "autoload-dev": { - "psr-4": { - "FG\\Test\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - } -} diff --git a/giggsey/libphonenumber-for-php/README.md b/giggsey/libphonenumber-for-php/README.md deleted file mode 100644 index 7daf81e46..000000000 --- a/giggsey/libphonenumber-for-php/README.md +++ /dev/null @@ -1,263 +0,0 @@ -# libphonenumber for PHP [![Build Status](https://github.com/giggsey/libphonenumber-for-php/workflows/Continuous%20Integration/badge.svg)](https://github.com/giggsey/libphonenumber-for-php/actions?query=workflow%3A%22Continuous+Integration%22) [![Coverage Status](https://img.shields.io/coveralls/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://coveralls.io/r/giggsey/libphonenumber-for-php?branch=master) - -[![Total Downloads](https://poser.pugx.org/giggsey/libphonenumber-for-php/downloads?format=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php) -[![Downloads per month](https://img.shields.io/packagist/dm/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php) -[![Latest Stable Version](https://img.shields.io/packagist/v/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php) -[![License](https://img.shields.io/badge/license-Apache%202.0-red.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php) - -## What is it? -A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://github.com/google/libphonenumber). - - - [Installation](#installation) - - [Documentation](#documentation) - - [Online Demo](#online-demo) - - [Highlights of functionality](#highlights-of-functionality) - - [Versioning](#versioning) - - [Quick Examples](#quick-examples) - - [Geocoder](#geocoder) - - [ShortNumberInfo](#shortnumberinfo) - - [Mapping Phone Numbers to carrier](#mapping-phone-numbers-to-carrier) - - [Mapping Phone Numbers to TimeZones](#mapping-phone-numbers-to-timezones) - - [FAQ](#faq) - - [Problems with Invalid Numbers?](#problems-with-invalid-numbers) - - [Generating data](#generating-data) - - [Integration with frameworks](#integration-with-frameworks) - - -## Installation - -PHP versions 5.3 up to PHP 8.0 are currently supported. - -The PECL [mbstring](http://php.net/mbstring) extension is required. - -It is recommended to use [composer](https://getcomposer.org) to install the library. - -```bash -$ composer require giggsey/libphonenumber-for-php -``` - -You can also use any other [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant autoloader. - -If you do not use composer, ensure that you also load any dependencies that this project has, such as [giggsey/locale](https://github.com/giggsey/Locale). - -## Documentation - - - [PhoneNumber Util](docs/PhoneNumberUtil.md) - - [ShortNumber Info](docs/ShortNumberInfo.md) - - [Phone Number Geolocation](docs/PhoneNumberOfflineGeocoder.md) - - [Phone Number to Carrier Mapping](docs/PhoneNumberToCarrierMapper.md) - - [Phone Number to Timezone Mapping](docs/PhoneNumberToTimeZonesMapper.md) - - [Phone Number Matcher](docs/PhoneNumberMatcher.md) - - [As You Type Formatter](docs/AsYouTypeFormatter.md) - -## Online Demo -An [online demo](http://giggsey.com/libphonenumber/) is available, and the source can be found at [giggsey/libphonenumber-example](https://github.com/giggsey/libphonenumber-example). - -# Highlights of functionality -* Parsing/formatting/validating phone numbers for all countries/regions of the world. -* `getNumberType` - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever feasible). -* `isNumberMatch` - gets a confidence level on whether two numbers could be the same. -* `getExampleNumber`/`getExampleNumberByType` - provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed. -* `isValidNumber` - full validation of a phone number for a region using length and prefix information. -* `PhoneNumberOfflineGeocoder` - provides geographical information related to a phone number. -* `PhoneNumberToTimeZonesMapper` - provides timezone information related to a phone number. -* `PhoneNumberToCarrierMapper` - provides carrier information related to a phone number. - -## Versioning - -This library will try to follow the same version numbers as Google. There could be additional releases where needed to fix critical issues that can not wait until the next release from Google. - -This does mean that this project may not follow [Semantic Versioning](http://semver.org/), but instead Google's version policy. As a result, jumps in major versions may not actually contain any backwards -incompatible changes. Please read the release notes for such releases. - -Google try to release their versions according to Semantic Versioning, as laid out of in their [Versioning Guide](https://github.com/google/libphonenumber#versioning-and-announcements). - -## Quick Examples -Let's say you have a string representing a phone number from Switzerland. This is how you parse/normalize it into a PhoneNumber object: - -```php -$swissNumberStr = "044 668 18 00"; -$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); -try { - $swissNumberProto = $phoneUtil->parse($swissNumberStr, "CH"); - var_dump($swissNumberProto); -} catch (\libphonenumber\NumberParseException $e) { - var_dump($e); -} -``` - -At this point, swissNumberProto contains: - - class libphonenumber\PhoneNumber#9 (7) { - private $countryCode => - int(41) - private $nationalNumber => - double(446681800) - private $extension => - NULL - private $italianLeadingZero => - NULL - private $rawInput => - NULL - private $countryCodeSource => - NULL - private $preferredDomesticCarrierCode => - NULL - } - -Now let us validate whether the number is valid: - -```php -$isValid = $phoneUtil->isValidNumber($swissNumberProto); -var_dump($isValid); // true -``` - -There are a few formats supported by the formatting method, as illustrated below: - -```php -// Produces "+41446681800" -echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::E164); - -// Produces "044 668 18 00" -echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::NATIONAL); - -// Produces "+41 44 668 18 00" -echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL); -``` - -You could also choose to format the number in the way it is dialled from another country: - -```php -// Produces "011 41 44 668 1800", the number when it is dialled in the United States. -echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "US"); - -// Produces "00 41 44 668 18 00", the number when it is dialled in Great Britain. -echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "GB"); -``` - -### Geocoder - -```php -$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); - -$swissNumberProto = $phoneUtil->parse("044 668 18 00", "CH"); -$usNumberProto = $phoneUtil->parse("+1 650 253 0000", "US"); -$gbNumberProto = $phoneUtil->parse("0161 496 0000", "GB"); - -$geocoder = \libphonenumber\geocoding\PhoneNumberOfflineGeocoder::getInstance(); - -// Outputs "Zurich" -echo $geocoder->getDescriptionForNumber($swissNumberProto, "en_US"); - -// Outputs "Zürich" -echo $geocoder->getDescriptionForNumber($swissNumberProto, "de_DE"); - -// Outputs "Zurigo" -echo $geocoder->getDescriptionForNumber($swissNumberProto, "it_IT"); - -// Outputs "Mountain View, CA" -echo $geocoder->getDescriptionForNumber($usNumberProto, "en_US"); - -// Outputs "Mountain View, CA" -echo $geocoder->getDescriptionForNumber($usNumberProto, "de_DE"); - -// Outputs "미국" (Korean for United States) -echo $geocoder->getDescriptionForNumber($usNumberProto, "ko-KR"); - -// Outputs "Manchester" -echo $geocoder->getDescriptionForNumber($gbNumberProto, "en_GB"); - -// Outputs "영국" (Korean for United Kingdom) -echo $geocoder->getDescriptionForNumber($gbNumberProto, "ko-KR"); -``` - -### ShortNumberInfo - -```php -$shortNumberInfo = \libphonenumber\ShortNumberInfo::getInstance(); - -// true -var_dump($shortNumberInfo->isEmergencyNumber("999", "GB")); - -// true -var_dump($shortNumberInfo->connectsToEmergencyNumber("999", "GB")); - -// false -var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "GB")); - -// true -var_dump($shortNumberInfo->isEmergencyNumber("911", "US")); - -// true -var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "US")); - -// false -var_dump($shortNumberInfo->isEmergencyNumber("911123", "US")); - -// true -var_dump($shortNumberInfo->connectsToEmergencyNumber("911123", "US")); -``` - -### Mapping Phone Numbers to carrier - -```php -$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); -$swissNumberProto = $phoneUtil->parse("798765432", "CH"); - -$carrierMapper = \libphonenumber\PhoneNumberToCarrierMapper::getInstance(); -// Outputs "Swisscom" -echo $carrierMapper->getNameForNumber($swissNumberProto, "en"); -``` - -### Mapping Phone Numbers to TimeZones - -```php -$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); -$swissNumberProto = $phoneUtil->parse("798765432", "CH"); - -$timeZoneMapper = \libphonenumber\PhoneNumberToTimeZonesMapper::getInstance(); -// returns array("Europe/Zurich") -$timeZones = $timeZoneMapper->getTimeZonesForNumber($swissNumberProto); -``` - -## FAQ - -#### Problems with Invalid Numbers? - -This library uses phone number metadata from Google's [libphonenumber](https://github.com/google/libphonenumber). If this library is working as intended, it should provide the same result as the Java version of Google's project. - -If you believe that a phone number is returning an incorrect result, first test it with [libphonenumber](https://github.com/google/libphonenumber) via their [Online Demo](https://libphonenumber.appspot.com/). If that returns the same result as this project, and you feel it is in error, raise it as an Issue with the libphonenumber project. - -If Google's [Online Demo](https://libphonenumber.appspot.com/) gives a different result to the [libphonenumber-for-php demo](http://giggsey.com/libphonenumber/), then please raise an Issue here. - -## Generating data - -Generating the data is not normally needed, as this repository will generally always have the up to data metadata. - -If you do need to generate the data, the commands are provided by [Phing](https://www.phing.info). Ensure you have all the dev composer dependencies installed, then run - -```bash -$ vendor/bin/phing compile -``` - -This compile process clones the [libphonenumber](https://github.com/google/libphonenumber) project at the version specified in [METADATA-VERSION.txt](METADATA-VERSION.txt). - -### Running tests - -This project uses [PHPUnit Bridge](https://symfony.com/doc/current/components/phpunit_bridge.html) to maintain compatibility for the supported PHP versions. - -To run the tests locally, run the `./phpunit` script. - -## Integration with frameworks - -Other packages exist that integrate libphonenumber-for-php into frameworks. - -| Framework | Packages | -| --------- |:-------------:| -|Symfony|[PhoneNumberBundle](https://github.com/odolbeau/phone-number-bundle)| -|Laravel|[Laravel Phone](https://github.com/Propaganistas/Laravel-Phone)| -|Yii2|[PhoneInput](https://github.com/Borales/yii2-phone-input)| -|Kohana|[PhoneNumber](https://github.com/softmediadev/kohana-phonenumber)| -|TYPO3|[TYPO3 Phone Extension](https://github.com/simonschaufi/typo3-phone)| - -These packages are supplied by third parties, and their quality can not be guaranteed. diff --git a/giggsey/libphonenumber-for-php/composer.json b/giggsey/libphonenumber-for-php/composer.json deleted file mode 100644 index 54cf98478..000000000 --- a/giggsey/libphonenumber-for-php/composer.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "giggsey/libphonenumber-for-php", - "type": "library", - "description": "PHP Port of Google's libphonenumber", - "keywords": [ - "phonenumber", - "libphonenumber", - "mobile", - "validation", - "geocoding", - "geolocation" - ], - "homepage": "https://github.com/giggsey/libphonenumber-for-php", - "license": "Apache-2.0", - "support": { - "irc": "irc://irc.appliedirc.com/lobby", - "source": "https://github.com/giggsey/libphonenumber-for-php", - "issues": "https://github.com/giggsey/libphonenumber-for-php/issues" - }, - "authors": [ - { - "name": "Joshua Gigg", - "email": "giggsey@gmail.com", - "homepage": "https://giggsey.com/" - } - ], - "autoload": { - "psr-4": { - "libphonenumber\\": "src/" - }, - "exclude-from-classmap": [ - "/src/data/", - "/src/carrier/data/", - "/src/geocoding/data/", - "/src/timezone/data/" - ] - - }, - "autoload-dev": { - "psr-4": { - "libphonenumber\\buildtools\\": "build/", - "libphonenumber\\Tests\\": "tests/" - } - }, - "archive": { - "exclude": [ - "build/", - "docs/", - "tests/", - ".github/", - ".editorconfig", - ".gitattributes", - ".gitignore", - ".styleci.yml", - ".travis.yml", - "build.xml", - "libphonenumber-for-php.spec", - "phpunit.xml.dist", - "phpunit" - ] - }, - "require": { - "php": ">=5.3.2", - "giggsey/locale": "^1.7|^2.0", - "symfony/polyfill-mbstring": "^1.17" - }, - "require-dev": { - "phing/phing": "^2.7", - "pear/versioncontrol_git": "^0.5", - "pear/pear-core-minimal": "^1.9", - "pear/pear_exception": "^1.0", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/console": "^2.8|^3.0|^v4.4|^v5.2", - "php-coveralls/php-coveralls": "^1.0|^2.0" - }, - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "scripts": { - "test": "./phpunit", - "metadata": "vendor/bin/phing compile" - } -} diff --git a/giggsey/locale/README.md b/giggsey/locale/README.md deleted file mode 100644 index f480edf57..000000000 --- a/giggsey/locale/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Locale [![Build Status](https://img.shields.io/travis/giggsey/Locale.svg?style=flat-square)](https://travis-ci.org/giggsey/Locale) [![Coverage Status](https://img.shields.io/coveralls/giggsey/Locale.svg?style=flat-square)](https://coveralls.io/r/giggsey/Locale) [![StyleCI](https://styleci.io/repos/24566760/shield)](https://styleci.io/repos/24566760) - -[![Total Downloads](https://poser.pugx.org/giggsey/locale/downloads?format=flat-square)](https://packagist.org/packages/giggsey/locale) [![Latest Stable Version](https://poser.pugx.org/giggsey/locale/v/stable?format=flat-square)](https://packagist.org/packages/giggsey/locale) [![License](https://poser.pugx.org/giggsey/locale/license?format=flat-square)](https://packagist.org/packages/giggsey/locale) - -A library providing up to date [CLDR](http://cldr.unicode.org/). Primarily as a requirement of [libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php). - -## Reasoning - -This was created because [libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php) required the [intl](http://php.net/intl) extension to use the Geo Coder. The extension is not installed by default, and can be a hurdle for users. It also relies on the [CLDR](http://cldr.unicode.org) data provided by the Operating System, which is quite often out of date. - -## Generating data - -Data is compiled from the latest [CLDR Data](http://cldr.unicode.org/) as specified in [CLDR-VERSION.txt](CLDR-VERSION.txt). - -A [Phing](https://www.phing.info/) task is used to compile the data from [JSON](https://github.com/unicode-org/cldr-json) into native PHP arrays. - -It is not normally needed to compile the data, as this repository will always have the up to date CLDR data. -To manually compile the data, ensure you have all the dependencies installed, then run: - -```bash -vendor/bin/phing compile -``` diff --git a/giggsey/locale/composer.json b/giggsey/locale/composer.json deleted file mode 100644 index ac2616165..000000000 --- a/giggsey/locale/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "giggsey/locale", - "description": "Locale functions required by libphonenumber-for-php", - "minimum-stability": "stable", - "license": "MIT", - "authors": [ - { - "name": "Joshua Gigg", - "email": "giggsey@gmail.com", - "homepage": "https://giggsey.com/" - } - ], - "require": { - "php": ">=7.2" - }, - "require-dev": { - "ext-json": "*", - "php-coveralls/php-coveralls": "^2.0", - "phing/phing": "^2.7", - "pear/versioncontrol_git": "^0.5", - "pear/pear-core-minimal": "^1.9", - "pear/pear_exception": "^1.0", - "phpunit/phpunit": "^8.5|^9.5", - "symfony/console": "^5.0", - "symfony/filesystem": "^5.0", - "symfony/process": "^5.0", - "symfony/finder": "^5.0" - }, - "autoload": { - "psr-4": { - "Giggsey\\Locale\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Giggsey\\Locale\\Tests\\": "tests/", - "Giggsey\\Locale\\Build\\": "build/Build/" - } - }, - "archive": { - "exclude": [ - "build/", - "tests/", - ".gitattributes", - ".gitignore", - ".styleci.yml", - ".travis.yml", - "build.xml", - "phpunit.xml.dist" - ] - }, - "scripts": { - "test": "phpunit", - "metadata": "phing compile" - } -} diff --git a/guzzlehttp/promises/CHANGELOG.md b/guzzlehttp/promises/CHANGELOG.md deleted file mode 100644 index 253282eb1..000000000 --- a/guzzlehttp/promises/CHANGELOG.md +++ /dev/null @@ -1,110 +0,0 @@ -# CHANGELOG - -## 1.5.2 - 2022-08-07 - -### Changed - -- Officially support PHP 8.2 - -## 1.5.1 - 2021-10-22 - -### Fixed - -- Revert "Call handler when waiting on fulfilled/rejected Promise" -- Fix pool memory leak when empty array of promises provided - -## 1.5.0 - 2021-10-07 - -### Changed - -- Call handler when waiting on fulfilled/rejected Promise -- Officially support PHP 8.1 - -### Fixed - -- Fix manually settle promises generated with `Utils::task` - -## 1.4.1 - 2021-02-18 - -### Fixed - -- Fixed `each_limit` skipping promises and failing - -## 1.4.0 - 2020-09-30 - -### Added - -- Support for PHP 8 -- Optional `$recursive` flag to `all` -- Replaced functions by static methods - -### Fixed - -- Fix empty `each` processing -- Fix promise handling for Iterators of non-unique keys -- Fixed `method_exists` crashes on PHP 8 -- Memory leak on exceptions - - -## 1.3.1 - 2016-12-20 - -### Fixed - -- `wait()` foreign promise compatibility - - -## 1.3.0 - 2016-11-18 - -### Added - -- Adds support for custom task queues. - -### Fixed - -- Fixed coroutine promise memory leak. - - -## 1.2.0 - 2016-05-18 - -### Changed - -- Update to now catch `\Throwable` on PHP 7+ - - -## 1.1.0 - 2016-03-07 - -### Changed - -- Update EachPromise to prevent recurring on a iterator when advancing, as this - could trigger fatal generator errors. -- Update Promise to allow recursive waiting without unwrapping exceptions. - - -## 1.0.3 - 2015-10-15 - -### Changed - -- Update EachPromise to immediately resolve when the underlying promise iterator - is empty. Previously, such a promise would throw an exception when its `wait` - function was called. - - -## 1.0.2 - 2015-05-15 - -### Changed - -- Conditionally require functions.php. - - -## 1.0.1 - 2015-06-24 - -### Changed - -- Updating EachPromise to call next on the underlying promise iterator as late - as possible to ensure that generators that generate new requests based on - callbacks are not iterated until after callbacks are invoked. - - -## 1.0.0 - 2015-05-12 - -- Initial release diff --git a/guzzlehttp/promises/README.md b/guzzlehttp/promises/README.md deleted file mode 100644 index 1ea667ab9..000000000 --- a/guzzlehttp/promises/README.md +++ /dev/null @@ -1,546 +0,0 @@ -# Guzzle Promises - -[Promises/A+](https://promisesaplus.com/) implementation that handles promise -chaining and resolution iteratively, allowing for "infinite" promise chaining -while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) -for a general introduction to promises. - -- [Features](#features) -- [Quick start](#quick-start) -- [Synchronous wait](#synchronous-wait) -- [Cancellation](#cancellation) -- [API](#api) - - [Promise](#promise) - - [FulfilledPromise](#fulfilledpromise) - - [RejectedPromise](#rejectedpromise) -- [Promise interop](#promise-interop) -- [Implementation notes](#implementation-notes) - - -## Features - -- [Promises/A+](https://promisesaplus.com/) implementation. -- Promise resolution and chaining is handled iteratively, allowing for - "infinite" promise chaining. -- Promises have a synchronous `wait` method. -- Promises can be cancelled. -- Works with any object that has a `then` function. -- C# style async/await coroutine promises using - `GuzzleHttp\Promise\Coroutine::of()`. - - -## Quick Start - -A *promise* represents the eventual result of an asynchronous operation. The -primary way of interacting with a promise is through its `then` method, which -registers callbacks to receive either a promise's eventual value or the reason -why the promise cannot be fulfilled. - -### Callbacks - -Callbacks are registered with the `then` method by providing an optional -`$onFulfilled` followed by an optional `$onRejected` function. - - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then( - // $onFulfilled - function ($value) { - echo 'The promise was fulfilled.'; - }, - // $onRejected - function ($reason) { - echo 'The promise was rejected.'; - } -); -``` - -*Resolving* a promise means that you either fulfill a promise with a *value* or -reject a promise with a *reason*. Resolving a promise triggers callbacks -registered with the promise's `then` method. These callbacks are triggered -only once and in the order in which they were added. - -### Resolving a Promise - -Promises are fulfilled using the `resolve($value)` method. Resolving a promise -with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger -all of the onFulfilled callbacks (resolving a promise with a rejected promise -will reject the promise and trigger the `$onRejected` callbacks). - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise - ->then(function ($value) { - // Return a value and don't break the chain - return "Hello, " . $value; - }) - // This then is executed after the first then and receives the value - // returned from the first then. - ->then(function ($value) { - echo $value; - }); - -// Resolving the promise triggers the $onFulfilled callbacks and outputs -// "Hello, reader." -$promise->resolve('reader.'); -``` - -### Promise Forwarding - -Promises can be chained one after the other. Each then in the chain is a new -promise. The return value of a promise is what's forwarded to the next -promise in the chain. Returning a promise in a `then` callback will cause the -subsequent promises in the chain to only be fulfilled when the returned promise -has been fulfilled. The next promise in the chain will be invoked with the -resolved value of the promise. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$nextPromise = new Promise(); - -$promise - ->then(function ($value) use ($nextPromise) { - echo $value; - return $nextPromise; - }) - ->then(function ($value) { - echo $value; - }); - -// Triggers the first callback and outputs "A" -$promise->resolve('A'); -// Triggers the second callback and outputs "B" -$nextPromise->resolve('B'); -``` - -### Promise Rejection - -When a promise is rejected, the `$onRejected` callbacks are invoked with the -rejection reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - echo $reason; -}); - -$promise->reject('Error!'); -// Outputs "Error!" -``` - -### Rejection Forwarding - -If an exception is thrown in an `$onRejected` callback, subsequent -`$onRejected` callbacks are invoked with the thrown exception as the reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - throw new Exception($reason); -})->then(null, function ($reason) { - assert($reason->getMessage() === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -You can also forward a rejection down the promise chain by returning a -`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or -`$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - return new RejectedPromise($reason); -})->then(null, function ($reason) { - assert($reason === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -If an exception is not thrown in a `$onRejected` callback and the callback -does not return a rejected promise, downstream `$onFulfilled` callbacks are -invoked using the value returned from the `$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise - ->then(null, function ($reason) { - return "It's ok"; - }) - ->then(function ($value) { - assert($value === "It's ok"); - }); - -$promise->reject('Error!'); -``` - - -## Synchronous Wait - -You can synchronously force promises to complete using a promise's `wait` -method. When creating a promise, you can provide a wait function that is used -to synchronously force a promise to complete. When a wait function is invoked -it is expected to deliver a value to the promise or reject the promise. If the -wait function does not deliver a value, then an exception is thrown. The wait -function provided to a promise constructor is invoked when the `wait` function -of the promise is called. - -```php -$promise = new Promise(function () use (&$promise) { - $promise->resolve('foo'); -}); - -// Calling wait will return the value of the promise. -echo $promise->wait(); // outputs "foo" -``` - -If an exception is encountered while invoking the wait function of a promise, -the promise is rejected with the exception and the exception is thrown. - -```php -$promise = new Promise(function () use (&$promise) { - throw new Exception('foo'); -}); - -$promise->wait(); // throws the exception. -``` - -Calling `wait` on a promise that has been fulfilled will not trigger the wait -function. It will simply return the previously resolved value. - -```php -$promise = new Promise(function () { die('this is not called!'); }); -$promise->resolve('foo'); -echo $promise->wait(); // outputs "foo" -``` - -Calling `wait` on a promise that has been rejected will throw an exception. If -the rejection reason is an instance of `\Exception` the reason is thrown. -Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason -can be obtained by calling the `getReason` method of the exception. - -```php -$promise = new Promise(); -$promise->reject('foo'); -$promise->wait(); -``` - -> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' - -### Unwrapping a Promise - -When synchronously waiting on a promise, you are joining the state of the -promise into the current state of execution (i.e., return the value of the -promise if it was fulfilled or throw an exception if it was rejected). This is -called "unwrapping" the promise. Waiting on a promise will by default unwrap -the promise state. - -You can force a promise to resolve and *not* unwrap the state of the promise -by passing `false` to the first argument of the `wait` function: - -```php -$promise = new Promise(); -$promise->reject('foo'); -// This will not throw an exception. It simply ensures the promise has -// been resolved. -$promise->wait(false); -``` - -When unwrapping a promise, the resolved value of the promise will be waited -upon until the unwrapped value is not a promise. This means that if you resolve -promise A with a promise B and unwrap promise A, the value returned by the -wait function will be the value delivered to promise B. - -**Note**: when you do not unwrap the promise, no value is returned. - - -## Cancellation - -You can cancel a promise that has not yet been fulfilled using the `cancel()` -method of a promise. When creating a promise you can provide an optional -cancel function that when invoked cancels the action of computing a resolution -of the promise. - - -## API - -### Promise - -When creating a promise object, you can provide an optional `$waitFn` and -`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is -expected to resolve the promise. `$cancelFn` is a function with no arguments -that is expected to cancel the computation of a promise. It is invoked when the -`cancel()` method of a promise is called. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise( - function () use (&$promise) { - $promise->resolve('waited'); - }, - function () { - // do something that will cancel the promise computation (e.g., close - // a socket, cancel a database query, etc...) - } -); - -assert('waited' === $promise->wait()); -``` - -A promise has the following methods: - -- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` - - Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. - -- `otherwise(callable $onRejected) : PromiseInterface` - - Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. - -- `wait($unwrap = true) : mixed` - - Synchronously waits on the promise to complete. - - `$unwrap` controls whether or not the value of the promise is returned for a - fulfilled promise or if an exception is thrown if the promise is rejected. - This is set to `true` by default. - -- `cancel()` - - Attempts to cancel the promise if possible. The promise being cancelled and - the parent most ancestor that has not yet been resolved will also be - cancelled. Any promises waiting on the cancelled promise to resolve will also - be cancelled. - -- `getState() : string` - - Returns the state of the promise. One of `pending`, `fulfilled`, or - `rejected`. - -- `resolve($value)` - - Fulfills the promise with the given `$value`. - -- `reject($reason)` - - Rejects the promise with the given `$reason`. - - -### FulfilledPromise - -A fulfilled promise can be created to represent a promise that has been -fulfilled. - -```php -use GuzzleHttp\Promise\FulfilledPromise; - -$promise = new FulfilledPromise('value'); - -// Fulfilled callbacks are immediately invoked. -$promise->then(function ($value) { - echo $value; -}); -``` - - -### RejectedPromise - -A rejected promise can be created to represent a promise that has been -rejected. - -```php -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new RejectedPromise('Error'); - -// Rejected callbacks are immediately invoked. -$promise->then(null, function ($reason) { - echo $reason; -}); -``` - - -## Promise Interoperability - -This library works with foreign promises that have a `then` method. This means -you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) -for example. When a foreign promise is returned inside of a then method -callback, promise resolution will occur recursively. - -```php -// Create a React promise -$deferred = new React\Promise\Deferred(); -$reactPromise = $deferred->promise(); - -// Create a Guzzle promise that is fulfilled with a React promise. -$guzzlePromise = new GuzzleHttp\Promise\Promise(); -$guzzlePromise->then(function ($value) use ($reactPromise) { - // Do something something with the value... - // Return the React promise - return $reactPromise; -}); -``` - -Please note that wait and cancel chaining is no longer possible when forwarding -a foreign promise. You will need to wrap a third-party promise with a Guzzle -promise in order to utilize wait and cancel functions with foreign promises. - - -### Event Loop Integration - -In order to keep the stack size constant, Guzzle promises are resolved -asynchronously using a task queue. When waiting on promises synchronously, the -task queue will be automatically run to ensure that the blocking promise and -any forwarded promises are resolved. When using promises asynchronously in an -event loop, you will need to run the task queue on each tick of the loop. If -you do not run the task queue, then promises will not be resolved. - -You can run the task queue using the `run()` method of the global task queue -instance. - -```php -// Get the global task queue -$queue = GuzzleHttp\Promise\Utils::queue(); -$queue->run(); -``` - -For example, you could use Guzzle promises with React using a periodic timer: - -```php -$loop = React\EventLoop\Factory::create(); -$loop->addPeriodicTimer(0, [$queue, 'run']); -``` - -*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? - - -## Implementation Notes - -### Promise Resolution and Chaining is Handled Iteratively - -By shuffling pending handlers from one owner to another, promises are -resolved iteratively, allowing for "infinite" then chaining. - -```php -then(function ($v) { - // The stack size remains constant (a good thing) - echo xdebug_get_stack_depth() . ', '; - return $v + 1; - }); -} - -$parent->resolve(0); -var_dump($p->wait()); // int(1000) - -``` - -When a promise is fulfilled or rejected with a non-promise value, the promise -then takes ownership of the handlers of each child promise and delivers values -down the chain without using recursion. - -When a promise is resolved with another promise, the original promise transfers -all of its pending handlers to the new promise. When the new promise is -eventually resolved, all of the pending handlers are delivered the forwarded -value. - -### A Promise is the Deferred - -Some promise libraries implement promises using a deferred object to represent -a computation and a promise object to represent the delivery of the result of -the computation. This is a nice separation of computation and delivery because -consumers of the promise cannot modify the value that will be eventually -delivered. - -One side effect of being able to implement promise resolution and chaining -iteratively is that you need to be able for one promise to reach into the state -of another promise to shuffle around ownership of handlers. In order to achieve -this without making the handlers of a promise publicly mutable, a promise is -also the deferred value, allowing promises of the same parent class to reach -into and modify the private properties of promises of the same type. While this -does allow consumers of the value to modify the resolution or rejection of the -deferred, it is a small price to pay for keeping the stack size constant. - -```php -$promise = new Promise(); -$promise->then(function ($value) { echo $value; }); -// The promise is the deferred value, so you can deliver a value to it. -$promise->resolve('foo'); -// prints "foo" -``` - - -## Upgrading from Function API - -A static API was first introduced in 1.4.0, in order to mitigate problems with -functions conflicting between global and local copies of the package. The -function API will be removed in 2.0.0. A migration table has been provided here -for your convenience: - -| Original Function | Replacement Method | -|----------------|----------------| -| `queue` | `Utils::queue` | -| `task` | `Utils::task` | -| `promise_for` | `Create::promiseFor` | -| `rejection_for` | `Create::rejectionFor` | -| `exception_for` | `Create::exceptionFor` | -| `iter_for` | `Create::iterFor` | -| `inspect` | `Utils::inspect` | -| `inspect_all` | `Utils::inspectAll` | -| `unwrap` | `Utils::unwrap` | -| `all` | `Utils::all` | -| `some` | `Utils::some` | -| `any` | `Utils::any` | -| `settle` | `Utils::settle` | -| `each` | `Each::of` | -| `each_limit` | `Each::ofLimit` | -| `each_limit_all` | `Each::ofLimitAll` | -| `!is_fulfilled` | `Is::pending` | -| `is_fulfilled` | `Is::fulfilled` | -| `is_rejected` | `Is::rejected` | -| `is_settled` | `Is::settled` | -| `coroutine` | `Coroutine::of` | - - -## Security - -If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information. - - -## License - -Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. - - -## For Enterprise - -Available as part of the Tidelift Subscription - -The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/guzzlehttp/promises/composer.json b/guzzlehttp/promises/composer.json deleted file mode 100644 index c959fb32b..000000000 --- a/guzzlehttp/promises/composer.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "guzzlehttp/promises", - "description": "Guzzle promises library", - "keywords": ["promise"], - "license": "MIT", - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": ["src/functions_include.php"] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Promise\\Tests\\": "tests/" - } - }, - "scripts": { - "test": "vendor/bin/simple-phpunit", - "test-ci": "vendor/bin/simple-phpunit --coverage-text" - }, - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "config": { - "preferred-install": "dist", - "sort-packages": true - } -} diff --git a/guzzlehttp/psr7/CHANGELOG.md b/guzzlehttp/psr7/CHANGELOG.md deleted file mode 100644 index 3fcf18a54..000000000 --- a/guzzlehttp/psr7/CHANGELOG.md +++ /dev/null @@ -1,396 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## Unreleased - -## 2.4.3 - 2022-10-26 - -### Changed - -- Replaced `sha1(uniqid())` by `bin2hex(random_bytes(20))` - -## 2.4.2 - 2022-10-25 - -### Fixed - -- Fixed erroneous behaviour when combining host and relative path - -## 2.4.1 - 2022-08-28 - -### Fixed - -- Rewind body before reading in `Message::bodySummary` - -## 2.4.0 - 2022-06-20 - -### Added - -- Added provisional PHP 8.2 support -- Added `UriComparator::isCrossOrigin` method - -## 2.3.0 - 2022-06-09 - -### Fixed - -- Added `Header::splitList` method -- Added `Utils::tryGetContents` method -- Improved `Stream::getContents` method -- Updated mimetype mappings - -## 2.2.2 - 2022-06-08 - -### Fixed - -- Fix `Message::parseRequestUri` for numeric headers -- Re-wrap exceptions thrown in `fread` into runtime exceptions -- Throw an exception when multipart options is misformatted - -## 2.2.1 - 2022-03-20 - -### Fixed - -- Correct header value validation - -## 2.2.0 - 2022-03-20 - -### Added - -- A more compressive list of mime types -- Add JsonSerializable to Uri -- Missing return types - -### Fixed - -- Bug MultipartStream no `uri` metadata -- Bug MultipartStream with filename for `data://` streams -- Fixed new line handling in MultipartStream -- Reduced RAM usage when copying streams -- Updated parsing in `Header::normalize()` - -## 2.1.1 - 2022-03-20 - -### Fixed - -- Validate header values properly - -## 2.1.0 - 2021-10-06 - -### Changed - -- Attempting to create a `Uri` object from a malformed URI will no longer throw a generic - `InvalidArgumentException`, but rather a `MalformedUriException`, which inherits from the former - for backwards compatibility. Callers relying on the exception being thrown to detect invalid - URIs should catch the new exception. - -### Fixed - -- Return `null` in caching stream size if remote size is `null` - -## 2.0.0 - 2021-06-30 - -Identical to the RC release. - -## 2.0.0@RC-1 - 2021-04-29 - -### Fixed - -- Handle possibly unset `url` in `stream_get_meta_data` - -## 2.0.0@beta-1 - 2021-03-21 - -### Added - -- PSR-17 factories -- Made classes final -- PHP7 type hints - -### Changed - -- When building a query string, booleans are represented as 1 and 0. - -### Removed - -- PHP < 7.2 support -- All functions in the `GuzzleHttp\Psr7` namespace - -## 1.8.1 - 2021-03-21 - -### Fixed - -- Issue parsing IPv6 URLs -- Issue modifying ServerRequest lost all its attributes - -## 1.8.0 - 2021-03-21 - -### Added - -- Locale independent URL parsing -- Most classes got a `@final` annotation to prepare for 2.0 - -### Fixed - -- Issue when creating stream from `php://input` and curl-ext is not installed -- Broken `Utils::tryFopen()` on PHP 8 - -## 1.7.0 - 2020-09-30 - -### Added - -- Replaced functions by static methods - -### Fixed - -- Converting a non-seekable stream to a string -- Handle multiple Set-Cookie correctly -- Ignore array keys in header values when merging -- Allow multibyte characters to be parsed in `Message:bodySummary()` - -### Changed - -- Restored partial HHVM 3 support - - -## [1.6.1] - 2019-07-02 - -### Fixed - -- Accept null and bool header values again - - -## [1.6.0] - 2019-06-30 - -### Added - -- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244) -- Added MIME type for WEBP image format (#246) -- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272) - -### Changed - -- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262) -- Accept port number 0 to be valid (#270) - -### Fixed - -- Fixed subsequent reads from `php://input` in ServerRequest (#247) -- Fixed readable/writable detection for certain stream modes (#248) -- Fixed encoding of special characters in the `userInfo` component of an URI (#253) - - -## [1.5.2] - 2018-12-04 - -### Fixed - -- Check body size when getting the message summary - - -## [1.5.1] - 2018-12-04 - -### Fixed - -- Get the summary of a body only if it is readable - - -## [1.5.0] - 2018-12-03 - -### Added - -- Response first-line to response string exception (fixes #145) -- A test for #129 behavior -- `get_message_body_summary` function in order to get the message summary -- `3gp` and `mkv` mime types - -### Changed - -- Clarify exception message when stream is detached - -### Deprecated - -- Deprecated parsing folded header lines as per RFC 7230 - -### Fixed - -- Fix `AppendStream::detach` to not close streams -- `InflateStream` preserves `isSeekable` attribute of the underlying stream -- `ServerRequest::getUriFromGlobals` to support URLs in query parameters - - -Several other fixes and improvements. - - -## [1.4.2] - 2017-03-20 - -### Fixed - -- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing - calls to `trigger_error` when deprecated methods are invoked. - - -## [1.4.1] - 2017-02-27 - -### Added - -- Rriggering of silenced deprecation warnings. - -### Fixed - -- Reverted BC break by reintroducing behavior to automagically fix a URI with a - relative path and an authority by adding a leading slash to the path. It's only - deprecated now. - - -## [1.4.0] - 2017-02-21 - -### Added - -- Added common URI utility methods based on RFC 3986 (see documentation in the readme): - - `Uri::isDefaultPort` - - `Uri::isAbsolute` - - `Uri::isNetworkPathReference` - - `Uri::isAbsolutePathReference` - - `Uri::isRelativePathReference` - - `Uri::isSameDocumentReference` - - `Uri::composeComponents` - - `UriNormalizer::normalize` - - `UriNormalizer::isEquivalent` - - `UriResolver::relativize` - -### Changed - -- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. -- Allow `parse_response` to parse a response without delimiting space and reason. -- Ensure each URI modification results in a valid URI according to PSR-7 discussions. - Invalid modifications will throw an exception instead of returning a wrong URI or - doing some magic. - - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception - because the path of a URI with an authority must start with a slash "/" or be empty - - `(new Uri())->withScheme('http')` will return `'http://localhost'` - -### Deprecated - -- `Uri::resolve` in favor of `UriResolver::resolve` -- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` - -### Fixed - -- `Stream::read` when length parameter <= 0. -- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. -- `ServerRequest::getUriFromGlobals` when `Host` header contains port. -- Compatibility of URIs with `file` scheme and empty host. - - -## [1.3.1] - 2016-06-25 - -### Fixed - -- `Uri::__toString` for network path references, e.g. `//example.org`. -- Missing lowercase normalization for host. -- Handling of URI components in case they are `'0'` in a lot of places, - e.g. as a user info password. -- `Uri::withAddedHeader` to correctly merge headers with different case. -- Trimming of header values in `Uri::withAddedHeader`. Header values may - be surrounded by whitespace which should be ignored according to RFC 7230 - Section 3.2.4. This does not apply to header names. -- `Uri::withAddedHeader` with an array of header values. -- `Uri::resolve` when base path has no slash and handling of fragment. -- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the - key/value both in encoded as well as decoded form to those methods. This is - consistent with withPath, withQuery etc. -- `ServerRequest::withoutAttribute` when attribute value is null. - - -## [1.3.0] - 2016-04-13 - -### Added - -- Remaining interfaces needed for full PSR7 compatibility - (ServerRequestInterface, UploadedFileInterface, etc.). -- Support for stream_for from scalars. - -### Changed - -- Can now extend Uri. - -### Fixed -- A bug in validating request methods by making it more permissive. - - -## [1.2.3] - 2016-02-18 - -### Fixed - -- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote - streams, which can sometimes return fewer bytes than requested with `fread`. -- Handling of gzipped responses with FNAME headers. - - -## [1.2.2] - 2016-01-22 - -### Added - -- Support for URIs without any authority. -- Support for HTTP 451 'Unavailable For Legal Reasons.' -- Support for using '0' as a filename. -- Support for including non-standard ports in Host headers. - - -## [1.2.1] - 2015-11-02 - -### Changes - -- Now supporting negative offsets when seeking to SEEK_END. - - -## [1.2.0] - 2015-08-15 - -### Changed - -- Body as `"0"` is now properly added to a response. -- Now allowing forward seeking in CachingStream. -- Now properly parsing HTTP requests that contain proxy targets in - `parse_request`. -- functions.php is now conditionally required. -- user-info is no longer dropped when resolving URIs. - - -## [1.1.0] - 2015-06-24 - -### Changed - -- URIs can now be relative. -- `multipart/form-data` headers are now overridden case-insensitively. -- URI paths no longer encode the following characters because they are allowed - in URIs: "(", ")", "*", "!", "'" -- A port is no longer added to a URI when the scheme is missing and no port is - present. - - -## 1.0.0 - 2015-05-19 - -Initial release. - -Currently unsupported: - -- `Psr\Http\Message\ServerRequestInterface` -- `Psr\Http\Message\UploadedFileInterface` - - - -[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 -[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 -[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 -[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 -[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 -[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 -[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 -[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 -[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 -[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 -[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 -[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 -[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 -[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/guzzlehttp/psr7/README.md b/guzzlehttp/psr7/README.md deleted file mode 100644 index 8b9929a1d..000000000 --- a/guzzlehttp/psr7/README.md +++ /dev/null @@ -1,872 +0,0 @@ -# PSR-7 Message Implementation - -This repository contains a full [PSR-7](https://www.php-fig.org/psr/psr-7/) -message implementation, several stream decorators, and some helpful -functionality like query string parsing. - -![CI](https://github.com/guzzle/psr7/workflows/CI/badge.svg) -![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg) - - -# Stream implementation - -This package comes with a number of stream implementations and stream -decorators. - - -## AppendStream - -`GuzzleHttp\Psr7\AppendStream` - -Reads from multiple streams, one after the other. - -```php -use GuzzleHttp\Psr7; - -$a = Psr7\Utils::streamFor('abc, '); -$b = Psr7\Utils::streamFor('123.'); -$composed = new Psr7\AppendStream([$a, $b]); - -$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me')); - -echo $composed; // abc, 123. Above all listen to me. -``` - - -## BufferStream - -`GuzzleHttp\Psr7\BufferStream` - -Provides a buffer stream that can be written to fill a buffer, and read -from to remove bytes from the buffer. - -This stream returns a "hwm" metadata value that tells upstream consumers -what the configured high water mark of the stream is, or the maximum -preferred size of the buffer. - -```php -use GuzzleHttp\Psr7; - -// When more than 1024 bytes are in the buffer, it will begin returning -// false to writes. This is an indication that writers should slow down. -$buffer = new Psr7\BufferStream(1024); -``` - - -## CachingStream - -The CachingStream is used to allow seeking over previously read bytes on -non-seekable streams. This can be useful when transferring a non-seekable -entity body fails due to needing to rewind the stream (for example, resulting -from a redirect). Data that is read from the remote stream will be buffered in -a PHP temp stream so that previously read bytes are cached first in memory, -then on disk. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r')); -$stream = new Psr7\CachingStream($original); - -$stream->read(1024); -echo $stream->tell(); -// 1024 - -$stream->seek(0); -echo $stream->tell(); -// 0 -``` - - -## DroppingStream - -`GuzzleHttp\Psr7\DroppingStream` - -Stream decorator that begins dropping data once the size of the underlying -stream becomes too full. - -```php -use GuzzleHttp\Psr7; - -// Create an empty stream -$stream = Psr7\Utils::streamFor(); - -// Start dropping data when the stream has more than 10 bytes -$dropping = new Psr7\DroppingStream($stream, 10); - -$dropping->write('01234567890123456789'); -echo $stream; // 0123456789 -``` - - -## FnStream - -`GuzzleHttp\Psr7\FnStream` - -Compose stream implementations based on a hash of functions. - -Allows for easy testing and extension of a provided stream without needing -to create a concrete class for a simple extension point. - -```php - -use GuzzleHttp\Psr7; - -$stream = Psr7\Utils::streamFor('hi'); -$fnStream = Psr7\FnStream::decorate($stream, [ - 'rewind' => function () use ($stream) { - echo 'About to rewind - '; - $stream->rewind(); - echo 'rewound!'; - } -]); - -$fnStream->rewind(); -// Outputs: About to rewind - rewound! -``` - - -## InflateStream - -`GuzzleHttp\Psr7\InflateStream` - -Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content. - -This stream decorator converts the provided stream to a PHP stream resource, -then appends the zlib.inflate filter. The stream is then converted back -to a Guzzle stream resource to be used as a Guzzle stream. - - -## LazyOpenStream - -`GuzzleHttp\Psr7\LazyOpenStream` - -Lazily reads or writes to a file that is opened only after an IO operation -take place on the stream. - -```php -use GuzzleHttp\Psr7; - -$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); -// The file has not yet been opened... - -echo $stream->read(10); -// The file is opened and read from only when needed. -``` - - -## LimitStream - -`GuzzleHttp\Psr7\LimitStream` - -LimitStream can be used to read a subset or slice of an existing stream object. -This can be useful for breaking a large file into smaller pieces to be sent in -chunks (e.g. Amazon S3's multipart upload API). - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+')); -echo $original->getSize(); -// >>> 1048576 - -// Limit the size of the body to 1024 bytes and start reading from byte 2048 -$stream = new Psr7\LimitStream($original, 1024, 2048); -echo $stream->getSize(); -// >>> 1024 -echo $stream->tell(); -// >>> 0 -``` - - -## MultipartStream - -`GuzzleHttp\Psr7\MultipartStream` - -Stream that when read returns bytes for a streaming multipart or -multipart/form-data stream. - - -## NoSeekStream - -`GuzzleHttp\Psr7\NoSeekStream` - -NoSeekStream wraps a stream and does not allow seeking. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor('foo'); -$noSeek = new Psr7\NoSeekStream($original); - -echo $noSeek->read(3); -// foo -var_export($noSeek->isSeekable()); -// false -$noSeek->seek(0); -var_export($noSeek->read(3)); -// NULL -``` - - -## PumpStream - -`GuzzleHttp\Psr7\PumpStream` - -Provides a read only stream that pumps data from a PHP callable. - -When invoking the provided callable, the PumpStream will pass the amount of -data requested to read to the callable. The callable can choose to ignore -this value and return fewer or more bytes than requested. Any extra data -returned by the provided callable is buffered internally until drained using -the read() function of the PumpStream. The provided callable MUST return -false when there is no more data to read. - - -## Implementing stream decorators - -Creating a stream decorator is very easy thanks to the -`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that -implement `Psr\Http\Message\StreamInterface` by proxying to an underlying -stream. Just `use` the `StreamDecoratorTrait` and implement your custom -methods. - -For example, let's say we wanted to call a specific function each time the last -byte is read from a stream. This could be implemented by overriding the -`read()` method. - -```php -use Psr\Http\Message\StreamInterface; -use GuzzleHttp\Psr7\StreamDecoratorTrait; - -class EofCallbackStream implements StreamInterface -{ - use StreamDecoratorTrait; - - private $callback; - - public function __construct(StreamInterface $stream, callable $cb) - { - $this->stream = $stream; - $this->callback = $cb; - } - - public function read($length) - { - $result = $this->stream->read($length); - - // Invoke the callback when EOF is hit. - if ($this->eof()) { - call_user_func($this->callback); - } - - return $result; - } -} -``` - -This decorator could be added to any existing stream and used like so: - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor('foo'); - -$eofStream = new EofCallbackStream($original, function () { - echo 'EOF!'; -}); - -$eofStream->read(2); -$eofStream->read(1); -// echoes "EOF!" -$eofStream->seek(0); -$eofStream->read(3); -// echoes "EOF!" -``` - - -## PHP StreamWrapper - -You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a -PSR-7 stream as a PHP stream resource. - -Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP -stream from a PSR-7 stream. - -```php -use GuzzleHttp\Psr7\StreamWrapper; - -$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!'); -$resource = StreamWrapper::getResource($stream); -echo fread($resource, 6); // outputs hello! -``` - - -# Static API - -There are various static methods available under the `GuzzleHttp\Psr7` namespace. - - -## `GuzzleHttp\Psr7\Message::toString` - -`public static function toString(MessageInterface $message): string` - -Returns the string representation of an HTTP message. - -```php -$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); -echo GuzzleHttp\Psr7\Message::toString($request); -``` - - -## `GuzzleHttp\Psr7\Message::bodySummary` - -`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null` - -Get a short summary of the message body. - -Will return `null` if the response is not printable. - - -## `GuzzleHttp\Psr7\Message::rewindBody` - -`public static function rewindBody(MessageInterface $message): void` - -Attempts to rewind a message body and throws an exception on failure. - -The body of the message will only be rewound if a call to `tell()` -returns a value other than `0`. - - -## `GuzzleHttp\Psr7\Message::parseMessage` - -`public static function parseMessage(string $message): array` - -Parses an HTTP message into an associative array. - -The array contains the "start-line" key containing the start line of -the message, "headers" key containing an associative array of header -array values, and a "body" key containing the body of the message. - - -## `GuzzleHttp\Psr7\Message::parseRequestUri` - -`public static function parseRequestUri(string $path, array $headers): string` - -Constructs a URI for an HTTP request message. - - -## `GuzzleHttp\Psr7\Message::parseRequest` - -`public static function parseRequest(string $message): Request` - -Parses a request message string into a request object. - - -## `GuzzleHttp\Psr7\Message::parseResponse` - -`public static function parseResponse(string $message): Response` - -Parses a response message string into a response object. - - -## `GuzzleHttp\Psr7\Header::parse` - -`public static function parse(string|array $header): array` - -Parse an array of header values containing ";" separated data into an -array of associative arrays representing the header key value pair data -of the header. When a parameter does not contain a value, but just -contains a key, this function will inject a key with a '' string value. - - -## `GuzzleHttp\Psr7\Header::splitList` - -`public static function splitList(string|string[] $header): string[]` - -Splits a HTTP header defined to contain a comma-separated list into -each individual value: - -``` -$knownEtags = Header::splitList($request->getHeader('if-none-match')); -``` - -Example headers include `accept`, `cache-control` and `if-none-match`. - - -## `GuzzleHttp\Psr7\Header::normalize` (deprecated) - -`public static function normalize(string|array $header): array` - -`Header::normalize()` is deprecated in favor of [`Header::splitList()`](README.md#guzzlehttppsr7headersplitlist) -which performs the same operation with a cleaned up API and improved -documentation. - -Converts an array of header values that may contain comma separated -headers into an array of headers with no comma separated values. - - -## `GuzzleHttp\Psr7\Query::parse` - -`public static function parse(string $str, int|bool $urlEncoding = true): array` - -Parse a query string into an associative array. - -If multiple values are found for the same key, the value of that key -value pair will become an array. This function does not parse nested -PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` -will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`. - - -## `GuzzleHttp\Psr7\Query::build` - -`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string` - -Build a query string from an array of key value pairs. - -This function can use the return value of `parse()` to build a query -string. This function does not modify the provided keys when an array is -encountered (like `http_build_query()` would). - - -## `GuzzleHttp\Psr7\Utils::caselessRemove` - -`public static function caselessRemove(iterable $keys, $keys, array $data): array` - -Remove the items given by the keys, case insensitively from the data. - - -## `GuzzleHttp\Psr7\Utils::copyToStream` - -`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void` - -Copy the contents of a stream into another stream until the given number -of bytes have been read. - - -## `GuzzleHttp\Psr7\Utils::copyToString` - -`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string` - -Copy the contents of a stream into a string until the given number of -bytes have been read. - - -## `GuzzleHttp\Psr7\Utils::hash` - -`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string` - -Calculate a hash of a stream. - -This method reads the entire stream to calculate a rolling hash, based on -PHP's `hash_init` functions. - - -## `GuzzleHttp\Psr7\Utils::modifyRequest` - -`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface` - -Clone and modify a request with the given changes. - -This method is useful for reducing the number of clones needed to mutate -a message. - -- method: (string) Changes the HTTP method. -- set_headers: (array) Sets the given headers. -- remove_headers: (array) Remove the given headers. -- body: (mixed) Sets the given body. -- uri: (UriInterface) Set the URI. -- query: (string) Set the query string value of the URI. -- version: (string) Set the protocol version. - - -## `GuzzleHttp\Psr7\Utils::readLine` - -`public static function readLine(StreamInterface $stream, int $maxLength = null): string` - -Read a line from the stream up to the maximum allowed buffer length. - - -## `GuzzleHttp\Psr7\Utils::streamFor` - -`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface` - -Create a new stream based on the input type. - -Options is an associative array that can contain the following keys: - -- metadata: Array of custom metadata. -- size: Size of the stream. - -This method accepts the following `$resource` types: - -- `Psr\Http\Message\StreamInterface`: Returns the value as-is. -- `string`: Creates a stream object that uses the given string as the contents. -- `resource`: Creates a stream object that wraps the given PHP stream resource. -- `Iterator`: If the provided value implements `Iterator`, then a read-only - stream object will be created that wraps the given iterable. Each time the - stream is read from, data from the iterator will fill a buffer and will be - continuously called until the buffer is equal to the requested read size. - Subsequent read calls will first read from the buffer and then call `next` - on the underlying iterator until it is exhausted. -- `object` with `__toString()`: If the object has the `__toString()` method, - the object will be cast to a string and then a stream will be returned that - uses the string value. -- `NULL`: When `null` is passed, an empty stream object is returned. -- `callable` When a callable is passed, a read-only stream object will be - created that invokes the given callable. The callable is invoked with the - number of suggested bytes to read. The callable can return any number of - bytes, but MUST return `false` when there is no more data to return. The - stream object that wraps the callable will invoke the callable until the - number of requested bytes are available. Any additional bytes will be - buffered and used in subsequent reads. - -```php -$stream = GuzzleHttp\Psr7\Utils::streamFor('foo'); -$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r')); - -$generator = function ($bytes) { - for ($i = 0; $i < $bytes; $i++) { - yield ' '; - } -} - -$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100)); -``` - - -## `GuzzleHttp\Psr7\Utils::tryFopen` - -`public static function tryFopen(string $filename, string $mode): resource` - -Safely opens a PHP stream resource using a filename. - -When fopen fails, PHP normally raises a warning. This function adds an -error handler that checks for errors and throws an exception instead. - - -## `GuzzleHttp\Psr7\Utils::tryGetContents` - -`public static function tryGetContents(resource $stream): string` - -Safely gets the contents of a given stream. - -When stream_get_contents fails, PHP normally raises a warning. This -function adds an error handler that checks for errors and throws an -exception instead. - - -## `GuzzleHttp\Psr7\Utils::uriFor` - -`public static function uriFor(string|UriInterface $uri): UriInterface` - -Returns a UriInterface for the given value. - -This function accepts a string or UriInterface and returns a -UriInterface for the given value. If the value is already a -UriInterface, it is returned as-is. - - -## `GuzzleHttp\Psr7\MimeType::fromFilename` - -`public static function fromFilename(string $filename): string|null` - -Determines the mimetype of a file by looking at its extension. - - -## `GuzzleHttp\Psr7\MimeType::fromExtension` - -`public static function fromExtension(string $extension): string|null` - -Maps a file extensions to a mimetype. - - -## Upgrading from Function API - -The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0. A migration table has been provided here for your convenience: - -| Original Function | Replacement Method | -|----------------|----------------| -| `str` | `Message::toString` | -| `uri_for` | `Utils::uriFor` | -| `stream_for` | `Utils::streamFor` | -| `parse_header` | `Header::parse` | -| `normalize_header` | `Header::normalize` | -| `modify_request` | `Utils::modifyRequest` | -| `rewind_body` | `Message::rewindBody` | -| `try_fopen` | `Utils::tryFopen` | -| `copy_to_string` | `Utils::copyToString` | -| `copy_to_stream` | `Utils::copyToStream` | -| `hash` | `Utils::hash` | -| `readline` | `Utils::readLine` | -| `parse_request` | `Message::parseRequest` | -| `parse_response` | `Message::parseResponse` | -| `parse_query` | `Query::parse` | -| `build_query` | `Query::build` | -| `mimetype_from_filename` | `MimeType::fromFilename` | -| `mimetype_from_extension` | `MimeType::fromExtension` | -| `_parse_message` | `Message::parseMessage` | -| `_parse_request_uri` | `Message::parseRequestUri` | -| `get_message_body_summary` | `Message::bodySummary` | -| `_caseless_remove` | `Utils::caselessRemove` | - - -# Additional URI Methods - -Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, -this library also provides additional functionality when working with URIs as static methods. - -## URI Types - -An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. -An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, -the base URI. Relative references can be divided into several forms according to -[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): - -- network-path references, e.g. `//example.com/path` -- absolute-path references, e.g. `/path` -- relative-path references, e.g. `subpath` - -The following methods can be used to identify the type of the URI. - -### `GuzzleHttp\Psr7\Uri::isAbsolute` - -`public static function isAbsolute(UriInterface $uri): bool` - -Whether the URI is absolute, i.e. it has a scheme. - -### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` - -`public static function isNetworkPathReference(UriInterface $uri): bool` - -Whether the URI is a network-path reference. A relative reference that begins with two slash characters is -termed an network-path reference. - -### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` - -`public static function isAbsolutePathReference(UriInterface $uri): bool` - -Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is -termed an absolute-path reference. - -### `GuzzleHttp\Psr7\Uri::isRelativePathReference` - -`public static function isRelativePathReference(UriInterface $uri): bool` - -Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is -termed a relative-path reference. - -### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` - -`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` - -Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its -fragment component, identical to the base URI. When no base URI is given, only an empty URI reference -(apart from its fragment) is considered a same-document reference. - -## URI Components - -Additional methods to work with URI components. - -### `GuzzleHttp\Psr7\Uri::isDefaultPort` - -`public static function isDefaultPort(UriInterface $uri): bool` - -Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null -or the standard port. This method can be used independently of the implementation. - -### `GuzzleHttp\Psr7\Uri::composeComponents` - -`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` - -Composes a URI reference string from its various components according to -[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called -manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. - -### `GuzzleHttp\Psr7\Uri::fromParts` - -`public static function fromParts(array $parts): UriInterface` - -Creates a URI from a hash of [`parse_url`](https://www.php.net/manual/en/function.parse-url.php) components. - - -### `GuzzleHttp\Psr7\Uri::withQueryValue` - -`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` - -Creates a new URI with a specific query string value. Any existing query string values that exactly match the -provided key are removed and replaced with the given key value pair. A value of null will set the query string -key without a value, e.g. "key" instead of "key=value". - -### `GuzzleHttp\Psr7\Uri::withQueryValues` - -`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` - -Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an -associative array of key => value. - -### `GuzzleHttp\Psr7\Uri::withoutQueryValue` - -`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` - -Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the -provided key are removed. - -## Cross-Origin Detection - -`GuzzleHttp\Psr7\UriComparator` provides methods to determine if a modified URL should be considered cross-origin. - -### `GuzzleHttp\Psr7\UriComparator::isCrossOrigin` - -`public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool` - -Determines if a modified URL should be considered cross-origin with respect to an original URL. - -## Reference Resolution - -`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according -to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers -do when resolving a link in a website based on the current request URI. - -### `GuzzleHttp\Psr7\UriResolver::resolve` - -`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` - -Converts the relative URI into a new URI that is resolved against the base URI. - -### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` - -`public static function removeDotSegments(string $path): string` - -Removes dot segments from a path and returns the new path according to -[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). - -### `GuzzleHttp\Psr7\UriResolver::relativize` - -`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` - -Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): - -```php -(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) -``` - -One use-case is to use the current request URI as base URI and then generate relative links in your documents -to reduce the document size or offer self-contained downloadable document archives. - -```php -$base = new Uri('http://example.com/a/b/'); -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. -echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. -``` - -## Normalization and Comparison - -`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to -[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). - -### `GuzzleHttp\Psr7\UriNormalizer::normalize` - -`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` - -Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. -This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask -of normalizations to apply. The following normalizations are available: - -- `UriNormalizer::PRESERVING_NORMALIZATIONS` - - Default normalizations which only include the ones that preserve semantics. - -- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` - - All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. - - Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` - -- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` - - Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of - ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should - not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved - characters by URI normalizers. - - Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` - -- `UriNormalizer::CONVERT_EMPTY_PATH` - - Converts the empty path to "/" for http and https URIs. - - Example: `http://example.org` → `http://example.org/` - -- `UriNormalizer::REMOVE_DEFAULT_HOST` - - Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host - "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to - RFC 3986. - - Example: `file://localhost/myfile` → `file:///myfile` - -- `UriNormalizer::REMOVE_DEFAULT_PORT` - - Removes the default port of the given URI scheme from the URI. - - Example: `http://example.org:80/` → `http://example.org/` - -- `UriNormalizer::REMOVE_DOT_SEGMENTS` - - Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would - change the semantics of the URI reference. - - Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` - -- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` - - Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes - and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization - may change the semantics. Encoded slashes (%2F) are not removed. - - Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` - -- `UriNormalizer::SORT_QUERY_PARAMETERS` - - Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be - significant (this is not defined by the standard). So this normalization is not safe and may change the semantics - of the URI. - - Example: `?lang=en&article=fred` → `?article=fred&lang=en` - -### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` - -`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` - -Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given -`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. -This of course assumes they will be resolved against the same base URI. If this is not the case, determination of -equivalence or difference of relative references does not mean anything. - - -## Version Guidance - -| Version | Status | PHP Version | -|---------|----------------|------------------| -| 1.x | Security fixes | >=5.4,<8.1 | -| 2.x | Latest | ^7.2.5 \|\| ^8.0 | - - -## Security - -If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. - - -## License - -Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. - - -## For Enterprise - -Available as part of the Tidelift Subscription - -The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/guzzlehttp/psr7/composer.json b/guzzlehttp/psr7/composer.json deleted file mode 100644 index cd91040cf..000000000 --- a/guzzlehttp/psr7/composer.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "guzzlehttp/psr7", - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "request", - "response", - "message", - "stream", - "http", - "uri", - "url", - "psr-7" - ], - "license": "MIT", - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^3.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\Psr7\\": "tests/" - } - }, - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "config": { - "allow-plugins": { - "bamarni/composer-bin-plugin": true - }, - "preferred-install": "dist", - "sort-packages": true - } -} diff --git a/guzzlehttp/uri-template/CHANGELOG.md b/guzzlehttp/uri-template/CHANGELOG.md deleted file mode 100644 index 2cf3dfb5a..000000000 --- a/guzzlehttp/uri-template/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Changelog - -All notable changes to `uri-template` will be documented in this file. - -Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. - -## v0.2.0 - 2020-07-21 - -### Added -- Support PHP 7.1 and 8.0 - -### Changed -- Renamed `GuzzleHttp\Utility\` to `GuzzleHttp\UriTemplate\` - -### Fixed -- Delegate RFC 3986 query string encoding to PHP -- Fixed some bugs when parts ofs values are not strings - -## v0.1.1 - 2020-06-30 - -### Fixed -- Fixed an error due to strict_types [d47d1b0a8e78a3fac1cd0f69d675fc9e06771ac8](https://github.com/guzzle/uri-template/commit/d47d1b0a8e78a3fac1cd0f69d675fc9e06771ac8) - -## v0.1.0 - 2020-06-30 - -### Added -- Moved the `UriTemplate` class in this package diff --git a/guzzlehttp/uri-template/README.md b/guzzlehttp/uri-template/README.md deleted file mode 100644 index 9902449be..000000000 --- a/guzzlehttp/uri-template/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# uri-template - -**THIS PACKAGE IS STILL UNDER DEVELOPMENT** if you use it make sure you lock into a specific version. - -## Install - -Via Composer - -``` bash -$ composer require guzzlehttp/uri-template -``` - -## Change log - -Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. - -## Testing - -``` bash -$ make test -``` - -## Security - -If you discover any security related issues, please email security@guzzlephp.org instead of using the issue tracker. - -## License - -The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/guzzlehttp/uri-template/composer.json b/guzzlehttp/uri-template/composer.json deleted file mode 100644 index 335a4b224..000000000 --- a/guzzlehttp/uri-template/composer.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "guzzlehttp/uri-template", - "type": "library", - "description": "A polyfill class for uri_template of PHP", - "keywords": [ - "guzzlehttp", - "uri-template" - ], - "homepage": "https://github.com/guzzlehttp/uri-template", - "license": "MIT", - "authors": [ - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos", - "role": "Developer" - } - ], - "repositories": [ - { - "type": "package", - "package": { - "name": "uri-template/tests", - "version": "1.0.0", - "dist": { - "url": "https://github.com/uri-templates/uritemplate-test/archive/520fdd8b0f78779d12178c357a986e0e727f4bd0.zip", - "type": "zip" - } - } - } - ], - "require": { - "php" : "^7.1 || ^8.0", - "symfony/polyfill-php80": "^1.17" - }, - "require-dev": { - "phpunit/phpunit" : "^7.5.15 || ^8.5 || ^9.3", - "uri-template/tests": "1.0.0" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\UriTemplate\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\UriTemplate\\Tests\\": "tests" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "config": { - "preferred-install": "dist", - "sort-packages": true - }, - "minimum-stability": "dev", - "prefer-stable": true -} diff --git a/icewind/searchdav/.gitignore b/icewind/searchdav/.gitignore deleted file mode 100644 index 3ca03c7d4..000000000 --- a/icewind/searchdav/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -composer.lock -vendor -coverage.xml -.phpunit.result.cache -*.cache diff --git a/icewind/searchdav/psalm.xml b/icewind/searchdav/psalm.xml deleted file mode 100644 index 30258a709..000000000 --- a/icewind/searchdav/psalm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/icewind/streams/.gitignore b/icewind/streams/.gitignore deleted file mode 100644 index a8fa5d4a9..000000000 --- a/icewind/streams/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.idea -vendor -composer.lock -build -example.php -*.cache diff --git a/justinrainbow/json-schema/.php_cs.dist b/justinrainbow/json-schema/.php_cs.dist deleted file mode 100644 index 5a7a578ef..000000000 --- a/justinrainbow/json-schema/.php_cs.dist +++ /dev/null @@ -1,33 +0,0 @@ -in(__DIR__); - -/* Based on ^2.1 of php-cs-fixer */ -$config - ->setRules(array( - // default - '@PSR2' => true, - '@Symfony' => true, - // additionally - 'array_syntax' => array('syntax' => 'long'), - 'binary_operator_spaces' => false, - 'concat_space' => array('spacing' => 'one'), - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_imports' => true, - 'phpdoc_no_package' => false, - 'phpdoc_order' => true, - 'phpdoc_summary' => false, - 'pre_increment' => false, - 'increment_style' => false, - 'simplified_null_return' => false, - 'trailing_comma_in_multiline_array' => false, - 'yoda_style' => false, - 'phpdoc_types_order' => array('null_adjustment' => 'none', 'sort_algorithm' => 'none'), - )) - ->setFinder($finder) -; - -return $config; diff --git a/justinrainbow/json-schema/README.md b/justinrainbow/json-schema/README.md deleted file mode 100644 index 8df14db79..000000000 --- a/justinrainbow/json-schema/README.md +++ /dev/null @@ -1,206 +0,0 @@ -# JSON Schema for PHP - -[![Build Status](https://travis-ci.org/justinrainbow/json-schema.svg?branch=master)](https://travis-ci.org/justinrainbow/json-schema) -[![Latest Stable Version](https://poser.pugx.org/justinrainbow/json-schema/v/stable.png)](https://packagist.org/packages/justinrainbow/json-schema) -[![Total Downloads](https://poser.pugx.org/justinrainbow/json-schema/downloads.png)](https://packagist.org/packages/justinrainbow/json-schema) - -A PHP Implementation for validating `JSON` Structures against a given `Schema`. - -See [json-schema](http://json-schema.org/) for more details. - -## Installation - -### Library - -```bash -git clone https://github.com/justinrainbow/json-schema.git -``` - -### Composer - -[Install PHP Composer](https://getcomposer.org/doc/00-intro.md) - -```bash -composer require justinrainbow/json-schema -``` - -## Usage - -```php -validate($data, (object)['$ref' => 'file://' . realpath('schema.json')]); - -if ($validator->isValid()) { - echo "The supplied JSON validates against the schema.\n"; -} else { - echo "JSON does not validate. Violations:\n"; - foreach ($validator->getErrors() as $error) { - echo sprintf("[%s] %s\n", $error['property'], $error['message']); - } -} -``` - -### Type coercion - -If you're validating data passed to your application via HTTP, you can cast strings and booleans to -the expected types defined by your schema: - -```php -"true", - 'refundAmount'=>"17" -]; - -$validator->validate( - $request, (object) [ - "type"=>"object", - "properties"=>(object)[ - "processRefund"=>(object)[ - "type"=>"boolean" - ], - "refundAmount"=>(object)[ - "type"=>"number" - ] - ] - ], - Constraint::CHECK_MODE_COERCE_TYPES -); // validates! - -is_bool($request->processRefund); // true -is_int($request->refundAmount); // true -``` - -A shorthand method is also available: -```PHP -$validator->coerce($request, $schema); -// equivalent to $validator->validate($data, $schema, Constraint::CHECK_MODE_COERCE_TYPES); -``` - -### Default values - -If your schema contains default values, you can have these automatically applied during validation: - -```php -17 -]; - -$validator = new Validator(); - -$validator->validate( - $request, - (object)[ - "type"=>"object", - "properties"=>(object)[ - "processRefund"=>(object)[ - "type"=>"boolean", - "default"=>true - ] - ] - ], - Constraint::CHECK_MODE_APPLY_DEFAULTS -); //validates, and sets defaults for missing properties - -is_bool($request->processRefund); // true -$request->processRefund; // true -``` - -### With inline references - -```php -addSchema('file://mySchema', $jsonSchemaObject); - -// Provide $schemaStorage to the Validator so that references can be resolved during validation -$jsonValidator = new Validator( new Factory($schemaStorage)); - -// JSON must be decoded before it can be validated -$jsonToValidateObject = json_decode('{"data":123}'); - -// Do validation (use isValid() and getErrors() to check the result) -$jsonValidator->validate($jsonToValidateObject, $jsonSchemaObject); -``` - -### Configuration Options -A number of flags are available to alter the behavior of the validator. These can be passed as the -third argument to `Validator::validate()`, or can be provided as the third argument to -`Factory::__construct()` if you wish to persist them across multiple `validate()` calls. - -| Flag | Description | -|------|-------------| -| `Constraint::CHECK_MODE_NORMAL` | Validate in 'normal' mode - this is the default | -| `Constraint::CHECK_MODE_TYPE_CAST` | Enable fuzzy type checking for associative arrays and objects | -| `Constraint::CHECK_MODE_COERCE_TYPES` | Convert data types to match the schema where possible | -| `Constraint::CHECK_MODE_APPLY_DEFAULTS` | Apply default values from the schema if not set | -| `Constraint::CHECK_MODE_ONLY_REQUIRED_DEFAULTS` | When applying defaults, only set values that are required | -| `Constraint::CHECK_MODE_EXCEPTIONS` | Throw an exception immediately if validation fails | -| `Constraint::CHECK_MODE_DISABLE_FORMAT` | Do not validate "format" constraints | -| `Constraint::CHECK_MODE_VALIDATE_SCHEMA` | Validate the schema as well as the provided document | - -Please note that using `Constraint::CHECK_MODE_COERCE_TYPES` or `Constraint::CHECK_MODE_APPLY_DEFAULTS` -will modify your original data. - -## Running the tests - -```bash -composer test # run all unit tests -composer testOnly TestClass # run specific unit test class -composer testOnly TestClass::testMethod # run specific unit test method -composer style-check # check code style for errors -composer style-fix # automatically fix code style errors -``` diff --git a/justinrainbow/json-schema/composer.json b/justinrainbow/json-schema/composer.json deleted file mode 100644 index fcacd40c3..000000000 --- a/justinrainbow/json-schema/composer.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "justinrainbow/json-schema", - "type": "library", - "description": "A library to validate a json schema.", - "keywords": [ - "json", - "schema" - ], - "homepage": "https://github.com/justinrainbow/json-schema", - "license": "MIT", - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "autoload-dev": { - "psr-4": { - "JsonSchema\\Tests\\": "tests/" - } - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "json-schema/json-schema-test-suite", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/json-schema/JSON-Schema-Test-Suite", - "reference": "1.2.0" - } - } - } - ], - "bin": [ - "bin/validate-json" - ], - "scripts": { - "coverage": "phpunit --coverage-text", - "style-check": "php-cs-fixer fix --dry-run --verbose --diff", - "style-fix": "php-cs-fixer fix --verbose", - "test": "phpunit", - "testOnly": "phpunit --colors --filter" - } -} diff --git a/justinrainbow/json-schema/phpunit.xml.dist b/justinrainbow/json-schema/phpunit.xml.dist deleted file mode 100644 index 0136d8edc..000000000 --- a/justinrainbow/json-schema/phpunit.xml.dist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - tests - - - - - - ./src/JsonSchema/ - - - diff --git a/laravel/serializable-closure/README.md b/laravel/serializable-closure/README.md deleted file mode 100644 index a9c25135c..000000000 --- a/laravel/serializable-closure/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Serializable Closure - - - Build Status - - - Total Downloads - - - Latest Stable Version - - - License - - -## Introduction - -> This project is a fork of the excellent [opis/closure: 3.x](https://github.com/opis/closure) package. At Laravel, we decided to fork this package as the upcoming version [4.x](https://github.com/opis/closure) is a complete rewrite on top of the [FFI extension](https://www.php.net/manual/en/book.ffi.php). As Laravel is a web framework, and FFI is not enabled by default in web requests, this fork allows us to keep using the `3.x` series while adding support for new PHP versions. - -Laravel Serializable Closure provides an easy and secure way to **serialize closures in PHP**. - -## Official Documentation - -### Installation - -> **Requires [PHP 7.4+](https://php.net/releases/)** - -First, install Laravel Serializable Closure via the [Composer](https://getcomposer.org/) package manager: - -```bash -composer require laravel/serializable-closure -``` - -### Usage - -You may serialize a closure this way: - -```php -use Laravel\SerializableClosure\SerializableClosure; - -$closure = fn () => 'james'; - -// Recommended -SerializableClosure::setSecretKey('secret'); - -$serialized = serialize(new SerializableClosure($closure)); -$closure = unserialize($serialized)->getClosure(); - -echo $closure(); // james; -``` - -### Caveats - -1. Creating **anonymous classes** within closures is not supported. -2. Using attributes within closures is not supported. - -## Contributing - -Thank you for considering contributing to Serializable Closure! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Code of Conduct - -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - -## Security Vulnerabilities - -Please review [our security policy](https://github.com/laravel/serializable-closure/security/policy) on how to report security vulnerabilities. - -## License - -Serializable Closure is open-sourced software licensed under the [MIT license](LICENSE.md). diff --git a/laravel/serializable-closure/composer.json b/laravel/serializable-closure/composer.json deleted file mode 100644 index 5e8fbbc82..000000000 --- a/laravel/serializable-closure/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "laravel/serializable-closure", - "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", - "keywords": ["laravel", "Serializable", "closure"], - "license": "MIT", - "support": { - "issues": "https://github.com/laravel/serializable-closure/issues", - "source": "https://github.com/laravel/serializable-closure" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - }, - { - "name": "Nuno Maduro", - "email": "nuno@laravel.com" - } - ], - "require": { - "php": "^7.3|^8.0" - }, - "require-dev": { - "pestphp/pest": "^1.18", - "phpstan/phpstan": "^0.12.98", - "symfony/var-dumper": "^5.3" - }, - "autoload": { - "psr-4": { - "Laravel\\SerializableClosure\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "pestphp/pest-plugin": true - } - }, - "minimum-stability": "dev", - "prefer-stable": true -} diff --git a/league/uri-interfaces/composer.json b/league/uri-interfaces/composer.json deleted file mode 100644 index 21dc27c54..000000000 --- a/league/uri-interfaces/composer.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "league/uri-interfaces", - "description" : "Common interface for URI representation", - "keywords": [ - "url", - "uri", - "rfc3986", - "rfc3987" - ], - "license": "MIT", - "homepage": "http://github.com/thephpleague/uri-interfaces", - "authors": [ - { - "name" : "Ignace Nyamagana Butera", - "email" : "nyamsprod@gmail.com", - "homepage" : "https://nyamsprod.com" - } - ], - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/nyamsprod" - } - ], - "require": { - "php" : "^7.1 || ^8.0", - "ext-json": "*" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12" - }, - "autoload": { - "psr-4": { - "League\\Uri\\": "src/" - } - }, - "scripts": { - "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes --ansi", - "phpstan": "phpstan analyse -l max -c phpstan.src.neon src --ansi", - "test": ["@phpcs", "@phpstan"] - }, - "scripts-descriptions": { - "phpcs":"Runs coding style test suite", - "phpstan":"Runs php static code analysis compliance test", - "test": "Runs all the test suite" - }, - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - } -} diff --git a/league/uri/composer.json b/league/uri/composer.json deleted file mode 100644 index 50cfedaab..000000000 --- a/league/uri/composer.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "league/uri", - "type": "library", - "description" : "URI manipulation library", - "keywords": [ - "url", - "uri", - "rfc3986", - "rfc3987", - "rfc6570", - "psr-7", - "parse_url", - "http", - "https", - "ws", - "ftp", - "data-uri", - "file-uri", - "middleware", - "parse_str", - "query-string", - "querystring", - "hostname", - "uri-template" - ], - "license": "MIT", - "homepage": "http://uri.thephpleague.com", - "authors": [ - { - "name" : "Ignace Nyamagana Butera", - "email" : "nyamsprod@gmail.com", - "homepage" : "https://nyamsprod.com" - } - ], - "support": { - "forum": "https://thephpleague.slack.com", - "docs": "https://uri.thephpleague.com", - "issues": "https://github.com/thephpleague/uri/issues" - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/nyamsprod" - } - ], - "require": { - "php": ">=7.2", - "ext-json": "*", - "psr/http-message": "^1.0", - "league/uri-interfaces": "^2.1" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", - "phpunit/phpunit" : "^8.0 || ^9.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "psr/http-factory": "^1.0" - }, - "autoload": { - "psr-4": { - "League\\Uri\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "LeagueTest\\Uri\\": "tests" - } - }, - "conflict": { - "league/uri-schemes": "^1.0" - }, - "scripts": { - "phpcs": "php-cs-fixer fix -v --diff --dry-run --allow-risky=yes --ansi", - "phpstan-src": "phpstan analyse -l max -c phpstan.src.neon src --ansi", - "phpstan-tests": "phpstan analyse -l max -c phpstan.tests.neon tests --ansi", - "phpstan": [ - "@phpstan-src", - "@phpstan-tests" - ], - "phpunit": "phpunit --coverage-text", - "test": [ - "@phpcs", - "@phpstan", - "@phpunit" - ] - }, - "scripts-descriptions": { - "phpcs": "Runs coding style test suite", - "phpstan": "Runs complete codebase static analysis", - "phpstan-src": "Runs source code static analysis", - "phpstan-test": "Runs test suite static analysis", - "phpunit": "Runs unit and functional testing", - "test": "Runs full test suite" - }, - "suggest": { - "league/uri-components" : "Needed to easily manipulate URI objects", - "ext-intl" : "Needed to improve host validation", - "ext-fileinfo": "Needed to create Data URI from a filepath", - "psr/http-factory": "Needed to use the URI factory" - }, - "extra": { - "branch-alias": { - "dev-master": "6.x-dev" - } - }, - "config": { - "sort-packages": true - } -} diff --git a/microsoft/azure-storage-blob/README.md b/microsoft/azure-storage-blob/README.md deleted file mode 100644 index 2bd850f8d..000000000 --- a/microsoft/azure-storage-blob/README.md +++ /dev/null @@ -1,174 +0,0 @@ -# Microsoft Azure Storage Blob PHP Client Library - -This project provides a PHP client library that makes it easy to access Microsoft Azure Storage blob services. For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](https://www.windowsazure.com/en-us/develop/php/). - -[![Latest Stable Version](https://poser.pugx.org/microsoft/azure-storage-blob/v/stable)](https://packagist.org/packages/microsoft/azure-storage-blob) - -> **Note** -> -> * This [repository](https://github.com/azure/azure-storage-blob-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. -> * If you are looking for the Service Bus, Service Runtime, Service Management or Media Services libraries, please visit https://github.com/Azure/azure-sdk-for-php. -> * If you need big file (larger than 2GB) or 64-bit integer support, please install PHP 7 64-bit version. - -# Features - -* Blobs - * create, list, and delete containers, work with container metadata and permissions, list blobs in container - * create block and page blobs (from a stream or a string), work with blob blocks and pages, delete blobs - * work with blob properties, metadata, leases, snapshot a blob - -Please check details on [API reference documents](https://azure.github.io/azure-storage-php). - -# Getting Started -## Minimum Requirements - -* PHP 5.6 or above -* See [composer.json](composer.json) for dependencies -* Required extension for PHP: - * php_fileinfo.dll - * php_mbstring.dll - * php_openssl.dll - * php_xsl.dll - -* Recommended extension for PHP: - * php_curl.dll - -## Download Source Code - -To get the source code from GitHub, type - -``` -git clone https://github.com/Azure/azure-storage-php.git -cd ./azure-storage-php -``` - -## Install via Composer - -1. Create a file named **composer.json** in the root of your project and add the following code to it: -```json -{ - "require": { - "microsoft/azure-storage-blob": "*" - } -} -``` -2. Download **[composer.phar](https://getcomposer.org/composer.phar)** in your project root. - -3. Open a command prompt and execute this in your project root - -``` -php composer.phar install -``` - -## Usage - -There are four basic steps that have to be performed before you can make a call to any Microsoft Azure Storage API when using the libraries. - -* First, include the autoloader script: - -```php -require_once "vendor/autoload.php"; -``` - -* Include the namespaces you are going to use. - - To create any Microsoft Azure service client you need to use the rest proxy classes, such as **BlobRestProxy** class: - -```php -use MicrosoftAzure\Storage\Blob\BlobRestProxy; -``` - - To process exceptions you need: - -```php -use MicrosoftAzure\Storage\Common\ServiceException; -``` - -* To instantiate the service client you will also need a valid [connection string](https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/). The format is: - -``` -DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey] -``` - - or: - -``` -BlobEndpoint=[myBlobEndpoint];SharedAccessSignature=[sasToken] -``` - -* Instantiate a client object - a wrapper around the available calls for the given service. - -```php -$blobClient = BlobRestProxy::createBlobService($connectionString); -``` -Or for token authentication: -```php -$blobClient = BlobRestProxy::createBlobServiceWithTokenCredential($token, $connectionString); -``` -### Using Middlewares -To specify the middlewares, user have to create an array with middlewares -and put it in the `$requestOptions` with key 'middlewares'. The sequence of -the array will affect the sequence in which the middleware is invoked. The -`$requestOptions` can usually be set in the options of an API call, such as -`MicrosoftAzure\Storage\Blob\Models\ListBlobOptions`. - -The user can push the middleware into the array with key 'middlewares' in -services' `$_options` instead when creating them if the middleware is to be -applied to each of the API call for a rest proxy. These middlewares will always -be invoked after the middlewares in the `$requestOptions`. -e.g.: -```php -$blobClient = BlobRestProxy::createBlobService( - $connectionString, - $optionsWithMiddlewares -); -``` - -Each of the middleware should be either an instance of a sub-class that -implements `MicrosoftAzure\Storage\Common\Internal\IMiddleware`, or a -`callable` that follows the Guzzle middleware implementation convention. - -User can create self-defined middleware that inherits from `MicrosoftAzure\Storage\Common\Internal\Middlewares\MiddlewareBase`. - -### Using proxies -To use proxies during HTTP requests, set system variable `HTTP_PROXY` and the proxy will be used. - -## Troubleshooting -### Error: Unable to get local issuer certificate -cURL can't verify the validity of Microsoft certificate when trying to issue a request call to Azure Storage Services. You must configure cURL to use a certificate when issuing https requests by the following steps: - -1. Download the cacert.pem file from [cURL site](https://curl.haxx.se/docs/caextract.html). - -2. Then either: - * Open your php.ini file and add the following line: - ```ini - curl.cainfo = "" - ``` - OR - * Point to the cacert in the options when creating the Proxy. - ```php - $options["http"] = ["verify" => ""]; - BlobRestProxy::createBlobService($connectionString, $options); - ``` - -## Code samples - -You can find samples in the [samples folder](https://github.com/Azure/azure-storage-php/tree/master/samples) - - -# Migrate from [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) - -If you are using [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) to access Azure Storage Service, we highly recommend you to migrate to this SDK for faster issue resolution and quicker feature implementation. We are working on supporting the latest service features as well as improvement on existing APIs. - -For now, Microsoft Azure Storage PHP client libraries share almost the same interface as the storage blobs, tables, queues and files APIs in Azure SDK for PHP. However, there are some minor breaking changes need to be addressed during your migration. You can find the details in [BreakingChanges.md](BreakingChanges.md). - -# Need Help? - -Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow](https://go.microsoft.com/fwlink/?LinkId=234489) and [github issues](https://github.com/Azure/azure-storage-php/issues) if you have trouble with the provided code. - -# Contribute Code or Provide Feedback - -If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](https://opensource.microsoft.com/program/#program-contributing). -You can find more details for contributing in the [CONTRIBUTING.md](CONTRIBUTING.md). - -If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-storage-php/issues) section of the project. diff --git a/microsoft/azure-storage-blob/composer.json b/microsoft/azure-storage-blob/composer.json deleted file mode 100644 index 3dd32f25a..000000000 --- a/microsoft/azure-storage-blob/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "microsoft/azure-storage-blob", - "version": "1.5.4", - "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.", - "keywords": [ "php", "azure", "storage", "sdk", "blob" ], - "license": "MIT", - "authors": [ - { - "name": "Azure Storage PHP Client Library", - "email": "dmsh@microsoft.com" - } - ], - "require": { - "php": ">=5.6.0", - "microsoft/azure-storage-common": "~1.5" - }, - "autoload": { - "psr-4": { - "MicrosoftAzure\\Storage\\Blob\\": "src/Blob" - } - } -} \ No newline at end of file diff --git a/microsoft/azure-storage-common/README.md b/microsoft/azure-storage-common/README.md deleted file mode 100644 index 94bd1bb91..000000000 --- a/microsoft/azure-storage-common/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Microsoft Azure Storage Common PHP Client Library - -This project provides a set of common PHP code shared by Azure Storage Blob, Table, Queue and File PHP client libraries. For how to access Microsoft Azure Storage services (blobs, tables, queues and files), please refer to the [Microsoft Azure Storage PHP Client Library](https://github.com/Azure/azure-storage-php). For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](http://www.windowsazure.com/en-us/develop/php/). - -[![Latest Stable Version](https://poser.pugx.org/microsoft/azure-storage-common/v/stable)](https://packagist.org/packages/microsoft/azure-storage-common) - -> **Note** -> -> * This [repository](https://github.com/azure/azure-storage-common-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. diff --git a/microsoft/azure-storage-common/composer.json b/microsoft/azure-storage-common/composer.json deleted file mode 100644 index 84db042c6..000000000 --- a/microsoft/azure-storage-common/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "microsoft/azure-storage-common", - "version": "1.5.2", - "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", - "keywords": [ "php", "azure", "storage", "sdk", "common" ], - "license": "MIT", - "authors": [ - { - "name": "Azure Storage PHP Client Library", - "email": "dmsh@microsoft.com" - } - ], - "require": { - "php": ">=5.6.0", - "guzzlehttp/guzzle": "~6.0|^7.0" - }, - "autoload": { - "psr-4": { - "MicrosoftAzure\\Storage\\Common\\": "src/Common" - } - } -} diff --git a/mtdowling/jmespath.php/composer.json b/mtdowling/jmespath.php/composer.json deleted file mode 100644 index 6b7006836..000000000 --- a/mtdowling/jmespath.php/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "mtdowling/jmespath.php", - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": ["json", "jsonpath"], - "license": "MIT", - - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - - "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "symfony/polyfill-mbstring": "^1.17" - }, - - "require-dev": { - "composer/xdebug-handler": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^7.5.15" - }, - - "autoload": { - "psr-4": { - "JmesPath\\": "src/" - }, - "files": ["src/JmesPath.php"] - }, - - "bin": ["bin/jp.php"], - - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - } -} diff --git a/opis/closure/README.md b/opis/closure/README.md deleted file mode 100644 index f5f3ad8cd..000000000 --- a/opis/closure/README.md +++ /dev/null @@ -1,92 +0,0 @@ -Opis Closure -==================== -[![Tests](https://github.com/opis/closure/workflows/Tests/badge.svg)](https://github.com/opis/closure/actions) -[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure) -[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure) -[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure) - -Serializable closures ---------------------- -**Opis Closure** is a library that aims to overcome PHP's limitations regarding closure -serialization by providing a wrapper that will make all closures serializable. - -**The library's key features:** - -- Serialize any closure -- Serialize arbitrary objects -- Doesn't use `eval` for closure serialization or unserialization -- Works with any PHP version that has support for closures -- Supports PHP 7 syntax -- Handles all variables referenced/imported in `use()` and automatically wraps all referenced/imported closures for -proper serialization -- Handles recursive closures -- Handles magic constants like `__FILE__`, `__DIR__`, `__LINE__`, `__NAMESPACE__`, `__CLASS__`, -`__TRAIT__`, `__METHOD__` and `__FUNCTION__`. -- Automatically resolves all class names, function names and constant names used inside the closure -- Track closure's residing source by using the `#trackme` directive -- Simple and very fast parser -- Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly -- You can serialize/unserialize any closure unlimited times, even those previously unserialized -(this is possible because `eval()` is not used for unserialization) -- Handles static closures -- Supports cryptographically signed closures -- Provides a reflector that can give you information about the serialized closure -- Provides an analyzer for *SuperClosure* library -- Automatically detects when the scope and/or the bound object of a closure needs to be serialized -in order for the closure to work after deserialization - -## Documentation - -The full documentation for this library can be found [here][documentation]. - -## License - -**Opis Closure** is licensed under the [MIT License (MIT)][license]. - -## Requirements - -* PHP ^5.4 || ^7.0 || ^8.0 - -## Installation - -**Opis Closure** is available on [Packagist] and it can be installed from a -command line interface by using [Composer]. - -```bash -composer require opis/closure -``` - -Or you could directly reference it into your `composer.json` file as a dependency - -```json -{ - "require": { - "opis/closure": "^3.5" - } -} -``` - -### Migrating from 2.x - -If your project needs to support PHP 5.3 you can continue using the `2.x` version -of **Opis Closure**. Otherwise, assuming you are not using one of the removed/refactored classes or features(see -[CHANGELOG]), migrating to version `3.x` is simply a matter of updating your `composer.json` file. - -### Semantic versioning - -**Opis Closure** follows [semantic versioning][SemVer] specifications. - -### Arbitrary object serialization - -We've added this feature in order to be able to support the serialization of a closure's bound object. -The implementation is far from being perfect, and it's really hard to make it work flawless. -We will try to improve this, but we can't guarantee anything. -So our advice regarding the `Opis\Closure\serialize|unserialize` functions is to use them with caution. - - -[documentation]: https://www.opis.io/closure "Opis Closure" -[license]: http://opensource.org/licenses/MIT "MIT License" -[Packagist]: https://packagist.org/packages/opis/closure "Packagist" -[Composer]: https://getcomposer.org "Composer" -[SemVer]: http://semver.org/ "Semantic versioning" -[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog" diff --git a/opis/closure/composer.json b/opis/closure/composer.json deleted file mode 100644 index 5d7d77acf..000000000 --- a/opis/closure/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "opis/closure", - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "keywords": ["closure", "serialization", "function", "serializable", "serialize", "anonymous functions"], - "homepage": "https://opis.io/closure", - "license": "MIT", - "authors": [ - { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" - } - ], - "require": { - "php": "^5.4 || ^7.0 || ^8.0" - }, - "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" - }, - "autoload": { - "psr-4": { - "Opis\\Closure\\": "src/" - }, - "files": ["functions.php"] - }, - "autoload-dev": { - "psr-4": { - "Opis\\Closure\\Test\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "3.6.x-dev" - } - }, - "config": { - "preferred-install": "dist", - "sort-packages": true - } -} diff --git a/pear/archive_tar/.gitignore b/pear/archive_tar/.gitignore deleted file mode 100644 index c703991e8..000000000 --- a/pear/archive_tar/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# composer related -composer.lock -composer.phar -vendor -# IDE -.idea -# eclipse -.buildpath -.project -.settings -# pear -.tarballs -*.tgz -# phpunit -build diff --git a/pear/archive_tar/README.md b/pear/archive_tar/README.md deleted file mode 100644 index f9c53be1a..000000000 --- a/pear/archive_tar/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Archive_Tar -========== - -![.github/workflows/build.yml](https://github.com/pear/Archive_Tar/workflows/.github/workflows/build.yml/badge.svg) - -This package provides handling of tar files in PHP. -It supports creating, listing, extracting and adding to tar files. -Gzip support is available if PHP has the zlib extension built-in or -loaded. Bz2 compression is also supported with the bz2 extension loaded. -Also Lzma2 compressed archives are supported with xz extension. - -This package is hosted at http://pear.php.net/package/Archive_Tar - -Please report all new issues via the PEAR bug tracker. - -Pull requests are welcome! - - -Testing, building ------------------ - -To test, run either -$ phpunit tests/ - or -$ pear run-tests -r - -To build, simply -$ pear package - -To install from scratch -$ pear install package.xml - -To upgrade -$ pear upgrade -f package.xml diff --git a/pear/archive_tar/composer.json b/pear/archive_tar/composer.json deleted file mode 100644 index e464d9d7b..000000000 --- a/pear/archive_tar/composer.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "pear/archive_tar", - "description": "Tar file management class with compression support (gzip, bzip2, lzma2)", - "type": "library", - "keywords": [ - "archive", - "tar" - ], - "homepage": "https://github.com/pear/Archive_Tar", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Vincent Blavet", - "email": "vincent@phpconcept.net" - }, - { - "name": "Greg Beaver", - "email": "greg@chiaraquartet.net" - }, - { - "name": "Michiel Rook", - "email": "mrook@php.net" - } - ], - "require": { - "php": ">=5.2.0", - "pear/pear-core-minimal": "^1.10.0alpha2" - }, - "suggest": { - "ext-zlib": "Gzip compression support.", - "ext-bz2": "Bz2 compression support.", - "ext-xz": "Lzma2 compression support." - }, - "autoload": { - "psr-0": { - "Archive_Tar": "" - } - }, - "include-path": [ - "./" - ], - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Archive_Tar", - "source": "https://github.com/pear/Archive_Tar" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - } -} diff --git a/pear/console_getopt/.gitignore b/pear/console_getopt/.gitignore deleted file mode 100644 index 783582816..000000000 --- a/pear/console_getopt/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# composer related -composer.lock -composer.phar -vendor -README.html -dist/ diff --git a/pear/console_getopt/composer.json b/pear/console_getopt/composer.json deleted file mode 100644 index 4dc7e7cca..000000000 --- a/pear/console_getopt/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "authors": [ - { - "email": "andrei@php.net", - "name": "Andrei Zmievski", - "role": "Lead" - }, - { - "email": "stig@php.net", - "name": "Stig Bakken", - "role": "Developer" - }, - { - "email": "cellog@php.net", - "name": "Greg Beaver", - "role": "Helper" - } - ], - "autoload": { - "psr-0": { - "Console": "./" - } - }, - "description": "More info available on: http://pear.php.net/package/Console_Getopt", - "include-path": [ - "./" - ], - "license": "BSD-2-Clause", - "name": "pear/console_getopt", - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Getopt", - "source": "https://github.com/pear/Console_Getopt" - }, - "type": "library" -} diff --git a/pear/pear-core-minimal/composer.json b/pear/pear-core-minimal/composer.json deleted file mode 100644 index d805f56ae..000000000 --- a/pear/pear-core-minimal/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "pear/pear-core-minimal", - "description": "Minimal set of PEAR core files to be used as composer dependency", - "license": "BSD-3-Clause", - "authors": [ - { - "email": "cweiske@php.net", - "name": "Christian Weiske", - "role": "Lead" - } - ], - "autoload": { - "psr-0": { - "": "src/" - } - }, - "include-path": [ - "src/" - ], - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", - "source": "https://github.com/pear/pear-core-minimal" - }, - "type": "library", - "require": { - "pear/console_getopt": "~1.4", - "pear/pear_exception": "~1.0" - }, - "replace": { - "rsky/pear-core-min": "self.version" - } -} diff --git a/pear/pear_exception/composer.json b/pear/pear_exception/composer.json deleted file mode 100644 index 9ffba9b3d..000000000 --- a/pear/pear_exception/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "pear/pear_exception", - "description": "The PEAR Exception base class.", - "type": "class", - "keywords": [ - "exception" - ], - "homepage": "https://github.com/pear/PEAR_Exception", - "license": "BSD-2-Clause", - "authors": [ - { - "name": "Helgi Thormar", - "email": "dufuz@php.net" - }, - { - "name": "Greg Beaver", - "email": "cellog@php.net" - } - ], - "require": { - "php": ">=5.2.0" - }, - "autoload": { - "classmap": ["PEAR/"] - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "include-path": [ - "." - ], - "support": { - "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR_Exception", - "source": "https://github.com/pear/PEAR_Exception" - }, - "require-dev": { - "phpunit/phpunit": "<9" - } -} diff --git a/php-ds/php-ds/CHANGELOG.md b/php-ds/php-ds/CHANGELOG.md deleted file mode 100644 index 2ab32ea80..000000000 --- a/php-ds/php-ds/CHANGELOG.md +++ /dev/null @@ -1,33 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](http://semver.org/). - -## [1.3.0] - 2020-10-13 -### Changed -- Implement ArrayAccess consistently -### Fixed -- Return types were incorrectly nullable in some cases -- Deque capacity was inconsistent with the extension - -## [1.2.0] - 2017-08-03 -### Changed -- Minor capacity updates - -## [1.1.1] - 2016-08-09 -### Fixed -- `Stack` and `Queue` array access should throw `OutOfBoundsException`, not `Error`. - -### Improved -- Added a lot of docblock comments that were missing. - -## [1.1.0] - 2016-08-04 -### Added -- `Pair::copy` - -## [1.0.3] - 2016-08-01 -### Added -- `Set::merge` - -## [1.0.2] - 2016-07-31 -### Added -- `Map::putAll` diff --git a/php-ds/php-ds/README.md b/php-ds/php-ds/README.md deleted file mode 100644 index ed77afc73..000000000 --- a/php-ds/php-ds/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Data Structures for PHP 7 - -[![Build Status](https://travis-ci.org/php-ds/polyfill.svg?branch=master)](https://travis-ci.org/php-ds/polyfill) -[![Code Coverage](https://scrutinizer-ci.com/g/php-ds/polyfill/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/php-ds/polyfill/?branch=master) -[![Packagist](https://img.shields.io/packagist/v/php-ds/php-ds.svg)](https://packagist.org/packages/php-ds/php-ds) - -This is a compatibility polyfill for the [extension](https://github.com/php-ds/extension). You should include this package as a dependency of your project -to ensure that your codebase would still be functional in an environment where the extension is not installed. The polyfill will not be loaded if the extension is installed and enabled. - -## Install - -```bash -composer require php-ds/php-ds -``` - -You can also *require* that the extension be installed using `ext-ds`. - -## Test - -``` -composer install -composer test -``` - -Make sure that the *ds* extension is not enabled, as the polyfill will not be loaded if it is. -The test output will indicate whether the extension is active. - -## Contributing - -Please see [CONTRIBUTING](CONTRIBUTING.md) for more information. - -### Credits - -- [Rudi Theunissen](https://github.com/rtheunissen) -- [Joe Watkins](https://github.com/krakjoe) - -### License - -The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information. diff --git a/php-ds/php-ds/composer.json b/php-ds/php-ds/composer.json deleted file mode 100644 index da1df60a6..000000000 --- a/php-ds/php-ds/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "php-ds/php-ds", - "license": "MIT", - "keywords": ["php", "ds", "data structures", "polyfill"], - "authors": [ - { - "name": "Rudi Theunissen", - "email": "rudolf.theunissen@gmail.com" - } - ], - "require": { - "php": ">=7.0.0", - "ext-json": "*" - }, - "require-dev": { - "php-ds/tests": "^1.3" - }, - "provide": { - "ext-ds": "1.3.0" - }, - "suggest": { - "ext-ds": "to improve performance and reduce memory usage" - }, - "scripts": { - "test": "phpunit" - }, - "autoload": { - "psr-4" : { - "Ds\\": "src" - } - } -} diff --git a/php-http/guzzle7-adapter/CHANGELOG.md b/php-http/guzzle7-adapter/CHANGELOG.md deleted file mode 100644 index 9aa94407b..000000000 --- a/php-http/guzzle7-adapter/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [1.0.0] - 2021-03-09 - -- Stable release - no changes since 0.1.1 - -## [0.1.1] - 2020-10-21 - -* Allow installation with PHP 8 - -## [0.1.0] - 2020-08-16 - -First release diff --git a/php-http/guzzle7-adapter/README.md b/php-http/guzzle7-adapter/README.md deleted file mode 100644 index 7e6b5b5dc..000000000 --- a/php-http/guzzle7-adapter/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Guzzle 7 HTTP Adapter - -[![Latest Version](https://img.shields.io/github/release/php-http/guzzle7-adapter.svg?style=flat-square)](https://github.com/php-http/guzzle7-adapter/releases) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Total Downloads](https://img.shields.io/packagist/dt/php-http/guzzle7-adapter.svg?style=flat-square)](https://packagist.org/packages/php-http/guzzle7-adapter) - -**Guzzle 7 HTTP Adapter.** - -## Install - -Via Composer - -``` bash -$ composer require php-http/guzzle7-adapter -``` - -## Documentation - -Please see the [official documentation](http://docs.php-http.org/en/latest/clients/guzzle7-adapter.html). - -## Testing - -First launch the http server: - -```bash -$ ./vendor/bin/http_test_server > /dev/null 2>&1 & -``` - -Then the test suite: - -``` bash -$ composer test -``` - -## Contributing - -Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). - -## Security - -If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). - -## License - -The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/php-http/guzzle7-adapter/composer.json b/php-http/guzzle7-adapter/composer.json deleted file mode 100644 index 3299d2eb7..000000000 --- a/php-http/guzzle7-adapter/composer.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "php-http/guzzle7-adapter", - "description": "Guzzle 7 HTTP Adapter", - "license": "MIT", - "keywords": ["guzzle", "http"], - "homepage": "http://httplug.io", - "authors": [ - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com" - } - ], - "require": { - "php": "^7.2 | ^8.0", - "php-http/httplug": "^2.0", - "psr/http-client": "^1.0", - "guzzlehttp/guzzle": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.3", - "php-http/client-integration-tests": "^3.0" - }, - "provide": { - "php-http/client-implementation": "1.0", - "php-http/async-client-implementation": "1.0", - "psr/http-client-implementation": "1.0" - }, - "autoload": { - "psr-4": { - "Http\\Adapter\\Guzzle7\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Http\\Adapter\\Guzzle7\\Tests\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "0.2.x-dev" - } - } -} diff --git a/php-http/guzzle7-adapter/psalm.xml b/php-http/guzzle7-adapter/psalm.xml deleted file mode 100644 index d70acfe4f..000000000 --- a/php-http/guzzle7-adapter/psalm.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/php-http/httplug/composer.json b/php-http/httplug/composer.json deleted file mode 100644 index 268b27ec7..000000000 --- a/php-http/httplug/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "php-http/httplug", - "description": "HTTPlug, the HTTP client abstraction for PHP", - "keywords": [ - "http", - "client" - ], - "homepage": "http://httplug.io", - "license": "MIT", - "authors": [ - { - "name": "Eric GELOEN", - "email": "geloen.eric@gmail.com" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "require": { - "php": "^7.1 || ^8.0", - "php-http/promise": "^1.1", - "psr/http-client": "^1.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" - }, - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Http\\Client\\": "src/" - } - }, - "scripts": { - "test": "vendor/bin/phpspec run", - "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" - } -} diff --git a/php-http/promise/composer.json b/php-http/promise/composer.json deleted file mode 100644 index 812167bc8..000000000 --- a/php-http/promise/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "php-http/promise", - "description": "Promise used for asynchronous HTTP requests", - "license": "MIT", - "keywords": ["promise"], - "homepage": "http://httplug.io", - "authors": [ - { - "name": "Joel Wurtz", - "email": "joel.wurtz@gmail.com" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "require": { - "php" : "^7.1 || ^8.0" - }, - "require-dev": { - "friends-of-phpspec/phpspec-code-coverage" : "^4.3.2", - "phpspec/phpspec": "^5.1.2 || ^6.2" - }, - "autoload": { - "psr-4": { - "Http\\Promise\\": "src/" - } - }, - "scripts": { - "test": "vendor/bin/phpspec run", - "test-ci": "vendor/bin/phpspec run -c phpspec.yml.ci" - }, - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - } -} diff --git a/php-opencloud/openstack/.gitignore b/php-opencloud/openstack/.gitignore deleted file mode 100644 index 5bf48fc4c..000000000 --- a/php-opencloud/openstack/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.idea/ -.test/ -coverage/ -vendor/ -*.pyc -phpunit.xml -coverage.xml -composer.lock -env_test.sh diff --git a/php-opencloud/openstack/.php_cs.dist b/php-opencloud/openstack/.php_cs.dist deleted file mode 100644 index 32d7e97ef..000000000 --- a/php-opencloud/openstack/.php_cs.dist +++ /dev/null @@ -1,23 +0,0 @@ -setRules( - [ - '@PSR2' => true, - '@Symfony' => true, - 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => ['default' => 'align'], - 'protected_to_private' => false, - ] - ) - ->setUsingCache(false) - ->setRiskyAllowed(true) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__.'/src') - ->append([__FILE__, __DIR__.'/samples']) - ); diff --git a/php-opencloud/openstack/.scrutinizer.yml b/php-opencloud/openstack/.scrutinizer.yml deleted file mode 100644 index 2e4268b68..000000000 --- a/php-opencloud/openstack/.scrutinizer.yml +++ /dev/null @@ -1,10 +0,0 @@ -filter: - excluded_paths: - - 'tests/*' - - 'samples/*' - - 'integration/*' - - '*/v*/Api.php' - - '*/v*/Params.php' - -checks: - php: true diff --git a/php-opencloud/openstack/CODE_OF_CONDUCT.md b/php-opencloud/openstack/CODE_OF_CONDUCT.md deleted file mode 100644 index 250253086..000000000 --- a/php-opencloud/openstack/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,51 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, and in the interest of -fostering an open and welcoming community, we pledge to respect all people who -contribute through reporting issues, posting feature requests, updating -documentation, submitting pull requests or patches, and other activities. - -We are committed to making participation in this project a harassment-free -experience for everyone, regardless of level of experience, gender, gender -identity and expression, sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, such as physical or electronic - addresses, without explicit permission -* Other unethical or unprofessional conduct - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -By adopting this Code of Conduct, project maintainers commit themselves to -fairly and consistently applying these principles to every aspect of managing -this project. Project maintainers who do not follow or enforce the Code of -Conduct may be permanently removed from the project team. - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting a project maintainer at sdk-support@rackspace.com or -jamie.hannaford@rackspace.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. Maintainers are -obligated to maintain confidentiality with regard to the reporter of an -incident. - - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 1.3.0, available at -[http://contributor-covenant.org/version/1/3/0/][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/3/0/ diff --git a/php-opencloud/openstack/README.md b/php-opencloud/openstack/README.md deleted file mode 100644 index 6b6084085..000000000 --- a/php-opencloud/openstack/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# PHP OpenStack SDK - -[![Build Status](https://travis-ci.org/php-opencloud/openstack.svg?branch=master)](https://travis-ci.org/php-opencloud/openstack) -[![Coverage Status](https://coveralls.io/repos/github/php-opencloud/openstack/badge.svg?branch=master)](https://coveralls.io/github/php-opencloud/openstack?branch=master) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/php-opencloud/openstack/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/php-opencloud/openstack/?branch=master) - -`php-opencloud/openstack` is an SDK which allows PHP developers to easily connect to OpenStack APIs in a simple and -idiomatic way. This binding is specifically designed for OpenStack APIs, but other provider SDKs are available. Multiple -OpenStack services, and versions of services, are supported. - -## Links - -* [Official documentation](https://php-openstack-sdk.readthedocs.io/en/latest/) -* [Reference documentation](http://refdocs.os.php-opencloud.com) -* [Contributing guide](/CONTRIBUTING.md) -* [Code of Conduct](/CODE_OF_CONDUCT.md) - - -## We need your help :smiley: - -We invest a large amount of work to ensure this SDK works with many OpenStack distributions via running end-to-end -integration tests with a real cluster. - -If you or your organization are in a position that can help us access popular distributions as listed below, do reach -out by open an issue in github. - -| Distribution | | -|---------------------|-------------------------| -|OpenStack RDO | :white_check_mark: | -|Red Hat OpenStack | Need sponsor! | -|OVH OpenStack | Need sponsor! | -|SUSE OpenStack | Need sponsor! | -|Canonical OpenStack | Need sponsor! | -|RackSpace OpenStack | Need sponsor! | - -## Join the community - -- Meet us on Slack: https://phpopencloud.slack.com ([Get your invitation](https://launchpass.com/phpopencloud)) -- Report an issue: https://github.com/php-opencloud/openstack/issues - -## Version Guidance - -| Version | Status | PHP Version | Support until | -| --------- | --------------------------- | ------------- | ----------------------- | -| `^3.1` | Latest | `>=7.2.5` | Oct 2023 | -| `^3.0` | Bug fixed only | `>=7.0` | Oct 2020 | -| `^2.0` | EOL (Bug fixes only) | `>=7.0,<7.2` | March 2018 | - - -## Upgrade from 2.x to 3.x - -Due to new [object typehint](https://wiki.php.net/rfc/object-typehint) since PHP 7.2, `Object` is a reserved keyword -thus class `OpenStack\ObjectStore\v1\Models\Object` had to be renamed to -`OpenStack\ObjectStore\v1\Models\StorageObject`. - -This change was introduced in [#184](https://github.com/php-opencloud/openstack/pull/184). - -## Requirements - -* PHP 7.0 -* `ext-curl` - -## How to install - -```bash -composer require php-opencloud/openstack -``` - -## Contributing - -Engaging the community and lowering barriers for contributors is something we care a lot about. For this reason, we've -taken the time to write a [contributing guide](CONTRIBUTING.md) for folks interested in getting involved in our project. -If you're not sure how you can get involved, feel free to -[submit an issue](https://github.com/php-opencloud/openstack/issues/new) or -[contact us](https://developer.rackspace.com/support/). You don't need to be a PHP expert - all members of the -community are welcome! \ No newline at end of file diff --git a/php-opencloud/openstack/composer.json b/php-opencloud/openstack/composer.json deleted file mode 100644 index f2a8d9c32..000000000 --- a/php-opencloud/openstack/composer.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "php-opencloud/openstack", - "description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi", - "keywords": [ - "php", - "openstack", - "api", - "sdk" - ], - "homepage": "https://github.com/php-opencloud/openstack", - "license": "Apache-2.0", - "authors": [ - { - "name": "Jamie Hannaford", - "email": "jamie.hannaford@rackspace.com", - "homepage" : "https://github.com/jamiehannaford" - }, - { - "name": "Ha Phan", - "email": "thanhha.work@gmail.com", - "homepage" : "https://github.com/haphan" - } - ], - "autoload": { - "psr-4": { - "OpenStack\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "OpenStack\\Test\\": "tests/unit/", - "OpenStack\\Integration\\": "tests/integration/" - } - }, - "require": { - "php": "^7.2.5", - "guzzlehttp/guzzle": "^7.0", - "guzzlehttp/uri-template": "0.2", - "justinrainbow/json-schema": "^5.2" - }, - "require-dev": { - "phpunit/phpunit": "^6.5", - "psr/log": "^1.0", - "php-coveralls/php-coveralls": "^2.0", - "jakub-onderka/php-parallel-lint": "^1.0", - "friendsofphp/php-cs-fixer": "^2.13" - }, - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - } -} diff --git a/php-opencloud/openstack/phpunit.xml.dist b/php-opencloud/openstack/phpunit.xml.dist deleted file mode 100644 index 05ba70a11..000000000 --- a/php-opencloud/openstack/phpunit.xml.dist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - tests/unit - - - - - - - - - - ./src - - ./src - ./src - ./src - - - - \ No newline at end of file diff --git a/psr/cache/README.md b/psr/cache/README.md deleted file mode 100644 index c8706ceea..000000000 --- a/psr/cache/README.md +++ /dev/null @@ -1,9 +0,0 @@ -PSR Cache -========= - -This repository holds all interfaces defined by -[PSR-6](http://www.php-fig.org/psr/psr-6/). - -Note that this is not a Cache implementation of its own. It is merely an -interface that describes a Cache implementation. See the specification for more -details. diff --git a/psr/cache/composer.json b/psr/cache/composer.json deleted file mode 100644 index e828fec94..000000000 --- a/psr/cache/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "psr/cache", - "description": "Common interface for caching libraries", - "keywords": ["psr", "psr-6", "cache"], - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/psr/container/.gitignore b/psr/container/.gitignore deleted file mode 100644 index b2395aa05..000000000 --- a/psr/container/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -composer.lock -composer.phar -/vendor/ diff --git a/psr/container/README.md b/psr/container/README.md deleted file mode 100644 index 1b9d9e570..000000000 --- a/psr/container/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Container interface -============== - -This repository holds all interfaces related to [PSR-11 (Container Interface)][psr-url]. - -Note that this is not a Container implementation of its own. It is merely abstractions that describe the components of a Dependency Injection Container. - -The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. - -[psr-url]: https://www.php-fig.org/psr/psr-11/ -[package-url]: https://packagist.org/packages/psr/container -[implementation-url]: https://packagist.org/providers/psr/container-implementation - diff --git a/psr/container/composer.json b/psr/container/composer.json deleted file mode 100644 index 3797a2538..000000000 --- a/psr/container/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "psr/container", - "type": "library", - "description": "Common Container Interface (PHP FIG PSR-11)", - "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], - "homepage": "https://github.com/php-fig/container", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "require": { - "php": ">=7.2.0" - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - } -} diff --git a/psr/event-dispatcher/.gitignore b/psr/event-dispatcher/.gitignore deleted file mode 100644 index 3a9875b46..000000000 --- a/psr/event-dispatcher/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/ -composer.lock diff --git a/psr/event-dispatcher/README.md b/psr/event-dispatcher/README.md deleted file mode 100644 index 294214afb..000000000 --- a/psr/event-dispatcher/README.md +++ /dev/null @@ -1,6 +0,0 @@ -PSR Event Dispatcher -==================== - -This repository holds the interfaces related to [PSR-14](http://www.php-fig.org/psr/psr-14/). - -Note that this is not an Event Dispatcher implementation of its own. It is merely interfaces that describe the components of an Event Dispatcher. See the specification for more details. diff --git a/psr/event-dispatcher/composer.json b/psr/event-dispatcher/composer.json deleted file mode 100644 index 667a71448..000000000 --- a/psr/event-dispatcher/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/event-dispatcher", - "description": "Standard interfaces for event handling.", - "type": "library", - "keywords": ["psr", "psr-14", "events"], - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=7.2.0" - }, - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/psr/http-client/composer.json b/psr/http-client/composer.json deleted file mode 100644 index c195f8ff1..000000000 --- a/psr/http-client/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "psr/http-client", - "description": "Common interface for HTTP clients", - "keywords": ["psr", "psr-18", "http", "http-client"], - "homepage": "https://github.com/php-fig/http-client", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/psr/http-factory/.gitignore b/psr/http-factory/.gitignore deleted file mode 100644 index d8a7996ab..000000000 --- a/psr/http-factory/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -composer.lock -vendor/ diff --git a/psr/http-factory/README.md b/psr/http-factory/README.md deleted file mode 100644 index 41d362a62..000000000 --- a/psr/http-factory/README.md +++ /dev/null @@ -1,10 +0,0 @@ -HTTP Factories -============== - -This repository holds all interfaces related to [PSR-17 (HTTP Message Factories)][psr-17]. -Please refer to the specification for a description. - -You can find implementations of the specification by looking for packages providing the -[psr/http-factory-implementation](https://packagist.org/providers/psr/http-factory-implementation) virtual package. - -[psr-17]: https://www.php-fig.org/psr/psr-17/ diff --git a/psr/http-factory/composer.json b/psr/http-factory/composer.json deleted file mode 100644 index af62b290f..000000000 --- a/psr/http-factory/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "psr/http-factory", - "description": "Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "psr", - "psr-7", - "psr-17", - "http", - "factory", - "message", - "request", - "response" - ], - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0" - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/psr/http-message/CHANGELOG.md b/psr/http-message/CHANGELOG.md deleted file mode 100644 index 74b1ef923..000000000 --- a/psr/http-message/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file, in reverse chronological order by release. - -## 1.0.1 - 2016-08-06 - -### Added - -- Nothing. - -### Deprecated - -- Nothing. - -### Removed - -- Nothing. - -### Fixed - -- Updated all `@return self` annotation references in interfaces to use - `@return static`, which more closelly follows the semantics of the - specification. -- Updated the `MessageInterface::getHeaders()` return annotation to use the - value `string[][]`, indicating the format is a nested array of strings. -- Updated the `@link` annotation for `RequestInterface::withRequestTarget()` - to point to the correct section of RFC 7230. -- Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation - to add the parameter name (`$uploadedFiles`). -- Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()` - method to correctly reference the method parameter (it was referencing an - incorrect parameter name previously). - -## 1.0.0 - 2016-05-18 - -Initial stable release; reflects accepted PSR-7 specification. diff --git a/psr/http-message/README.md b/psr/http-message/README.md deleted file mode 100644 index 28185338f..000000000 --- a/psr/http-message/README.md +++ /dev/null @@ -1,13 +0,0 @@ -PSR Http Message -================ - -This repository holds all interfaces/classes/traits related to -[PSR-7](http://www.php-fig.org/psr/psr-7/). - -Note that this is not a HTTP message implementation of its own. It is merely an -interface that describes a HTTP message. See the specification for more details. - -Usage ------ - -We'll certainly need some stuff in here. \ No newline at end of file diff --git a/psr/http-message/composer.json b/psr/http-message/composer.json deleted file mode 100644 index b0d2937a0..000000000 --- a/psr/http-message/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/http-message", - "description": "Common interface for HTTP messages", - "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"], - "homepage": "https://github.com/php-fig/http-message", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/psr/log/README.md b/psr/log/README.md deleted file mode 100644 index a9f20c437..000000000 --- a/psr/log/README.md +++ /dev/null @@ -1,58 +0,0 @@ -PSR Log -======= - -This repository holds all interfaces/classes/traits related to -[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). - -Note that this is not a logger of its own. It is merely an interface that -describes a logger. See the specification for more details. - -Installation ------------- - -```bash -composer require psr/log -``` - -Usage ------ - -If you need a logger, you can use the interface like this: - -```php -logger = $logger; - } - - public function doSomething() - { - if ($this->logger) { - $this->logger->info('Doing work'); - } - - try { - $this->doSomethingElse(); - } catch (Exception $exception) { - $this->logger->error('Oh no!', array('exception' => $exception)); - } - - // do something useful - } -} -``` - -You can then pick one of the implementations of the interface to get a logger. - -If you want to implement the interface, you can require this package and -implement `Psr\Log\LoggerInterface` in your code. Please read the -[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -for details. diff --git a/psr/log/composer.json b/psr/log/composer.json deleted file mode 100644 index ca0569537..000000000 --- a/psr/log/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/log", - "description": "Common interface for logging libraries", - "keywords": ["psr", "psr-3", "log"], - "homepage": "https://github.com/php-fig/log", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - } -} diff --git a/punic/punic/README.md b/punic/punic/README.md deleted file mode 100644 index d350928c9..000000000 --- a/punic/punic/README.md +++ /dev/null @@ -1,20 +0,0 @@ -[![Build Status](https://api.travis-ci.org/punic/punic.svg?branch=master)](https://travis-ci.org/punic/punic) -[![HHVM Status](http://hhvm.h4cc.de/badge/punic/punic.svg)](http://hhvm.h4cc.de/package/punic/punic) -[![Coverage Status](https://img.shields.io/coveralls/punic/punic.svg)](https://coveralls.io/r/punic/punic) -[![Monthly Downloads](https://poser.pugx.org/punic/punic/d/monthly.svg)](https://packagist.org/packages/punic/punic) -[![Join the chat at https://gitter.im/punic/punic](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/punic/punic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![License](https://poser.pugx.org/punic/punic/license.svg)](https://packagist.org/packages/punic/punic) -Punic - PHP Unicode CLDR Toolkit -================================ - -Documentation -------------- - -See [punic.github.io](https://punic.github.io) for more info. - -Contributing ------------- - -We are always happy to get feedback or even pull requests. -In order to keep the code consistent, please use the wonderful [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). Simply launch it in the Punic root directory to normalize the coding style: -`php-cs-fixer fix` diff --git a/punic/punic/composer.json b/punic/punic/composer.json deleted file mode 100644 index 88c4b4236..000000000 --- a/punic/punic/composer.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "punic/punic", - "description": "PHP-Unicode CLDR", - "keywords": [ - "localization", - "l10n", - "internationalization", - "i18n", - "translations", - "translate", - "php", - "unicode", - "cldr", - "calendar", - "date-time", - "date", - "time" - ], - "homepage": "https://github.com/punic/punic", - "license": "MIT", - "authors": [ - { - "name": "Michele Locati", - "email": "mlocati@gmail.com", - "role": "Developer" - }, - { - "name": "Remo Laubacher", - "email": "remo.laubacher@gmail.com", - "role": "Collaborator, motivator and perfectionist supporter" - } - ], - "autoload": { - "psr-4": { - "Punic\\": "code/" - } - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "apigen/apigen": "4.0.*" - }, - "replace": { - "punic/common": "*", - "punic/calendar": "*" - } -} diff --git a/ralouphie/getallheaders/README.md b/ralouphie/getallheaders/README.md deleted file mode 100644 index 9430d76bb..000000000 --- a/ralouphie/getallheaders/README.md +++ /dev/null @@ -1,27 +0,0 @@ -getallheaders -============= - -PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. - -[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) -[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) -[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) -[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) -[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) - - -This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). - -## Install - -For PHP version **`>= 5.6`**: - -``` -composer require ralouphie/getallheaders -``` - -For PHP version **`< 5.6`**: - -``` -composer require ralouphie/getallheaders "^2" -``` diff --git a/ralouphie/getallheaders/composer.json b/ralouphie/getallheaders/composer.json deleted file mode 100644 index de8ce62e4..000000000 --- a/ralouphie/getallheaders/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "ralouphie/getallheaders", - "description": "A polyfill for getallheaders.", - "license": "MIT", - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^5 || ^6.5", - "php-coveralls/php-coveralls": "^2.1" - }, - "autoload": { - "files": ["src/getallheaders.php"] - }, - "autoload-dev": { - "psr-4": { - "getallheaders\\Tests\\": "tests/" - } - } -} diff --git a/ramsey/collection/README.md b/ramsey/collection/README.md deleted file mode 100644 index ce7a554d2..000000000 --- a/ramsey/collection/README.md +++ /dev/null @@ -1,84 +0,0 @@ -

ramsey/collection

- -

- A PHP library for representing and manipulating collections. -

- -

- Source Code - Download Package - PHP Programming Language - Build Status - Codecov Code Coverage - Psalm Type Coverage - Read License - Package downloads on Packagist - Chat with the maintainers -

- -## About - -ramsey/collection is a PHP 7.2+ library for representing and manipulating collections. - -Much inspiration for this library came from the [Java Collections Framework][java]. - -This project adheres to a [code of conduct](CODE_OF_CONDUCT.md). -By participating in this project and its community, you are expected to -uphold this code. - -## Installation - -Install this package as a dependency using [Composer](https://getcomposer.org). - -``` bash -composer require ramsey/collection -``` - -## Usage - -Examples of how to use this framework can be found in the -[Wiki pages](https://github.com/ramsey/collection/wiki/Examples). - -## Contributing - -Contributions are welcome! Before contributing to this project, familiarize -yourself with [CONTRIBUTING.md](CONTRIBUTING.md). - -To develop this project, you will need [PHP](https://www.php.net) 7.2 or greater -and [Composer](https://getcomposer.org). - -After cloning this repository locally, execute the following commands: - -``` bash -cd /path/to/repository -composer install -``` - -Now, you are ready to develop! - -## Coordinated Disclosure - -Keeping user information safe and secure is a top priority, and we welcome the -contribution of external security researchers. If you believe you've found a -security issue in software that is maintained in this repository, please read -[SECURITY.md][] for instructions on submitting a vulnerability report. - -## ramsey/collection for Enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of ramsey/collection and thousands of other packages are working -with Tidelift to deliver commercial support and maintenance for the open source -packages you use to build your applications. Save time, reduce risk, and improve -code health, while paying the maintainers of the exact packages you use. -[Learn more.](https://tidelift.com/subscription/pkg/packagist-ramsey-collection?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - -## Copyright and License - -The ramsey/collection library is copyright © [Ben Ramsey](https://benramsey.com) -and licensed for use under the terms of the -MIT License (MIT). Please see [LICENSE](LICENSE) for more information. - - -[java]: http://docs.oracle.com/javase/8/docs/technotes/guides/collections/index.html -[security.md]: https://github.com/ramsey/collection/blob/master/SECURITY.md diff --git a/ramsey/collection/composer.json b/ramsey/collection/composer.json deleted file mode 100644 index 0c5d09578..000000000 --- a/ramsey/collection/composer.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "ramsey/collection", - "type": "library", - "description": "A PHP 7.2+ library for representing and manipulating collections.", - "keywords": [ - "array", - "collection", - "hash", - "map", - "queue", - "set" - ], - "license": "MIT", - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "require": { - "php": "^7.2 || ^8" - }, - "require-dev": { - "captainhook/captainhook": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.6", - "fakerphp/faker": "^1.5", - "hamcrest/hamcrest-php": "^2", - "jangregor/phpstan-prophecy": "^0.8", - "mockery/mockery": "^1.3", - "phpstan/extension-installer": "^1", - "phpstan/phpstan": "^0.12.32", - "phpstan/phpstan-mockery": "^0.12.5", - "phpstan/phpstan-phpunit": "^0.12.11", - "phpunit/phpunit": "^8.5 || ^9", - "psy/psysh": "^0.10.4", - "slevomat/coding-standard": "^6.3", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.4" - }, - "config": { - "sort-packages": true - }, - "autoload": { - "psr-4": { - "Ramsey\\Collection\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Ramsey\\Console\\": "resources/console/", - "Ramsey\\Collection\\Test\\": "tests/" - }, - "files": [ - "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" - ] - }, - "scripts": { - "post-autoload-dump": "captainhook install --ansi -f -s", - "br:analyze": [ - "@br:analyze:phpstan", - "@br:analyze:psalm" - ], - "br:analyze:phpstan": "phpstan --memory-limit=1G analyse", - "br:analyze:psalm": "psalm --diff --config=psalm.xml", - "br:build:clean": "git clean -fX build/.", - "br:build:clear-cache": "git clean -fX build/cache/.", - "br:lint": "phpcs --cache=build/cache/phpcs.cache", - "br:lint:fix": "./bin/lint-fix.sh", - "br:repl": [ - "echo ; echo 'Type ./bin/repl to start the REPL.'" - ], - "br:test": "phpunit", - "br:test:all": [ - "@br:lint", - "@br:analyze", - "@br:test" - ], - "br:test:coverage:ci": "phpunit --coverage-clover build/logs/clover.xml", - "br:test:coverage:html": "phpunit --coverage-html build/coverage", - "pre-commit": [ - "@br:lint:fix", - "@br:lint", - "@br:analyze" - ], - "test": "@br:test:all" - }, - "scripts-descriptions": { - "br:analyze": "Performs static analysis on the code base.", - "br:analyze:phpstan": "Runs the PHPStan static analyzer.", - "br:analyze:psalm": "Runs the Psalm static analyzer.", - "br:build:clean": "Removes everything not under version control from the build directory.", - "br:build:clear-cache": "Removes everything not under version control from build/cache/.", - "br:lint": "Checks all source code for coding standards issues.", - "br:lint:fix": "Checks source code for coding standards issues and fixes them, if possible.", - "br:repl": "Note: Use ./bin/repl to run the REPL.", - "br:test": "Runs the full unit test suite.", - "br:test:all": "Runs linting, static analysis, and unit tests.", - "br:test:coverage:ci": "Runs the unit test suite and generates a Clover coverage report.", - "br:test:coverage:html": "Runs the unit tests suite and generates an HTML coverage report.", - "pre-commit": "These commands are run as part of a Git pre-commit hook installed using captainhook/captainhook. Each command should be prepared to accept a list of space-separated staged files.", - "test": "Shortcut to run the full test suite." - } -} diff --git a/ramsey/uuid/CHANGELOG.md b/ramsey/uuid/CHANGELOG.md deleted file mode 100644 index e65960558..000000000 --- a/ramsey/uuid/CHANGELOG.md +++ /dev/null @@ -1,1262 +0,0 @@ -# ramsey/uuid Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - - -## [Unreleased] - -### Added - -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security - - -## [4.1.1] - 2020-08-18 - -### Fixed - -* Allow use of brick/math version 0.9 - - -## [4.1.0] - 2020-07-28 - -### Changed - -* Improve performance of `Uuid::fromString()`, `Uuid::fromBytes()`, - `UuidInterface#toString()`, and `UuidInterface#getBytes()`. See PR - [#324](https://github.com/ramsey/uuid/pull/324) for more information. - - -## [4.0.1] - 2020-03-29 - -### Fixed - -* Fix collection deserialization errors due to upstream `allowed_classes` being - set to `false`. For details, see [ramsey/uuid#303](https://github.com/ramsey/uuid/issues/303) - and [ramsey/collection#47](https://github.com/ramsey/collection/issues/47). - - -## [4.0.0] - 2020-03-22 - -### Added - -* Add support for version 6 UUIDs, as defined by , - including the static method `Uuid::uuid6()`, which returns a - `Nonstandard\UuidV6` instance. -* Add ability to generate version 2 (DCE Security) UUIDs, including the static - method `Uuid::uuid2()`, which returns an `Rfc4122\UuidV2` instance. -* Add classes to represent each version of RFC 4122 UUID. When generating new - UUIDs or creating UUIDs from existing strings, bytes, or integers, if the UUID - is an RFC 4122 variant, one of these instances will be returned: - * `Rfc4122\UuidV1` - * `Rfc4122\UuidV2` - * `Rfc4122\UuidV3` - * `Rfc4122\UuidV4` - * `Rfc4122\UuidV5` - * `Rfc4122\NilUuid` -* Add classes to represent version 6 UUIDs, GUIDs, and nonstandard - (non-RFC 4122 variant) UUIDs: - * `Nonstandard\UuidV6` - * `Guid\Guid` - * `Nonstandard\Uuid` -* Add `Uuid::fromDateTime()` to create version 1 UUIDs from instances of - `\DateTimeInterface`. -* The `\DateTimeInterface` instance returned by `UuidInterface::getDateTime()` - (and now `Rfc4122\UuidV1::getDateTime()`) now includes microseconds, as - specified by the version 1 UUID. -* Add `Validator\ValidatorInterface` and `Validator\GenericValidator` to allow - flexibility in validating UUIDs/GUIDs. - * The default validator continues to validate UUID strings using the same - relaxed validation pattern found in the 3.x series of ramsey/uuid. - * Introduce `Rfc4122\Validator` that may be used for strict validation of - RFC 4122 UUID strings. - * Add ability to change the default validator used by `Uuid` through - `FeatureSet::setValidator()`. - * Add `getValidator()` and `setValidator()` to `UuidFactory`. -* Add `Provider\Node\StaticNodeProvider` to assist in setting a custom static - node value with the multicast bit set for version 1 UUIDs. -* Add the following new exceptions: - * `Exception\BuilderNotFoundException` - - Thrown to indicate that no suitable UUID builder could be found. - * `Exception\DateTimeException` - - Thrown to indicate that the PHP DateTime extension encountered an - exception/error. - * `Exception\DceSecurityException` - - Thrown to indicate an exception occurred while dealing with DCE Security - (version 2) UUIDs. - * `Exception\InvalidArgumentException` - - Thrown to indicate that the argument received is not valid. This extends the - built-in PHP `\InvalidArgumentException`, so there should be no BC breaks - with ramsey/uuid throwing this exception, if you are catching the PHP - exception. - * `Exception\InvalidBytesException` - - Thrown to indicate that the bytes being operated on are invalid in some way. - * `Exception\NameException` - - Thrown to indicate that an error occurred while attempting to hash a - namespace and name. - * `Exception\NodeException` - - Throw to indicate that attempting to fetch or create a node ID encountered - an error. - * `Exception\RandomSourceException` - - Thrown to indicate that the source of random data encountered an error. - * `Exception\TimeSourceException` - - Thrown to indicate that the source of time encountered an error. - * `Exception\UnableToBuildUuidException` - - Thrown to indicate a builder is unable to build a UUID. -* Introduce a `Builder\FallbackBuilder`, used by `FeatureSet` to help decide - whether to return a `Uuid` or `Nonstandard\Uuid` when decoding a - UUID string or bytes. -* Add `Rfc4122\UuidInterface` to specifically represent RFC 4122 variant UUIDs. -* Add `Rfc4122\UuidBuilder` to build RFC 4122 variant UUIDs. This replaces the - existing `Builder\DefaultUuidBuilder`, which is now deprecated. -* Introduce `Math\CalculatorInterface` for representing calculators to perform - arithmetic operations on integers. -* Depend on [brick/math](https://github.com/brick/math) for the - `Math\BrickMathCalculator`, which is the default calculator used by this - library when math cannot be performed in native PHP due to integer size - limitations. The calculator is configurable and may be changed, if desired. -* Add `Converter\Number\GenericNumberConverter` and - `Converter\Time\GenericTimeConverter` which will use the calculator provided - to convert numbers and time to values for UUIDs. -* Introduce `Type\Hexadecimal`, `Type\Integer`, `Type\Decimal`, and `Type\Time` - for improved type-safety when dealing with arbitrary string values. -* Add a `Type\TypeInterface` that each of the ramsey/uuid types implements. -* Add `Fields\FieldsInterface` and `Rfc4122\FieldsInterface` to define - field layouts for UUID variants. The implementations `Rfc4122\Fields`, - `Guid\Fields`, and `Nonstandard\Fields` store the 16-byte, - binary string representation of the UUID internally, and these manage - conversion of the binary string into the hexadecimal field values. -* Introduce `Builder\BuilderCollection` and `Provider\Node\NodeProviderCollection`. - These are typed collections for providing builders and node providers to - `Builder\FallbackBuilder` and `Provider\Node\FallbackNodeProvider`, respectively. -* Add `Generator\NameGeneratorInterface` to support alternate methods of - generating bytes for version 3 and version 5 name-based UUID. By default, - ramsey/uuid uses the `Generator\DefaultNameGenerator`, which uses the standard - algorithm this library has used since the beginning. You may choose to use the - new `Generator\PeclUuidNameGenerator` to make use of the new - `uuid_generate_md5()` and `uuid_generate_sha1()` functions in - [ext-uuid version 1.1.0](https://pecl.php.net/package/uuid). - -### Changed - -* Set minimum required PHP version to 7.2. -* This library now works on 32-bit and 64-bit systems, with no degradation in - functionality. -* By default, the following static methods will now return specific instance - types. This should not cause any BC breaks if typehints target `UuidInterface`: - * `Uuid::uuid1` returns `Rfc4122\UuidV1` - * `Uuid::uuid3` returns `Rfc4122\UuidV3` - * `Uuid::uuid4` returns `Rfc4122\UuidV4` - * `Uuid::uuid5` returns `Rfc4122\UuidV5` -* Accept `Type\Hexadecimal` for the `$node` parameter for - `UuidFactoryInterface::uuid1()`. This is in addition to the `int|string` types - already accepted, so there are no BC breaks. `Type\Hexadecimal` is now the - recommended type to pass for `$node`. -* Out of the box, `Uuid::fromString()`, `Uuid::fromBytes()`, and - `Uuid::fromInteger()` will now return either an `Rfc4122\UuidInterface` - instance or an instance of `Nonstandard\Uuid`, depending on whether the input - contains an RFC 4122 variant UUID with a valid version identifier. Both - implement `UuidInterface`, so BC breaks should not occur if typehints use the - interface. -* Change `Uuid::getFields()` to return an instance of `Fields\FieldsInterface`. - Previously, it returned an array of integer values (on 64-bit systems only). -* `Uuid::getDateTime()` now returns an instance of `\DateTimeImmutable` instead - of `\DateTime`. -* Make the following changes to `UuidInterface`: - * `getHex()` now returns a `Type\Hexadecimal` instance. - * `getInteger()` now returns a `Type\Integer` instance. The `Type\Integer` - instance holds a string representation of a 128-bit integer. You may then - use a math library of your choice (bcmath, gmp, etc.) to operate on the - string integer. - * `getDateTime()` now returns `\DateTimeInterface` instead of `\DateTime`. - * Add `__toString()` method. - * Add `getFields()` method. It returns an instance of `Fields\FieldsInterface`. -* Add the following new methods to `UuidFactoryInterface`: - * `uuid2()` - * `uuid6()` - * `fromDateTime()` - * `fromInteger()` - * `getValidator()` -* This library no longer throws generic exceptions. However, this should not - result in BC breaks, since the new exceptions extend from built-in PHP - exceptions that this library previously threw. - * `Exception\UnsupportedOperationException` is now descended from - `\LogicException`. Previously, it descended from `\RuntimeException`. -* Change required constructor parameters for `Uuid`: - * Change the first required constructor parameter for `Uuid` from - `array $fields` to `Rfc4122\FieldsInterface $fields`. - * Add `Converter\TimeConverterInterface $timeConverter` as the fourth - required constructor parameter for `Uuid`. -* Change the second required parameter of `Builder\UuidBuilderInterface::build()` - from `array $fields` to `string $bytes`. Rather than accepting an array of - hexadecimal strings as UUID fields, the `build()` method now expects a byte - string. -* Add `Converter\TimeConverterInterface $timeConverter` as the second required - constructor parameter for `Rfc4122\UuidBuilder`. This also affects the - now-deprecated `Builder\DefaultUuidBuilder`, since this class now inherits - from `Rfc4122\UuidBuilder`. -* Add `convertTime()` method to `Converter\TimeConverterInterface`. -* Add `getTime()` method to `Provider\TimeProviderInterface`. It replaces the - `currentTime()` method. -* `Provider\Node\FallbackNodeProvider` now accepts only a - `Provider\Node\NodeProviderCollection` as its constructor parameter. -* `Provider\Time\FixedTimeProvider` no longer accepts an array but accepts only - `Type\Time` instances. -* `Provider\NodeProviderInterface::getNode()` now returns `Type\Hexadecimal` - instead of `string|false|null`. -* `Converter/TimeConverterInterface::calculateTime()` now returns - `Type\Hexadecimal` instead of `array`. The value is the full UUID timestamp - value (count of 100-nanosecond intervals since the Gregorian calendar epoch) - in hexadecimal format. -* Change methods in `NumberConverterInterface` to accept and return string values - instead of `mixed`; this simplifies the interface and makes it consistent. -* `Generator\DefaultTimeGenerator` no longer adds the variant and version bits - to the bytes it returns. These must be applied to the bytes afterwards. -* When encoding to bytes or decoding from bytes, `OrderedTimeCodec` now checks - whether the UUID is an RFC 4122 variant, version 1 UUID. If not, it will throw - an exception—`InvalidArgumentException` when using - `OrderedTimeCodec::encodeBinary()` and `UnsupportedOperationException` when - using `OrderedTimeCodec::decodeBytes()`. - -### Deprecated - -The following functionality is deprecated and will be removed in ramsey/uuid -5.0.0. - -* The following methods from `UuidInterface` and `Uuid` are deprecated. Use their - counterparts on the `Rfc4122\FieldsInterface` returned by `Uuid::getFields()`. - * `getClockSeqHiAndReservedHex()` - * `getClockSeqLowHex()` - * `getClockSequenceHex()` - * `getFieldsHex()` - * `getNodeHex()` - * `getTimeHiAndVersionHex()` - * `getTimeLowHex()` - * `getTimeMidHex()` - * `getTimestampHex()` - * `getVariant()` - * `getVersion()` -* The following methods from `Uuid` are deprecated. Use the `Rfc4122\FieldsInterface` - instance returned by `Uuid::getFields()` to get the `Type\Hexadecimal` value - for these fields. You may use the new `Math\CalculatorInterface::toIntegerValue()` - method to convert the `Type\Hexadecimal` instances to instances of - `Type\Integer`. This library provides `Math\BrickMathCalculator`, which may be - used for this purpose, or you may use the arbitrary-precision arithemetic - library of your choice. - * `getClockSeqHiAndReserved()` - * `getClockSeqLow()` - * `getClockSequence()` - * `getNode()` - * `getTimeHiAndVersion()` - * `getTimeLow()` - * `getTimeMid()` - * `getTimestamp()` -* `getDateTime()` on `UuidInterface` and `Uuid` is deprecated. Use this method - only on instances of `Rfc4122\UuidV1` or `Nonstandard\UuidV6`. -* `getUrn()` on `UuidInterface` and `Uuid` is deprecated. It is available on - `Rfc4122\UuidInterface` and classes that implement it. -* The following methods are deprecated and have no direct replacements. However, - you may obtain the same information by calling `UuidInterface::getHex()` and - splitting the return value in half. - * `UuidInterface::getLeastSignificantBitsHex()` - * `UuidInterface::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBitsHex()` - * `Uuid::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBits()` - * `Uuid::getMostSignificantBits()` -* `UuidInterface::getNumberConverter()` and `Uuid::getNumberConverter()` are - deprecated. There is no alternative recommendation, so plan accordingly. -* `Builder\DefaultUuidBuilder` is deprecated; transition to `Rfc4122\UuidBuilder`. -* `Converter\Number\BigNumberConverter` is deprecated; transition to - `Converter\Number\GenericNumberConverter`. -* `Converter\Time\BigNumberTimeConverter` is deprecated; transition to - `Converter\Time\GenericTimeConverter`. -* The classes for representing and generating *degraded* UUIDs are deprecated. - These are no longer necessary; this library now behaves the same on 32-bit and - 64-bit systems. - * `Builder\DegradedUuidBuilder` - * `Converter\Number\DegradedNumberConverter` - * `Converter\Time\DegradedTimeConverter` - * `DegradedUuid` -* The `Uuid::UUID_TYPE_IDENTIFIER` constant is deprecated. Use - `Uuid::UUID_TYPE_DCE_SECURITY` instead. -* The `Uuid::VALID_PATTERN` constant is deprecated. Use - `Validator\GenericValidator::getPattern()` or `Rfc4122\Validator::getPattern()` - instead. - -### Removed - -* Remove the following bytes generators and recommend - `Generator\RandomBytesGenerator` as a suitable replacement: - * `Generator\MtRandGenerator` - * `Generator\OpenSslGenerator` - * `Generator\SodiumRandomGenerator` -* Remove `Exception\UnsatisfiedDependencyException`. This library no longer - throws this exception. -* Remove the method `Provider\TimeProviderInterface::currentTime()`. Use - `Provider\TimeProviderInterface::getTime()` instead. - - -## [4.0.0-beta2] - 2020-03-01 - -## Added - -* Add missing convenience methods for `Rfc4122\UuidV2`. -* Add `Provider\Node\StaticNodeProvider` to assist in setting a custom static - node value with the multicast bit set for version 1 UUIDs. - -## Changed - -* `Provider\NodeProviderInterface::getNode()` now returns `Type\Hexadecimal` - instead of `string|false|null`. - - -## [4.0.0-beta1] - 2020-02-27 - -### Added - -* Add `ValidatorInterface::getPattern()` to return the regular expression - pattern used by the validator. -* Add `v6()` helper function for version 6 UUIDs. - -### Changed - -* Set the pattern constants on validators as `private`. Use the `getPattern()` - method instead. -* Change the `$node` parameter for `UuidFactoryInterface::uuid6()` to accept - `null` or `Type\Hexadecimal`. -* Accept `Type\Hexadecimal` for the `$node` parameter for - `UuidFactoryInterface::uuid1()`. This is in addition to the `int|string` types - already accepted, so there are no BC breaks. `Type\Hexadecimal` is now the - recommended type to pass for `$node`. - -### Removed - -* Remove `currentTime()` method from `Provider\Time\FixedTimeProvider` and - `Provider\Time\SystemTimeProvider`; it had previously been removed from - `Provider\TimeProviderInterface`. - - -## [4.0.0-alpha5] - 2020-02-23 - -### Added - -* Introduce `Builder\BuilderCollection` and `Provider\Node\NodeProviderCollection`. - -### Changed - -* `Builder\FallbackBuilder` now accepts only a `Builder\BuilderCollection` as - its constructor parameter. -* `Provider\Node\FallbackNodeProvider` now accepts only a `Provider\Node\NodeProviderCollection` - as its constructor parameter. -* `Provider\Time\FixedTimeProvider` no longer accepts an array but accepts only - `Type\Time` instances. - - -## [4.0.0-alpha4] - 2020-02-23 - -### Added - -* Add a `Type\TypeInterface` that each of the ramsey/uuid types implements. -* Support version 6 UUIDs; see . - -### Changed - -* Rename `Type\IntegerValue` to `Type\Integer`. It was originally named - `IntegerValue` because static analysis sees `Integer` in docblock annotations - and treats it as the native `int` type. `Integer` is not a reserved word in - PHP, so it should be named `Integer` for consistency with other types in this - library. When using it, a class alias prevents static analysis from - complaining. -* Mark `Guid\Guid` and `Nonstandard\Uuid` classes as `final`. -* Add `uuid6()` method to `UuidFactoryInterface`. - -### Deprecated - -* `Uuid::UUID_TYPE_IDENTIFIER` is deprecated. Use `Uuid::UUID_TYPE_DCE_SECURITY` - instead. -* `Uuid::VALID_PATTERN` is deprecated. Use `Validator\GenericValidator::VALID_PATTERN` - instead. - - -## [4.0.0-alpha3] - 2020-02-21 - -### Fixed - -* Fix microsecond rounding error on 32-bit systems. - - -## [4.0.0-alpha2] - 2020-02-21 - -### Added - -* Add `Uuid::fromDateTime()` to create version 1 UUIDs from instances of - `\DateTimeInterface`. -* Add `Generator\NameGeneratorInterface` to support alternate methods of - generating bytes for version 3 and version 5 name-based UUID. By default, - ramsey/uuid uses the `Generator\DefaultNameGenerator`, which uses the standard - algorithm this library has used since the beginning. You may choose to use the - new `Generator\PeclUuidNameGenerator` to make use of the new - `uuid_generate_md5()` and `uuid_generate_sha1()` functions in ext-uuid version - 1.1.0. - -### Changed - -* Add `fromDateTime()` method to `UuidFactoryInterface`. -* Change `UuidInterface::getHex()` to return a `Ramsey\Uuid\Type\Hexadecimal` instance. -* Change `UuidInterface::getInteger()` to return a `Ramsey\Uuid\Type\IntegerValue` instance. - -### Fixed - -* Round microseconds to six digits when getting DateTime from v1 UUIDs. This - circumvents a needless exception for an otherwise valid time-based UUID. - - -## [4.0.0-alpha1] - 2020-01-22 - -### Added - -* Add `Validator\ValidatorInterface` and `Validator\GenericValidator` to allow - flexibility in validating UUIDs/GUIDs. - * Add ability to change the default validator used by `Uuid` through - `FeatureSet::setValidator()`. - * Add `getValidator()` and `setValidator()` to `UuidFactory`. -* Add an internal `InvalidArgumentException` that descends from the built-in - PHP `\InvalidArgumentException`. All places that used to throw - `\InvalidArgumentException` now throw `Ramsey\Uuid\Exception\InvalidArgumentException`. - This should not cause any BC breaks, however. -* Add an internal `DateTimeException` that descends from the built-in PHP - `\RuntimeException`. `Uuid::getDateTime()` may throw this exception if - `\DateTimeImmutable` throws an error or exception. -* Add `RandomSourceException` that descends from the built-in PHP - `\RuntimeException`. `DefaultTimeGenerator`, `RandomBytesGenerator`, and - `RandomNodeProvider` may throw this exception if `random_bytes()` or - `random_int()` throw an error or exception. -* Add `Fields\FieldsInterface` and `Rfc4122\FieldsInterface` to define - field layouts for UUID variants. The implementations `Rfc4122\Fields`, - `Guid\Fields`, and `Nonstandard\Fields` store the 16-byte, - binary string representation of the UUID internally, and these manage - conversion of the binary string into the hexadecimal field values. -* Add `Rfc4122\UuidInterface` to specifically represent RFC 4122 variant UUIDs. -* Add classes to represent each version of RFC 4122 UUID. When generating new - UUIDs or creating UUIDs from existing strings, bytes, or integers, if the UUID - is an RFC 4122 variant, one of these instances will be returned: - * `Rfc4122\UuidV1` - * `Rfc4122\UuidV2` - * `Rfc4122\UuidV3` - * `Rfc4122\UuidV4` - * `Rfc4122\UuidV5` - * `Rfc4122\NilUuid` -* Add `Rfc4122\UuidBuilder` to build RFC 4122 variant UUIDs. This replaces the - existing `Builder\DefaultUuidBuilder`, which is now deprecated. -* Add ability to generate version 2 (DCE Security) UUIDs, including the static - method `Uuid::uuid2()`, which returns an `Rfc4122\UuidV2` instance. -* Add classes to represent GUIDs and nonstandard (non-RFC 4122 variant) UUIDs: - * `Guid\Guid` - * `Nonstandard\Uuid`. -* Introduce a `Builder\FallbackBuilder`, used by `FeatureSet` to help decide - whether to return a `Uuid` or `Nonstandard\Uuid` when decoding a - UUID string or bytes. -* Introduce `Type\Hexadecimal`, `Type\IntegerValue`, and `Type\Time` for - improved type-safety when dealing with arbitrary string values. -* Introduce `Math\CalculatorInterface` for representing calculators to perform - arithmetic operations on integers. -* Depend on [brick/math](https://github.com/brick/math) for the - `Math\BrickMathCalculator`, which is the default calculator used by this - library when math cannot be performed in native PHP due to integer size - limitations. The calculator is configurable and may be changed, if desired. -* Add `Converter\Number\GenericNumberConverter` and - `Converter\Time\GenericTimeConverter` which will use the calculator provided - to convert numbers and time to values for UUIDs. -* The `\DateTimeInterface` instance returned by `UuidInterface::getDateTime()` - (and now `Rfc4122\UuidV1::getDateTime()`) now includes microseconds, as - specified by the version 1 UUID. - -### Changed - -* Set minimum required PHP version to 7.2. -* Add `__toString()` method to `UuidInterface`. -* The `UuidInterface::getDateTime()` method now specifies `\DateTimeInterface` - as the return value, rather than `\DateTime`; `Uuid::getDateTime()` now - returns an instance of `\DateTimeImmutable` instead of `\DateTime`. -* Add `getFields()` method to `UuidInterface`. -* Add `getValidator()` method to `UuidFactoryInterface`. -* Add `uuid2()` method to `UuidFactoryInterface`. -* Add `convertTime()` method to `Converter\TimeConverterInterface`. -* Add `getTime()` method to `Provider\TimeProviderInterface`. -* Change `Uuid::getFields()` to return an instance of `Fields\FieldsInterface`. - Previously, it returned an array of integer values (on 64-bit systems only). -* Change the first required constructor parameter for `Uuid` from - `array $fields` to `Rfc4122\FieldsInterface $fields`. -* Introduce `Converter\TimeConverterInterface $timeConverter` as fourth required - constructor parameter for `Uuid` and second required constructor parameter for - `Builder\DefaultUuidBuilder`. -* Change `UuidInterface::getInteger()` to always return a `string` value instead - of `mixed`. This is a string representation of a 128-bit integer. You may then - use a math library of your choice (bcmath, gmp, etc.) to operate on the - string integer. -* Change the second required parameter of `Builder\UuidBuilderInterface::build()` - from `array $fields` to `string $bytes`. Rather than accepting an array of - hexadecimal strings as UUID fields, the `build()` method now expects a byte - string. -* `Generator\DefaultTimeGenerator` no longer adds the variant and version bits - to the bytes it returns. These must be applied to the bytes afterwards. -* `Converter/TimeConverterInterface::calculateTime()` now returns - `Type\Hexadecimal` instead of `array`. The value is the full UUID timestamp - value (count of 100-nanosecond intervals since the Gregorian calendar epoch) - in hexadecimal format. -* Change methods in converter interfaces to accept and return string values - instead of `mixed`; this simplifies the interface and makes it consistent: - * `NumberConverterInterface::fromHex(string $hex): string` - * `NumberConverterInterface::toHex(string $number): string` - * `TimeConverterInterface::calculateTime(string $seconds, string $microseconds): array` -* `UnsupportedOperationException` is now descended from `\LogicException`. - Previously, it descended from `\RuntimeException`. -* When encoding to bytes or decoding from bytes, `OrderedTimeCodec` now checks - whether the UUID is an RFC 4122 variant, version 1 UUID. If not, it will throw - an exception—`InvalidArgumentException` when using - `OrderedTimeCodec::encodeBinary()` and `UnsupportedOperationException` when - using `OrderedTimeCodec::decodeBytes()`. -* Out of the box, `Uuid::fromString()`, `Uuid::fromBytes()`, and - `Uuid::fromInteger()` will now return either an `Rfc4122\UuidInterface` - instance or an instance of `Nonstandard\Uuid`, depending on whether the input - contains an RFC 4122 variant UUID with a valid version identifier. Both - implement `UuidInterface`, so BC breaks should not occur if typehints use the - interface. -* By default, the following static methods will now return the specific instance - types. This should not cause any BC breaks if typehints target `UuidInterface`: - * `Uuid::uuid1` returns `Rfc4122\UuidV1` - * `Uuid::uuid3` returns `Rfc4122\UuidV3` - * `Uuid::uuid4` returns `Rfc4122\UuidV4` - * `Uuid::uuid5` returns `Rfc4122\UuidV5` - -### Deprecated - -The following functionality is deprecated and will be removed in ramsey/uuid -5.0.0. - -* The following methods from `UuidInterface` and `Uuid` are deprecated. Use their - counterparts on the `Rfc4122\FieldsInterface` returned by `Uuid::getFields()`. - * `getClockSeqHiAndReservedHex()` - * `getClockSeqLowHex()` - * `getClockSequenceHex()` - * `getFieldsHex()` - * `getNodeHex()` - * `getTimeHiAndVersionHex()` - * `getTimeLowHex()` - * `getTimeMidHex()` - * `getTimestampHex()` - * `getVariant()` - * `getVersion()` -* The following methods from `Uuid` are deprecated. Use the `Rfc4122\FieldsInterface` - instance returned by `Uuid::getFields()` to get the `Type\Hexadecimal` value - for these fields, and then use the arbitrary-precision arithmetic library of - your choice to convert them to string integers. - * `getClockSeqHiAndReserved()` - * `getClockSeqLow()` - * `getClockSequence()` - * `getNode()` - * `getTimeHiAndVersion()` - * `getTimeLow()` - * `getTimeMid()` - * `getTimestamp()` -* `getDateTime()` on `UuidInterface` and `Uuid` is deprecated. Use this method - only on instances of `Rfc4122\UuidV1`. -* `getUrn()` on `UuidInterface` and `Uuid` is deprecated. It is available on - `Rfc4122\UuidInterface` and classes that implement it. -* The following methods are deprecated and have no direct replacements. However, - you may obtain the same information by calling `UuidInterface::getHex()` and - splitting the return value in half. - * `UuidInterface::getLeastSignificantBitsHex()` - * `UuidInterface::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBitsHex()` - * `Uuid::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBits()` - * `Uuid::getMostSignificantBits()` -* `UuidInterface::getNumberConverter()` and `Uuid::getNumberConverter()` are - deprecated. There is no alternative recommendation, so plan accordingly. -* `Builder\DefaultUuidBuilder` is deprecated; transition to - `Rfc4122\UuidBuilder`. -* `Converter\Number\BigNumberConverter` is deprecated; transition to - `Converter\Number\GenericNumberConverter`. -* `Converter\Time\BigNumberTimeConverter` is deprecated; transition to - `Converter\Time\GenericTimeConverter`. -* `Provider\TimeProviderInterface::currentTime()` is deprecated; transition to - the `getTimestamp()` method on the same interface. -* The classes for representing and generating *degraded* UUIDs are deprecated. - These are no longer necessary; this library now behaves the same on 32-bit and - 64-bit PHP. - * `Builder\DegradedUuidBuilder` - * `Converter\Number\DegradedNumberConverter` - * `Converter\Time\DegradedTimeConverter` - * `DegradedUuid` - -### Removed - -* Remove the following bytes generators and recommend - `Generator\RandomBytesGenerator` as a suitable replacement: - * `Generator\MtRandGenerator` - * `Generator\OpenSslGenerator` - * `Generator\SodiumRandomGenerator` -* Remove `Exception\UnsatisfiedDependencyException`. This library no longer - throws this exception. - - -## [3.9.3] - 2020-02-20 - -### Fixed - -* For v1 UUIDs, round down for timestamps so that microseconds do not bump the - timestamp to the next second. - - As an example, consider the case of timestamp `1` with `600000` microseconds - (`1.600000`). This is the first second after midnight on January 1, 1970, UTC. - Previous versions of this library had a bug that would round this to `2`, so - the rendered time was `1970-01-01 00:00:02`. This was incorrect. Despite - having `600000` microseconds, the time should not round up to the next second. - Rather, the time should be `1970-01-01 00:00:01.600000`. Since this version of - ramsey/uuid does not support microseconds, the microseconds are dropped, and - the time is `1970-01-01 00:00:01`. No rounding should occur. - - -## [3.9.2] - 2019-12-17 - -### Fixed - -* Check whether files returned by `/sys/class/net/*/address` are readable - before attempting to read them. This avoids a PHP warning that was being - emitted on hosts that do not grant permission to read these files. - - -## [3.9.1] - 2019-12-01 - -### Fixed - -* Fix `RandomNodeProvider` behavior on 32-bit systems. The `RandomNodeProvider` - was converting a 6-byte string to a decimal number, which is a 48-bit, - unsigned integer. This caused problems on 32-bit systems and has now been - resolved. - - -## [3.9.0] - 2019-11-30 - -### Added - -* Add function API as convenience. The functions are available in the - `Ramsey\Uuid` namespace. - * `v1(int|string|null $node = null, int|null $clockSeq = null): string` - * `v3(string|UuidInterface $ns, string $name): string` - * `v4(): string` - * `v5(string|UuidInterface $ns, string $name): string` - -### Changed - -* Use paragonie/random-lib instead of ircmaxell/random-lib. This is a - non-breaking change. -* Use a high-strength generator by default, when using `RandomLibAdapter`. This - is a non-breaking change. - -### Deprecated - -These will be removed in ramsey/uuid version 4.0.0: - -* `MtRandGenerator`, `OpenSslGenerator`, and `SodiumRandomGenerator` are - deprecated in favor of using the default `RandomBytesGenerator`. - -### Fixed - -* Set `ext-json` as a required dependency in `composer.json`. -* Use `PHP_OS` instead of `php_uname()` when determining the system OS, for - cases when `php_uname()` is disabled for security reasons. - - -## [3.8.0] - 2018-07-19 - -### Added - -* Support discovery of MAC addresses on FreeBSD systems -* Use a polyfill to provide PHP ctype functions when running on systems where the - ctype functions are not part of the PHP build -* Disallow a trailing newline character when validating UUIDs -* Annotate thrown exceptions for improved IDE hinting - - -## [3.7.3] - 2018-01-19 - -### Fixed - -* Gracefully handle cases where `glob()` returns false when searching - `/sys/class/net/*/address` files on Linux -* Fix off-by-one error in `DefaultTimeGenerator` - -### Security - -* Switch to `random_int()` from `mt_rand()` for better random numbers - - -## [3.7.2] - 2018-01-13 - -### Fixed - -* Check sysfs on Linux to determine the node identifier; this provides a - reliable way to identify the node on Docker images, etc. - - -## [3.7.1] - 2017-09-22 - -### Fixed - -* Set the multicast bit for random nodes, according to RFC 4122, §4.5 - -### Security - -* Use `random_bytes()` when generating random nodes - - -## [3.7.0] - 2017-08-04 - -### Added - -* Add the following UUID version constants: - * `Uuid::UUID_TYPE_TIME` - * `Uuid::UUID_TYPE_IDENTIFIER` - * `Uuid::UUID_TYPE_HASH_MD5` - * `Uuid::UUID_TYPE_RANDOM` - * `Uuid::UUID_TYPE_HASH_SHA1` - - -## [3.6.1] - 2017-03-26 - -### Fixed - -* Optimize UUID string decoding by using `str_pad()` instead of `sprintf()` - - -## [3.6.0] - 2017-03-18 - -### Added - -* Add `InvalidUuidStringException`, which is thrown when attempting to decode an - invalid string UUID; this does not introduce any BC issues, since the new - exception inherits from the previously used `InvalidArgumentException` - -### Fixed - -* Improve memory usage when generating large quantities of UUIDs (use `str_pad()` - and `dechex()` instead of `sprintf()`) - - -## [3.5.2] - 2016-11-22 - -### Fixed - -* Improve test coverage - - -## [3.5.1] - 2016-10-02 - -### Fixed - -* Fix issue where the same UUIDs were not being treated as equal when using - mixed cases - - -## [3.5.0] - 2016-08-02 - -### Added - -* Add `OrderedTimeCodec` to store UUID in an optimized way for InnoDB - -### Fixed - -* Fix invalid node generation in `RandomNodeProvider` -* Avoid multiple unnecessary system calls by caching failed attempt to retrieve - system node - - -## [3.4.1] - 2016-04-23 - -### Fixed - -* Fix test that violated a PHP CodeSniffer rule, breaking the build - - -## [3.4.0] - 2016-04-23 - -### Added - -* Add `TimestampFirstCombCodec` and `TimestampLastCombCodec` codecs to provide - the ability to generate [COMB sequential UUIDs] with the timestamp encoded as - either the first 48 bits or the last 48 bits -* Improve logic of `CombGenerator` for COMB sequential UUIDs - - -## [3.3.0] - 2016-03-22 - -### Security - -* Drop the use of OpenSSL as a fallback and use [paragonie/random_compat] to - support `RandomBytesGenerator` in versions of PHP earlier than 7.0; - this addresses and fixes the [collision issue] - - -## [3.2.0] - 2016-02-17 - -### Added - -* Add `SodiumRandomGenerator` to allow use of the [PECL libsodium extension] as - a random bytes generator when creating UUIDs - - -## [3.1.0] - 2015-12-17 - -### Added - -* Implement the PHP `Serializable` interface to provide the ability to - serialize/unserialize UUID objects - - -## [3.0.1] - 2015-10-21 - -### Added - -* Adopt the [Contributor Code of Conduct] for this project - - -## [3.0.0] - 2015-09-28 - -The 3.0.0 release represents a significant step for the ramsey/uuid library. -While the simple and familiar API used in previous versions remains intact, this -release provides greater flexibility to integrators, including the ability to -inject your own number generators, UUID codecs, node and time providers, and -more. - -*Please note: The changelog for 3.0.0 includes all notes from the alpha and beta -versions leading up to this release.* - -### Added - -* Add a number of generators that may be used to override the library defaults - for generating random bytes (version 4) or time-based (version 1) UUIDs - * `CombGenerator` to allow generation of sequential UUIDs - * `OpenSslGenerator` to generate random bytes on systems where - `openssql_random_pseudo_bytes()` is present - * `MtRandGenerator` to provide a fallback in the event other random generators - are not present - * `RandomLibAdapter` to allow use of [ircmaxell/random-lib] - * `RandomBytesGenerator` for use with PHP 7; ramsey/uuid will default to use - this generator when running on PHP 7 - * Refactor time-based (version 1) UUIDs into a `TimeGeneratorInterface` to - allow for other sources to generate version 1 UUIDs in this library - * `PeclUuidTimeGenerator` and `PeclUuidRandomGenerator` for creating version - 1 or version 4 UUIDs using the pecl-uuid extension -* Add a `setTimeGenerator` method on `UuidFactory` to override the default time - generator -* Add option to enable `PeclUuidTimeGenerator` via `FeatureSet` -* Support GUID generation by configuring a `FeatureSet` to use GUIDs -* Allow UUIDs to be serialized as JSON through `JsonSerializable` - -### Changed - -* Change root namespace from "Rhumsaa" to "Ramsey;" in most cases, simply - making this change in your applications is the only upgrade path you will - need—everything else should work as expected -* No longer consider `Uuid` class as `final`; everything is now based around - interfaces and factories, allowing you to use this package as a base to - implement other kinds of UUIDs with different dependencies -* Return an object of type `DegradedUuid` on 32-bit systems to indicate that - certain features are not available -* Default `RandomLibAdapter` to a medium-strength generator with - [ircmaxell/random-lib]; this is configurable, so other generator strengths may - be used - -### Removed - -* Remove `PeclUuidFactory` in favor of using pecl-uuid with generators -* Remove `timeConverter` and `timeProvider` properties, setters, and getters in - both `FeatureSet` and `UuidFactory` as those are now exclusively used by the - default `TimeGenerator` -* Move UUID [Doctrine field type] to [ramsey/uuid-doctrine] -* Move `uuid` console application to [ramsey/uuid-console] -* Remove `Uuid::VERSION` package version constant - -### Fixed - -* Improve GUID support to ensure that: - * On little endian (LE) architectures, the byte order of the first three - fields is LE - * On big endian (BE) architectures, it is the same as a GUID - * String representation is always the same -* Fix exception message for `DegradedNumberConverter::fromHex()` - - -## [3.0.0-beta1] - 2015-08-31 - -### Fixed - -* Improve GUID support to ensure that: - * On little endian (LE) architectures, the byte order of the first three - fields is LE - * On big endian (BE) architectures, it is the same as a GUID - * String representation is always the same -* Fix exception message for `DegradedNumberConverter::fromHex()` - - -## [3.0.0-alpha3] - 2015-07-28 - -### Added - -* Enable use of custom `TimeGenerator` implementations -* Add a `setTimeGenerator` method on `UuidFactory` to override the default time - generator -* Add option to enable `PeclUuidTimeGenerator` via `FeatureSet` - -### Removed - -* Remove `timeConverter` and `timeProvider` properties, setters, and getters in - both `FeatureSet` and `UuidFactory` as those are now exclusively used by the - default `TimeGenerator` - - -## [3.0.0-alpha2] - 2015-07-28 - -### Added - -* Refactor time-based (version 1) UUIDs into a `TimeGeneratorInterface` to allow - for other sources to generate version 1 UUIDs in this library -* Add `PeclUuidTimeGenerator` and `PeclUuidRandomGenerator` for creating version - 1 or version 4 UUIDs using the pecl-uuid extension -* Add `RandomBytesGenerator` for use with PHP 7. ramsey/uuid will default to use - this generator when running on PHP 7 - -### Changed - -* Default `RandomLibAdapter` to a medium-strength generator with - [ircmaxell/random-lib]; this is configurable, so other generator strengths may - be used - -### Removed - -* Remove `PeclUuidFactory` in favor of using pecl-uuid with generators - - -## [3.0.0-alpha1] - 2015-07-16 - -### Added - -* Allow dependency injection through `UuidFactory` and/or extending `FeatureSet` - to override any package defaults -* Add a number of generators that may be used to override the library defaults: - * `CombGenerator` to allow generation of sequential UUIDs - * `OpenSslGenerator` to generate random bytes on systems where - `openssql_random_pseudo_bytes()` is present - * `MtRandGenerator` to provide a fallback in the event other random generators - are not present - * `RandomLibAdapter` to allow use of [ircmaxell/random-lib] -* Support GUID generation by configuring a `FeatureSet` to use GUIDs -* Allow UUIDs to be serialized as JSON through `JsonSerializable` - -### Changed - -* Change root namespace from "Rhumsaa" to "Ramsey;" in most cases, simply - making this change in your applications is the only upgrade path you will - need—everything else should work as expected -* No longer consider `Uuid` class as `final`; everything is now based around - interfaces and factories, allowing you to use this package as a base to - implement other kinds of UUIDs with different dependencies -* Return an object of type `DegradedUuid` on 32-bit systems to indicate that - certain features are not available - -### Removed - -* Move UUID [Doctrine field type] to [ramsey/uuid-doctrine] -* Move `uuid` console application to [ramsey/uuid-console] -* Remove `Uuid::VERSION` package version constant - - -## [2.9.0] - 2016-03-22 - -### Security - -* Drop the use of OpenSSL as a fallback and use [paragonie/random_compat] to - support `RandomBytesGenerator` in versions of PHP earlier than 7.0; - this addresses and fixes the [collision issue] - - -## [2.8.4] - 2015-12-17 - -### Added - -* Add support for symfony/console v3 in the `uuid` CLI application - - -## [2.8.3] - 2015-08-31 - -### Fixed - -* Fix exception message in `Uuid::calculateUuidTime()` - - -## [2.8.2] - 2015-07-23 - -### Fixed - -* Ensure the release tag makes it into the rhumsaa/uuid package - - -## [2.8.1] - 2015-06-16 - -### Fixed - -* Use `passthru()` and output buffering in `getIfconfig()` -* Cache the system node in a static variable so that we process it only once per - runtime - - -## [2.8.0] - 2014-11-09 - -### Added - -* Add static `fromInteger()` method to create UUIDs from string integer or - `Moontoast\Math\BigNumber` - -### Fixed - -* Improve Doctrine conversion to Uuid or string for the ramsey/uuid [Doctrine field type] - - -## [2.7.4] - 2014-10-29 - -### Fixed - -* Change loop in `generateBytes()` from `foreach` to `for` - - -## [2.7.3] - 2014-08-27 - -### Fixed - -* Fix upper range for `mt_rand` used in version 4 UUIDs - - -## [2.7.2] - 2014-07-28 - -### Changed - -* Upgrade to PSR-4 autoloading - - -## [2.7.1] - 2014-02-19 - -### Fixed - -* Move moontoast/math and symfony/console to require-dev -* Support symfony/console 2.3 (LTS version) - - -## [2.7.0] - 2014-01-31 - -### Added - -* Add `Uuid::VALID_PATTERN` constant containing a UUID validation regex pattern - - -## [2.6.1] - 2014-01-27 - -### Fixed - -* Fix bug where `uuid` console application could not find the Composer - autoloader when installed in another project - - -## [2.6.0] - 2014-01-17 - -### Added - -* Introduce `uuid` console application for generating and decoding UUIDs from - CLI (run `./bin/uuid` for details) -* Add `Uuid::getInteger()` to retrieve a `Moontoast\Math\BigNumber` - representation of the 128-bit integer representing the UUID -* Add `Uuid::getHex()` to retrieve the hexadecimal representation of the UUID -* Use `netstat` on Linux to capture the node for a version 1 UUID -* Require moontoast/math as part of the regular package requirements - - -## [2.5.0] - 2013-10-30 - -### Added - -* Use `openssl_random_pseudo_bytes()`, if available, to generate random bytes - - -## [2.4.0] - 2013-07-29 - -### Added - -* Return `null` from `Uuid::getVersion()` if the UUID isn't an RFC 4122 variant -* Support string UUIDs without dashes passed to `Uuid::fromString()` - - -## [2.3.0] - 2013-07-16 - -### Added - -* Support creation of UUIDs from bytes with `Uuid::fromBytes()` - - -## [2.2.0] - 2013-07-04 - -### Added - -* Add `Doctrine\UuidType::requiresSQLCommentHint()` method - - -## [2.1.2] - 2013-07-03 - -### Fixed - -* Fix cases where the system node was coming back with uppercase hexadecimal - digits; this ensures that case in the node is converted to lowercase - - -## [2.1.1] - 2013-04-29 - -### Fixed - -* Fix bug in `Uuid::isValid()` where the NIL UUID was not reported as valid - - -## [2.1.0] - 2013-04-15 - -### Added - -* Allow checking the validity of a UUID through the `Uuid::isValid()` method - - -## [2.0.0] - 2013-02-11 - -### Added - -* Support UUID generation on 32-bit platforms - -### Changed - -* Mark `Uuid` class `final` -* Require moontoast/math on 64-bit platforms for - `Uuid::getLeastSignificantBits()` and `Uuid::getMostSignificantBits()`; the - integers returned by these methods are *unsigned* 64-bit integers and - unsupported even on 64-bit builds of PHP -* Move `UnsupportedOperationException` to the `Exception` subnamespace - - -## [1.1.2] - 2012-11-29 - -### Fixed - -* Relax [Doctrine field type] conversion rules for UUIDs - - -## [1.1.1] - 2012-08-27 - -### Fixed - -* Remove `final` keyword from `Uuid` class - - -## [1.1.0] - 2012-08-06 - -### Added - -* Support ramsey/uuid UUIDs as a Doctrine Database Abstraction Layer (DBAL) - field mapping type - - -## [1.0.0] - 2012-07-19 - -### Added - -* Support generation of version 1, 3, 4, and 5 UUIDs - - -[comb sequential uuids]: http://www.informit.com/articles/article.aspx?p=25862&seqNum=7 -[paragonie/random_compat]: https://github.com/paragonie/random_compat -[collision issue]: https://github.com/ramsey/uuid/issues/80 -[contributor code of conduct]: https://github.com/ramsey/uuid/blob/master/.github/CODE_OF_CONDUCT.md -[pecl libsodium extension]: http://pecl.php.net/package/libsodium -[ircmaxell/random-lib]: https://github.com/ircmaxell/RandomLib -[doctrine field type]: http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html -[ramsey/uuid-doctrine]: https://github.com/ramsey/uuid-doctrine -[ramsey/uuid-console]: https://github.com/ramsey/uuid-console - -[unreleased]: https://github.com/ramsey/uuid/compare/4.1.1...HEAD -[4.1.1]: https://github.com/ramsey/uuid/compare/4.1.0...4.1.1 -[4.1.0]: https://github.com/ramsey/uuid/compare/4.0.1...4.1.0 -[4.0.1]: https://github.com/ramsey/uuid/compare/4.0.0...4.0.1 -[4.0.0]: https://github.com/ramsey/uuid/compare/4.0.0-beta2...4.0.0 -[4.0.0-beta2]: https://github.com/ramsey/uuid/compare/4.0.0-beta1...4.0.0-beta2 -[4.0.0-beta1]: https://github.com/ramsey/uuid/compare/4.0.0-alpha5...4.0.0-beta1 -[4.0.0-alpha5]: https://github.com/ramsey/uuid/compare/4.0.0-alpha4...4.0.0-alpha5 -[4.0.0-alpha4]: https://github.com/ramsey/uuid/compare/4.0.0-alpha3...4.0.0-alpha4 -[4.0.0-alpha3]: https://github.com/ramsey/uuid/compare/4.0.0-alpha2...4.0.0-alpha3 -[4.0.0-alpha2]: https://github.com/ramsey/uuid/compare/4.0.0-alpha1...4.0.0-alpha2 -[4.0.0-alpha1]: https://github.com/ramsey/uuid/compare/3.9.3...4.0.0-alpha1 -[3.9.3]: https://github.com/ramsey/uuid/compare/3.9.2...3.9.3 -[3.9.2]: https://github.com/ramsey/uuid/compare/3.9.1...3.9.2 -[3.9.1]: https://github.com/ramsey/uuid/compare/3.9.0...3.9.1 -[3.9.0]: https://github.com/ramsey/uuid/compare/3.8.0...3.9.0 -[3.8.0]: https://github.com/ramsey/uuid/compare/3.7.3...3.8.0 -[3.7.3]: https://github.com/ramsey/uuid/compare/3.7.2...3.7.3 -[3.7.2]: https://github.com/ramsey/uuid/compare/3.7.1...3.7.2 -[3.7.1]: https://github.com/ramsey/uuid/compare/3.7.0...3.7.1 -[3.7.0]: https://github.com/ramsey/uuid/compare/3.6.1...3.7.0 -[3.6.1]: https://github.com/ramsey/uuid/compare/3.6.0...3.6.1 -[3.6.0]: https://github.com/ramsey/uuid/compare/3.5.2...3.6.0 -[3.5.2]: https://github.com/ramsey/uuid/compare/3.5.1...3.5.2 -[3.5.1]: https://github.com/ramsey/uuid/compare/3.5.0...3.5.1 -[3.5.0]: https://github.com/ramsey/uuid/compare/3.4.1...3.5.0 -[3.4.1]: https://github.com/ramsey/uuid/compare/3.4.0...3.4.1 -[3.4.0]: https://github.com/ramsey/uuid/compare/3.3.0...3.4.0 -[3.3.0]: https://github.com/ramsey/uuid/compare/3.2.0...3.3.0 -[3.2.0]: https://github.com/ramsey/uuid/compare/3.1.0...3.2.0 -[3.1.0]: https://github.com/ramsey/uuid/compare/3.0.1...3.1.0 -[3.0.1]: https://github.com/ramsey/uuid/compare/3.0.0...3.0.1 -[3.0.0]: https://github.com/ramsey/uuid/compare/3.0.0-beta1...3.0.0 -[3.0.0-beta1]: https://github.com/ramsey/uuid/compare/3.0.0-alpha3...3.0.0-beta1 -[3.0.0-alpha3]: https://github.com/ramsey/uuid/compare/3.0.0-alpha2...3.0.0-alpha3 -[3.0.0-alpha2]: https://github.com/ramsey/uuid/compare/3.0.0-alpha1...3.0.0-alpha2 -[3.0.0-alpha1]: https://github.com/ramsey/uuid/compare/2.9.0...3.0.0-alpha1 -[2.9.0]: https://github.com/ramsey/uuid/compare/2.8.4...2.9.0 -[2.8.4]: https://github.com/ramsey/uuid/compare/2.8.3...2.8.4 -[2.8.3]: https://github.com/ramsey/uuid/compare/2.8.2...2.8.3 -[2.8.2]: https://github.com/ramsey/uuid/compare/2.8.1...2.8.2 -[2.8.1]: https://github.com/ramsey/uuid/compare/2.8.0...2.8.1 -[2.8.0]: https://github.com/ramsey/uuid/compare/2.7.4...2.8.0 -[2.7.4]: https://github.com/ramsey/uuid/compare/2.7.3...2.7.4 -[2.7.3]: https://github.com/ramsey/uuid/compare/2.7.2...2.7.3 -[2.7.2]: https://github.com/ramsey/uuid/compare/2.7.1...2.7.2 -[2.7.1]: https://github.com/ramsey/uuid/compare/2.7.0...2.7.1 -[2.7.0]: https://github.com/ramsey/uuid/compare/2.6.1...2.7.0 -[2.6.1]: https://github.com/ramsey/uuid/compare/2.6.0...2.6.1 -[2.6.0]: https://github.com/ramsey/uuid/compare/2.5.0...2.6.0 -[2.5.0]: https://github.com/ramsey/uuid/compare/2.4.0...2.5.0 -[2.4.0]: https://github.com/ramsey/uuid/compare/2.3.0...2.4.0 -[2.3.0]: https://github.com/ramsey/uuid/compare/2.2.0...2.3.0 -[2.2.0]: https://github.com/ramsey/uuid/compare/2.1.2...2.2.0 -[2.1.2]: https://github.com/ramsey/uuid/compare/2.1.1...2.1.2 -[2.1.1]: https://github.com/ramsey/uuid/compare/2.1.0...2.1.1 -[2.1.0]: https://github.com/ramsey/uuid/compare/2.0.0...2.1.0 -[2.0.0]: https://github.com/ramsey/uuid/compare/1.1.2...2.0.0 -[1.1.2]: https://github.com/ramsey/uuid/compare/1.1.1...1.1.2 -[1.1.1]: https://github.com/ramsey/uuid/compare/1.1.0...1.1.1 -[1.1.0]: https://github.com/ramsey/uuid/compare/1.0.0...1.1.0 -[1.0.0]: https://github.com/ramsey/uuid/commits/1.0.0 diff --git a/ramsey/uuid/README.md b/ramsey/uuid/README.md deleted file mode 100644 index 0e539e6b8..000000000 --- a/ramsey/uuid/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# ramsey/uuid - -[![Source Code][badge-source]][source] -[![Latest Version][badge-release]][release] -[![Software License][badge-license]][license] -[![PHP Version][badge-php]][php] -[![Build Status][badge-build]][build] -[![Coverage Status][badge-coverage]][coverage] -[![Total Downloads][badge-downloads]][downloads] - -ramsey/uuid is a PHP library for generating and working with universally unique -identifiers (UUIDs). - -This project adheres to a [Contributor Code of Conduct][conduct]. By -participating in this project and its community, you are expected to uphold this -code. - -Much inspiration for this library came from the [Java][javauuid] and -[Python][pyuuid] UUID libraries. - - -## Installation - -The preferred method of installation is via [Composer][]. Run the following -command to install the package and add it as a requirement to your project's -`composer.json`: - -```bash -composer require ramsey/uuid -``` - - -## Upgrading to Version 4 - -See the documentation for a thorough upgrade guide: - -* [Upgrading ramsey/uuid Version 3 to 4](https://uuid.ramsey.dev/en/latest/upgrading/3-to-4.html) - - -## Documentation - -Please see for documentation, tips, examples, and -frequently asked questions. - - -## Contributing - -Contributions are welcome! Please read [CONTRIBUTING.md][] for details. - - -## Copyright and License - -The ramsey/uuid library is copyright © [Ben Ramsey](https://benramsey.com/) and -licensed for use under the MIT License (MIT). Please see [LICENSE][] for more -information. - - -[rfc4122]: http://tools.ietf.org/html/rfc4122 -[conduct]: https://github.com/ramsey/uuid/blob/master/.github/CODE_OF_CONDUCT.md -[javauuid]: http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html -[pyuuid]: http://docs.python.org/3/library/uuid.html -[composer]: http://getcomposer.org/ -[contributing.md]: https://github.com/ramsey/uuid/blob/master/.github/CONTRIBUTING.md - -[badge-source]: https://img.shields.io/badge/source-ramsey/uuid-blue.svg?style=flat-square -[badge-release]: https://img.shields.io/packagist/v/ramsey/uuid.svg?style=flat-square&label=release -[badge-license]: https://img.shields.io/packagist/l/ramsey/uuid.svg?style=flat-square -[badge-php]: https://img.shields.io/packagist/php-v/ramsey/uuid.svg?style=flat-square -[badge-build]: https://img.shields.io/travis/ramsey/uuid/master.svg?style=flat-square -[badge-coverage]: https://img.shields.io/coveralls/github/ramsey/uuid/master.svg?style=flat-square -[badge-downloads]: https://img.shields.io/packagist/dt/ramsey/uuid.svg?style=flat-square&colorB=mediumvioletred - -[source]: https://github.com/ramsey/uuid -[release]: https://packagist.org/packages/ramsey/uuid -[license]: https://github.com/ramsey/uuid/blob/master/LICENSE -[php]: https://php.net -[build]: https://travis-ci.org/ramsey/uuid -[coverage]: https://coveralls.io/github/ramsey/uuid?branch=master -[downloads]: https://packagist.org/packages/ramsey/uuid diff --git a/ramsey/uuid/composer.json b/ramsey/uuid/composer.json deleted file mode 100644 index 41d500b20..000000000 --- a/ramsey/uuid/composer.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "name": "ramsey/uuid", - "type": "library", - "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", - "keywords": [ - "uuid", - "identifier", - "guid" - ], - "homepage": "https://github.com/ramsey/uuid", - "license": "MIT", - "require": { - "php": "^7.2 || ^8", - "ext-json": "*", - "brick/math": "^0.8 || ^0.9", - "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "codeception/aspect-mock": "^3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", - "doctrine/annotations": "^1.8", - "goaop/framework": "^2", - "mockery/mockery": "^1.3", - "moontoast/math": "^1.1", - "paragonie/random-lib": "^2", - "php-mock/php-mock-mockery": "^1.3", - "php-mock/php-mock-phpunit": "^2.5", - "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^0.17.1", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5", - "psy/psysh": "^0.10.0", - "slevomat/coding-standard": "^6.0", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "3.9.4" - }, - "suggest": { - "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", - "ext-ctype": "Enables faster processing of character classification using ctype functions.", - "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", - "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type.", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter" - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Ramsey\\Uuid\\Benchmark\\": "tests/benchmark/", - "Ramsey\\Uuid\\StaticAnalysis\\": "tests/static-analysis/", - "Ramsey\\Uuid\\Test\\": "tests/" - } - }, - "scripts": { - "lint": "parallel-lint src tests", - "phpbench": "phpbench run", - "phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache", - "phpcs": "phpcs --cache=build/cache/phpcs.cache", - "phpstan": [ - "phpstan analyse -c tests/phpstan.neon --no-progress", - "phpstan analyse -c tests/phpstan-tests.neon --no-progress" - ], - "psalm": "psalm --show-info=false --config=tests/psalm.xml", - "phpunit": "phpunit --verbose --colors=always", - "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage", - "test": [ - "@lint", - "@phpbench", - "@phpcs", - "@phpstan", - "@psalm", - "@phpunit" - ] - }, - "support": { - "issues": "https://github.com/ramsey/uuid/issues", - "rss": "https://github.com/ramsey/uuid/releases.atom", - "source": "https://github.com/ramsey/uuid" - } -} diff --git a/sabre/dav/README.md b/sabre/dav/README.md deleted file mode 100644 index 32ca1c3fa..000000000 --- a/sabre/dav/README.md +++ /dev/null @@ -1,39 +0,0 @@ -![sabre's logo](http://sabre.io/img/logo.png) sabre/dav -======================================================= - -Introduction ------------- - -sabre/dav is the most popular WebDAV framework for PHP. Use it to create WebDAV, CalDAV and CardDAV servers. - -Full documentation can be found on the website: - -http://sabre.io/ - - -Build status ------------- - -| branch | status | PHP version | -|------------|---------------------------------------------------------------------------|--------------------| -| master 4.* | ![CI](https://github.com/sabre-io/dav/actions/workflows/ci.yml/badge.svg) | PHP 7.1 up, 8.0 up | -| 3.2 | unmaintained | PHP 5.5 to 7.1 | -| 3.1 | unmaintained | PHP 5.5 | -| 3.0 | unmaintained | PHP 5.4 | -| 2.1 | unmaintained | PHP 5.4 | -| 2.0 | unmaintained | PHP 5.4 | -| 1.8 | unmaintained | PHP 5.3 | -| 1.7 | unmaintained | PHP 5.3 | -| 1.6 | unmaintained | PHP 5.3 | - -Documentation -------------- - -* [Introduction](http://sabre.io/dav/). -* [Installation](http://sabre.io/dav/install/). - - -Made at fruux -------------- - -SabreDAV is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support. diff --git a/sabre/dav/composer.json b/sabre/dav/composer.json deleted file mode 100644 index 5f0a44d66..000000000 --- a/sabre/dav/composer.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "sabre/dav", - "type": "library", - "description": "WebDAV Framework for PHP", - "keywords": ["Framework", "WebDAV", "CalDAV", "CardDAV", "iCalendar"], - "homepage": "http://sabre.io/", - "license" : "BSD-3-Clause", - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage" : "http://evertpot.com/", - "role" : "Developer" - } - ], - "require": { - "php": "^7.1.0 || ^8.0", - "sabre/vobject": "^4.2.1", - "sabre/event" : "^5.0", - "sabre/xml" : "^2.0.1", - "sabre/http" : "^5.0.5", - "sabre/uri" : "^2.0", - "ext-dom": "*", - "ext-pcre": "*", - "ext-spl": "*", - "ext-simplexml": "*", - "ext-mbstring" : "*", - "ext-ctype" : "*", - "ext-date" : "*", - "ext-iconv" : "*", - "lib-libxml" : ">=2.7.0", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "ext-json": "*" - }, - "require-dev" : { - "friendsofphp/php-cs-fixer": "^2.17.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0", - "evert/phpdoc-md" : "~0.1.0", - "monolog/monolog": "^1.18" - }, - "suggest" : { - "ext-curl" : "*", - "ext-pdo" : "*", - "ext-imap": "*" - }, - "autoload": { - "psr-4" : { - "Sabre\\DAV\\" : "lib/DAV/", - "Sabre\\DAVACL\\" : "lib/DAVACL/", - "Sabre\\CalDAV\\" : "lib/CalDAV/", - "Sabre\\CardDAV\\" : "lib/CardDAV/" - } - }, - "autoload-dev" : { - "psr-4" : { - "Sabre\\" : "tests/Sabre/", - "Sabre\\CalDAV\\" : "tests/Sabre/CalDAV", - "Sabre\\CardDAV\\" : "tests/Sabre/CardDAV", - "Sabre\\DAV\\" : "tests/Sabre/DAV", - "Sabre\\DAV\\Property\\" : "tests/Sabre/DAV/Xml/Property", - "Sabre\\DAVACL\\" : "tests/Sabre/DAVACL", - "Sabre\\HTTP\\" : "tests/Sabre/HTTP" - } - }, - "support" : { - "forum" : "https://groups.google.com/group/sabredav-discuss", - "source" : "https://github.com/fruux/sabre-dav" - }, - "bin" : [ - "bin/sabredav", - "bin/naturalselection" - ], - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/sabre/event/composer.json b/sabre/event/composer.json deleted file mode 100644 index 42fb4aa22..000000000 --- a/sabre/event/composer.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "sabre/event", - "description": "sabre/event is a library for lightweight event-based programming", - "keywords": [ - "Events", - "EventEmitter", - "Promise", - "Hooks", - "Plugin", - "Signal", - "Async", - "EventLoop", - "Reactor", - "Coroutine" - ], - "homepage": "http://sabre.io/event/", - "license": "BSD-3-Clause", - "require": { - "php": "^7.1 || ^8.0" - }, - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "source": "https://github.com/fruux/sabre-event" - }, - "autoload": { - "psr-4": { - "Sabre\\Event\\": "lib/" - }, - "files" : [ - "lib/coroutine.php", - "lib/Loop/functions.php", - "lib/Promise/functions.php" - ] - }, - "autoload-dev": { - "psr-4" : { - "Sabre\\Event\\" : "tests/Event" - } - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0" - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/sabre/http/.gitignore b/sabre/http/.gitignore deleted file mode 100644 index 367bba576..000000000 --- a/sabre/http/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Composer -vendor/ -composer.lock - -# Tests -tests/cov/ -.phpunit.result.cache -.php_cs.cache diff --git a/sabre/http/CHANGELOG.md b/sabre/http/CHANGELOG.md deleted file mode 100644 index 4650ea540..000000000 --- a/sabre/http/CHANGELOG.md +++ /dev/null @@ -1,360 +0,0 @@ -ChangeLog -========= - -5.1.5 (2022-07-09) ------------------- - -* #184 Remove 4GB file size workaround for 32bit OS / Stream Videos on IOS (@schoetju) - -5.1.4 (2022-06-24) ------------------- - -* #182 Fix encoding detection on PHP 8.1 (@come-nc) - -5.1.3 (2021-11-04) ------------------- - -* #179 version bump that was missed in 5.1.2 (@phil-davis) - -5.1.2 (2021-11-04) -------------------------- - -* #169 Ensure $_SERVER keys are read as strings (@fredrik-eriksson) -* #170 Fix deprecated usages on PHP 8.1 (@cedric-anne) -* #175 Add resource size to CURL options in client (from #172 ) (@Dartui) - -5.1.1 (2020-10-03) -------------------------- - -* #160: Added support for PHP 8.0 (@phil-davis) - -5.1.0 (2020-01-31) -------------------------- - -* Added support for PHP 7.4, dropped support for PHP 7.0 (@phil-davis) -* Updated testsuite for phpunit8, added phpstan coverage (@phil-davis) -* Added autoload-dev for test classes (@C0pyR1ght) - -5.0.5 (2019-11-28) -------------------------- - -* #138: Fixed possible infinite loop (@dpakach, @vfreex, @phil-davis) -* #136: Improvement regex content-range (@ho4ho) - -5.0.4 (2019-10-08) -------------------------- - -* #133: Fix short Content-Range download - Regression from 5.0.3 (@phil-davis) - -5.0.3 (2019-10-08) -------------------------- - -* #119: Significantly improve file download speed by enabling mmap based stream_copy_to_stream (@vfreex) - -5.0.2 (2019-09-12) -------------------------- - -* #125: Fix Strict Error if Response Body Empty (@WorksDev, @phil-davis) - -5.0.1 (2019-09-11) -------------------------- - -* #121: fix "Trying to access array offset on value of type bool" in 7.4 (@remicollet) -* #115: Reduce memory footprint when parsing HTTP result (@Gasol) -* #114: Misc code improvements (@mrcnpdlk) -* #111, #118: Added phpstan analysis (@DeepDiver1975, @staabm) -* #107: Tested with php 7.3 (@DeepDiver1975) - - -5.0.0 (2018-06-04) -------------------------- - -* #99: Previous CURL opts are not persisted anymore (@christiaan) -* Final release - -5.0.0-alpha1 (2018-02-16) -------------------------- - -* Now requires PHP 7.0+. -* Supports sabre/event 4.x and 5.x -* Depends on sabre/uri 2. -* hhvm is no longer supported starting this release. -* #65: It's now possible to supply request/response bodies using a callback - functions. This allows very high-speed/low-memory responses to be created. - (@petrkotek). -* Strict typing is used every where this is applicable. -* Removed `URLUtil` class. It was deprecated a long time ago, and most of - its functions moved to the `sabre/uri` package. -* Removed `Util` class. Most of its functions moved to the `functions.php` - file. -* #68: The `$method` and `$uri` arguments when constructing a Request object - are now required. -* When `Sapi::getRequest()` is called, we default to setting the HTTP Method - to `CLI`. -* The HTTP response is now initialized with HTTP code `500` instead of `null`, - so if it's not changed, it will be emitted as 500. -* #69: Sending `charset="UTF-8"` on Basic authentication challenges per - [rfc7617][rfc7617]. -* #84: Added support for `SERVER_PROTOCOL HTTP/2.0` (@jens1o) - - -4.2.3 (2017-06-12) ------------------- - -* #74, #77: Work around 4GB file size limit at 32 Bit systems - - -4.2.2 (2017-01-02) ------------------- - -* #72: Handling clients that send invalid `Content-Length` headers. - - -4.2.1 (2016-01-06) ------------------- - -* #56: `getBodyAsString` now returns at most as many bytes as the contents of - the `Content-Length` header. This allows users to pass much larger strings - without having to copy and truncate them. -* The client now sets a default `User-Agent` header identifying this library. - - -4.2.0 (2016-01-04) ------------------- - -* This package now supports sabre/event 3.0. - - -4.1.0 (2015-09-04) ------------------- - -* The async client wouldn't `wait()` for new http requests being started - after the (previous) last request in the queue was resolved. -* Added `Sabre\HTTP\Auth\Bearer`, to easily extract a OAuth2 bearer token. - - -4.0.0 (2015-05-20) ------------------- - -* Deprecated: All static functions from `Sabre\HTTP\URLUtil` and - `Sabre\HTTP\Util` moved to a separate `functions.php`, which is also - autoloaded. The old functions are still there, but will be removed in a - future version. (#49) - - -4.0.0-alpha3 (2015-05-19) -------------------------- - -* Added a parser for the HTTP `Prefer` header, as defined in [RFC7240][rfc7240]. -* Deprecated `Sabre\HTTP\Util::parseHTTPDate`, use `Sabre\HTTP\parseDate()`. -* Deprecated `Sabre\HTTP\Util::toHTTPDate` use `Sabre\HTTP\toDate()`. - - -4.0.0-alpha2 (2015-05-18) -------------------------- - -* #45: Don't send more data than what is promised in the HTTP content-length. - (@dratini0). -* #43: `getCredentials` returns null if incomplete. (@Hywan) -* #48: Now using php-cs-fixer to make our CS consistent (yay!) -* This includes fixes released in version 3.0.5. - - -4.0.0-alpha1 (2015-02-25) -------------------------- - -* #41: Fixing bugs related to comparing URLs in `Request::getPath()`. -* #41: This library now uses the `sabre/uri` package for uri handling. -* Added `421 Misdirected Request` from the HTTP/2.0 spec. - - -3.0.5 (2015-05-11) ------------------- - -* #47 #35: When re-using the client and doing any request after a `HEAD` - request, the client discards the body. - - -3.0.4 (2014-12-10) ------------------- - -* #38: The Authentication helpers no longer overwrite any existing - `WWW-Authenticate` headers, but instead append new headers. This ensures - that multiple authentication systems can exist in the same environment. - - -3.0.3 (2014-12-03) ------------------- - -* Hiding `Authorization` header value from `Request::__toString`. - - -3.0.2 (2014-10-09) ------------------- - -* When parsing `Accept:` headers, we're ignoring invalid parts. Before we - would throw a PHP E_NOTICE. - - -3.0.1 (2014-09-29) ------------------- - -* Minor change in unittests. - - -3.0.0 (2014-09-23) ------------------- - -* `getHeaders()` now returns header values as an array, just like psr/http. -* Added `hasHeader()`. - - -2.1.0-alpha1 (2014-09-15) -------------------------- - -* Changed: Copied most of the header-semantics for the PSR draft for - representing HTTP messages. [Reference here][psr-http]. -* This means that `setHeaders()` does not wipe out every existing header - anymore. -* We also support multiple headers with the same name. -* Use `Request::getHeaderAsArray()` and `Response::getHeaderAsArray()` to - get a hold off multiple headers with the same name. -* If you use `getHeader()`, and there's more than 1 header with that name, we - concatenate all these with a comma. -* `addHeader()` will now preserve an existing header with that name, and add a - second header with the same name. -* The message class should be a lot faster now for looking up headers. No more - array traversal, because we maintain a tiny index. -* Added: `URLUtil::resolve()` to make resolving relative urls super easy. -* Switched to PSR-4. -* #12: Circumventing CURL's FOLLOW_LOCATION and doing it in PHP instead. This - fixes compatibility issues with people that have open_basedir turned on. -* Added: Content negotiation now correctly support mime-type parameters such as - charset. -* Changed: `Util::negotiate()` is now deprecated. Use - `Util::negotiateContentType()` instead. -* #14: The client now only follows http and https urls. - - -2.0.4 (2014-07-14) ------------------- - -* Changed: No longer escaping @ in urls when it's not needed. -* Fixed: #7: Client now correctly deals with responses without a body. - - -2.0.3 (2014-04-17) ------------------- - -* Now works on hhvm! -* Fixed: Now throwing an error when a Request object is being created with - arguments that were valid for sabre/http 1.0. Hopefully this will aid with - debugging for upgraders. - - -2.0.2 (2014-02-09) ------------------- - -* Fixed: Potential security problem in the client. - - -2.0.1 (2014-01-09) ------------------- - -* Fixed: getBodyAsString on an empty body now works. -* Fixed: Version string - - -2.0.0 (2014-01-08) ------------------- - -* Removed: Request::createFromPHPRequest. This is now handled by - Sapi::getRequest. - - -2.0.0alpha6 (2014-01-03) ------------------------- - -* Added: Asynchronous HTTP client. See examples/asyncclient.php. -* Fixed: Issue #4: Don't escape colon (:) when it's not needed. -* Fixed: Fixed a bug in the content negotation script. -* Fixed: Fallback for when CURLOPT_POSTREDIR is not defined (mainly for hhvm). -* Added: The Request and Response object now have a `__toString()` method that - serializes the objects into a standard HTTP message. This is mainly for - debugging purposes. -* Changed: Added Response::getStatusText(). This method returns the - human-readable HTTP status message. This part has been removed from - Response::getStatus(), which now always returns just the status code as an - int. -* Changed: Response::send() is now Sapi::sendResponse($response). -* Changed: Request::createFromPHPRequest is now Sapi::getRequest(). -* Changed: Message::getBodyAsStream and Message::getBodyAsString were added. The - existing Message::getBody changed it's behavior, so be careful. - - -2.0.0alpha5 (2013-11-07) ------------------------- - -* Added: HTTP Status 451 Unavailable For Legal Reasons. Fight government - censorship! -* Added: Ability to catch and retry http requests in the client when a curl - error occurs. -* Changed: Request::getPath does not return the query part of the url, so - everything after the ? is stripped. -* Added: a reverse proxy example. - - -2.0.0alpha4 (2013-08-07) ------------------------- - -* Fixed: Doing a GET request with the client uses the last used HTTP method - instead. -* Added: HttpException -* Added: The Client class can now automatically emit exceptions when HTTP errors - occurred. - - -2.0.0alpha3 (2013-07-24) ------------------------- - -* Changed: Now depends on sabre/event package. -* Changed: setHeaders() now overwrites any existing http headers. -* Added: getQueryParameters to RequestInterface. -* Added: Util::negotiate. -* Added: RequestDecorator, ResponseDecorator. -* Added: A very simple HTTP client. -* Added: addHeaders() to append a list of new headers. -* Fixed: Not erroring on unknown HTTP status codes. -* Fixed: Throwing exceptions on invalid HTTP status codes (not 3 digits). -* Fixed: Much better README.md -* Changed: getBody() now uses a bitfield to specify what type to return. - - -2.0.0alpha2 (2013-07-02) ------------------------- - -* Added: Digest & AWS Authentication. -* Added: Message::getHttpVersion and Message::setHttpVersion. -* Added: Request::setRawServerArray, getRawServerValue. -* Added: Request::createFromPHPRequest -* Added: Response::send -* Added: Request::getQueryParameters -* Added: Utility for dealing with HTTP dates. -* Added: Request::setPostData and Request::getPostData. -* Added: Request::setAbsoluteUrl and Request::getAbsoluteUrl. -* Added: URLUtil, methods for calculation relative and base urls. -* Removed: Response::sendBody - - -2.0.0alpha1 (2012-10-07) ------------------------- - -* Fixed: Lots of small naming improvements -* Added: Introduction of Message, MessageInterface, Response, ResponseInterface. - -Before 2.0.0, this package was built-into SabreDAV, where it first appeared in -January 2009. - -[psr-http]: https://github.com/php-fig/fig-standards/blob/master/proposed/http-message.md -[rfc7240]: http://tools.ietf.org/html/rfc7240 -[rfc7617]: https://tools.ietf.org/html/rfc7617 diff --git a/sabre/http/README.md b/sabre/http/README.md deleted file mode 100644 index 8159b4d49..000000000 --- a/sabre/http/README.md +++ /dev/null @@ -1,747 +0,0 @@ -sabre/http -========== - -This library provides a toolkit to make working with the [HTTP protocol](https://tools.ietf.org/html/rfc2616) easier. - -Most PHP scripts run within a HTTP request but accessing information about the -HTTP request is cumbersome at least. - -There's bad practices, inconsistencies and confusion. This library is -effectively a wrapper around the following PHP constructs: - -For Input: - -* `$_GET`, -* `$_POST`, -* `$_SERVER`, -* `php://input` or `$HTTP_RAW_POST_DATA`. - -For output: - -* `php://output` or `echo`, -* `header()`. - -What this library provides, is a `Request` object, and a `Response` object. - -The objects are extendable and easily mockable. - -Build status ------------- - -| branch | status | -| ------ | ------ | -| master | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=master)](https://travis-ci.org/sabre-io/http) | -| 4.2 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=4.2)](https://travis-ci.org/sabre-io/http) | -| 3.0 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=3.0)](https://travis-ci.org/sabre-io/http) | - -Installation ------------- - -Make sure you have [composer][1] installed. In your project directory, create, -or edit a `composer.json` file, and make sure it contains something like this: - -```json -{ - "require" : { - "sabre/http" : "~5.0.0" - } -} -``` - -After that, just hit `composer install` and you should be rolling. - -Quick history -------------- - -This library came to existence in 2009, as a part of the [`sabre/dav`][2] -project, which uses it heavily. - -It got split off into a separate library to make it easier to manage -releases and hopefully giving it use outside of the scope of just `sabre/dav`. - -Although completely independently developed, this library has a LOT of -overlap with [Symfony's `HttpFoundation`][3]. - -Said library does a lot more stuff and is significantly more popular, -so if you are looking for something to fulfill this particular requirement, -I'd recommend also considering [`HttpFoundation`][3]. - - -Getting started ---------------- - -First and foremost, this library wraps the superglobals. The easiest way to -instantiate a request object is as follows: - -```php -use Sabre\HTTP; - -include 'vendor/autoload.php'; - -$request = HTTP\Sapi::getRequest(); -``` - -This line should only happen once in your entire application. Everywhere else -you should pass this request object around using dependency injection. - -You should always typehint on it's interface: - -```php -function handleRequest(HTTP\RequestInterface $request) { - - // Do something with this request :) - -} -``` - -A response object you can just create as such: - -```php -use Sabre\HTTP; - -include 'vendor/autoload.php'; - -$response = new HTTP\Response(); -$response->setStatus(201); // created ! -$response->setHeader('X-Foo', 'bar'); -$response->setBody( - 'success!' -); - -``` - -After you fully constructed your response, you must call: - -```php -HTTP\Sapi::sendResponse($response); -``` - -This line should generally also appear once in your application (at the very -end). - -Decorators ----------- - -It may be useful to extend the `Request` and `Response` objects in your -application, if you for example would like them to carry a bit more -information about the current request. - -For instance, you may want to add an `isLoggedIn` method to the Request -object. - -Simply extending Request and Response may pose some problems: - -1. You may want to extend the objects with new behaviors differently, in - different subsystems of your application, -2. The `Sapi::getRequest` factory always returns a instance of - `Request` so you would have to override the factory method as well, -3. By controlling the instantation and depend on specific `Request` and - `Response` instances in your library or application, you make it harder to - work with other applications which also use `sabre/http`. - -In short: it would be bad design. Instead, it's recommended to use the -[decorator pattern][6] to add new behavior where you need it. `sabre/http` -provides helper classes to quickly do this. - -Example: - -```php -use Sabre\HTTP; - -class MyRequest extends HTTP\RequestDecorator { - - function isLoggedIn() { - - return true; - - } - -} -``` - -Our application assumes that the true `Request` object was instantiated -somewhere else, by some other subsystem. This could simply be a call like -`$request = Sapi::getRequest()` at the top of your application, -but could also be somewhere in a unittest. - -All we know in the current subsystem, is that we received a `$request` and -that it implements `Sabre\HTTP\RequestInterface`. To decorate this object, -all we need to do is: - -```php -$request = new MyRequest($request); -``` - -And that's it, we now have an `isLoggedIn` method, without having to mess -with the core instances. - - -Client ------- - -This package also contains a simple wrapper around [cURL][4], which will allow -you to write simple clients, using the `Request` and `Response` objects you're -already familiar with. - -It's by no means a replacement for something like [Guzzle][7], but it provides -a simple and lightweight API for making the occasional API call. - -### Usage - -```php -use Sabre\HTTP; - -$request = new HTTP\Request('GET', 'http://example.org/'); -$request->setHeader('X-Foo', 'Bar'); - -$client = new HTTP\Client(); -$response = $client->send($request); - -echo $response->getBodyAsString(); -``` - -The client emits 3 event using [`sabre/event`][5]. `beforeRequest`, -`afterRequest` and `error`. - -```php -$client = new HTTP\Client(); -$client->on('beforeRequest', function($request) { - - // You could use beforeRequest to for example inject a few extra headers. - // into the Request object. - -}); - -$client->on('afterRequest', function($request, $response) { - - // The afterRequest event could be a good time to do some logging, or - // do some rewriting in the response. - -}); - -$client->on('error', function($request, $response, &$retry, $retryCount) { - - // The error event is triggered for every response with a HTTP code higher - // than 399. - -}); - -$client->on('error:401', function($request, $response, &$retry, $retryCount) { - - // You can also listen for specific error codes. This example shows how - // to inject HTTP authentication headers if a 401 was returned. - - if ($retryCount > 1) { - // We're only going to retry exactly once. - } - - $request->setHeader('Authorization', 'Basic xxxxxxxxxx'); - $retry = true; - -}); -``` - -### Asynchronous requests - -The `Client` also supports doing asynchronous requests. This is especially handy -if you need to perform a number of requests, that are allowed to be executed -in parallel. - -The underlying system for this is simply [cURL's multi request handler][8], -but this provides a much nicer API to handle this. - -Sample usage: - -```php - -use Sabre\HTTP; - -$request = new Request('GET', 'http://localhost/'); -$client = new Client(); - -// Executing 1000 requests -for ($i = 0; $i < 1000; $i++) { - $client->sendAsync( - $request, - function(ResponseInterface $response) { - // Success handler - }, - function($error) { - // Error handler - } - ); -} - -// Wait for all requests to get a result. -$client->wait(); - -``` - -Check out `examples/asyncclient.php` for more information. - -Writing a reverse proxy ------------------------ - -With all these tools combined, it becomes very easy to write a simple reverse -http proxy. - -```php -use - Sabre\HTTP\Sapi, - Sabre\HTTP\Client; - -// The url we're proxying to. -$remoteUrl = 'http://example.org/'; - -// The url we're proxying from. Please note that this must be a relative url, -// and basically acts as the base url. -// -// If youre $remoteUrl doesn't end with a slash, this one probably shouldn't -// either. -$myBaseUrl = '/reverseproxy.php'; -// $myBaseUrl = '/~evert/sabre/http/examples/reverseproxy.php/'; - -$request = Sapi::getRequest(); -$request->setBaseUrl($myBaseUrl); - -$subRequest = clone $request; - -// Removing the Host header. -$subRequest->removeHeader('Host'); - -// Rewriting the url. -$subRequest->setUrl($remoteUrl . $request->getPath()); - -$client = new Client(); - -// Sends the HTTP request to the server -$response = $client->send($subRequest); - -// Sends the response back to the client that connected to the proxy. -Sapi::sendResponse($response); -``` - -The Request and Response API's ------------------------------- - -### Request - -```php - -/** - * Creates the request object - * - * @param string $method - * @param string $url - * @param array $headers - * @param resource $body - */ -public function __construct($method = null, $url = null, array $headers = null, $body = null); - -/** - * Returns the current HTTP method - * - * @return string - */ -function getMethod(); - -/** - * Sets the HTTP method - * - * @param string $method - * @return void - */ -function setMethod($method); - -/** - * Returns the request url. - * - * @return string - */ -function getUrl(); - -/** - * Sets the request url. - * - * @param string $url - * @return void - */ -function setUrl($url); - -/** - * Returns the absolute url. - * - * @return string - */ -function getAbsoluteUrl(); - -/** - * Sets the absolute url. - * - * @param string $url - * @return void - */ -function setAbsoluteUrl($url); - -/** - * Returns the current base url. - * - * @return string - */ -function getBaseUrl(); - -/** - * Sets a base url. - * - * This url is used for relative path calculations. - * - * The base url should default to / - * - * @param string $url - * @return void - */ -function setBaseUrl($url); - -/** - * Returns the relative path. - * - * This is being calculated using the base url. This path will not start - * with a slash, so it will always return something like - * 'example/path.html'. - * - * If the full path is equal to the base url, this method will return an - * empty string. - * - * This method will also urldecode the path, and if the url was incoded as - * ISO-8859-1, it will convert it to UTF-8. - * - * If the path is outside of the base url, a LogicException will be thrown. - * - * @return string - */ -function getPath(); - -/** - * Returns the list of query parameters. - * - * This is equivalent to PHP's $_GET superglobal. - * - * @return array - */ -function getQueryParameters(); - -/** - * Returns the POST data. - * - * This is equivalent to PHP's $_POST superglobal. - * - * @return array - */ -function getPostData(); - -/** - * Sets the post data. - * - * This is equivalent to PHP's $_POST superglobal. - * - * This would not have been needed, if POST data was accessible as - * php://input, but unfortunately we need to special case it. - * - * @param array $postData - * @return void - */ -function setPostData(array $postData); - -/** - * Returns an item from the _SERVER array. - * - * If the value does not exist in the array, null is returned. - * - * @param string $valueName - * @return string|null - */ -function getRawServerValue($valueName); - -/** - * Sets the _SERVER array. - * - * @param array $data - * @return void - */ -function setRawServerData(array $data); - -/** - * Returns the body as a readable stream resource. - * - * Note that the stream may not be rewindable, and therefore may only be - * read once. - * - * @return resource - */ -function getBodyAsStream(); - -/** - * Returns the body as a string. - * - * Note that because the underlying data may be based on a stream, this - * method could only work correctly the first time. - * - * @return string - */ -function getBodyAsString(); - -/** - * Returns the message body, as it's internal representation. - * - * This could be either a string or a stream. - * - * @return resource|string - */ -function getBody(); - -/** - * Updates the body resource with a new stream. - * - * @param resource $body - * @return void - */ -function setBody($body); - -/** - * Returns all the HTTP headers as an array. - * - * @return array - */ -function getHeaders(); - -/** - * Returns a specific HTTP header, based on it's name. - * - * The name must be treated as case-insensitive. - * - * If the header does not exist, this method must return null. - * - * @param string $name - * @return string|null - */ -function getHeader($name); - -/** - * Updates a HTTP header. - * - * The case-sensitity of the name value must be retained as-is. - * - * @param string $name - * @param string $value - * @return void - */ -function setHeader($name, $value); - -/** - * Resets HTTP headers - * - * This method overwrites all existing HTTP headers - * - * @param array $headers - * @return void - */ -function setHeaders(array $headers); - -/** - * Adds a new set of HTTP headers. - * - * Any header specified in the array that already exists will be - * overwritten, but any other existing headers will be retained. - * - * @param array $headers - * @return void - */ -function addHeaders(array $headers); - -/** - * Removes a HTTP header. - * - * The specified header name must be treated as case-insenstive. - * This method should return true if the header was successfully deleted, - * and false if the header did not exist. - * - * @return bool - */ -function removeHeader($name); - -/** - * Sets the HTTP version. - * - * Should be 1.0, 1.1 or 2.0. - * - * @param string $version - * @return void - */ -function setHttpVersion($version); - -/** - * Returns the HTTP version. - * - * @return string - */ -function getHttpVersion(); -``` - -### Response - -```php -/** - * Returns the current HTTP status. - * - * This is the status-code as well as the human readable string. - * - * @return string - */ -function getStatus(); - -/** - * Sets the HTTP status code. - * - * This can be either the full HTTP status code with human readable string, - * for example: "403 I can't let you do that, Dave". - * - * Or just the code, in which case the appropriate default message will be - * added. - * - * @param string|int $status - * @throws \InvalidArgumentExeption - * @return void - */ -function setStatus($status); - -/** - * Returns the body as a readable stream resource. - * - * Note that the stream may not be rewindable, and therefore may only be - * read once. - * - * @return resource - */ -function getBodyAsStream(); - -/** - * Returns the body as a string. - * - * Note that because the underlying data may be based on a stream, this - * method could only work correctly the first time. - * - * @return string - */ -function getBodyAsString(); - -/** - * Returns the message body, as it's internal representation. - * - * This could be either a string or a stream. - * - * @return resource|string - */ -function getBody(); - - -/** - * Updates the body resource with a new stream. - * - * @param resource $body - * @return void - */ -function setBody($body); - -/** - * Returns all the HTTP headers as an array. - * - * @return array - */ -function getHeaders(); - -/** - * Returns a specific HTTP header, based on it's name. - * - * The name must be treated as case-insensitive. - * - * If the header does not exist, this method must return null. - * - * @param string $name - * @return string|null - */ -function getHeader($name); - -/** - * Updates a HTTP header. - * - * The case-sensitity of the name value must be retained as-is. - * - * @param string $name - * @param string $value - * @return void - */ -function setHeader($name, $value); - -/** - * Resets HTTP headers - * - * This method overwrites all existing HTTP headers - * - * @param array $headers - * @return void - */ -function setHeaders(array $headers); - -/** - * Adds a new set of HTTP headers. - * - * Any header specified in the array that already exists will be - * overwritten, but any other existing headers will be retained. - * - * @param array $headers - * @return void - */ -function addHeaders(array $headers); - -/** - * Removes a HTTP header. - * - * The specified header name must be treated as case-insenstive. - * This method should return true if the header was successfully deleted, - * and false if the header did not exist. - * - * @return bool - */ -function removeHeader($name); - -/** - * Sets the HTTP version. - * - * Should be 1.0, 1.1 or 2.0. - * - * @param string $version - * @return void - */ -function setHttpVersion($version); - -/** - * Returns the HTTP version. - * - * @return string - */ -function getHttpVersion(); -``` - -Made at fruux -------------- - -This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support. - -[1]: http://getcomposer.org/ -[2]: http://sabre.io/ -[3]: https://github.com/symfony/HttpFoundation -[4]: http://php.net/curl -[5]: https://github.com/fruux/sabre-event -[6]: http://en.wikipedia.org/wiki/Decorator_pattern -[7]: http://guzzlephp.org/ -[8]: http://php.net/curl_multi_init diff --git a/sabre/http/composer.json b/sabre/http/composer.json deleted file mode 100644 index 353646a28..000000000 --- a/sabre/http/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "sabre/http", - "description" : "The sabre/http library provides utilities for dealing with http requests and responses. ", - "keywords" : [ "HTTP" ], - "homepage" : "https://github.com/fruux/sabre-http", - "license" : "BSD-3-Clause", - "require" : { - "php" : "^7.1 || ^8.0", - "ext-mbstring" : "*", - "ext-ctype" : "*", - "ext-curl" : "*", - "sabre/event" : ">=4.0 <6.0", - "sabre/uri" : "^2.0" - }, - "require-dev" : { - "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0" - }, - "suggest" : { - "ext-curl" : " to make http requests with the Client class" - }, - "authors" : [ - { - "name" : "Evert Pot", - "email" : "me@evertpot.com", - "homepage" : "http://evertpot.com/", - "role" : "Developer" - } - ], - "support" : { - "forum" : "https://groups.google.com/group/sabredav-discuss", - "source" : "https://github.com/fruux/sabre-http" - }, - "autoload" : { - "files" : [ - "lib/functions.php" - ], - "psr-4" : { - "Sabre\\HTTP\\" : "lib/" - } - }, - "autoload-dev" : { - "psr-4" : { - "Sabre\\HTTP\\" : "tests/HTTP" - } - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/sabre/uri/.gitignore b/sabre/uri/.gitignore deleted file mode 100644 index a6c2b5a25..000000000 --- a/sabre/uri/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Composer -vendor/ -composer.lock - -# Tests -tests/cov/ -tests/.phpunit.result.cache -.php_cs.cache diff --git a/sabre/uri/composer.json b/sabre/uri/composer.json deleted file mode 100644 index d58fd51f7..000000000 --- a/sabre/uri/composer.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "sabre/uri", - "description": "Functions for making sense out of URIs.", - "keywords": [ - "URI", - "URL", - "rfc3986" - ], - "homepage": "http://sabre.io/uri/", - "license": "BSD-3-Clause", - "require": { - "php": "^7.1 || ^8.0" - }, - "authors": [ - { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" - } - ], - "support": { - "forum": "https://groups.google.com/group/sabredav-discuss", - "source": "https://github.com/fruux/sabre-uri" - }, - "autoload": { - "files" : [ - "lib/functions.php" - ], - "psr-4" : { - "Sabre\\Uri\\" : "lib/" - } - }, - "autoload-dev": { - "psr-4": { - "Sabre\\Uri\\": "tests/Uri" - } - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0" - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/sabre/vobject/README.md b/sabre/vobject/README.md deleted file mode 100644 index 659e3fa83..000000000 --- a/sabre/vobject/README.md +++ /dev/null @@ -1,55 +0,0 @@ -sabre/vobject -============= - -The VObject library allows you to easily parse and manipulate [iCalendar](https://tools.ietf.org/html/rfc5545) -and [vCard](https://tools.ietf.org/html/rfc6350) objects using PHP. - -The goal of the VObject library is to create a very complete library, with an easy-to-use API. - - -Installation ------------- - -Make sure you have [Composer][1] installed, and then run: - - composer require sabre/vobject "^4.0" - -This package requires PHP 5.5. If you need the PHP 5.3/5.4 version of this package instead, use: - - - composer require sabre/vobject "^3.4" - - -Usage ------ - -* [Working with vCards](http://sabre.io/vobject/vcard/) -* [Working with iCalendar](http://sabre.io/vobject/icalendar/) - - - -Build status ------------- - -| branch | status | -| ------ | ------ | -| master | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=master)](https://travis-ci.org/sabre-io/vobject) | -| 3.5 | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=3.5)](https://travis-ci.org/sabre-io/vobject) | -| 3.4 | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=3.4)](https://travis-ci.org/sabre-io/vobject) | -| 3.1 | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=3.1)](https://travis-ci.org/sabre-io/vobject) | -| 2.1 | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=2.1)](https://travis-ci.org/sabre-io/vobject) | -| 2.0 | [![Build Status](https://travis-ci.org/sabre-io/vobject.svg?branch=2.0)](https://travis-ci.org/sabre-io/vobject) | - - - -Support -------- - -Head over to the [SabreDAV mailing list](http://groups.google.com/group/sabredav-discuss) for any questions. - -Made at fruux -------------- - -This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support. - -[1]: https://getcomposer.org/ diff --git a/sabre/vobject/composer.json b/sabre/vobject/composer.json deleted file mode 100644 index b745b1fa6..000000000 --- a/sabre/vobject/composer.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "name": "sabre/vobject", - "description" : "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects", - "keywords" : [ - "iCalendar", - "iCal", - "vCalendar", - "vCard", - "jCard", - "jCal", - "ics", - "vcf", - "xCard", - "xCal", - "freebusy", - "recurrence", - "availability", - "rfc2425", - "rfc2426", - "rfc2739", - "rfc4770", - "rfc5545", - "rfc5546", - "rfc6321", - "rfc6350", - "rfc6351", - "rfc6474", - "rfc6638", - "rfc6715", - "rfc6868" - ], - "homepage" : "http://sabre.io/vobject/", - "license" : "BSD-3-Clause", - "require" : { - "php" : "^7.1 || ^8.0", - "ext-mbstring" : "*", - "sabre/xml" : "^2.1" - }, - "require-dev" : { - "friendsofphp/php-cs-fixer": "~2.17.1", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0", - "phpunit/php-invoker" : "^2.0 || ^3.1", - "phpstan/phpstan": "^0.12" - }, - "suggest" : { - "hoa/bench" : "If you would like to run the benchmark scripts" - }, - "authors" : [ - { - "name" : "Evert Pot", - "email" : "me@evertpot.com", - "homepage" : "http://evertpot.com/", - "role" : "Developer" - }, - { - "name" : "Dominik Tobschall", - "email" : "dominik@fruux.com", - "homepage" : "http://tobschall.de/", - "role" : "Developer" - }, - { - "name" : "Ivan Enderlin", - "email" : "ivan.enderlin@hoa-project.net", - "homepage" : "http://mnt.io/", - "role" : "Developer" - } - ], - "support" : { - "forum" : "https://groups.google.com/group/sabredav-discuss", - "source" : "https://github.com/fruux/sabre-vobject" - }, - "autoload" : { - "psr-4" : { - "Sabre\\VObject\\" : "lib/" - } - }, - "autoload-dev" : { - "psr-4" : { - "Sabre\\VObject\\" : "tests/VObject" - } - }, - "bin" : [ - "bin/vobject", - "bin/generate_vcards" - ], - "extra" : { - "branch-alias" : { - "dev-master" : "4.0.x-dev" - } - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/sabre/xml/README.md b/sabre/xml/README.md deleted file mode 100644 index 55af24fc6..000000000 --- a/sabre/xml/README.md +++ /dev/null @@ -1,25 +0,0 @@ -sabre/xml -========= - -[![Build Status](https://secure.travis-ci.org/sabre-io/xml.svg?branch=master)](http://travis-ci.org/sabre-io/xml) - -The sabre/xml library is a specialized XML reader and writer. - -Documentation -------------- - -* [Introduction](http://sabre.io/xml/). -* [Installation](http://sabre.io/xml/install/). -* [Reading XML](http://sabre.io/xml/reading/). -* [Writing XML](http://sabre.io/xml/writing/). - - -Support -------- - -Head over to the [SabreDAV mailing list](http://groups.google.com/group/sabredav-discuss) for any questions. - -Made at fruux -------------- - -This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support. diff --git a/sabre/xml/composer.json b/sabre/xml/composer.json deleted file mode 100644 index 4524cf59b..000000000 --- a/sabre/xml/composer.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "sabre/xml", - "description" : "sabre/xml is an XML library that you may not hate.", - "keywords" : [ "XML", "XMLReader", "XMLWriter", "DOM" ], - "homepage" : "https://sabre.io/xml/", - "license" : "BSD-3-Clause", - "require" : { - "php" : "^7.1 || ^8.0", - "ext-xmlwriter" : "*", - "ext-xmlreader" : "*", - "ext-dom" : "*", - "lib-libxml" : ">=2.6.20", - "sabre/uri" : ">=1.0,<3.0.0" - }, - "authors" : [ - { - "name" : "Evert Pot", - "email" : "me@evertpot.com", - "homepage" : "http://evertpot.com/", - "role" : "Developer" - }, - { - "name": "Markus Staab", - "email": "markus.staab@redaxo.de", - "role" : "Developer" - } - ], - "support" : { - "forum" : "https://groups.google.com/group/sabredav-discuss", - "source" : "https://github.com/fruux/sabre-xml" - }, - "autoload" : { - "psr-4" : { - "Sabre\\Xml\\" : "lib/" - }, - "files": [ - "lib/Deserializer/functions.php", - "lib/Serializer/functions.php" - ] - }, - "autoload-dev" : { - "psr-4" : { - "Sabre\\Xml\\" : "tests/Sabre/Xml/" - } - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.17.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0" - }, - "scripts": { - "phpstan": [ - "phpstan analyse lib tests" - ], - "cs-fixer": [ - "php-cs-fixer fix" - ], - "phpunit": [ - "phpunit --configuration tests/phpunit.xml" - ], - "test": [ - "composer phpstan", - "composer cs-fixer", - "composer phpunit" - ] - } -} diff --git a/scssphp/scssphp/README.md b/scssphp/scssphp/README.md deleted file mode 100644 index 65bb93ea7..000000000 --- a/scssphp/scssphp/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# scssphp -### - -![Build](https://github.com/scssphp/scssphp/workflows/CI/badge.svg) -[![License](https://poser.pugx.org/scssphp/scssphp/license)](https://packagist.org/packages/scssphp/scssphp) - -`scssphp` is a compiler for SCSS written in PHP. - -Checkout the homepage, , for directions on how to use. - -## Running Tests - -`scssphp` uses [PHPUnit](https://github.com/sebastianbergmann/phpunit) for testing. - -Run the following command from the root directory to run every test: - - vendor/bin/phpunit tests - -There are several tests in the `tests/` directory: - -* `ApiTest.php` contains various unit tests that test the PHP interface. -* `ExceptionTest.php` contains unit tests that test for exceptions thrown by the parser and compiler. -* `FailingTest.php` contains tests reported in Github issues that demonstrate compatibility bugs. -* `InputTest.php` compiles every `.scss` file in the `tests/inputs` directory - then compares to the respective `.css` file in the `tests/outputs` directory. -* `SassSpecTest.php` extracts tests from the `sass/sass-spec` repository. - -When changing any of the tests in `tests/inputs`, the tests will most likely -fail because the output has changed. Once you verify that the output is correct -you can run the following command to rebuild all the tests: - - BUILD=1 vendor/bin/phpunit tests - -This will compile all the tests, and save results into `tests/outputs`. It also -updates the list of excluded specs from sass-spec. - -To enable the full `sass-spec` compatibility tests: - - TEST_SASS_SPEC=1 vendor/bin/phpunit tests - -## Coding Standard - -`scssphp` source conforms to [PSR12](https://www.php-fig.org/psr/psr-12/). - -Run the following command from the root directory to check the code for "sniffs". - - vendor/bin/phpcs --standard=PSR12 --extensions=php bin src tests *.php - -## Static Analysis - -`scssphp` uses [phpstan](https://phpstan.org/) for static analysis. - -Run the following command from the root directory to analyse the codebase: - - make phpstan - -As most of the codebase is composed of legacy code which cannot be type-checked -fully, the setup contains a baseline file with all errors we want to ignore. In -particular, we ignore all errors related to not specifying the types inside arrays -when these arrays correspond to the representation of Sass values and Sass AST nodes -in the parser and compiler. -When contributing, the proper process to deal with static analysis is the following: - -1. Make your change in the codebase -2. Run `make phpstan` -3. Fix errors reported by phpstan when possible -4. Repeat step 2 and 3 until nothing gets fixed anymore at step 3 -5. Run `make phpstan-baseline` to regenerate the phpstan baseline - -Additions to the baseline will be reviewed to avoid ignoring errors that should have -been fixed. diff --git a/scssphp/scssphp/composer.json b/scssphp/scssphp/composer.json deleted file mode 100644 index 86cd396bf..000000000 --- a/scssphp/scssphp/composer.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "name": "scssphp/scssphp", - "type": "library", - "description": "scssphp is a compiler for SCSS written in PHP.", - "keywords": ["css", "stylesheet", "scss", "sass", "less"], - "homepage": "http://scssphp.github.io/scssphp/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthon Pang", - "email": "apang@softwaredevelopment.ca", - "homepage": "https://github.com/robocoder" - }, - { - "name": "Cédric Morin", - "email": "cedric@yterium.com", - "homepage": "https://github.com/Cerdic" - } - ], - "autoload": { - "psr-4": { "ScssPhp\\ScssPhp\\": "src/" } - }, - "autoload-dev": { - "psr-4": { "ScssPhp\\ScssPhp\\Tests\\": "tests/" } - }, - "require": { - "php": ">=5.6.0", - "ext-json": "*", - "ext-ctype": "*" - }, - "suggest": { - "ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv", - "ext-iconv": "Can be used as fallback when ext-mbstring is not available" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4", - "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3 || ^9.4", - "sass/sass-spec": "*", - "squizlabs/php_codesniffer": "~3.5", - "symfony/phpunit-bridge": "^5.1", - "thoughtbot/bourbon": "^7.0", - "twbs/bootstrap": "~5.0", - "twbs/bootstrap4": "4.6.0", - "zurb/foundation": "~6.5" - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "sass/sass-spec", - "version": "2021.09.15", - "source": { - "type": "git", - "url": "https://github.com/sass/sass-spec.git", - "reference": "eb2d7a0865c1faf0b55a39ff962b24aca9b4c955" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sass/sass-spec/zipball/eb2d7a0865c1faf0b55a39ff962b24aca9b4c955", - "reference": "eb2d7a0865c1faf0b55a39ff962b24aca9b4c955", - "shasum": "" - } - } - }, - { - "type": "package", - "package": { - "name": "thoughtbot/bourbon", - "version": "v7.0.0", - "source": { - "type": "git", - "url": "https://github.com/thoughtbot/bourbon.git", - "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thoughtbot/bourbon/zipball/fbe338ee6807e7f7aa996d82c8a16f248bb149b3", - "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3", - "shasum": "" - } - } - }, - { - "type": "package", - "package": { - "name": "twbs/bootstrap4", - "version": "v4.6.0", - "source": { - "type": "git", - "url": "https://github.com/twbs/bootstrap.git", - "reference": "6ffb0b48e455430f8a5359ed689ad64c1143fac2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twbs/bootstrap/zipball/6ffb0b48e455430f8a5359ed689ad64c1143fac2", - "reference": "6ffb0b48e455430f8a5359ed689ad64c1143fac2", - "shasum": "" - } - } - } - ], - "bin": ["bin/pscss"], - "config": { - "sort-packages": true - } -} diff --git a/spomky-labs/base64url/composer.json b/spomky-labs/base64url/composer.json deleted file mode 100644 index 1f3941b9e..000000000 --- a/spomky-labs/base64url/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "spomky-labs/base64url", - "description": "Base 64 URL Safe Encoding/Decoding PHP Library", - "type": "library", - "license": "MIT", - "keywords": ["Base64", "URL", "Safe", "RFC4648"], - "homepage": "https://github.com/Spomky-Labs/base64url", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky-Labs/base64url/contributors" - } - ], - "autoload": { - "psr-4": { - "Base64Url\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Base64Url\\Test\\": "tests/" - } - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.11|^0.12", - "phpstan/phpstan-beberlei-assert": "^0.11|^0.12", - "phpstan/phpstan-deprecation-rules": "^0.11|^0.12", - "phpstan/phpstan-phpunit": "^0.11|^0.12", - "phpstan/phpstan-strict-rules": "^0.11|^0.12" - } -} diff --git a/spomky-labs/cbor-php/CODE_OF_CONDUCT.md b/spomky-labs/cbor-php/CODE_OF_CONDUCT.md deleted file mode 100644 index 4ec12c72b..000000000 --- a/spomky-labs/cbor-php/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@spomky-labs.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/spomky-labs/cbor-php/composer.json b/spomky-labs/cbor-php/composer.json deleted file mode 100644 index b3dc344be..000000000 --- a/spomky-labs/cbor-php/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "spomky-labs/cbor-php", - "type": "library", - "license": "MIT", - "keywords": ["CBOR", "Concise Binary Object Representation", "RFC7049"], - "description": "CBOR Encoder/Decoder for PHP", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - },{ - "name": "All contributors", - "homepage": "https://github.com/Spomky-Labs/cbor-php/contributors" - } - ], - "autoload": { - "psr-4": { - "CBOR\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "CBOR\\Test\\": "tests/" - } - }, - "require": { - "php": ">=7.3", - "brick/math": "^0.8.15|^0.9.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-beberlei-assert": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12" - }, - "suggest": { - "ext-gmp": "GMP or BCMath extensions will drastically improve the library performance", - "ext-bcmath": "GMP or BCMath extensions will drastically improve the library performance. BCMath extension needed to handle the Big Float and Decimal Fraction Tags" - } -} diff --git a/swiftmailer/swiftmailer/.php_cs.dist b/swiftmailer/swiftmailer/.php_cs.dist deleted file mode 100644 index 563b48b90..000000000 --- a/swiftmailer/swiftmailer/.php_cs.dist +++ /dev/null @@ -1,21 +0,0 @@ -setRules([ - '@Symfony' => true, - '@Symfony:risky' => true, - '@PHPUnit75Migration:risky' => true, - 'php_unit_dedicate_assert' => ['target' => '5.6'], - 'array_syntax' => ['syntax' => 'short'], - 'php_unit_fqcn_annotation' => true, - 'no_unreachable_default_argument_value' => false, - 'braces' => ['allow_single_line_closure' => true], - 'heredoc_to_nowdoc' => false, - 'ordered_imports' => true, - 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'], - 'fopen_flags' => false, - ]) - ->setRiskyAllowed(true) - ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) -; diff --git a/swiftmailer/swiftmailer/README.md b/swiftmailer/swiftmailer/README.md deleted file mode 100644 index 788d7223b..000000000 --- a/swiftmailer/swiftmailer/README.md +++ /dev/null @@ -1,25 +0,0 @@ -Swift Mailer ------------- - -**Swiftmailer will stop being maintained at the end of November 2021.** - -Please, move to [Symfony Mailer](https://symfony.com/doc/current/mailer.html) at your earliest convenience. -[Symfony Mailer](https://symfony.com/doc/current/mailer.html) is the next evolution of Swiftmailer. -It provides the same features with support for modern PHP code and support for third-party providers. - -Swift Mailer is a component based mailing solution for PHP. -It is released under the MIT license. - -Swift Mailer is highly object-oriented by design and lends itself -to use in complex web application with a great deal of flexibility. - -For full details on usage, read the [documentation](https://swiftmailer.symfony.com/docs/introduction.html). - -Sponsors --------- - - diff --git a/symfony/console/CHANGELOG.md b/symfony/console/CHANGELOG.md deleted file mode 100644 index 515924455..000000000 --- a/symfony/console/CHANGELOG.md +++ /dev/null @@ -1,162 +0,0 @@ -CHANGELOG -========= - -4.4.0 ------ - - * deprecated finding hidden commands using an abbreviation, use the full name instead - * added `Question::setTrimmable` default to true to allow the answer to be trimmed - * added method `minSecondsBetweenRedraws()` and `maxSecondsBetweenRedraws()` on `ProgressBar` - * `Application` implements `ResetInterface` - * marked all dispatched event classes as `@final` - * added support for displaying table horizontally - * deprecated returning `null` from `Command::execute()`, return `0` instead - * Deprecated the `Application::renderException()` and `Application::doRenderException()` methods, - use `renderThrowable()` and `doRenderThrowable()` instead. - * added support for the `NO_COLOR` env var (https://no-color.org/) - -4.3.0 ------ - - * added support for hyperlinks - * added `ProgressBar::iterate()` method that simplify updating the progress bar when iterating - * added `Question::setAutocompleterCallback()` to provide a callback function - that dynamically generates suggestions as the user types - -4.2.0 ------ - - * allowed passing commands as `[$process, 'ENV_VAR' => 'value']` to - `ProcessHelper::run()` to pass environment variables - * deprecated passing a command as a string to `ProcessHelper::run()`, - pass it the command as an array of its arguments instead - * made the `ProcessHelper` class final - * added `WrappableOutputFormatterInterface::formatAndWrap()` (implemented in `OutputFormatter`) - * added `capture_stderr_separately` option to `CommandTester::execute()` - -4.1.0 ------ - - * added option to run suggested command if command is not found and only 1 alternative is available - * added option to modify console output and print multiple modifiable sections - * added support for iterable messages in output `write` and `writeln` methods - -4.0.0 ------ - - * `OutputFormatter` throws an exception when unknown options are used - * removed `QuestionHelper::setInputStream()/getInputStream()` - * removed `Application::getTerminalWidth()/getTerminalHeight()` and - `Application::setTerminalDimensions()/getTerminalDimensions()` - * removed `ConsoleExceptionEvent` - * removed `ConsoleEvents::EXCEPTION` - -3.4.0 ------ - - * added `SHELL_VERBOSITY` env var to control verbosity - * added `CommandLoaderInterface`, `FactoryCommandLoader` and PSR-11 - `ContainerCommandLoader` for commands lazy-loading - * added a case-insensitive command name matching fallback - * added static `Command::$defaultName/getDefaultName()`, allowing for - commands to be registered at compile time in the application command loader. - Setting the `$defaultName` property avoids the need for filling the `command` - attribute on the `console.command` tag when using `AddConsoleCommandPass`. - -3.3.0 ------ - - * added `ExceptionListener` - * added `AddConsoleCommandPass` (originally in FrameworkBundle) - * [BC BREAK] `Input::getOption()` no longer returns the default value for options - with value optional explicitly passed empty - * added console.error event to catch exceptions thrown by other listeners - * deprecated console.exception event in favor of console.error - * added ability to handle `CommandNotFoundException` through the - `console.error` event - * deprecated default validation in `SymfonyQuestionHelper::ask` - -3.2.0 ------- - - * added `setInputs()` method to CommandTester for ease testing of commands expecting inputs - * added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface) - * added StreamableInputInterface - * added LockableTrait - -3.1.0 ------ - - * added truncate method to FormatterHelper - * added setColumnWidth(s) method to Table - -2.8.3 ------ - - * remove readline support from the question helper as it caused issues - -2.8.0 ------ - - * use readline for user input in the question helper when available to allow - the use of arrow keys - -2.6.0 ------ - - * added a Process helper - * added a DebugFormatter helper - -2.5.0 ------ - - * deprecated the dialog helper (use the question helper instead) - * deprecated TableHelper in favor of Table - * deprecated ProgressHelper in favor of ProgressBar - * added ConsoleLogger - * added a question helper - * added a way to set the process name of a command - * added a way to set a default command instead of `ListCommand` - -2.4.0 ------ - - * added a way to force terminal dimensions - * added a convenient method to detect verbosity level - * [BC BREAK] made descriptors use output instead of returning a string - -2.3.0 ------ - - * added multiselect support to the select dialog helper - * added Table Helper for tabular data rendering - * added support for events in `Application` - * added a way to normalize EOLs in `ApplicationTester::getDisplay()` and `CommandTester::getDisplay()` - * added a way to set the progress bar progress via the `setCurrent` method - * added support for multiple InputOption shortcuts, written as `'-a|-b|-c'` - * added two additional verbosity levels, VERBOSITY_VERY_VERBOSE and VERBOSITY_DEBUG - -2.2.0 ------ - - * added support for colorization on Windows via ConEmu - * add a method to Dialog Helper to ask for a question and hide the response - * added support for interactive selections in console (DialogHelper::select()) - * added support for autocompletion as you type in Dialog Helper - -2.1.0 ------ - - * added ConsoleOutputInterface - * added the possibility to disable a command (Command::isEnabled()) - * added suggestions when a command does not exist - * added a --raw option to the list command - * added support for STDERR in the console output class (errors are now sent - to STDERR) - * made the defaults (helper set, commands, input definition) in Application - more easily customizable - * added support for the shell even if readline is not available - * added support for process isolation in Symfony shell via - `--process-isolation` switch - * added support for `--`, which disables options parsing after that point - (tokens will be parsed as arguments) diff --git a/symfony/console/README.md b/symfony/console/README.md deleted file mode 100644 index c89b4a1a2..000000000 --- a/symfony/console/README.md +++ /dev/null @@ -1,20 +0,0 @@ -Console Component -================= - -The Console component eases the creation of beautiful and testable command line -interfaces. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/console.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) - -Credits -------- - -`Resources/bin/hiddeninput.exe` is a third party binary provided within this -component. Find sources and license at https://github.com/Seldaek/hidden-input. diff --git a/symfony/console/composer.json b/symfony/console/composer.json deleted file mode 100644 index 90cbd24f5..000000000 --- a/symfony/console/composer.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "symfony/console", - "type": "library", - "description": "Eases the creation of beautiful and testable command line interfaces", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" - }, - "require-dev": { - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0", - "psr/log": "^1|^2" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "suggest": { - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "", - "psr/log": "For using the console logger" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Console\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/css-selector/README.md b/symfony/css-selector/README.md deleted file mode 100644 index ede4a3acc..000000000 --- a/symfony/css-selector/README.md +++ /dev/null @@ -1,20 +0,0 @@ -CssSelector Component -===================== - -The CssSelector component converts CSS selectors to XPath expressions. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/css_selector.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) - -Credits -------- - -This component is a port of the Python cssselect library -[v0.7.1](https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1), -which is distributed under the BSD license. diff --git a/symfony/css-selector/composer.json b/symfony/css-selector/composer.json deleted file mode 100644 index f0b712495..000000000 --- a/symfony/css-selector/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "symfony/css-selector", - "type": "library", - "description": "Converts CSS selectors to XPath expressions", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\CssSelector\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/deprecation-contracts/.gitignore b/symfony/deprecation-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/symfony/deprecation-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/symfony/deprecation-contracts/README.md b/symfony/deprecation-contracts/README.md deleted file mode 100644 index 4957933a6..000000000 --- a/symfony/deprecation-contracts/README.md +++ /dev/null @@ -1,26 +0,0 @@ -Symfony Deprecation Contracts -============================= - -A generic function and convention to trigger deprecation notices. - -This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. - -By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, -the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. - -The function requires at least 3 arguments: - - the name of the Composer package that is triggering the deprecation - - the version of the package that introduced the deprecation - - the message of the deprecation - - more arguments can be provided: they will be inserted in the message using `printf()` formatting - -Example: -```php -trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); -``` - -This will generate the following message: -`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` - -While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty -`function trigger_deprecation() {}` in your application. diff --git a/symfony/deprecation-contracts/composer.json b/symfony/deprecation-contracts/composer.json deleted file mode 100644 index cc7cc1237..000000000 --- a/symfony/deprecation-contracts/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "symfony/deprecation-contracts", - "type": "library", - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} diff --git a/symfony/dom-crawler/README.md b/symfony/dom-crawler/README.md deleted file mode 100644 index c77a5e39c..000000000 --- a/symfony/dom-crawler/README.md +++ /dev/null @@ -1,13 +0,0 @@ -DomCrawler Component -==================== - -The DomCrawler component eases DOM navigation for HTML and XML documents. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/dom_crawler.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/symfony/dom-crawler/composer.json b/symfony/dom-crawler/composer.json deleted file mode 100644 index f89432dac..000000000 --- a/symfony/dom-crawler/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "symfony/dom-crawler", - "type": "library", - "description": "Eases DOM navigation for HTML and XML documents", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "symfony/css-selector": "^4.4|^5.0|^6.0", - "masterminds/html5": "^2.6" - }, - "conflict": { - "masterminds/html5": "<2.6" - }, - "suggest": { - "symfony/css-selector": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\DomCrawler\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/event-dispatcher-contracts/.gitignore b/symfony/event-dispatcher-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/symfony/event-dispatcher-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/symfony/event-dispatcher-contracts/README.md b/symfony/event-dispatcher-contracts/README.md deleted file mode 100644 index fb051c73f..000000000 --- a/symfony/event-dispatcher-contracts/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Symfony EventDispatcher Contracts -================================= - -A set of abstractions extracted out of the Symfony components. - -Can be used to build on semantics that the Symfony components proved useful - and -that already have battle tested implementations. - -See https://github.com/symfony/contracts/blob/master/README.md for more information. diff --git a/symfony/event-dispatcher-contracts/composer.json b/symfony/event-dispatcher-contracts/composer.json deleted file mode 100644 index 862c2565f..000000000 --- a/symfony/event-dispatcher-contracts/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "symfony/event-dispatcher-contracts", - "type": "library", - "description": "Generic abstractions related to dispatching event", - "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" - }, - "autoload": { - "psr-4": { "Symfony\\Contracts\\EventDispatcher\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} diff --git a/symfony/event-dispatcher/CHANGELOG.md b/symfony/event-dispatcher/CHANGELOG.md deleted file mode 100644 index 4a3ea066e..000000000 --- a/symfony/event-dispatcher/CHANGELOG.md +++ /dev/null @@ -1,67 +0,0 @@ -CHANGELOG -========= - -4.4.0 ------ - - * `AddEventAliasesPass` has been added, allowing applications and bundles to extend the event alias mapping used by `RegisterListenersPass`. - * Made the `event` attribute of the `kernel.event_listener` tag optional for FQCN events. - -4.3.0 ------ - - * The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated - * deprecated the `Event` class, use `Symfony\Contracts\EventDispatcher\Event` instead - -4.1.0 ------ - - * added support for invokable event listeners tagged with `kernel.event_listener` by default - * The `TraceableEventDispatcher::getOrphanedEvents()` method has been added. - * The `TraceableEventDispatcherInterface` has been deprecated. - -4.0.0 ------ - - * removed the `ContainerAwareEventDispatcher` class - * added the `reset()` method to the `TraceableEventDispatcherInterface` - -3.4.0 ------ - - * Implementing `TraceableEventDispatcherInterface` without the `reset()` method has been deprecated. - -3.3.0 ------ - - * The ContainerAwareEventDispatcher class has been deprecated. Use EventDispatcher with closure factories instead. - -3.0.0 ------ - - * The method `getListenerPriority($eventName, $listener)` has been added to the - `EventDispatcherInterface`. - * The methods `Event::setDispatcher()`, `Event::getDispatcher()`, `Event::setName()` - and `Event::getName()` have been removed. - The event dispatcher and the event name are passed to the listener call. - -2.5.0 ------ - - * added Debug\TraceableEventDispatcher (originally in HttpKernel) - * changed Debug\TraceableEventDispatcherInterface to extend EventDispatcherInterface - * added RegisterListenersPass (originally in HttpKernel) - -2.1.0 ------ - - * added TraceableEventDispatcherInterface - * added ContainerAwareEventDispatcher - * added a reference to the EventDispatcher on the Event - * added a reference to the Event name on the event - * added fluid interface to the dispatch() method which now returns the Event - object - * added GenericEvent event class - * added the possibility for subscribers to subscribe several times for the - same event - * added ImmutableEventDispatcher diff --git a/symfony/event-dispatcher/README.md b/symfony/event-dispatcher/README.md deleted file mode 100644 index dcdb68d21..000000000 --- a/symfony/event-dispatcher/README.md +++ /dev/null @@ -1,15 +0,0 @@ -EventDispatcher Component -========================= - -The EventDispatcher component provides tools that allow your application -components to communicate with each other by dispatching events and listening to -them. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/event_dispatcher.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/symfony/event-dispatcher/composer.json b/symfony/event-dispatcher/composer.json deleted file mode 100644 index 55c2716a6..000000000 --- a/symfony/event-dispatcher/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "symfony/event-dispatcher", - "type": "library", - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/http-foundation/README.md b/symfony/http-foundation/README.md deleted file mode 100644 index 424f2c4f0..000000000 --- a/symfony/http-foundation/README.md +++ /dev/null @@ -1,28 +0,0 @@ -HttpFoundation Component -======================== - -The HttpFoundation component defines an object-oriented layer for the HTTP -specification. - -Sponsor -------- - -The HttpFoundation component for Symfony 5.4/6.0 is [backed][1] by [Laravel][2]. - -Laravel is a PHP web development framework that is passionate about maximum developer -happiness. Laravel is built using a variety of bespoke and Symfony based components. - -Help Symfony by [sponsoring][3] its development! - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/http_foundation.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) - -[1]: https://symfony.com/backers -[2]: https://laravel.com/ -[3]: https://symfony.com/sponsor diff --git a/symfony/http-foundation/composer.json b/symfony/http-foundation/composer.json deleted file mode 100644 index d54bbfd16..000000000 --- a/symfony/http-foundation/composer.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "symfony/http-foundation", - "type": "library", - "description": "Defines an object-oriented layer for the HTTP specification", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0" - }, - "suggest" : { - "symfony/mime": "To use the file extension guesser" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/polyfill-ctype/README.md b/symfony/polyfill-ctype/README.md deleted file mode 100644 index 8add1ab00..000000000 --- a/symfony/polyfill-ctype/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Symfony Polyfill / Ctype -======================== - -This component provides `ctype_*` functions to users who run php versions without the ctype extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-ctype/composer.json b/symfony/polyfill-ctype/composer.json deleted file mode 100644 index f0621a3b6..000000000 --- a/symfony/polyfill-ctype/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "symfony/polyfill-ctype", - "type": "library", - "description": "Symfony polyfill for ctype functions", - "keywords": ["polyfill", "compatibility", "portable", "ctype"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-iconv/README.md b/symfony/polyfill-iconv/README.md deleted file mode 100644 index b089088b9..000000000 --- a/symfony/polyfill-iconv/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Symfony Polyfill / Iconv -======================== - -This component provides a native PHP implementation of the -[php.net/iconv](https://php.net/iconv) functions -(short of [`ob_iconv_handler`](https://php.net/ob-iconv-handler)). - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-iconv/composer.json b/symfony/polyfill-iconv/composer.json deleted file mode 100644 index 361f55549..000000000 --- a/symfony/polyfill-iconv/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "symfony/polyfill-iconv", - "type": "library", - "description": "Symfony polyfill for the Iconv extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "iconv"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-iconv": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Iconv\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-iconv": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-intl-grapheme/README.md b/symfony/polyfill-intl-grapheme/README.md deleted file mode 100644 index 77523ea27..000000000 --- a/symfony/polyfill-intl-grapheme/README.md +++ /dev/null @@ -1,31 +0,0 @@ -Symfony Polyfill / Intl: Grapheme -================================= - -This component provides a partial, native PHP implementation of the -[Grapheme functions](https://php.net/intl.grapheme) from the -[Intl](https://php.net/intl) extension. - -- [`grapheme_extract`](https://php.net/grapheme_extract): Extract a sequence of grapheme - clusters from a text buffer, which must be encoded in UTF-8 -- [`grapheme_stripos`](https://php.net/grapheme_stripos): Find position (in grapheme units) - of first occurrence of a case-insensitive string -- [`grapheme_stristr`](https://php.net/grapheme_stristr): Returns part of haystack string - from the first occurrence of case-insensitive needle to the end of haystack -- [`grapheme_strlen`](https://php.net/grapheme_strlen): Get string length in grapheme units -- [`grapheme_strpos`](https://php.net/grapheme_strpos): Find position (in grapheme units) - of first occurrence of a string -- [`grapheme_strripos`](https://php.net/grapheme_strripos): Find position (in grapheme units) - of last occurrence of a case-insensitive string -- [`grapheme_strrpos`](https://php.net/grapheme_strrpos): Find position (in grapheme units) - of last occurrence of a string -- [`grapheme_strstr`](https://php.net/grapheme_strstr): Returns part of haystack string from - the first occurrence of needle to the end of haystack -- [`grapheme_substr`](https://php.net/grapheme_substr): Return part of a string - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-intl-grapheme/composer.json b/symfony/polyfill-intl-grapheme/composer.json deleted file mode 100644 index 02c98ee30..000000000 --- a/symfony/polyfill-intl-grapheme/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "symfony/polyfill-intl-grapheme", - "type": "library", - "description": "Symfony polyfill for intl's grapheme_* functions", - "keywords": ["polyfill", "shim", "compatibility", "portable", "intl", "grapheme"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-intl": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-intl-idn/README.md b/symfony/polyfill-intl-idn/README.md deleted file mode 100644 index cae551705..000000000 --- a/symfony/polyfill-intl-idn/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Symfony Polyfill / Intl: Idn -============================ - -This component provides [`idn_to_ascii`](https://php.net/idn-to-ascii) and [`idn_to_utf8`](https://php.net/idn-to-utf8) functions to users who run php versions without the [Intl](https://php.net/intl) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-intl-idn/composer.json b/symfony/polyfill-intl-idn/composer.json deleted file mode 100644 index 105e3d06c..000000000 --- a/symfony/polyfill-intl-idn/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "symfony/polyfill-intl-idn", - "type": "library", - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "keywords": ["polyfill", "shim", "compatibility", "portable", "intl", "idn"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Intl\\Idn\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-intl": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-intl-normalizer/README.md b/symfony/polyfill-intl-normalizer/README.md deleted file mode 100644 index b9b762e85..000000000 --- a/symfony/polyfill-intl-normalizer/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Symfony Polyfill / Intl: Normalizer -=================================== - -This component provides a fallback implementation for the -[`Normalizer`](https://php.net/Normalizer) class provided -by the [Intl](https://php.net/intl) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-intl-normalizer/composer.json b/symfony/polyfill-intl-normalizer/composer.json deleted file mode 100644 index 65f72d645..000000000 --- a/symfony/polyfill-intl-normalizer/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "symfony/polyfill-intl-normalizer", - "type": "library", - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "keywords": ["polyfill", "shim", "compatibility", "portable", "intl", "normalizer"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "suggest": { - "ext-intl": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-mbstring/README.md b/symfony/polyfill-mbstring/README.md deleted file mode 100644 index 478b40da2..000000000 --- a/symfony/polyfill-mbstring/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Symfony Polyfill / Mbstring -=========================== - -This component provides a partial, native PHP implementation for the -[Mbstring](https://php.net/mbstring) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-mbstring/composer.json b/symfony/polyfill-mbstring/composer.json deleted file mode 100644 index 44895536b..000000000 --- a/symfony/polyfill-mbstring/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "symfony/polyfill-mbstring", - "type": "library", - "description": "Symfony polyfill for the Mbstring extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-php72/README.md b/symfony/polyfill-php72/README.md deleted file mode 100644 index ed1905055..000000000 --- a/symfony/polyfill-php72/README.md +++ /dev/null @@ -1,35 +0,0 @@ -Symfony Polyfill / Php72 -======================== - -This component provides functions added to PHP 7.2 core: - -- [`spl_object_id`](https://php.net/spl_object_id) -- [`stream_isatty`](https://php.net/stream_isatty) - -And also functions added to PHP 7.2 mbstring: - -- [`mb_ord`](https://php.net/mb_ord) -- [`mb_chr`](https://php.net/mb_chr) -- [`mb_scrub`](https://php.net/mb_scrub) - -On Windows only: - -- [`sapi_windows_vt100_support`](https://php.net/sapi_windows_vt100_support) - -Moved to core since 7.2 (was in the optional XML extension earlier): - -- [`utf8_encode`](https://php.net/utf8_encode) -- [`utf8_decode`](https://php.net/utf8_decode) - -Also, it provides constants added to PHP 7.2: - -- [`PHP_FLOAT_*`](https://php.net/reserved.constants#constant.php-float-dig) -- [`PHP_OS_FAMILY`](https://php.net/reserved.constants#constant.php-os-family) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-php72/composer.json b/symfony/polyfill-php72/composer.json deleted file mode 100644 index 5f17af343..000000000 --- a/symfony/polyfill-php72/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "symfony/polyfill-php72", - "type": "library", - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php72\\": "" }, - "files": [ "bootstrap.php" ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-php73/README.md b/symfony/polyfill-php73/README.md deleted file mode 100644 index b3ebbce51..000000000 --- a/symfony/polyfill-php73/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Symfony Polyfill / Php73 -======================== - -This component provides functions added to PHP 7.3 core: - -- [`array_key_first`](https://php.net/array_key_first) -- [`array_key_last`](https://php.net/array_key_last) -- [`hrtime`](https://php.net/function.hrtime) -- [`is_countable`](https://php.net/is_countable) -- [`JsonException`](https://php.net/JsonException) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-php73/composer.json b/symfony/polyfill-php73/composer.json deleted file mode 100644 index a7fe47875..000000000 --- a/symfony/polyfill-php73/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "symfony/polyfill-php73", - "type": "library", - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php73\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/polyfill-php80/README.md b/symfony/polyfill-php80/README.md deleted file mode 100644 index 3816c559d..000000000 --- a/symfony/polyfill-php80/README.md +++ /dev/null @@ -1,25 +0,0 @@ -Symfony Polyfill / Php80 -======================== - -This component provides features added to PHP 8.0 core: - -- [`Stringable`](https://php.net/stringable) interface -- [`fdiv`](https://php.net/fdiv) -- [`ValueError`](https://php.net/valueerror) class -- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class -- `FILTER_VALIDATE_BOOL` constant -- [`get_debug_type`](https://php.net/get_debug_type) -- [`PhpToken`](https://php.net/phptoken) class -- [`preg_last_error_msg`](https://php.net/preg_last_error_msg) -- [`str_contains`](https://php.net/str_contains) -- [`str_starts_with`](https://php.net/str_starts_with) -- [`str_ends_with`](https://php.net/str_ends_with) -- [`get_resource_id`](https://php.net/get_resource_id) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/symfony/polyfill-php80/composer.json b/symfony/polyfill-php80/composer.json deleted file mode 100644 index cd3e9b65f..000000000 --- a/symfony/polyfill-php80/composer.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "symfony/polyfill-php80", - "type": "library", - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php80\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/symfony/process/CHANGELOG.md b/symfony/process/CHANGELOG.md deleted file mode 100644 index 69d4cbd77..000000000 --- a/symfony/process/CHANGELOG.md +++ /dev/null @@ -1,96 +0,0 @@ -CHANGELOG -========= - -4.4.0 ------ - - * deprecated `Process::inheritEnvironmentVariables()`: env variables are always inherited. - * added `Process::getLastOutputTime()` method - -4.2.0 ------ - - * added the `Process::fromShellCommandline()` to run commands in a shell wrapper - * deprecated passing a command as string when creating a `Process` instance - * deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods - * added the `Process::waitUntil()` method to wait for the process only for a - specific output, then continue the normal execution of your application - -4.1.0 ------ - - * added the `Process::isTtySupported()` method that allows to check for TTY support - * made `PhpExecutableFinder` look for the `PHP_BINARY` env var when searching the php binary - * added the `ProcessSignaledException` class to properly catch signaled process errors - -4.0.0 ------ - - * environment variables will always be inherited - * added a second `array $env = []` argument to the `start()`, `run()`, - `mustRun()`, and `restart()` methods of the `Process` class - * added a second `array $env = []` argument to the `start()` method of the - `PhpProcess` class - * the `ProcessUtils::escapeArgument()` method has been removed - * the `areEnvironmentVariablesInherited()`, `getOptions()`, and `setOptions()` - methods of the `Process` class have been removed - * support for passing `proc_open()` options has been removed - * removed the `ProcessBuilder` class, use the `Process` class instead - * removed the `getEnhanceWindowsCompatibility()` and `setEnhanceWindowsCompatibility()` methods of the `Process` class - * passing a not existing working directory to the constructor of the `Symfony\Component\Process\Process` class is not - supported anymore - -3.4.0 ------ - - * deprecated the ProcessBuilder class - * deprecated calling `Process::start()` without setting a valid working directory beforehand (via `setWorkingDirectory()` or constructor) - -3.3.0 ------ - - * added command line arrays in the `Process` class - * added `$env` argument to `Process::start()`, `run()`, `mustRun()` and `restart()` methods - * deprecated the `ProcessUtils::escapeArgument()` method - * deprecated not inheriting environment variables - * deprecated configuring `proc_open()` options - * deprecated configuring enhanced Windows compatibility - * deprecated configuring enhanced sigchild compatibility - -2.5.0 ------ - - * added support for PTY mode - * added the convenience method "mustRun" - * deprecation: Process::setStdin() is deprecated in favor of Process::setInput() - * deprecation: Process::getStdin() is deprecated in favor of Process::getInput() - * deprecation: Process::setInput() and ProcessBuilder::setInput() do not accept non-scalar types - -2.4.0 ------ - - * added the ability to define an idle timeout - -2.3.0 ------ - - * added ProcessUtils::escapeArgument() to fix the bug in escapeshellarg() function on Windows - * added Process::signal() - * added Process::getPid() - * added support for a TTY mode - -2.2.0 ------ - - * added ProcessBuilder::setArguments() to reset the arguments on a builder - * added a way to retrieve the standard and error output incrementally - * added Process:restart() - -2.1.0 ------ - - * added support for non-blocking processes (start(), wait(), isRunning(), stop()) - * enhanced Windows compatibility - * added Process::getExitCodeText() that returns a string representation for - the exit code returned by the process - * added ProcessBuilder diff --git a/symfony/process/README.md b/symfony/process/README.md deleted file mode 100644 index afce5e45e..000000000 --- a/symfony/process/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Process Component -================= - -The Process component executes commands in sub-processes. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/process.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/symfony/process/composer.json b/symfony/process/composer.json deleted file mode 100644 index c0f7599f2..000000000 --- a/symfony/process/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "symfony/process", - "type": "library", - "description": "Executes commands in sub-processes", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Process\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/routing/CHANGELOG.md b/symfony/routing/CHANGELOG.md deleted file mode 100644 index 5df451356..000000000 --- a/symfony/routing/CHANGELOG.md +++ /dev/null @@ -1,259 +0,0 @@ -CHANGELOG -========= - -4.4.0 ------ - - * Deprecated `ServiceRouterLoader` in favor of `ContainerLoader`. - * Deprecated `ObjectRouteLoader` in favor of `ObjectLoader`. - * Added a way to exclude patterns of resources from being imported by the `import()` method - -4.3.0 ------ - - * added `CompiledUrlMatcher` and `CompiledUrlMatcherDumper` - * added `CompiledUrlGenerator` and `CompiledUrlGeneratorDumper` - * deprecated `PhpGeneratorDumper` and `PhpMatcherDumper` - * deprecated `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options - * `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`. - Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible - with the new serialization methods in PHP 7.4. - * exposed `utf8` Route option, defaults "locale" and "format" in configuration loaders and configurators - * added support for invokable service route loaders - -4.2.0 ------ - - * added fallback to cultureless locale for internationalized routes - -4.0.0 ------ - - * dropped support for using UTF-8 route patterns without using the `utf8` option - * dropped support for using UTF-8 route requirements without using the `utf8` option - -3.4.0 ------ - - * Added `NoConfigurationException`. - * Added the possibility to define a prefix for all routes of a controller via @Route(name="prefix_") - * Added support for prioritized routing loaders. - * Add matched and default parameters to redirect responses - * Added support for a `controller` keyword for configuring route controllers in YAML and XML configurations. - -3.3.0 ------ - - * [DEPRECATION] Class parameters have been deprecated and will be removed in 4.0. - * router.options.generator_class - * router.options.generator_base_class - * router.options.generator_dumper_class - * router.options.matcher_class - * router.options.matcher_base_class - * router.options.matcher_dumper_class - * router.options.matcher.cache_class - * router.options.generator.cache_class - -3.2.0 ------ - - * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations. - * Added support for UTF-8 requirements - -2.8.0 ------ - - * allowed specifying a directory to recursively load all routing configuration files it contains - * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded - by calling a method on an object/service. - * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method. - Use the constants defined in the `UrlGeneratorInterface` instead. - - Before: - - ```php - $router->generate('blog_show', ['slug' => 'my-blog-post'], true); - ``` - - After: - - ```php - use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - - $router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL); - ``` - -2.5.0 ------ - - * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and - will be removed in Symfony 3.0, since the performance gains were minimal and - it's hard to replicate the behavior of PHP implementation. - -2.3.0 ------ - - * added RequestContext::getQueryString() - -2.2.0 ------ - - * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0): - - * The `pattern` setting for a route has been deprecated in favor of `path` - * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings - - Before: - - ```yaml - article_edit: - pattern: /article/{id} - requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' } - ``` - - ```xml - - POST|PUT - https - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPattern('/article/{id}'); - $route->setRequirement('_method', 'POST|PUT'); - $route->setRequirement('_scheme', 'https'); - ``` - - After: - - ```yaml - article_edit: - path: /article/{id} - methods: [POST, PUT] - schemes: https - requirements: { 'id': '\d+' } - ``` - - ```xml - - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPath('/article/{id}'); - $route->setMethods(['POST', 'PUT']); - $route->setSchemes('https'); - ``` - - * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as - a flat array of Routes. So when using PHP to build the RouteCollection, you must - make sure to add routes to the sub-collection before adding it to the parent - collection (this is not relevant when using YAML or XML for Route definitions). - - Before: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $rootCollection->addCollection($subCollection); - $subCollection->add('foo', new Route('/foo')); - ``` - - After: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $subCollection->add('foo', new Route('/foo')); - $rootCollection->addCollection($subCollection); - ``` - - Also one must call `addCollection` from the bottom to the top hierarchy. - So the correct sequence is the following (and not the reverse): - - ```php - $childCollection->addCollection($grandchildCollection); - $rootCollection->addCollection($childCollection); - ``` - - * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()` - have been deprecated and will be removed in Symfony 2.3. - * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements - or options without adding a prefix is not supported anymore. So if you called `addPrefix` - with an empty prefix or `/` only (both have no relevance), like - `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)` - you need to use the new dedicated methods `addDefaults($defaultsArray)`, - `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead. - * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated - because adding options has nothing to do with adding a path prefix. If you want to add options - to all child routes of a RouteCollection, you can use `addOptions()`. - * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated - because it suggested that all routes in the collection would have this prefix, which is - not necessarily true. On top of that, since there is no tree structure anymore, this method - is also useless. Don't worry about performance, prefix optimization for matching is still done - in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities. - * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be - used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` - will still work, but have been deprecated. The `addPrefix` method should be used for this - use-case instead. - Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])` - After: - ```php - $collection->addPrefix('/prefix', [...], [...]); - $parentCollection->addCollection($collection); - ``` - * added support for the method default argument values when defining a @Route - * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`. - * Characters that function as separator between placeholders are now whitelisted - to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`. - * [BC BREAK] The default requirement of a variable has been changed slightly. - Previously it disallowed the previous and the next char around a variable. Now - it disallows the slash (`/`) and the next char. Using the previous char added - no value and was problematic because the route `/index.{_format}` would be - matched by `/index.ht/ml`. - * The default requirement now uses possessive quantifiers when possible which - improves matching performance by up to 20% because it prevents backtracking - when it's not needed. - * The ConfigurableRequirementsInterface can now also be used to disable the requirements - check on URL generation completely by calling `setStrictRequirements(null)`. It - improves performance in production environment as you should know that params always - pass the requirements (otherwise it would break your link anyway). - * There is no restriction on the route name anymore. So non-alphanumeric characters - are now also allowed. - * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static - (only relevant if you implemented your own RouteCompiler). - * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g. - "../parent-file" and "//example.com/dir/file". The third parameter in - `UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)` - now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for - claritiy. The old method calls with a Boolean parameter will continue to work because they - equal the signature using the constants. - -2.1.0 ------ - - * added RequestMatcherInterface - * added RequestContext::fromRequest() - * the UrlMatcher does not throw a \LogicException anymore when the required - scheme is not the current one - * added TraceableUrlMatcher - * added the possibility to define options, default values and requirements - for placeholders in prefix, including imported routes - * added RouterInterface::getRouteCollection - * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they - were decoded twice before. Note that the `urldecode()` calls have been - changed for a single `rawurldecode()` in order to support `+` for input - paths. - * added RouteCollection::getRoot method to retrieve the root of a - RouteCollection tree - * [BC BREAK] made RouteCollection::setParent private which could not have - been used anyway without creating inconsistencies - * [BC BREAK] RouteCollection::remove also removes a route from parent - collections (not only from its children) - * added ConfigurableRequirementsInterface that allows to disable exceptions - (and generate empty URLs instead) when generating a route with an invalid - parameter value diff --git a/symfony/routing/README.md b/symfony/routing/README.md deleted file mode 100644 index ae8284f54..000000000 --- a/symfony/routing/README.md +++ /dev/null @@ -1,51 +0,0 @@ -Routing Component -================= - -The Routing component maps an HTTP request to a set of configuration variables. - -Getting Started ---------------- - -``` -$ composer require symfony/routing -``` - -```php -use App\Controller\BlogController; -use Symfony\Component\Routing\Generator\UrlGenerator; -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -$route = new Route('/blog/{slug}', ['_controller' => BlogController::class]); -$routes = new RouteCollection(); -$routes->add('blog_show', $route); - -$context = new RequestContext(); - -// Routing can match routes with incoming requests -$matcher = new UrlMatcher($routes, $context); -$parameters = $matcher->match('/blog/lorem-ipsum'); -// $parameters = [ -// '_controller' => 'App\Controller\BlogController', -// 'slug' => 'lorem-ipsum', -// '_route' => 'blog_show' -// ] - -// Routing can also generate URLs for a given route -$generator = new UrlGenerator($routes, $context); -$url = $generator->generate('blog_show', [ - 'slug' => 'my-blog-post', -]); -// $url = '/blog/my-blog-post' -``` - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/routing.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/symfony/routing/composer.json b/symfony/routing/composer.json deleted file mode 100644 index c6ef01bcb..000000000 --- a/symfony/routing/composer.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "symfony/routing", - "type": "library", - "description": "Maps an HTTP request to a set of configuration variables", - "keywords": ["routing", "router", "URL", "URI"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "symfony/config": "^4.2|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "doctrine/annotations": "^1.10.4", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "suggest": { - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/yaml": "For using the YAML loader", - "symfony/expression-language": "For using expression matching", - "doctrine/annotations": "For using the annotation loader" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Routing\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/symfony/service-contracts/.gitignore b/symfony/service-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/symfony/service-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/symfony/service-contracts/README.md b/symfony/service-contracts/README.md deleted file mode 100644 index 41e054a10..000000000 --- a/symfony/service-contracts/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Symfony Service Contracts -========================= - -A set of abstractions extracted out of the Symfony components. - -Can be used to build on semantics that the Symfony components proved useful - and -that already have battle tested implementations. - -See https://github.com/symfony/contracts/blob/main/README.md for more information. diff --git a/symfony/service-contracts/composer.json b/symfony/service-contracts/composer.json deleted file mode 100644 index 353413f32..000000000 --- a/symfony/service-contracts/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "symfony/service-contracts", - "type": "library", - "description": "Generic abstractions related to writing services", - "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "autoload": { - "psr-4": { "Symfony\\Contracts\\Service\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} diff --git a/symfony/translation-contracts/.gitignore b/symfony/translation-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/symfony/translation-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/symfony/translation-contracts/README.md b/symfony/translation-contracts/README.md deleted file mode 100644 index 42e5c5175..000000000 --- a/symfony/translation-contracts/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Symfony Translation Contracts -============================= - -A set of abstractions extracted out of the Symfony components. - -Can be used to build on semantics that the Symfony components proved useful - and -that already have battle tested implementations. - -See https://github.com/symfony/contracts/blob/main/README.md for more information. diff --git a/symfony/translation-contracts/composer.json b/symfony/translation-contracts/composer.json deleted file mode 100644 index 00e27f836..000000000 --- a/symfony/translation-contracts/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "symfony/translation-contracts", - "type": "library", - "description": "Generic abstractions related to translation", - "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/translation-implementation": "" - }, - "autoload": { - "psr-4": { "Symfony\\Contracts\\Translation\\": "" } - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} diff --git a/symfony/translation/CHANGELOG.md b/symfony/translation/CHANGELOG.md deleted file mode 100644 index 97845322e..000000000 --- a/symfony/translation/CHANGELOG.md +++ /dev/null @@ -1,133 +0,0 @@ -CHANGELOG -========= - -4.4.0 ------ - - * deprecated support for using `null` as the locale in `Translator` - * deprecated accepting STDIN implicitly when using the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. - * Marked the `TranslationDataCollector` class as `@final`. - -4.3.0 ------ - - * Improved Xliff 1.2 loader to load the original file's metadata - * Added `TranslatorPathsPass` - -4.2.0 ------ - - * Started using ICU parent locales as fallback locales. - * allow using the ICU message format using domains with the "+intl-icu" suffix - * deprecated `Translator::transChoice()` in favor of using `Translator::trans()` with a `%count%` parameter - * deprecated `TranslatorInterface` in favor of `Symfony\Contracts\Translation\TranslatorInterface` - * deprecated `MessageSelector`, `Interval` and `PluralizationRules`; use `IdentityTranslator` instead - * Added `IntlFormatter` and `IntlFormatterInterface` - * added support for multiple files and directories in `XliffLintCommand` - * Marked `Translator::getFallbackLocales()` and `TranslationDataCollector::getFallbackLocales()` as internal - -4.1.0 ------ - - * The `FileDumper::setBackup()` method is deprecated. - * The `TranslationWriter::disableBackup()` method is deprecated. - * The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0. - -4.0.0 ------ - - * removed the backup feature of the `FileDumper` class - * removed `TranslationWriter::writeTranslations()` method - * removed support for passing `MessageSelector` instances to the constructor of the `Translator` class - -3.4.0 ------ - - * Added `TranslationDumperPass` - * Added `TranslationExtractorPass` - * Added `TranslatorPass` - * Added `TranslationReader` and `TranslationReaderInterface` - * Added `` section to the Xliff 2.0 dumper. - * Improved Xliff 2.0 loader to load `` section. - * Added `TranslationWriterInterface` - * Deprecated `TranslationWriter::writeTranslations` in favor of `TranslationWriter::write` - * added support for adding custom message formatter and decoupling the default one. - * Added `PhpExtractor` - * Added `PhpStringTokenParser` - -3.2.0 ------ - - * Added support for escaping `|` in plural translations with double pipe. - -3.1.0 ------ - - * Deprecated the backup feature of the file dumper classes. - -3.0.0 ------ - - * removed `FileDumper::format()` method. - * Changed the visibility of the locale property in `Translator` from protected to private. - -2.8.0 ------ - - * deprecated FileDumper::format(), overwrite FileDumper::formatCatalogue() instead. - * deprecated Translator::getMessages(), rely on TranslatorBagInterface::getCatalogue() instead. - * added `FileDumper::formatCatalogue` which allows format the catalogue without dumping it into file. - * added option `json_encoding` to JsonFileDumper - * added options `as_tree`, `inline` to YamlFileDumper - * added support for XLIFF 2.0. - * added support for XLIFF target and tool attributes. - * added message parameters to DataCollectorTranslator. - * [DEPRECATION] The `DiffOperation` class has been deprecated and - will be removed in Symfony 3.0, since its operation has nothing to do with 'diff', - so the class name is misleading. The `TargetOperation` class should be used for - this use-case instead. - -2.7.0 ------ - - * added DataCollectorTranslator for collecting the translated messages. - -2.6.0 ------ - - * added possibility to cache catalogues - * added TranslatorBagInterface - * added LoggingTranslator - * added Translator::getMessages() for retrieving the message catalogue as an array - -2.5.0 ------ - - * added relative file path template to the file dumpers - * added optional backup to the file dumpers - * changed IcuResFileDumper to extend FileDumper - -2.3.0 ------ - - * added classes to make operations on catalogues (like making a diff or a merge on 2 catalogues) - * added Translator::getFallbackLocales() - * deprecated Translator::setFallbackLocale() in favor of the new Translator::setFallbackLocales() method - -2.2.0 ------ - - * QtTranslationsLoader class renamed to QtFileLoader. QtTranslationsLoader is deprecated and will be removed in 2.3. - * [BC BREAK] uniformized the exception thrown by the load() method when an error occurs. The load() method now - throws Symfony\Component\Translation\Exception\NotFoundResourceException when a resource cannot be found - and Symfony\Component\Translation\Exception\InvalidResourceException when a resource is invalid. - * changed the exception class thrown by some load() methods from \RuntimeException to \InvalidArgumentException - (IcuDatFileLoader, IcuResFileLoader and QtFileLoader) - -2.1.0 ------ - - * added support for more than one fallback locale - * added support for extracting translation messages from templates (Twig and PHP) - * added dumpers for translation catalogs - * added support for QT, gettext, and ResourceBundles diff --git a/symfony/translation/README.md b/symfony/translation/README.md deleted file mode 100644 index 720bee3b8..000000000 --- a/symfony/translation/README.md +++ /dev/null @@ -1,33 +0,0 @@ -Translation Component -===================== - -The Translation component provides tools to internationalize your application. - -Getting Started ---------------- - -``` -$ composer require symfony/translation -``` - -```php -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\Loader\ArrayLoader; - -$translator = new Translator('fr_FR'); -$translator->addLoader('array', new ArrayLoader()); -$translator->addResource('array', [ - 'Hello World!' => 'Bonjour !', -], 'fr_FR'); - -echo $translator->trans('Hello World!'); // outputs « Bonjour ! » -``` - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/translation.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/symfony/translation/composer.json b/symfony/translation/composer.json deleted file mode 100644 index 9eafc1b14..000000000 --- a/symfony/translation/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "symfony/translation", - "type": "library", - "description": "Provides tools to internationalize your application", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^1.1.6|^2" - }, - "require-dev": { - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "symfony/translation-implementation": "1.0|2.0" - }, - "suggest": { - "symfony/config": "", - "symfony/yaml": "", - "psr/log-implementation": "To use logging capability in translator" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Translation\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/thecodingmachine/safe/README.md b/thecodingmachine/safe/README.md deleted file mode 100644 index 3c2ee624f..000000000 --- a/thecodingmachine/safe/README.md +++ /dev/null @@ -1,178 +0,0 @@ -[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/safe/v/stable.svg)](https://packagist.org/packages/thecodingmachine/safe) -[![Total Downloads](https://poser.pugx.org/thecodingmachine/safe/downloads.svg)](https://packagist.org/packages/thecodingmachine/safe) -[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/safe/v/unstable.svg)](https://packagist.org/packages/thecodingmachine/safe) -[![License](https://poser.pugx.org/thecodingmachine/safe/license.svg)](https://packagist.org/packages/thecodingmachine/safe) -[![Build Status](https://travis-ci.org/thecodingmachine/safe.svg?branch=master)](https://travis-ci.org/thecodingmachine/safe) -[![Continuous Integration](https://github.com/thecodingmachine/safe/workflows/Continuous%20Integration/badge.svg)](https://github.com/thecodingmachine/safe/actions) -[![codecov](https://codecov.io/gh/thecodingmachine/safe/branch/master/graph/badge.svg)](https://codecov.io/gh/thecodingmachine/safe) - -Safe PHP -======== - -**Work in progress** - -A set of core PHP functions rewritten to throw exceptions instead of returning `false` when an error is encountered. - -## The problem - -Most PHP core functions were written before exception handling was added to the language. Therefore, most PHP functions -do not throw exceptions. Instead, they return `false` in case of error. - -But most of us are too lazy to check explicitly for every single return of every core PHP function. - -```php -// This code is incorrect. Twice. -// "file_get_contents" can return false if the file does not exists -// "json_decode" can return false if the file content is not valid JSON -$content = file_get_contents('foobar.json'); -$foobar = json_decode($content); -``` - -The correct version of this code would be: - -```php -$content = file_get_contents('foobar.json'); -if ($content === false) { - throw new FileLoadingException('Could not load file foobar.json'); -} -$foobar = json_decode($content); -if (json_last_error() !== JSON_ERROR_NONE) { - throw new FileLoadingException('foobar.json does not contain valid JSON: '.json_last_error_msg()); -} -``` - -Obviously, while this snippet is correct, it is less easy to read. - -## The solution - -Enter *thecodingmachine/safe* aka Safe-PHP. - -Safe-PHP redeclares all core PHP functions. The new PHP functions act exactly as the old ones, except they -throw exceptions properly when an error is encountered. The "safe" functions have the same name as the core PHP -functions, except they are in the `Safe` namespace. - -```php -use function Safe\file_get_contents; -use function Safe\json_decode; - -// This code is both safe and simple! -$content = file_get_contents('foobar.json'); -$foobar = json_decode($content); -``` - -All PHP functions that can return `false` on error are part of Safe. -In addition, Safe also provide 2 'Safe' classes: `Safe\DateTime` and `Safe\DateTimeImmutable` whose methods will throw exceptions instead of returning false. - -## PHPStan integration - -> Yeah... but I must explicitly think about importing the "safe" variant of the function, for each and every file of my application. -> I'm sure I will forget some "use function" statements! - -Fear not! thecodingmachine/safe comes with a PHPStan rule. - -Never heard of [PHPStan](https://github.com/phpstan/phpstan) before? -Check it out, it's an amazing code analyzer for PHP. - -Simply install the Safe rule in your PHPStan setup (explained in the "Installation" section) and PHPStan will let you know each time you are using an "unsafe" function. - -The code below will trigger this warning: - -```php -$content = file_get_contents('foobar.json'); -``` - -> Function file_get_contents is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\file_get_contents;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library. - -## Installation - -Use composer to install Safe-PHP: - -```bash -$ composer require thecodingmachine/safe -``` - -*Highly recommended*: install PHPStan and PHPStan extension: - -```bash -$ composer require --dev thecodingmachine/phpstan-safe-rule -``` - -Now, edit your `phpstan.neon` file and add these rules: - -```yml -includes: - - vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon -``` - -## Automated refactoring - -You have a large legacy codebase and want to use "Safe-PHP" functions throughout your project? PHPStan will help you -find these functions but changing the namespace of the functions one function at a time might be a tedious task. - -Fortunately, Safe comes bundled with a "Rector" configuration file. [Rector](https://github.com/rectorphp/rector) is a command-line -tool that performs instant refactoring of your application. - -Run - -```bash -$ composer require --dev rector/rector:^0.7 -``` - -to install `rector/rector`. - -Run - -```bash -vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.7.php -``` - -to run `rector/rector`. - -*Note:* do not forget to replace "src/" with the path to your source directory. - -**Important:** the refactoring only performs a "dumb" replacement of functions. It will not modify the way -"false" return values are handled. So if your code was already performing error handling, you will have to deal -with it manually. - -Especially, you should look for error handling that was already performed, like: - -```php -if (!mkdir($dirPath)) { - // Do something on error -} -``` - -This code will be refactored by Rector to: - -```php -if (!\Safe\mkdir($dirPath)) { - // Do something on error -} -``` - -You should then (manually) refactor it to: - -```php -try { - \Safe\mkdir($dirPath)); -} catch (\Safe\FilesystemException $e) { - // Do something on error -} -``` - -## Performance impact - -Safe is loading 1000+ functions from ~85 files on each request. Yet, the performance impact of this loading is quite low. - -In case you worry, using Safe will "cost" you ~700µs on each request. The [performance section](performance/README.md) -contains more information regarding the way we tested the performance impact of Safe. - -## Learn more - -Read [the release article on TheCodingMachine's blog](https://thecodingmachine.io/introducing-safe-php) if you want to -learn more about what triggered the development of Safe-PHP. - -## Contributing - -The files that contain all the functions are auto-generated from the PHP doc. -Read the [CONTRIBUTING.md](CONTRIBUTING.md) file to learn how to regenerate these files and to contribute to this library. diff --git a/thecodingmachine/safe/composer.json b/thecodingmachine/safe/composer.json deleted file mode 100644 index 2cd03fcc8..000000000 --- a/thecodingmachine/safe/composer.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "thecodingmachine/safe", - "description": "PHP core functions that throw exceptions instead of returning FALSE on error", - "license": "MIT", - "autoload": { - "psr-4": { - "Safe\\": [ - "lib/", - "deprecated/", - "generated/" - ] - }, - "files": [ - "deprecated/apc.php", - "deprecated/libevent.php", - "deprecated/mssql.php", - "deprecated/stats.php", - "lib/special_cases.php", - "generated/apache.php", - "generated/apcu.php", - "generated/array.php", - "generated/bzip2.php", - "generated/calendar.php", - "generated/classobj.php", - "generated/com.php", - "generated/cubrid.php", - "generated/curl.php", - "generated/datetime.php", - "generated/dir.php", - "generated/eio.php", - "generated/errorfunc.php", - "generated/exec.php", - "generated/fileinfo.php", - "generated/filesystem.php", - "generated/filter.php", - "generated/fpm.php", - "generated/ftp.php", - "generated/funchand.php", - "generated/gmp.php", - "generated/gnupg.php", - "generated/hash.php", - "generated/ibase.php", - "generated/ibmDb2.php", - "generated/iconv.php", - "generated/image.php", - "generated/imap.php", - "generated/info.php", - "generated/ingres-ii.php", - "generated/inotify.php", - "generated/json.php", - "generated/ldap.php", - "generated/libxml.php", - "generated/lzf.php", - "generated/mailparse.php", - "generated/mbstring.php", - "generated/misc.php", - "generated/msql.php", - "generated/mysql.php", - "generated/mysqli.php", - "generated/mysqlndMs.php", - "generated/mysqlndQc.php", - "generated/network.php", - "generated/oci8.php", - "generated/opcache.php", - "generated/openssl.php", - "generated/outcontrol.php", - "generated/password.php", - "generated/pcntl.php", - "generated/pcre.php", - "generated/pdf.php", - "generated/pgsql.php", - "generated/posix.php", - "generated/ps.php", - "generated/pspell.php", - "generated/readline.php", - "generated/rpminfo.php", - "generated/rrd.php", - "generated/sem.php", - "generated/session.php", - "generated/shmop.php", - "generated/simplexml.php", - "generated/sockets.php", - "generated/sodium.php", - "generated/solr.php", - "generated/spl.php", - "generated/sqlsrv.php", - "generated/ssdeep.php", - "generated/ssh2.php", - "generated/stream.php", - "generated/strings.php", - "generated/swoole.php", - "generated/uodbc.php", - "generated/uopz.php", - "generated/url.php", - "generated/var.php", - "generated/xdiff.php", - "generated/xml.php", - "generated/xmlrpc.php", - "generated/yaml.php", - "generated/yaz.php", - "generated/zip.php", - "generated/zlib.php" - ] - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpstan/phpstan": "^0.12", - "thecodingmachine/phpstan-strict-rules": "^0.12", - "squizlabs/php_codesniffer": "^3.2" - }, - "scripts": { - "phpstan": "phpstan analyse lib -c phpstan.neon --level=max --no-progress -vvv", - "cs-fix": "phpcbf", - "cs-check": "phpcs" - }, - "extra": { - "branch-alias": { - "dev-master": "0.1-dev" - } - } -} \ No newline at end of file diff --git a/web-auth/cose-lib/composer.json b/web-auth/cose-lib/composer.json deleted file mode 100644 index 34d0f1eea..000000000 --- a/web-auth/cose-lib/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "web-auth/cose-lib", - "type": "library", - "license": "MIT", - "description": "CBOR Object Signing and Encryption (COSE) For PHP", - "keywords": ["COSE", "RFC8152"], - "homepage": "https://github.com/web-auth", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-auth/cose/contributors" - } - ], - "require": { - "php": ">=7.2", - "ext-json": "*", - "ext-openssl": "*", - "ext-mbstring": "*", - "fgrosse/phpasn1": "^2.1", - "beberlei/assert": "^3.2" - }, - "autoload": { - "psr-4": { - "Cose\\": "src/" - } - } -} diff --git a/web-auth/metadata-service/composer.json b/web-auth/metadata-service/composer.json deleted file mode 100644 index c0ac1b2e3..000000000 --- a/web-auth/metadata-service/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "web-auth/metadata-service", - "type": "library", - "license": "MIT", - "description": "Metadata Service for FIDO2/Webauthn", - "keywords": ["FIDO", "FIDO2", "webauthn"], - "homepage": "https://github.com/web-auth", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-auth/metadata-service/contributors" - } - ], - "require": { - "php": ">=7.2", - "ext-json": "*", - "beberlei/assert": "^3.2", - "league/uri": "^6.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log-implementation": "Recommended to receive logs from the library" - }, - "autoload": { - "psr-4": { - "Webauthn\\MetadataService\\": "src/" - } - }, - "suggest": { - "web-token/jwt-key-mgmt": "Mandatory for fetching Metadata Statement from distant sources", - "web-token/jwt-signature-algorithm-ecdsa": "Mandatory for fetching Metadata Statement from distant sources" - } -} diff --git a/web-auth/webauthn-lib/composer.json b/web-auth/webauthn-lib/composer.json deleted file mode 100644 index 03c661b45..000000000 --- a/web-auth/webauthn-lib/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "web-auth/webauthn-lib", - "type": "library", - "license": "MIT", - "description": "FIDO2/Webauthn Support For PHP", - "keywords": ["FIDO", "FIDO2", "webauthn"], - "homepage": "https://github.com/web-auth", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - }, - { - "name": "All contributors", - "homepage": "https://github.com/web-auth/webauthn-library/contributors" - } - ], - "require": { - "php": ">=7.2", - "ext-json": "*", - "ext-openssl": "*", - "ext-mbstring": "*", - "beberlei/assert": "^3.2", - "fgrosse/phpasn1": "^2.1", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "psr/log": "^1.1", - "ramsey/uuid": "^3.8|^4.0", - "spomky-labs/base64url": "^2.0", - "spomky-labs/cbor-php": "^1.1|^2.0", - "symfony/process": "^3.0|^4.0|^5.0", - "thecodingmachine/safe": "^1.1", - "web-auth/cose-lib": "self.version", - "web-auth/metadata-service": "self.version" - }, - "autoload": { - "psr-4": { - "Webauthn\\": "src/" - } - }, - "suggest": { - "psr/log-implementation": "Recommended to receive logs from the library", - "web-token/jwt-key-mgmt": "Mandatory for the AndroidSafetyNet Attestation Statement support", - "web-token/jwt-signature-algorithm-rsa": "Mandatory for the AndroidSafetyNet Attestation Statement support", - "web-token/jwt-signature-algorithm-ecdsa": "Recommended for the AndroidSafetyNet Attestation Statement support", - "web-token/jwt-signature-algorithm-eddsa": "Recommended for the AndroidSafetyNet Attestation Statement support" - } -}