Skip to content

Commit

Permalink
Merge pull request #50 from brefphp/symfony-6
Browse files Browse the repository at this point in the history
Symfony 6 compatibility
  • Loading branch information
mnapoli authored Dec 28, 2021
2 parents bd40727 + b9f815d commit d06e657
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ 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.*']
exclude:
- php: 7.3
sf_version: 6.0.*

- php: 7.4
sf_version: 6.0.*

steps:
- name: Set up PHP
Expand Down
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@
"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
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"symfony/runtime": false
}
}
}
13 changes: 4 additions & 9 deletions src/BrefKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -13,10 +14,7 @@ public function isLambda(): bool
return getenv('LAMBDA_TASK_ROOT') !== false;
}

/**
* {@inheritDoc}
*/
public function getCacheDir()
public function getCacheDir(): string
{
if ($this->isLambda()) {
return '/tmp/cache/' . $this->environment;
Expand All @@ -25,10 +23,7 @@ public function getCacheDir()
return parent::getCacheDir();
}

/**
* {@inheritDoc}
*/
public function getLogDir()
public function getLogDir(): string
{
if ($this->isLambda()) {
return '/tmp/log/';
Expand All @@ -46,7 +41,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());

Expand Down
1 change: 1 addition & 0 deletions tests/Functional/App/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
composer.lock
symfony.lock
tmp/
config/preload.php

###> symfony/framework-bundle ###
/.env.local
Expand Down
5 changes: 2 additions & 3 deletions tests/Functional/App/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -44,13 +43,13 @@ 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';

$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');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit d06e657

Please sign in to comment.