Skip to content

Commit 9b8f75e

Browse files
authored
Merge pull request #179 from javer/symfony6
Add Symfony 6 support and bump PHP to 7.4
2 parents b67f25e + a063036 commit 9b8f75e

File tree

6 files changed

+77
-70
lines changed

6 files changed

+77
-70
lines changed

.github/workflows/build.yml

+47-47
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
name: Build
22

33
on:
4-
push: ~
5-
pull_request: ~
6-
release:
7-
types: [created]
8-
schedule:
9-
-
10-
cron: "0 1 * * 6" # Run at 1am every Saturday
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, edited, reopened]
117

128
jobs:
13-
tests:
14-
runs-on: ubuntu-latest
15-
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
9+
test:
10+
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
11+
runs-on: ubuntu-20.04
12+
continue-on-error: false
1613
strategy:
1714
fail-fast: false
1815
matrix:
19-
php: ["7.3", "7.4", "8.0", "8.1"]
20-
symfony: ["4.4.*", "5.1.*"]
21-
16+
php-version:
17+
- '7.4'
18+
- '8.0'
19+
- '8.1'
20+
symfony-version:
21+
- '4.4.*'
22+
- '5.4.*'
23+
- '6.0.*'
24+
exclude:
25+
- php-version: '7.4'
26+
symfony-version: '6.0.*'
2227
steps:
23-
-
24-
uses: actions/checkout@v2
25-
26-
-
27-
name: Setup PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: "${{ matrix.php }}"
31-
coverage: none
32-
33-
-
34-
name: Update Symfony version
35-
if: matrix.symfony != ''
36-
run: |
37-
composer require symfony/dependency-injection:${{ matrix.symfony }} --no-update --no-scripts
38-
composer require symfony/http-kernel:${{ matrix.symfony }} --no-update --no-scripts
39-
composer require symfony/proxy-manager-bridge:${{ matrix.symfony }} --no-update --no-scripts
40-
41-
composer require --dev symfony/browser-kit:${{ matrix.symfony }} --no-update --no-scripts
42-
composer require --dev symfony/framework-bundle:${{ matrix.symfony }} --no-update --no-scripts
43-
composer require --dev symfony/process:${{ matrix.symfony }} --no-update --no-scripts
44-
composer require --dev symfony/yaml:${{ matrix.symfony }} --no-update --no-scripts
45-
46-
-
47-
name: Install dependencies
48-
run: composer update
49-
50-
-
51-
name: Run analysis
52-
run: composer analyse
53-
54-
-
55-
name: Run tests
56-
run: composer test
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
coverage: none
35+
ini-values: "memory_limit=-1"
36+
php-version: ${{ matrix.php-version }}
37+
tools: composer:v2, flex
38+
39+
- name: Validate composer.json
40+
run: composer validate --no-check-lock
41+
42+
- name: Remove analysis dependencies
43+
run: composer remove --dev --no-update sylius-labs/coding-standard vimeo/psalm
44+
if: matrix.symfony-version == '6.0.*'
45+
46+
- name: Install dependencies
47+
run: composer install --prefer-dist --no-progress
48+
env:
49+
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}"
50+
51+
- name: Run analysis
52+
run: composer analyse
53+
if: matrix.symfony-version != '6.0.*'
54+
55+
- name: Run tests
56+
run: composer test

composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.3 || ^8.0",
14+
"php": "^7.4 || ^8.0",
1515
"behat/behat": "^3.6.1",
16-
"symfony/dependency-injection": "^4.4 || ^5.1",
17-
"symfony/http-kernel": "^4.4 || ^5.1",
18-
"symfony/proxy-manager-bridge": "^4.4 || ^5.1"
16+
"symfony/dependency-injection": "^4.4 || ^5.1 || ^6.0",
17+
"symfony/http-kernel": "^4.4 || ^5.1 || ^6.0",
18+
"symfony/proxy-manager-bridge": "^4.4 || ^5.1 || ^6.0"
1919
},
2020
"require-dev": {
2121
"behat/mink-selenium2-driver": "^1.3",
@@ -25,10 +25,10 @@
2525
"friends-of-behat/page-object-extension": "^0.3.2",
2626
"friends-of-behat/service-container-extension": "^1.1",
2727
"sylius-labs/coding-standard": "^3.2",
28-
"symfony/browser-kit": "^4.4 || ^5.1",
29-
"symfony/framework-bundle": "^4.4 || ^5.1",
30-
"symfony/process": "^4.4 || ^5.1",
31-
"symfony/yaml": "^4.4 || ^5.1",
28+
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
29+
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0",
30+
"symfony/process": "^4.4 || ^5.1 || ^6.0",
31+
"symfony/yaml": "^4.4 || ^5.1 || ^6.0",
3232
"vimeo/psalm": "4.4.1"
3333
},
3434
"suggest": {

features/configuration/autodiscovering_application_kernel.feature

+4-8
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Feature: Autodiscovering the application kernel
6161
use Symfony\Component\DependencyInjection\ContainerBuilder;
6262
use Symfony\Component\HttpFoundation\Response;
6363
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
64-
use Symfony\Component\Routing\RouteCollectionBuilder;
6564
6665
class Kernel extends HttpKernel
6766
{
@@ -85,7 +84,7 @@ Feature: Autodiscovering the application kernel
8584
$loader->load(__DIR__ . '/../config/services.yaml');
8685
}
8786
88-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
87+
protected function configureRoutes($routes): void {}
8988
}
9089
"""
9190
When I run Behat
@@ -101,7 +100,6 @@ Feature: Autodiscovering the application kernel
101100
use Symfony\Component\DependencyInjection\ContainerBuilder;
102101
use Symfony\Component\HttpFoundation\Response;
103102
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
104-
use Symfony\Component\Routing\RouteCollectionBuilder;
105103
106104
class AppKernel extends HttpKernel
107105
{
@@ -125,7 +123,7 @@ Feature: Autodiscovering the application kernel
125123
$loader->load(__DIR__ . '/../config/services.yaml');
126124
}
127125
128-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
126+
protected function configureRoutes($routes): void {}
129127
}
130128
"""
131129
When I run Behat
@@ -147,7 +145,6 @@ Feature: Autodiscovering the application kernel
147145
use Symfony\Component\DependencyInjection\ContainerBuilder;
148146
use Symfony\Component\HttpFoundation\Response;
149147
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
150-
use Symfony\Component\Routing\RouteCollectionBuilder;
151148
152149
class Kernel extends HttpKernel
153150
{
@@ -171,7 +168,7 @@ Feature: Autodiscovering the application kernel
171168
$loader->load(__DIR__ . '/../config/services.yaml');
172169
}
173170
174-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
171+
protected function configureRoutes($routes): void {}
175172
}
176173
"""
177174
And a kernel file "app/AppKernel.php" containing:
@@ -183,7 +180,6 @@ Feature: Autodiscovering the application kernel
183180
use Symfony\Component\DependencyInjection\ContainerBuilder;
184181
use Symfony\Component\HttpFoundation\Response;
185182
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
186-
use Symfony\Component\Routing\RouteCollectionBuilder;
187183
188184
class AppKernel extends HttpKernel
189185
{
@@ -207,7 +203,7 @@ Feature: Autodiscovering the application kernel
207203
$loader->load(__DIR__ . '/../config/services.yaml');
208204
}
209205
210-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
206+
protected function configureRoutes($routes): void {}
211207
}
212208
"""
213209
When I run Behat

features/configuration/loading_configured_application_kernel.feature

+2-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ Feature: Loading configured application kernel
6666
use Symfony\Component\DependencyInjection\ContainerBuilder;
6767
use Symfony\Component\HttpFoundation\Response;
6868
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
69-
use Symfony\Component\Routing\RouteCollectionBuilder;
7069
7170
class Kernel extends HttpKernel
7271
{
@@ -90,7 +89,7 @@ Feature: Loading configured application kernel
9089
$loader->load(__DIR__ . '/../../config/services.yaml');
9190
}
9291
93-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
92+
protected function configureRoutes($routes): void {}
9493
}
9594
"""
9695
When I run Behat
@@ -115,7 +114,6 @@ Feature: Loading configured application kernel
115114
use Symfony\Component\DependencyInjection\ContainerBuilder;
116115
use Symfony\Component\HttpFoundation\Response;
117116
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
118-
use Symfony\Component\Routing\RouteCollectionBuilder;
119117
120118
class AppKernel extends HttpKernel
121119
{
@@ -139,7 +137,7 @@ Feature: Loading configured application kernel
139137
$loader->load(__DIR__ . '/../../config/services.yaml');
140138
}
141139
142-
protected function configureRoutes(RouteCollectionBuilder $routes): void {}
140+
protected function configureRoutes($routes): void {}
143141
}
144142
"""
145143
When I run Behat

psalm.xml

+6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
<errorLevel type="suppress">
2020
<referencedClass name="Symfony\Component\BrowserKit\AbstractBrowser" />
2121
<referencedClass name="Symfony\Component\BrowserKit\Client" />
22+
<referencedClass name="Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator" />
2223
</errorLevel>
2324
</UndefinedClass>
25+
<InvalidAttribute>
26+
<errorLevel type="suppress">
27+
<file name="src/Mink/MinkParameters.php" />
28+
</errorLevel>
29+
</InvalidAttribute>
2430
</issueHandlers>
2531
</psalm>

tests/Behat/Context/TestContext.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class: App\Kernel
100100
use Symfony\Component\Config\Loader\LoaderInterface;
101101
use Symfony\Component\DependencyInjection\ContainerBuilder;
102102
use Symfony\Component\HttpKernel\Kernel as HttpKernel;
103-
use Symfony\Component\Routing\RouteCollectionBuilder;
103+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
104104
105105
class Kernel extends HttpKernel
106106
{
@@ -125,9 +125,16 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
125125
$loader->load(__DIR__ . '/../config/services.yaml');
126126
}
127127
128-
protected function configureRoutes(RouteCollectionBuilder $routes): void
128+
protected function configureRoutes($routes): void
129129
{
130-
$routes->add('/hello-world', 'App\Controller:helloWorld');
130+
if ($routes instanceof RoutingConfigurator) { // available since Symfony 5.1
131+
$routes
132+
->add('app_hello', '/hello-world')
133+
->controller('App\Controller::helloWorld')
134+
;
135+
} else { // support Symfony 4.4
136+
$routes->add('/hello-world', 'App\Controller:helloWorld');
137+
}
131138
}
132139
}
133140
CON

0 commit comments

Comments
 (0)