Add Symfony 6 support
This commit is contained in:
70
.github/workflows/build.yml
vendored
70
.github/workflows/build.yml
vendored
@@ -1,56 +1,56 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push: ~
|
||||
pull_request: ~
|
||||
release:
|
||||
types: [created]
|
||||
schedule:
|
||||
-
|
||||
cron: "0 1 * * 6" # Run at 1am every Saturday
|
||||
push:
|
||||
pull_request:
|
||||
types: [opened, synchronize, edited, reopened]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
|
||||
test:
|
||||
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
|
||||
runs-on: ubuntu-20.04
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["7.3", "7.4", "8.0", "8.1"]
|
||||
symfony: ["4.4.*", "5.1.*"]
|
||||
|
||||
php-version:
|
||||
- '7.4'
|
||||
- '8.0'
|
||||
- '8.1'
|
||||
symfony-version:
|
||||
- '4.4.*'
|
||||
- '5.4.*'
|
||||
- '6.0.*'
|
||||
exclude:
|
||||
- php-version: '7.4'
|
||||
symfony-version: '6.0.*'
|
||||
steps:
|
||||
-
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
-
|
||||
name: Setup PHP
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php }}"
|
||||
coverage: none
|
||||
ini-values: "memory_limit=-1"
|
||||
php-version: ${{ matrix.php-version }}
|
||||
tools: composer:v2, flex
|
||||
|
||||
-
|
||||
name: Update Symfony version
|
||||
if: matrix.symfony != ''
|
||||
run: |
|
||||
composer require symfony/dependency-injection:${{ matrix.symfony }} --no-update --no-scripts
|
||||
composer require symfony/http-kernel:${{ matrix.symfony }} --no-update --no-scripts
|
||||
composer require symfony/proxy-manager-bridge:${{ matrix.symfony }} --no-update --no-scripts
|
||||
- name: Validate composer.json
|
||||
run: composer validate --no-check-lock
|
||||
|
||||
composer require --dev symfony/browser-kit:${{ matrix.symfony }} --no-update --no-scripts
|
||||
composer require --dev symfony/framework-bundle:${{ matrix.symfony }} --no-update --no-scripts
|
||||
composer require --dev symfony/process:${{ matrix.symfony }} --no-update --no-scripts
|
||||
composer require --dev symfony/yaml:${{ matrix.symfony }} --no-update --no-scripts
|
||||
- name: Remove analysis dependencies
|
||||
run: composer remove --dev --no-update sylius-labs/coding-standard vimeo/psalm
|
||||
if: matrix.symfony-version == '6.0.*'
|
||||
|
||||
-
|
||||
name: Install dependencies
|
||||
run: composer update
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
env:
|
||||
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}"
|
||||
|
||||
-
|
||||
name: Run analysis
|
||||
- name: Run analysis
|
||||
run: composer analyse
|
||||
if: matrix.symfony-version != '6.0.*'
|
||||
|
||||
-
|
||||
name: Run tests
|
||||
- name: Run tests
|
||||
run: composer test
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.3 || ^8.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"behat/behat": "^3.6.1",
|
||||
"symfony/dependency-injection": "^4.4 || ^5.1",
|
||||
"symfony/http-kernel": "^4.4 || ^5.1",
|
||||
"symfony/proxy-manager-bridge": "^4.4 || ^5.1"
|
||||
"symfony/dependency-injection": "^4.4 || ^5.1 || ^6.0",
|
||||
"symfony/http-kernel": "^4.4 || ^5.1 || ^6.0",
|
||||
"symfony/proxy-manager-bridge": "^4.4 || ^5.1 || ^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"behat/mink-selenium2-driver": "^1.3",
|
||||
@@ -25,10 +25,10 @@
|
||||
"friends-of-behat/page-object-extension": "^0.3.2",
|
||||
"friends-of-behat/service-container-extension": "^1.1",
|
||||
"sylius-labs/coding-standard": "^3.2",
|
||||
"symfony/browser-kit": "^4.4 || ^5.1",
|
||||
"symfony/framework-bundle": "^4.4 || ^5.1",
|
||||
"symfony/process": "^4.4 || ^5.1",
|
||||
"symfony/yaml": "^4.4 || ^5.1",
|
||||
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
|
||||
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0",
|
||||
"symfony/process": "^4.4 || ^5.1 || ^6.0",
|
||||
"symfony/yaml": "^4.4 || ^5.1 || ^6.0",
|
||||
"vimeo/psalm": "4.4.1"
|
||||
},
|
||||
"suggest": {
|
||||
|
||||
@@ -61,7 +61,6 @@ Feature: Autodiscovering the application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@@ -85,7 +84,7 @@ Feature: Autodiscovering the application kernel
|
||||
$loader->load(__DIR__ . '/../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
When I run Behat
|
||||
@@ -101,7 +100,6 @@ Feature: Autodiscovering the application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class AppKernel extends HttpKernel
|
||||
{
|
||||
@@ -125,7 +123,7 @@ Feature: Autodiscovering the application kernel
|
||||
$loader->load(__DIR__ . '/../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
When I run Behat
|
||||
@@ -147,7 +145,6 @@ Feature: Autodiscovering the application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@@ -171,7 +168,7 @@ Feature: Autodiscovering the application kernel
|
||||
$loader->load(__DIR__ . '/../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
And a kernel file "app/AppKernel.php" containing:
|
||||
@@ -183,7 +180,6 @@ Feature: Autodiscovering the application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class AppKernel extends HttpKernel
|
||||
{
|
||||
@@ -207,7 +203,7 @@ Feature: Autodiscovering the application kernel
|
||||
$loader->load(__DIR__ . '/../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
When I run Behat
|
||||
|
||||
@@ -66,7 +66,6 @@ Feature: Loading configured application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@@ -90,7 +89,7 @@ Feature: Loading configured application kernel
|
||||
$loader->load(__DIR__ . '/../../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
When I run Behat
|
||||
@@ -115,7 +114,6 @@ Feature: Loading configured application kernel
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
|
||||
class AppKernel extends HttpKernel
|
||||
{
|
||||
@@ -139,7 +137,7 @@ Feature: Loading configured application kernel
|
||||
$loader->load(__DIR__ . '/../../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
|
||||
protected function configureRoutes($routes): void {}
|
||||
}
|
||||
"""
|
||||
When I run Behat
|
||||
|
||||
@@ -19,7 +19,13 @@
|
||||
<errorLevel type="suppress">
|
||||
<referencedClass name="Symfony\Component\BrowserKit\AbstractBrowser" />
|
||||
<referencedClass name="Symfony\Component\BrowserKit\Client" />
|
||||
<referencedClass name="Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator" />
|
||||
</errorLevel>
|
||||
</UndefinedClass>
|
||||
<InvalidAttribute>
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Mink/MinkParameters.php" />
|
||||
</errorLevel>
|
||||
</InvalidAttribute>
|
||||
</issueHandlers>
|
||||
</psalm>
|
||||
|
||||
@@ -100,7 +100,7 @@ use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@@ -125,11 +125,18 @@ class Kernel extends HttpKernel
|
||||
$loader->load(__DIR__ . '/../config/services.yaml');
|
||||
}
|
||||
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes): void
|
||||
protected function configureRoutes($routes): void
|
||||
{
|
||||
if ($routes instanceof RoutingConfigurator) { // available since Symfony 5.1
|
||||
$routes
|
||||
->add('app_hello', '/hello-world')
|
||||
->controller('App\Controller::helloWorld')
|
||||
;
|
||||
} else { // support Symfony 4.4
|
||||
$routes->add('/hello-world', 'App\Controller:helloWorld');
|
||||
}
|
||||
}
|
||||
}
|
||||
CON
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user