Skip to content

Commit e132fd3

Browse files
committed
Add support for Symfony 6
1 parent 1fc0fcc commit e132fd3

28 files changed

+505
-121
lines changed

.github/workflows/ci.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ jobs:
7878
fail-fast: false
7979
matrix:
8080
php: ['7.3', '7.4', '8.0']
81-
symfony_version: ['4.4.*', '5.2.*']
81+
symfony_version: ['4.4.*', '5.2.*', '6.0.*']
8282
dependencies: ['--prefer-lowest', '--prefer-dist']
8383
exclude:
8484
- php: '8.0'
8585
symfony_version: '4.4.*'
86+
- php: '7.3'
87+
symfony_version: '6.0.*'
88+
- php: '7.4'
89+
symfony_version: '6.0.*'
8690

8791
name: PHP ${{ matrix.php }} unit tests on Sf ${{ matrix.symfony_version }}, deps=${{ matrix.dependencies }}
8892

@@ -122,12 +126,16 @@ jobs:
122126
fail-fast: false
123127
matrix:
124128
php: ['7.4', '8.0'] # same as in the container
125-
symfony_version: ['4.4.*', '5.2.*']
129+
symfony_version: ['4.4.*', '5.2.*', '6.0.*']
126130
dependencies: ['--prefer-lowest', '--prefer-dist']
127131
rdkafka_action: ['exclude-group', 'group']
128132
exclude:
129133
- php: '8.0'
130134
symfony_version: '4.4.*'
135+
- php: '7.3'
136+
symfony_version: '6.0.*'
137+
- php: '7.4'
138+
symfony_version: '6.0.*'
131139

132140
name: PHP ${{ matrix.php }} functional tests on Sf ${{ matrix.symfony_version }}, rdkafka_action=${{ matrix.rdkafka_action }}, deps=${{ matrix.dependencies }}
133141

.php_cs.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
<?php
22

3-
return PhpCsFixer\Config::create()
3+
return (new PhpCsFixer\Config())
44
->setRiskyAllowed(true)
55
->setRules(array(
66
'@Symfony' => true,
77
'@Symfony:risky' => true,
88
'array_syntax' => array('syntax' => 'short'),
99
'combine_consecutive_unsets' => true,
1010
// one should use PHPUnit methods to set up expected exception instead of annotations
11-
'general_phpdoc_annotation_remove' => array('expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'),
11+
'general_phpdoc_annotation_remove' => ['annotations' =>
12+
['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp']
13+
],
1214
'heredoc_to_nowdoc' => true,
13-
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'),
15+
'no_extra_blank_lines' => ['tokens' => [
16+
'break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']
17+
],
1418
'no_unreachable_default_argument_value' => true,
1519
'no_useless_else' => true,
1620
'no_useless_return' => true,
1721
'ordered_class_elements' => true,
1822
'ordered_imports' => true,
1923
'phpdoc_add_missing_param_annotation' => true,
2024
'phpdoc_order' => true,
21-
'psr4' => true,
25+
'psr_autoloading' => true,
2226
'strict_param' => true,
2327
'native_function_invocation' => false,
2428
))

composer.json

+15-14
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"doctrine/dbal": "^2.12|^3.1",
2424
"ramsey/uuid": "^3.5|^4",
2525
"psr/log": "^1.1 || ^2.0 || ^3.0",
26-
"psr/container": "^1 || ^2.0",
26+
"psr/container": "^1.1 || ^2.0",
2727
"makasim/temp-file": "^0.2",
2828
"google/cloud-pubsub": "^1.4.3",
2929
"doctrine/orm": "^2.7.4",
@@ -53,23 +53,23 @@
5353
"phpunit/phpunit": "^9.5",
5454
"phpstan/phpstan": "^0.12",
5555
"queue-interop/queue-spec": "^0.6.2",
56-
"symfony/browser-kit": "^4.3|^5",
57-
"symfony/config": "^4.3|^5",
58-
"symfony/process": "^4.3|^5",
59-
"symfony/console": "^4.3|^5",
60-
"symfony/dependency-injection": "^4.3|^5",
61-
"symfony/event-dispatcher": "^4.3|^5",
62-
"symfony/expression-language": "^4.3|^5",
63-
"symfony/http-kernel": "^4.3|^5",
64-
"symfony/filesystem": "^4.3|^5",
65-
"symfony/framework-bundle": "^4.3|^5",
66-
"symfony/yaml": "^4.3|^5",
56+
"symfony/browser-kit": "^4.3|^5|^6.0",
57+
"symfony/config": "^4.3|^5|^6.0",
58+
"symfony/process": "^4.3|^5|^6.0",
59+
"symfony/console": "^4.3|^5|^6.0",
60+
"symfony/dependency-injection": "^4.3|^5|^6.0",
61+
"symfony/event-dispatcher": "^4.3|^5|^6.0",
62+
"symfony/expression-language": "^4.3|^5|^6.0",
63+
"symfony/http-kernel": "^4.3|^5|^6.0",
64+
"symfony/filesystem": "^4.3|^5|^6.0",
65+
"symfony/framework-bundle": "^4.3|^5|^6.0",
66+
"symfony/yaml": "^4.3|^5|^6.0",
6767
"empi89/php-amqp-stubs": "*@dev",
6868
"doctrine/doctrine-bundle": "^2.0",
6969
"doctrine/mongodb-odm-bundle": "^3.5|^4.3",
7070
"alcaeus/mongo-php-adapter": "^1.0",
7171
"kwn/php-rdkafka-stubs": "^2.0.3",
72-
"friendsofphp/php-cs-fixer": "^2",
72+
"friendsofphp/php-cs-fixer": "^3.4",
7373
"dms/phpunit-arraysubset-asserts": "^0.2.1",
7474
"phpspec/prophecy-phpunit": "^2.0"
7575
},
@@ -127,7 +127,8 @@
127127
"ext-mongodb": "1.5",
128128
"ext-bcmath": "1",
129129
"ext-mbstring": "1",
130-
"ext-mongo": "1.6.14"
130+
"ext-mongo": "1.6.14",
131+
"ext-sockets": "1"
131132
},
132133
"prefer-stable": true
133134
}

pkg/async-command/composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"php": "^7.3|^8.0",
1010
"enqueue/enqueue": "^0.10",
1111
"queue-interop/queue-interop": "^0.8",
12-
"symfony/console": "^4.3|^5",
13-
"symfony/process": "^4.3|^5"
12+
"symfony/console": "^4.3|^5|^6.0",
13+
"symfony/process": "^4.3|^5|^6.0"
1414
},
1515
"require-dev": {
1616
"phpunit/phpunit": "^9.5",
17-
"symfony/dependency-injection": "^4.3|^5",
18-
"symfony/config": "^4.3|^5",
19-
"symfony/http-kernel": "^4.3|^5",
20-
"symfony/filesystem": "^4.3|^5",
21-
"symfony/yaml": "^4.3|^5",
17+
"symfony/dependency-injection": "^4.3|^5|^6.0",
18+
"symfony/config": "^4.3|^5|^6.0",
19+
"symfony/http-kernel": "^4.3|^5|^6.0",
20+
"symfony/filesystem": "^4.3|^5|^6.0",
21+
"symfony/yaml": "^4.3|^5|^6.0",
2222
"enqueue/null": "0.10.x-dev",
2323
"enqueue/fs": "0.10.x-dev",
2424
"enqueue/test": "0.10.x-dev"
@@ -31,7 +31,7 @@
3131
"docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
3232
},
3333
"suggest": {
34-
"symfony/dependency-injection": "^4.3|^5 If you'd like to use async event dispatcher container extension."
34+
"symfony/dependency-injection": "^4.3|^5|^6.0 If you'd like to use async event dispatcher container extension."
3535
},
3636
"autoload": {
3737
"psr-4": { "Enqueue\\AsyncCommand\\": "" },

pkg/async-event-dispatcher/composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"php": "^7.3|^8.0",
1010
"enqueue/enqueue": "^0.10",
1111
"queue-interop/queue-interop": "^0.8",
12-
"symfony/event-dispatcher": "^4.3|^5"
12+
"symfony/event-dispatcher": "^4.3|^5|^6.0"
1313
},
1414
"require-dev": {
1515
"phpunit/phpunit": "^9.5",
16-
"symfony/dependency-injection": "^4.3|^5",
17-
"symfony/config": "^4.3|^5",
18-
"symfony/http-kernel": "^4.3|^5",
19-
"symfony/filesystem": "^4.3|^5",
20-
"symfony/yaml": "^4.3|^5",
16+
"symfony/dependency-injection": "^4.3|^5|^6.0",
17+
"symfony/config": "^4.3|^5|^6.0",
18+
"symfony/http-kernel": "^4.3|^5|^6.0",
19+
"symfony/filesystem": "^4.3|^5|^6.0",
20+
"symfony/yaml": "^4.3|^5|^6.0",
2121
"enqueue/null": "0.10.x-dev",
2222
"enqueue/fs": "0.10.x-dev",
2323
"enqueue/test": "0.10.x-dev"

pkg/enqueue-bundle/Tests/Functional/App/AppKernel.php

+10-13
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
class AppKernel extends Kernel
99
{
10-
/**
11-
* @return array
12-
*/
13-
public function registerBundles()
10+
public function registerBundles(): iterable
1411
{
1512
$bundles = [
1613
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
@@ -21,28 +18,28 @@ public function registerBundles()
2118
return $bundles;
2219
}
2320

24-
/**
25-
* @return string
26-
*/
27-
public function getCacheDir()
21+
public function getCacheDir(): string
2822
{
2923
return sys_get_temp_dir().'/EnqueueBundle/cache';
3024
}
3125

32-
/**
33-
* @return string
34-
*/
35-
public function getLogDir()
26+
public function getLogDir(): string
3627
{
3728
return sys_get_temp_dir().'/EnqueueBundle/cache/logs';
3829
}
3930

4031
public function registerContainerConfiguration(LoaderInterface $loader)
4132
{
33+
if (self::VERSION_ID < 60000) {
34+
$loader->load(__DIR__.'/config/config-sf5.yml');
35+
36+
return;
37+
}
38+
4239
$loader->load(__DIR__.'/config/config.yml');
4340
}
4441

45-
protected function getContainerClass()
42+
protected function getContainerClass(): string
4643
{
4744
return parent::getContainerClass().'BundleDefault';
4845
}

pkg/enqueue-bundle/Tests/Functional/App/CustomAppKernel.php

+9-14
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ public function setEnqueueConfig(array $config)
3838
$fs->mkdir(sys_get_temp_dir().'/EnqueueBundleCustom/cache/'.$this->enqueueConfigId);
3939
}
4040

41-
/**
42-
* @return array
43-
*/
44-
public function registerBundles()
41+
public function registerBundles(): iterable
4542
{
4643
$bundles = [
4744
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
@@ -52,23 +49,17 @@ public function registerBundles()
5249
return $bundles;
5350
}
5451

55-
/**
56-
* @return string
57-
*/
58-
public function getCacheDir()
52+
public function getCacheDir(): string
5953
{
6054
return sys_get_temp_dir().'/EnqueueBundleCustom/cache/'.$this->enqueueConfigId;
6155
}
6256

63-
/**
64-
* @return string
65-
*/
66-
public function getLogDir()
57+
public function getLogDir(): string
6758
{
6859
return sys_get_temp_dir().'/EnqueueBundleCustom/cache/logs/'.$this->enqueueConfigId;
6960
}
7061

71-
protected function getContainerClass()
62+
protected function getContainerClass(): string
7263
{
7364
return parent::getContainerClass().'Custom'.$this->enqueueConfigId;
7465
}
@@ -78,7 +69,11 @@ protected function getContainerClass()
7869
*/
7970
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
8071
{
81-
$loader->load(__DIR__.'/config/custom-config.yml');
72+
if (self::VERSION_ID < 60000) {
73+
$loader->load(__DIR__.'/config/custom-config-sf5.yml');
74+
} else {
75+
$loader->load(__DIR__.'/config/custom-config.yml');
76+
}
8277

8378
$c->loadFromExtension('enqueue', $this->enqueueConfig);
8479
}

0 commit comments

Comments
 (0)