From 9ba77ae8e12ab99a3c67ae7ca52d18ed9a26e743 Mon Sep 17 00:00:00 2001 From: Andrew MacRobert Date: Sat, 20 Nov 2021 11:24:24 -0500 Subject: [PATCH 1/7] Symfony 6 support --- .github/workflows/ci.yml | 4 ++-- composer.json | 10 +++++----- src/BrefKernel.php | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1854fcc..3daa3c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ jobs: max-parallel: 10 fail-fast: false matrix: - php: ['7.3', '7.4', '8.0'] - sf_version: ['4.4.*', '5.0.*', '5.2.*'] + php: ['7.3', '7.4', '8.0', '8.1'] + sf_version: ['4.4.*', '5.0.*', '5.2.*', '5.4.*', '6.0.*'] steps: - name: Set up PHP diff --git a/composer.json b/composer.json index c68eb42..c4b0f4b 100644 --- a/composer.json +++ b/composer.json @@ -21,15 +21,15 @@ "require": { "php": ">=7.3", "bref/bref": "^1.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0" + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0" }, "require-dev": { "mnapoli/hard-mode": "^0.3.0", "phpunit/phpunit": "^8.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0" }, "config": { "sort-packages": true diff --git a/src/BrefKernel.php b/src/BrefKernel.php index 131ae1c..c76d8f0 100644 --- a/src/BrefKernel.php +++ b/src/BrefKernel.php @@ -3,6 +3,7 @@ namespace Bref\SymfonyBridge; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; @@ -16,7 +17,7 @@ public function isLambda(): bool /** * {@inheritDoc} */ - public function getCacheDir() + public function getCacheDir(): string { if ($this->isLambda()) { return '/tmp/cache/' . $this->environment; @@ -28,7 +29,7 @@ public function getCacheDir() /** * {@inheritDoc} */ - public function getLogDir() + public function getLogDir(): string { if ($this->isLambda()) { return '/tmp/log/'; @@ -46,7 +47,7 @@ public function getLogDir() * * @see https://github.com/brefphp/symfony-bridge/pull/37 */ - public function handle($request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) + public function handle($request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): Response { $this->prepareCacheDir(parent::getCacheDir(), $this->getCacheDir()); From f913e61878b4f444b09f3a5b739c771867a01c32 Mon Sep 17 00:00:00 2001 From: Andrew MacRobert Date: Mon, 20 Dec 2021 09:24:37 -0500 Subject: [PATCH 2/7] Update .github/workflows/ci.yml Co-authored-by: Thibault RICHARD --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3daa3c9..65fcfee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,12 @@ jobs: matrix: php: ['7.3', '7.4', '8.0', '8.1'] sf_version: ['4.4.*', '5.0.*', '5.2.*', '5.4.*', '6.0.*'] + exclude: + - php: 7.3 + sf_version: 6.0.* + + - php: 7.4 + sf_version: 6.0.* steps: - name: Set up PHP From ec7c7a33560fc334ae5ab8a84992e41daec31f95 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 28 Dec 2021 11:35:38 +0100 Subject: [PATCH 3/7] Support new Composer options --- composer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c4b0f4b..18bc730 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,10 @@ "symfony/process": "^4.4|^5.0|^6.0" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "symfony/runtime": false + } } } From 929302201c87908f15ff59a4184909623d483d0d Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 28 Dec 2021 11:41:12 +0100 Subject: [PATCH 4/7] Fix type issue between Symfony versions --- tests/Functional/App/src/Kernel.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Functional/App/src/Kernel.php b/tests/Functional/App/src/Kernel.php index 58a7ea8..fedccf7 100644 --- a/tests/Functional/App/src/Kernel.php +++ b/tests/Functional/App/src/Kernel.php @@ -8,7 +8,6 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Routing\RouteCollectionBuilder; class Kernel extends BrefKernel { @@ -44,7 +43,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes($routes): void { $confDir = $this->getProjectDir().'/config'; From 95066c61a3211b8ec646c4ce051b3afe6f47341b Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 28 Dec 2021 11:57:15 +0100 Subject: [PATCH 5/7] Fix the tests for Symfony 6 --- tests/Functional/App/src/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Functional/App/src/Kernel.php b/tests/Functional/App/src/Kernel.php index fedccf7..bf6f98d 100644 --- a/tests/Functional/App/src/Kernel.php +++ b/tests/Functional/App/src/Kernel.php @@ -49,7 +49,7 @@ protected function configureRoutes($routes): void $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir.'/routes.yaml'); } /** From 55dc40171cbd5581e4e7fa866e86196f796f2247 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 28 Dec 2021 11:57:36 +0100 Subject: [PATCH 6/7] Run tests by default on latest Symfony and PHP versions locally --- tests/Functional/App/.gitignore | 1 + tests/Functional/FunctionalTest.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Functional/App/.gitignore b/tests/Functional/App/.gitignore index 3477dc9..6607830 100644 --- a/tests/Functional/App/.gitignore +++ b/tests/Functional/App/.gitignore @@ -1,6 +1,7 @@ composer.lock symfony.lock tmp/ +config/preload.php ###> symfony/framework-bundle ### /.env.local diff --git a/tests/Functional/FunctionalTest.php b/tests/Functional/FunctionalTest.php index 06560a2..eeaecc8 100644 --- a/tests/Functional/FunctionalTest.php +++ b/tests/Functional/FunctionalTest.php @@ -36,7 +36,7 @@ abstract public function test Symfony works(): void; protected function composerInstall(): void { $symfonyRequirement = getenv('SYMFONY_REQUIRE'); - $symfonyRequirement = $symfonyRequirement === false ? '4.4.*' : $symfonyRequirement; + $symfonyRequirement = $symfonyRequirement === false ? '6.0.*' : $symfonyRequirement; $composerInstall = new Process([ 'composer', @@ -128,7 +128,7 @@ private function runInDockerProcess(array $command): Process { $projectRoot = dirname(__DIR__, 2); $phpVersion = getenv('PHP_VERSION'); - $phpVersion = $phpVersion === false ? '74' : str_replace('.', '', $phpVersion); + $phpVersion = $phpVersion === false ? '81' : str_replace('.', '', $phpVersion); $baseCommand = [ 'docker', From b9f815d0cd6a5bce0b828017ca6aaebab5058557 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 28 Dec 2021 12:00:12 +0100 Subject: [PATCH 7/7] Fix code style --- src/BrefKernel.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/BrefKernel.php b/src/BrefKernel.php index c76d8f0..7d5d4dd 100644 --- a/src/BrefKernel.php +++ b/src/BrefKernel.php @@ -14,9 +14,6 @@ public function isLambda(): bool return getenv('LAMBDA_TASK_ROOT') !== false; } - /** - * {@inheritDoc} - */ public function getCacheDir(): string { if ($this->isLambda()) { @@ -26,9 +23,6 @@ public function getCacheDir(): string return parent::getCacheDir(); } - /** - * {@inheritDoc} - */ public function getLogDir(): string { if ($this->isLambda()) {