Skip to content

Commit 124c7a6

Browse files
Merge pull request #634 from alexislefebvre/chore-allow-symfony-7
chore: allow Symfony 7
2 parents 5658b8a + bb01956 commit 124c7a6

File tree

18 files changed

+109
-324
lines changed

18 files changed

+109
-324
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
php-version: ['7.4', '8.0', '8.1', '8.2']
13+
# Symfony 6.3 requires PHP >= 8.0, it will be installed on PHP >= 8.0
14+
# Symfony 7.0 requires PHP >= 8.2, it will be installed on PHP >= 8.2
15+
php-version: ['8.1', '8.2']
1416
composer-flags: ['']
15-
symfony-version: ['^5.4']
17+
symfony-version: ['^6.4']
1618
include:
1719
- php-version: 7.4
18-
symfony-version: "^4.4"
20+
symfony-version: "^5.4"
1921
composer-flags: "--prefer-lowest"
20-
- php-version: 7.4
21-
symfony-version: "^4.4"
22-
- php-version: 8.0
23-
symfony-version: "^4.4"
2422
- php-version: 8.1
25-
symfony-version: "^6.2"
23+
symfony-version: "^5.4"
24+
- php-version: 8.1
25+
symfony-version: "^6.4"
26+
- php-version: 8.2
27+
symfony-version: "^6.4"
2628
- php-version: 8.2
27-
symfony-version: "^6.2"
29+
symfony-version: "^7.0"
2830

2931
steps:
3032
- name: Checkout

composer.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
"require": {
1818
"php": "^7.4 || ^8.0",
1919
"phpunit/phpunit": "^9.6 || ^10.0",
20-
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
21-
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0"
20+
"symfony/browser-kit": "^5.4 || ^6.4 || ^7.0",
21+
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0"
2222
},
2323
"require-dev": {
2424
"ext-json": "*",
2525
"doctrine/annotations": "^1.3 || ^2.0",
26-
"doctrine/doctrine-bundle": "^2.1",
26+
"doctrine/doctrine-bundle": "^2.11",
2727
"doctrine/orm": "^2.7",
28-
"monolog/monolog": "~1.11",
29-
"symfony/css-selector": "^4.4 || ^5.1 || ^6.0",
30-
"symfony/doctrine-bridge": "^4.4 || ^5.1 || ^6.0",
31-
"symfony/form": "^4.4 || ^5.1 || ^6.0",
32-
"symfony/http-kernel": "^4.4 || ^5.1 || ^6.0",
28+
"monolog/monolog": "^1.25.1 || ^2.0 || ^3.0",
29+
"symfony/css-selector": "^5.4 || ^6.4 || ^7.0",
30+
"symfony/doctrine-bridge": "^5.4 || ^6.4 || ^7.0",
31+
"symfony/form": "^5.4 || ^6.4 || ^7.0",
32+
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0",
3333
"symfony/monolog-bundle": "^3.4",
34-
"symfony/security-bundle": "^4.4 || ^5.1 || ^6.0",
35-
"symfony/twig-bundle": "^4.4 || ^5.1 || ^6.0",
36-
"symfony/validator": "^4.4 || ^5.1 || ^6.0",
37-
"symfony/yaml": "^4.4 || ^5.1 || ^6.0",
38-
"twig/twig": "^2.0 || ^3.0"
34+
"symfony/security-bundle": "^5.4 || ^6.4 || ^7.0",
35+
"symfony/twig-bundle": "^5.4 || ^6.4 || ^7.0",
36+
"symfony/validator": "^5.4 || ^6.4 || ^7.0",
37+
"symfony/yaml": "^5.4 || ^6.4 || ^7.0",
38+
"twig/twig": "^2.0 || ^3.8"
3939
},
4040
"conflict": {
4141
"symfony/framework-bundle": "4.3.0"

src/EventListener/ExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function setException(GetResponseForExceptionEvent $event): void
4343

4444
public function clearLastException(GetResponseEvent $event): void
4545
{
46-
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
46+
if (HttpKernelInterface::MAIN_REQUEST === $event->getRequestType()) {
4747
$this->lastException = null;
4848
}
4949
}

src/QueryCounter.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919

2020
final class QueryCounter
2121
{
22-
/** @var int */
23-
private $defaultMaxCount;
22+
private ?int $defaultMaxCount;
23+
private ?Reader $annotationReader;
2424

25-
/** @var Reader */
26-
private $annotationReader;
27-
28-
public function __construct(?int $defaultMaxCount, Reader $annotationReader)
25+
public function __construct(?int $defaultMaxCount, ?Reader $annotationReader)
2926
{
3027
$this->defaultMaxCount = $defaultMaxCount;
3128
$this->annotationReader = $annotationReader;
@@ -57,6 +54,10 @@ private function getMaxQueryCount(): ?int
5754

5855
private function getMaxQueryAnnotation(): ?int
5956
{
57+
if (null === $this->annotationReader) {
58+
@trigger_error('The annotationReader is not available', \E_USER_ERROR);
59+
}
60+
6061
foreach (debug_backtrace() as $step) {
6162
if ('test' === substr($step['function'], 0, 4)) { //TODO: handle tests with the @test annotation
6263
$annotations = $this->annotationReader->getMethodAnnotations(

src/Resources/config/functional_test.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<service id="liip_functional_test.query.counter" class="Liip\FunctionalTestBundle\QueryCounter">
2323
<argument>%liip_functional_test.query.max_query_count%</argument>
24-
<argument type="service" id="annotation_reader" />
24+
<argument type="service" id="annotation_reader" on-invalid="null" />
2525
</service>
2626
</services>
2727
</container>

tests/App/AppKernel.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,8 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
3737
{
3838
$loader->load(__DIR__.'/config.yml');
3939

40-
if (Kernel::MAJOR_VERSION >= 5) {
41-
$loader->load(__DIR__.'/security_5.yml');
42-
$loader->load(__DIR__.'/session_5.yml');
43-
} else {
44-
$loader->load(__DIR__.'/security_4.yml');
45-
$loader->load(__DIR__.'/session_4.yml');
46-
}
40+
$loader->load(__DIR__.'/security_5.yml');
41+
$loader->load(__DIR__.'/session_5.yml');
4742
}
4843

4944
public function getCacheDir(): string

tests/App/Command/TestCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure(): void
3737
->setDescription('Test command');
3838
}
3939

40-
protected function execute(InputInterface $input, OutputInterface $output)
40+
protected function execute(InputInterface $input, OutputInterface $output): int
4141
{
4242
// Symfony version check
4343
$version = Kernel::VERSION_ID;

tests/App/Command/TestInteractiveCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function configure(): void
3030
;
3131
}
3232

33-
protected function execute(InputInterface $input, OutputInterface $output)
33+
protected function execute(InputInterface $input, OutputInterface $output): int
3434
{
3535
$helper = $this->getHelper('question');
3636
$question = new Question('Please enter the input', 'AcmeDemoBundle');

tests/App/Controller/DefaultController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,9 @@ public function embeddedAction(): Response
107107
{
108108
return new Response('Embedded Content', Response::HTTP_OK);
109109
}
110+
111+
public function exceptionAction(): Response
112+
{
113+
throw new \Exception('foo');
114+
}
110115
}

0 commit comments

Comments
 (0)