Skip to content

Commit e3b3115

Browse files
authored
Merge branch 'master' into symfony5.4
2 parents 7a8d7c9 + 638ea41 commit e3b3115

File tree

6 files changed

+127
-78
lines changed

6 files changed

+127
-78
lines changed

.github/workflows/lint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
on: [push, pull_request]
2+
name: Main
3+
jobs:
4+
php-cs-fixer:
5+
name: PHP-CS-Fixer
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: PHP-CS-Fixer
10+
uses: docker://oskarstark/php-cs-fixer-ga

.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"

.php-cs-fixer.dist.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of PHP CS Fixer.
7+
*
8+
* (c) Fabien Potencier <fabien@symfony.com>
9+
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
10+
*
11+
* This source file is subject to the MIT license that is bundled
12+
* with this source code in the file LICENSE.
13+
*/
14+
15+
$header = <<<'EOF'
16+
This file is part of PHP CS Fixer.
17+
18+
(c) Fabien Potencier <fabien@symfony.com>
19+
Dariusz Rumiński <dariusz.ruminski@gmail.com>
20+
21+
This source file is subject to the MIT license that is bundled
22+
with this source code in the file LICENSE.
23+
EOF;
24+
25+
$finder = PhpCsFixer\Finder::create()
26+
->ignoreDotFiles(false)
27+
->ignoreVCSIgnored(true)
28+
->exclude('tests/Fixtures')
29+
->in(__DIR__)
30+
->append([
31+
__DIR__.'/dev-tools/doc.php',
32+
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
33+
])
34+
;
35+
36+
$config = new PhpCsFixer\Config();
37+
$config
38+
->setRiskyAllowed(true)
39+
->setRules([
40+
'@PSR12' => true,
41+
])
42+
->setFinder($finder)
43+
;
44+
45+
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
46+
if (false !== getenv('FABBOT_IO')) {
47+
try {
48+
PhpCsFixer\FixerFactory::create()
49+
->registerBuiltInFixers()
50+
->registerCustomFixers($config->getCustomFixers())
51+
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()))
52+
;
53+
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
54+
$config->setRules([]);
55+
} catch (UnexpectedValueException $e) {
56+
$config->setRules([]);
57+
} catch (InvalidArgumentException $e) {
58+
$config->setRules([]);
59+
}
60+
}
61+
62+
return $config;

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)