Skip to content

Commit 10dd195

Browse files
lpinsembertLouis PinsembertMilletMorgan
authored
feat(sf6): compatibility with sf6 and php8 (#9)
* feat(sf6): update to sf6 and php8 * feat(review): added missing var declarations * fix(composer): change php and sf version * feat(gha): add strategy for version in workflows * fix(composer): change version of var-dumper Co-authored-by: Louis Pinsembert <lpinsembert.external@bedrockstreaming.com> Co-authored-by: Millet Morgan <millet.morgan5@gmail.com>
1 parent cfed75a commit 10dd195

13 files changed

Lines changed: 37 additions & 22 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ jobs:
55
ci:
66
name: Tests & Quality
77
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
version: [ '8.0', '8.1' ]
11+
fail-fast: false
812
steps:
913
- uses: actions/checkout@master
1014
- uses: shivammathur/setup-php@v2
1115
with:
12-
php-version: 7.4
16+
php-version: ${{ matrix.version }}
1317
- run: make install
1418
- run: make ci

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/bin/
33
composer.lock
44
.phpunit.result.cache
5-
.php_cs.cache
5+
.php-cs-fixer.cache
File renamed without changes.

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
"sort-packages": true
1717
},
1818
"require": {
19-
"php": "7.4.*",
19+
"php": ">=8.0",
2020
"ext-json": "*",
2121
"doctrine/annotations": "^1.10.0",
22-
"symfony/config": "4.4.*|^5.0",
23-
"symfony/dependency-injection": "4.4.*|^5.0",
24-
"symfony/event-dispatcher": "4.4.*|^5.0",
25-
"symfony/http-foundation": "4.4.*|^5.0",
26-
"symfony/http-kernel": "4.4.*|^5.0",
27-
"symfony/options-resolver": "^5.0"
22+
"symfony/config": "^6.0",
23+
"symfony/dependency-injection": "^6.0",
24+
"symfony/event-dispatcher": "^6.0",
25+
"symfony/http-foundation": "^6.0",
26+
"symfony/http-kernel": "^6.0",
27+
"symfony/options-resolver": "^6.0"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "9.4.*",
31-
"m6web/php-cs-fixer-config": "1.3.*",
32-
"phpstan/phpstan": "0.12.*",
33-
"phpstan/phpstan-phpunit": "0.12.*",
34-
"symfony/var-dumper": "4.4.*"
30+
"phpunit/phpunit": "9.5.*",
31+
"m6web/php-cs-fixer-config": "^2.1",
32+
"phpstan/phpstan": "^1.5",
33+
"phpstan/phpstan-phpunit": "^1.1",
34+
"symfony/var-dumper": "^6.0"
3535
},
3636
"suggest": {
3737
"webonyx/graphql-php": "Needed to support @GraphQLRateLimit annotation"

src/EventListener/AddRateLimitHeadersListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function onKernelResponse(ResponseEvent $event): void
2323
return;
2424
}
2525

26-
if (!$event->isMasterRequest()) {
26+
if (!$event->isMainRequest()) {
2727
return;
2828
}
2929

src/EventListener/LimitRateListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(RateLimitStorageInterface $storage, bool $displayHea
2525

2626
public function onKernelController(ControllerArgumentsEvent $event): void
2727
{
28-
if (!$event->isMasterRequest()) {
28+
if (!$event->isMainRequest()) {
2929
return;
3030
}
3131

src/EventListener/ReadGraphQLRateLmitAnnotationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(ContainerInterface $container, Reader $annotationRea
2929
{
3030
foreach ($rateLimitModifiers as $rateLimitModifier) {
3131
if (!($rateLimitModifier instanceof RateLimitModifierInterface)) {
32-
throw new \InvalidArgumentException(('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class));
32+
throw new \InvalidArgumentException('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class);
3333
}
3434
}
3535

src/EventListener/ReadRateLimitAnnotationListener.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(ContainerInterface $container, Reader $annotationRea
2929
{
3030
foreach ($rateLimitModifiers as $rateLimitModifier) {
3131
if (!($rateLimitModifier instanceof RateLimitModifierInterface)) {
32-
throw new \InvalidArgumentException(('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class));
32+
throw new \InvalidArgumentException('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class);
3333
}
3434
}
3535

@@ -78,7 +78,9 @@ public function onKernelController(ControllerEvent $event): void
7878
$annotation->getPeriod() ?? $this->period
7979
);
8080

81-
$rateLimit->varyHashOn('_route', $request->attributes->get('_route'));
81+
/** @var string $route */
82+
$route = $request->attributes->get('_route');
83+
$rateLimit->varyHashOn('_route', $route);
8284
}
8385

8486
foreach ($this->rateLimitModifiers as $hashKeyVarier) {

src/EventListener/ReadRateLimitConfigurationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(iterable $rateLimitModifiers, int $limit, int $perio
2626
{
2727
foreach ($rateLimitModifiers as $rateLimitModifier) {
2828
if (!($rateLimitModifier instanceof RateLimitModifierInterface)) {
29-
throw new \InvalidArgumentException(('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class));
29+
throw new \InvalidArgumentException('$rateLimitModifiers must be instance of '.RateLimitModifierInterface::class);
3030
}
3131
}
3232

src/RateLimitBundle.php

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

1010
class RateLimitBundle extends Bundle
1111
{
12-
public function getContainerExtension()
12+
public function getContainerExtension(): BedrockRateLimitExtension
1313
{
1414
return new BedrockRateLimitExtension();
1515
}

0 commit comments

Comments
 (0)