From d05aaa27ebd0d0d5fe61c34da10d4362c3223ea1 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 14 Jan 2021 07:22:07 +0000 Subject: [PATCH] fixes Symfony BC issue (#61) --- CHANGELOG-3.x.md | 4 ++ composer.json | 3 +- config/set/common.php | 2 +- config/set/default.php | 2 +- .../Framework/Symfony/Polyfill.php | 40 +++++++++++++++++++ .../Console/Command/AbstractCommand.php | 3 ++ .../Console/Command/DiagnoseCommand.php | 3 +- .../Console/Command/InitCommand.php | 3 +- .../Console/Command/ListCommand.php | 3 +- .../Console/Command/ReleaseCommand.php | 5 +-- .../Console/Command/ShowCommand.php | 6 +-- 11 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 src/Infrastructure/Framework/Symfony/Polyfill.php diff --git a/CHANGELOG-3.x.md b/CHANGELOG-3.x.md index 2dc124b..0229ff1 100644 --- a/CHANGELOG-3.x.md +++ b/CHANGELOG-3.x.md @@ -6,6 +6,10 @@ using the [Keep a CHANGELOG](http://keepachangelog.com) principles. ## [Unreleased] +### Fixed + +- [#61](https://github.com/llaville/php-compatinfo-db/issues/61) Keep Symfony 4.4 Backward Compatibility + ## [3.1.0] - 2021-01-09 ### Added diff --git a/composer.json b/composer.json index 5171be1..3448740 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,8 @@ "autoload": { "psr-4": { "Bartlett\\CompatInfoDb\\": "src/" - } + }, + "files": ["src/Infrastructure/Framework/Symfony/Polyfill.php"] }, "autoload-dev": { "psr-4": { diff --git a/config/set/common.php b/config/set/common.php index ef25457..f480a16 100644 --- a/config/set/common.php +++ b/config/set/common.php @@ -7,6 +7,7 @@ use Bartlett\CompatInfoDb\Presentation\Console\Command\FactoryCommandLoader; use Bartlett\CompatInfoDb\Presentation\Console\Input\Input; use Bartlett\CompatInfoDb\Presentation\Console\Output\Output; +use function Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony\service; use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; use Symfony\Component\Console\Input\InputInterface; @@ -15,7 +16,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Stopwatch\Stopwatch; -use function Symfony\Component\DependencyInjection\Loader\Configurator\service; use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; /** diff --git a/config/set/default.php b/config/set/default.php index 413eb33..25ff7e8 100644 --- a/config/set/default.php +++ b/config/set/default.php @@ -16,6 +16,7 @@ use Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Repository\PlatformRepository as InfrastructurePlatformRepository; use Bartlett\CompatInfoDb\Application\Service\JsonFileHandler; use Bartlett\CompatInfoDb\Presentation\Console\Command\CommandInterface; +use function Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony\service; use Composer\Semver\VersionParser; @@ -25,7 +26,6 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\Messenger\Command\DebugCommand; -use function Symfony\Component\DependencyInjection\Loader\Configurator\service; /** * Build the Container with default parameters and services diff --git a/src/Infrastructure/Framework/Symfony/Polyfill.php b/src/Infrastructure/Framework/Symfony/Polyfill.php new file mode 100644 index 0000000..7aff5e5 --- /dev/null +++ b/src/Infrastructure/Framework/Symfony/Polyfill.php @@ -0,0 +1,40 @@ + + * @license https://opensource.org/licenses/BSD-3-Clause The 3-Clause BSD License + * @link http://bartlett.laurent-laville.org/php-compatinfo/ + */ + +namespace Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony; + +use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator; + +/** + * @since 3.1.1 + * @see https://github.com/llaville/php-compatinfo-db/issues/61 + */ +final class Polyfill +{ + /** + * Creates a reference to a service. + * + * @param string $serviceId + * @return ReferenceConfigurator + */ + public static function service(string $serviceId): ReferenceConfigurator + { + return new ReferenceConfigurator($serviceId); + } +} + +function service(string $serviceId): ReferenceConfigurator +{ + return Polyfill::service($serviceId); +} diff --git a/src/Presentation/Console/Command/AbstractCommand.php b/src/Presentation/Console/Command/AbstractCommand.php index 998905f..5a9b2a3 100644 --- a/src/Presentation/Console/Command/AbstractCommand.php +++ b/src/Presentation/Console/Command/AbstractCommand.php @@ -24,6 +24,9 @@ */ abstract class AbstractCommand extends Command { + public const SUCCESS = 0; + public const FAILURE = 1; + /** @var CommandBusInterface */ protected $commandBus; diff --git a/src/Presentation/Console/Command/DiagnoseCommand.php b/src/Presentation/Console/Command/DiagnoseCommand.php index 01527fd..6f2881c 100644 --- a/src/Presentation/Console/Command/DiagnoseCommand.php +++ b/src/Presentation/Console/Command/DiagnoseCommand.php @@ -22,7 +22,6 @@ use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -65,6 +64,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $checker->setAppName('PHP CompatInfoDB'); $checker->printDiagnostic($projectRequirements); - return Command::SUCCESS; + return self::SUCCESS; } } diff --git a/src/Presentation/Console/Command/InitCommand.php b/src/Presentation/Console/Command/InitCommand.php index b1e5722..80c54fa 100644 --- a/src/Presentation/Console/Command/InitCommand.php +++ b/src/Presentation/Console/Command/InitCommand.php @@ -18,7 +18,6 @@ use Bartlett\CompatInfoDb\Presentation\Console\ApplicationInterface; use Bartlett\CompatInfoDb\Presentation\Console\Style; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -59,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $exitCode = $this->queryBus->query($initQuery); - if (Command::SUCCESS === $exitCode) { + if (self::SUCCESS === $exitCode) { $io->success('Database built successfully!'); } else { $io->warning('Database already exists.'); diff --git a/src/Presentation/Console/Command/ListCommand.php b/src/Presentation/Console/Command/ListCommand.php index 350ccb8..3f47f6d 100644 --- a/src/Presentation/Console/Command/ListCommand.php +++ b/src/Presentation/Console/Command/ListCommand.php @@ -20,7 +20,6 @@ use Bartlett\CompatInfoDb\Presentation\Console\ApplicationInterface; use Bartlett\CompatInfoDb\Presentation\Console\Style; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\TableSeparator; @@ -105,6 +104,6 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); - return Command::SUCCESS; + return self::SUCCESS; } } diff --git a/src/Presentation/Console/Command/ReleaseCommand.php b/src/Presentation/Console/Command/ReleaseCommand.php index 2315f5d..8f2049d 100644 --- a/src/Presentation/Console/Command/ReleaseCommand.php +++ b/src/Presentation/Console/Command/ReleaseCommand.php @@ -15,9 +15,8 @@ namespace Bartlett\CompatInfoDb\Presentation\Console\Command; use Bartlett\CompatInfoDb\Application\Command\Release\ReleaseCommand as AppReleaseCommand; - use Bartlett\CompatInfoDb\Presentation\Console\Style; -use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -69,6 +68,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->success('New release was added in JSON files'); $io->note('Do not forget to update constants of ExtensionVersionProviderInterface'); - return Command::SUCCESS; + return self::SUCCESS; } } diff --git a/src/Presentation/Console/Command/ShowCommand.php b/src/Presentation/Console/Command/ShowCommand.php index 7b3254f..c16bfce 100644 --- a/src/Presentation/Console/Command/ShowCommand.php +++ b/src/Presentation/Console/Command/ShowCommand.php @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (null === $extension) { $io->error(sprintf('Extension "%s" is not available', $showQuery->getExtension())); - return Command::FAILURE; + return self::FAILURE; } $summary = true; @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } if (!$summary) { - return Command::SUCCESS; + return self::SUCCESS; } $io->title('Reference Summary'); @@ -157,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ' Methods %10d' ); - return Command::SUCCESS; + return self::SUCCESS; } private function formatSection(array $data, string $section, StyleInterface $io): void From 3b8dd5711ad97a0a34fe22bd6df30247d6e8bbf9 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 14 Jan 2021 08:55:57 +0000 Subject: [PATCH] fixe OCI8 reference issue (#62) see report comment --- CHANGELOG-3.x.md | 1 + data/reference/extension/oci8/1/methods.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-3.x.md b/CHANGELOG-3.x.md index 0229ff1..50c4f04 100644 --- a/CHANGELOG-3.x.md +++ b/CHANGELOG-3.x.md @@ -9,6 +9,7 @@ using the [Keep a CHANGELOG](http://keepachangelog.com) principles. ### Fixed - [#61](https://github.com/llaville/php-compatinfo-db/issues/61) Keep Symfony 4.4 Backward Compatibility +- [#62](https://github.com/llaville/php-compatinfo-db/issues/62) OCI8 reference issue ## [3.1.0] - 2021-01-09 diff --git a/data/reference/extension/oci8/1/methods.json b/data/reference/extension/oci8/1/methods.json index 0aa2507..96ed79e 100644 --- a/data/reference/extension/oci8/1/methods.json +++ b/data/reference/extension/oci8/1/methods.json @@ -42,7 +42,7 @@ "ext_min": "1.0", "ext_max": "", "php_min": "4.3.0", - "php_max": "7.4.11" + "php_max": "7.4.14" }, { "class_name": "OCI-Collection", @@ -269,4 +269,4 @@ "php_min": "4.3.0", "php_max": "7.4.14" } -] \ No newline at end of file +] From 3c9ecc1a0f262fb010f698a6404b72fa779a4b9a Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sat, 16 Jan 2021 09:39:15 +0000 Subject: [PATCH] fixe class constants missing to solve issue #63 --- data/reference/extension/http/2/const.json | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/data/reference/extension/http/2/const.json b/data/reference/extension/http/2/const.json index c496afd..0e96bdd 100644 --- a/data/reference/extension/http/2/const.json +++ b/data/reference/extension/http/2/const.json @@ -262,5 +262,29 @@ "ext_max": "", "php_min": "5.3.0", "php_max": "" + }, + { + "class_name": "http\\Cookie", + "name": "PARSE_RAW", + "ext_min": "2.0.0", + "ext_max": "", + "php_min": "5.3.0", + "php_max": "" + }, + { + "class_name": "http\\Cookie", + "name": "SECURE", + "ext_min": "2.0.0", + "ext_max": "", + "php_min": "5.3.0", + "php_max": "" + }, + { + "class_name": "http\\Cookie", + "name": "HTTPONLY", + "ext_min": "2.0.0", + "ext_max": "", + "php_min": "5.3.0", + "php_max": "" } ] From 46ad813dd87effe6ecc08a0639fe49e553aabd5d Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sat, 16 Jan 2021 18:21:51 +0000 Subject: [PATCH] fixes xmlrpc reference issue (#64) --- CHANGELOG-3.x.md | 1 + README.md | 1 + .../reference/extension/xmlrpc/1/classes.json | 9 ++ .../extension/xmlrpc/1/functions.json | 128 ++++++++++++++++++ .../extension/xmlrpc/1/releases.json | 18 +++ .../extension/xmlrpc/43/releases.json | 2 +- src/Application/Query/Init/InitHandler.php | 11 +- 7 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 data/reference/extension/xmlrpc/1/classes.json create mode 100644 data/reference/extension/xmlrpc/1/functions.json create mode 100644 data/reference/extension/xmlrpc/1/releases.json diff --git a/data/reference/extension/xmlrpc/1/classes.json b/data/reference/extension/xmlrpc/1/classes.json new file mode 100644 index 0000000..0b0cb64 --- /dev/null +++ b/data/reference/extension/xmlrpc/1/classes.json @@ -0,0 +1,9 @@ +[ + { + "name": "XmlRpcServer", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "" + } +] diff --git a/data/reference/extension/xmlrpc/1/functions.json b/data/reference/extension/xmlrpc/1/functions.json new file mode 100644 index 0000000..09d5846 --- /dev/null +++ b/data/reference/extension/xmlrpc/1/functions.json @@ -0,0 +1,128 @@ +[ + { + "name": "xmlrpc_encode", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_decode", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_decode_request", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_encode_request", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_get_type", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_set_type", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_is_fault", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_create", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_destroy", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_register_method", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_call_method", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_parse_method_descriptions", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_add_introspection_data", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + }, + { + "name": "xmlrpc_server_register_introspection_callback", + "ext_min": "1.0.0RC1", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "", + "parameters": "", + "php_excludes": "" + } +] diff --git a/data/reference/extension/xmlrpc/1/releases.json b/data/reference/extension/xmlrpc/1/releases.json new file mode 100644 index 0000000..432d15a --- /dev/null +++ b/data/reference/extension/xmlrpc/1/releases.json @@ -0,0 +1,18 @@ +[ + { + "rel_version": "1.0.0RC1", + "rel_date": "2021-01-04", + "rel_state": "beta", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "" + }, + { + "rel_version": "1.0.0RC2", + "rel_date": "2021-01-15", + "rel_state": "beta", + "ext_max": "", + "php_min": "8.0.0", + "php_max": "" + } +] diff --git a/data/reference/extension/xmlrpc/43/releases.json b/data/reference/extension/xmlrpc/43/releases.json index 0613962..db1c4b6 100644 --- a/data/reference/extension/xmlrpc/43/releases.json +++ b/data/reference/extension/xmlrpc/43/releases.json @@ -5,6 +5,6 @@ "rel_state": "stable", "ext_max": "", "php_min": "4.3.0", - "php_max": "" + "php_max": "7.4.14" } ] diff --git a/src/Application/Query/Init/InitHandler.php b/src/Application/Query/Init/InitHandler.php index 53a92fa..95f69a6 100644 --- a/src/Application/Query/Init/InitHandler.php +++ b/src/Application/Query/Init/InitHandler.php @@ -1240,8 +1240,15 @@ private function majorReleaseDefinitionProvider(): Generator ]; yield 'xmlrpc' => [ - 'functions' => ['41'], - 'releases' => ['41', '43'], + 'classes' => ['1'], + 'functions' => [ + '41', // when bundled with PHP < 8 + '1', // as pecl extension for PHP 8 + ], + 'releases' => [ + '41', '43', // when bundled with PHP < 8 + '1' // as pecl extension for PHP 8 + ], ]; yield 'xmlwriter' => [ From 26d04a01cedc0238b28a238ebb54364474313b09 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sun, 17 Jan 2021 07:00:27 +0000 Subject: [PATCH] keep compatibility between xmlrpc extension php bundled and unbundled (pecl) --- src/Application/Query/Init/InitHandler.php | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Application/Query/Init/InitHandler.php b/src/Application/Query/Init/InitHandler.php index 95f69a6..63f0f2d 100644 --- a/src/Application/Query/Init/InitHandler.php +++ b/src/Application/Query/Init/InitHandler.php @@ -33,6 +33,7 @@ use function implode; use function json_last_error; use function sprintf; +use function version_compare; use const DIRECTORY_SEPARATOR; use const JSON_ERROR_NONE; @@ -1239,17 +1240,20 @@ private function majorReleaseDefinitionProvider(): Generator ), ]; - yield 'xmlrpc' => [ - 'classes' => ['1'], - 'functions' => [ - '41', // when bundled with PHP < 8 - '1', // as pecl extension for PHP 8 - ], - 'releases' => [ - '41', '43', // when bundled with PHP < 8 - '1' // as pecl extension for PHP 8 - ], - ]; + if (version_compare(PHP_VERSION, '8.0.0', 'lt')) { + // when bundled with PHP < 8 + yield 'xmlrpc' => [ + 'functions' => ['41'], + 'releases' => ['41', '43'], + ]; + } else { + // as pecl extension for PHP 8 + yield 'xmlrpc' => [ + 'classes' => ['1'], + 'functions' => ['1'], + 'releases' => ['1'], + ]; + } yield 'xmlwriter' => [ 'classes' => ['51'],