diff options
author | Remi Collet <remi@remirepo.net> | 2021-01-14 08:46:12 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-01-14 08:46:12 +0100 |
commit | aa459b5c0becf24753c18e3752f5fed9970f18c4 (patch) | |
tree | d6662059386a408247fdf1c44b6859b92e8f6693 /php-bartlett-php-compatinfo-db-upstream.patch | |
parent | 2308b6d7b907cdebbec2e9062de6a8e0ef48129f (diff) |
add upstream patch for Symfony 4
Diffstat (limited to 'php-bartlett-php-compatinfo-db-upstream.patch')
-rw-r--r-- | php-bartlett-php-compatinfo-db-upstream.patch | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/php-bartlett-php-compatinfo-db-upstream.patch b/php-bartlett-php-compatinfo-db-upstream.patch new file mode 100644 index 0000000..82345d1 --- /dev/null +++ b/php-bartlett-php-compatinfo-db-upstream.patch @@ -0,0 +1,264 @@ +From d05aaa27ebd0d0d5fe61c34da10d4362c3223ea1 Mon Sep 17 00:00:00 2001 +From: Laurent Laville <laurent.laville@gmail.com> +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 @@ ++<?php declare(strict_types=1); ++ ++/** ++ * Keep BC between Symfony 4.4 and Symfony 5.x ++ * ++ * PHP version 7 ++ * ++ * @category PHP ++ * @package PHP_CompatInfo_Db ++ * @author Laurent Laville <pear@laurent-laville.org> ++ * @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 |