Skip to content

Commit

Permalink
Add Symfony 7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Sep 15, 2023
1 parent 1ad9014 commit 8721d07
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
include:
# Run "no Twig" build on latest PHP and Symfony LTS
- php: '8.2'
symfony: '5.4.*'
symfony: '6.4.*@dev'
composer-flags: '--prefer-stable'
can-fail: false
with-twig: false
Expand All @@ -27,6 +27,16 @@ jobs:
composer-flags: '--prefer-stable --prefer-lowest'
can-fail: false
with-twig: true
- php: '8.2'
symfony: '6.4.*@dev'
composer-flags: '--prefer-stable'
can-fail: true
with-twig: true
- php: '8.2'
symfony: '7.0.*@dev'
composer-flags: '--prefer-stable'
can-fail: true
with-twig: true

name: "PHP ${{ matrix.php }}${{ matrix.pagerfanta != '' && format(' - Pagerfanta {0}', matrix.pagerfanta) || '' }}${{ matrix.with-twig == false && ' - Without Twig' || '' }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"

Expand Down
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"php": "^8.1",
"pagerfanta/core": "^3.7 || ^4.0",
"psr/container": "^1.0 || ^2.0",
"symfony/config": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/property-access": "^5.4 || ^6.2",
"symfony/routing": "^5.4 || ^6.2"
"symfony/config": "^5.4 || ^6.3 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.3 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.3 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.3 || ^7.0",
"symfony/property-access": "^5.4 || ^6.3 || ^7.0",
"symfony/routing": "^5.4 || ^6.3 || ^7.0"
},
"require-dev": {
"jms/serializer": "^3.18",
Expand All @@ -25,21 +25,21 @@
"phpstan/phpstan-phpunit": "1.3.14",
"phpstan/phpstan-symfony": "1.3.2",
"phpunit/phpunit": "9.6.12",
"symfony/phpunit-bridge": "^5.4 || ^6.2",
"symfony/serializer": "^5.4 || ^6.2",
"symfony/twig-bridge": "^5.4 || ^6.2",
"symfony/twig-bundle": "^5.4 || ^6.2",
"symfony/translation": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^5.4 || ^6.3 || ^7.0",
"symfony/serializer": "^5.4 || ^6.3 || ^7.0",
"symfony/twig-bridge": "^5.4 || ^6.3 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/translation": "^5.4 || ^6.3 || ^7.0",
"twig/twig": "^2.13 || ^3.0"
},
"conflict": {
"jms/serializer": "<3.18",
"jms/serializer-bundle": "<4.2",
"pagerfanta/twig": "<3.7",
"symfony/serializer": "<5.4 || >=6.0,<6.2",
"symfony/translation": "<5.4 || >=6.0,<6.2",
"symfony/twig-bridge": "<5.4 || >=6.0,<6.2",
"symfony/twig-bundle": "<5.4 || >=6.0,<6.2",
"symfony/serializer": "<5.4 || >=6.0,<6.3",
"symfony/translation": "<5.4 || >=6.0,<6.3",
"symfony/twig-bridge": "<5.4 || >=6.0,<6.3",
"symfony/twig-bundle": "<5.4 || >=6.0,<6.3",
"twig/twig": "<2.13",
"white-october/pagerfanta-bundle": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion src/BabDevPagerfantaBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function build(ContainerBuilder $container): void

public function getContainerExtension(): ?ExtensionInterface
{
if (null === $this->extension) {
if (!isset($this->extension)) {
$this->extension = new BabDevPagerfantaExtension();
}

Expand Down
9 changes: 9 additions & 0 deletions tests/Serializer/Normalizer/PagerfantaNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Pagerfanta\PagerfantaInterface;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
use Symfony\Component\Serializer\Serializer;

final class PagerfantaNormalizerTest extends TestCase
Expand Down Expand Up @@ -42,6 +43,10 @@ public function testNormalize(): void
*/
public function testNormalizeWithLegacyDecorator(): void
{
if (!interface_exists(CacheableSupportsMethodInterface::class)) {
self::markTestSkipped('Test requires symfony/serializer:<6.4');
}

$pager = new Pagerfanta(
new NullAdapter(25),
);
Expand Down Expand Up @@ -90,6 +95,10 @@ public function testSupportsNormalization(mixed $data, bool $supported): void
*/
public function testHasCacheableSupportsMethod(): void
{
if (!interface_exists(CacheableSupportsMethodInterface::class)) {
self::markTestSkipped('Test requires symfony/serializer:<6.4');
}

self::assertTrue((new LegacyPagerfantaNormalizer(new PagerfantaNormalizer()))->hasCacheableSupportsMethod());
}

Expand Down

0 comments on commit 8721d07

Please sign in to comment.