Skip to content

Commit 638ea41

Browse files
authored
Merge pull request #675 from ruudk/patch-7
PHP 8.1 + Symfony 6.0
2 parents 2f0dcda + 30175c8 commit 638ea41

File tree

5 files changed

+56
-79
lines changed

5 files changed

+56
-79
lines changed

.github/workflows/test.yaml

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,20 @@ jobs:
66
test:
77
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
88

9-
runs-on: ubuntu-18.04
10-
11-
continue-on-error: ${{ matrix.experimental }}
9+
runs-on: ubuntu-20.04
1210

1311
strategy:
1412
matrix:
15-
include:
16-
- php-version: '7.1'
17-
symfony-version: '^4.3'
18-
composer-version: v1
19-
stability: stable
20-
coverage: none
21-
experimental: false
22-
- php-version: '7.2'
23-
symfony-version: '^4.3'
24-
composer-version: v1
25-
stability: stable
26-
coverage: none
27-
experimental: false
28-
- php-version: '7.2'
29-
symfony-version: '^5.0'
30-
composer-version: v1
31-
stability: stable
32-
coverage: none
33-
experimental: false
34-
- php-version: '7.3'
35-
symfony-version: '^5.0'
36-
composer-version: v1
37-
stability: stable
38-
coverage: none
39-
experimental: false
13+
php-version: ['7.4', '8.0', '8.1']
14+
symfony-version: ['4.4', '5.3', '5.4', '6.0']
15+
coverage: ['none']
16+
exclude:
4017
- php-version: '7.4'
41-
symfony-version: '^5.0'
42-
composer-version: v2
43-
stability: stable
44-
coverage: xdebug
45-
experimental: false
18+
symfony-version: '6.0'
19+
include:
4620
- php-version: '8.0'
47-
symfony-version: '^5.0'
48-
composer-version: v2
49-
stability: RC
50-
coverage: none
51-
experimental: false
21+
symfony-version: '5.4'
22+
coverage: xdebug
5223

5324
steps:
5425
- name: Checkout
@@ -60,22 +31,17 @@ jobs:
6031
coverage: ${{ matrix.coverage }}
6132
ini-values: "memory_limit=-1"
6233
php-version: ${{ matrix.php-version }}
63-
tools: composer:${{ matrix.composer-version }}
34+
tools: composer,flex
6435

6536
- name: Validate composer.json
6637
run: composer validate --no-check-lock
6738

68-
- name: Configure Symfony version
69-
run: composer require --no-update symfony/framework-bundle "${{ matrix.symfony-version }}"
70-
71-
- name: Configure composer stability
72-
if: matrix.stability != 'stable'
73-
run: composer config minimum-stability "${{ matrix.stability }}"
74-
7539
- name: Install Composer dependencies
7640
uses: ramsey/composer-install@v1
7741
with:
7842
composer-options: "--prefer-dist"
43+
env:
44+
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}.*"
7945

8046
- name: Setup problem matchers for PHP
8147
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ protected function injectConnection(Definition $definition, $connectionName)
654654
$definition->addArgument(new Reference(sprintf('old_sound_rabbit_mq.connection.%s', $connectionName)));
655655
}
656656

657-
public function getAlias()
657+
public function getAlias() : string
658658
{
659659
return 'old_sound_rabbit_mq';
660660
}

RabbitMq/BaseAmqp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ abstract class BaseAmqp
5555
protected $eventDispatcher = null;
5656

5757
/**
58-
* @param AbstractConnection $conn
59-
* @param AMQPChannel|null $ch
60-
* @param null $consumerTag
58+
* @param AbstractConnection $conn
59+
* @param AMQPChannel|null $ch
60+
* @param string|null $consumerTag
6161
*/
6262
public function __construct(AbstractConnection $conn, AMQPChannel $ch = null, $consumerTag = null)
6363
{
@@ -68,7 +68,7 @@ public function __construct(AbstractConnection $conn, AMQPChannel $ch = null, $c
6868
$this->getChannel();
6969
}
7070

71-
$this->consumerTag = empty($consumerTag) ? sprintf("PHPPROCESS_%s_%s", gethostname(), getmypid()) : $consumerTag;
71+
$this->consumerTag = $consumerTag ?? sprintf("PHPPROCESS_%s_%s", gethostname(), getmypid());
7272

7373
$this->logger = new NullLogger();
7474
}

Tests/RabbitMq/ConsumerTest.php

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,34 @@ public function testShouldAllowContinueConsumptionAfterIdleTimeout()
271271
->disableOriginalConstructor()
272272
->getMock();
273273

274-
$eventDispatcher->expects($this->at(1))
274+
$eventDispatcher->expects($this->exactly(4))
275275
->method('dispatch')
276-
->with($this->isInstanceOf(OnIdleEvent::class), OnIdleEvent::NAME)
277-
->willReturnCallback(function (OnIdleEvent $event, $eventName) {
278-
$event->setForceStop(false);
279-
280-
return $event;
281-
});
282-
283-
$eventDispatcher->expects($this->at(3))
284-
->method('dispatch')
285-
->with($this->isInstanceOf(OnIdleEvent::class), OnIdleEvent::NAME)
286-
->willReturnCallback(function (OnIdleEvent $event, $eventName) {
287-
$event->setForceStop(true);
288-
289-
return $event;
290-
});
276+
->withConsecutive(
277+
[
278+
$this->isInstanceOf(OnConsumeEvent::class),
279+
OnConsumeEvent::NAME,
280+
],
281+
[
282+
$this->callback(function (OnIdleEvent $event) {
283+
$event->setForceStop(false);
284+
285+
return true;
286+
}),
287+
OnIdleEvent::NAME,
288+
],
289+
[
290+
$this->isInstanceOf(OnConsumeEvent::class),
291+
OnConsumeEvent::NAME,
292+
],
293+
[
294+
$this->callback(function (OnIdleEvent $event) {
295+
$event->setForceStop(true);
296+
297+
return true;
298+
}),
299+
OnIdleEvent::NAME,
300+
]
301+
);
291302

292303
$consumer->setEventDispatcher($eventDispatcher);
293304

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
"name" : "Alvaro Videla"
99
}],
1010
"require": {
11-
"php": "^7.1|^8.0",
11+
"php": "^7.4|^8.0",
1212

13-
"symfony/dependency-injection": "^4.3|^5.0",
14-
"symfony/event-dispatcher": "^4.3|^5.0",
15-
"symfony/config": "^4.3|^5.0",
16-
"symfony/yaml": "^4.3|^5.0",
17-
"symfony/console": "^4.3|^5.0",
13+
"symfony/dependency-injection": "^4.4|^5.3|^6.0",
14+
"symfony/event-dispatcher": "^4.4|^5.3|^6.0",
15+
"symfony/config": "^4.4|^5.3|^6.0",
16+
"symfony/yaml": "^4.4|^5.3|^6.0",
17+
"symfony/console": "^4.4|^5.3|^6.0",
1818
"php-amqplib/php-amqplib": "^2.12.2|^3.0",
1919
"psr/log": "^1.0 || ^2.0 || ^3.0",
20-
"symfony/http-kernel": "^4.4|^5.0",
21-
"symfony/framework-bundle": "^4.4|^5.0"
20+
"symfony/http-kernel": "^4.4|^5.3|^6.0",
21+
"symfony/framework-bundle": "^4.4|^5.3|^6.0"
2222
},
2323
"require-dev": {
24-
"symfony/serializer": "^4.3|^5.0",
25-
"phpunit/phpunit": "^7.5|^8.5",
26-
"phpstan/phpstan": "^0.12.11",
27-
"phpstan/phpstan-phpunit": "^0.12.6"
24+
"symfony/serializer": "^4.4|^5.3|^6.0",
25+
"phpunit/phpunit": "^9.5",
26+
"phpstan/phpstan": "^1.2",
27+
"phpstan/phpstan-phpunit": "^1.0"
2828
},
2929
"replace": {
3030
"oldsound/rabbitmq-bundle": "self.version",

0 commit comments

Comments
 (0)