Skip to content

Commit 5a92d37

Browse files
authored
Merge pull request #5 from p-chess/sf8
⬆️ allow Symfony 8
2 parents 1d85650 + a0ccb9c commit 5a92d37

11 files changed

Lines changed: 65 additions & 53 deletions

File tree

.github/workflows/build.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
name: Build
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request: ~
5-
push: ~
68

79
jobs:
810
phpstan:
911
runs-on: ubuntu-24.04
1012
name: PHPStan
1113
steps:
1214
- name: Checkout
13-
uses: actions/checkout@v4
15+
uses: actions/checkout@v6
1416
- name: PHPStan
1517
uses: docker://oskarstark/phpstan-ga:1.8.0
1618
env:
@@ -22,7 +24,7 @@ jobs:
2224
name: PHP-CS-Fixer
2325
steps:
2426
- name: Checkout
25-
uses: actions/checkout@v4
27+
uses: actions/checkout@v6
2628
- name: Fix CS
2729
uses: docker://oskarstark/php-cs-fixer-ga
2830
with:
@@ -36,20 +38,24 @@ jobs:
3638
- '8.2'
3739
- '8.3'
3840
- '8.4'
41+
- '8.5'
3942
include:
4043
- description: 'Symfony 6.4'
4144
php: '8.1'
4245
composer_option: '--prefer-lowest'
4346
- description: 'Symfony 6.4'
4447
php: '8.3'
4548
symfony: 6.4.*
46-
- description: 'Symfony 7.3'
49+
- description: 'Symfony 7.4'
4750
php: '8.4'
48-
symfony: 7.3.*
51+
symfony: 7.4.*
52+
- description: 'Symfony 8.0'
53+
php: '8.5'
54+
symfony: 8.0.*
4955
name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
5056
steps:
5157
- name: Checkout
52-
uses: actions/checkout@v4
58+
uses: actions/checkout@v6
5359
- name: Cache
5460
uses: actions/cache@v4
5561
with:

.php-cs-fixer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
// see https://github.com/FriendsOfPHP/PHP-CS-Fixer
33

44
$finder = PhpCsFixer\Finder::create()
5-
->in([__DIR__.'/src', __DIR__.'/tests'])
5+
->in([__DIR__.'/config', __DIR__.'/src', __DIR__.'/tests'])
66
;
77

88
return (new PhpCsFixer\Config())
99
->setRiskyAllowed(true)
1010
->setRules([
1111
'@Symfony' => true,
1212
'@Symfony:risky' => true,
13-
'@PHP80Migration' => true,
14-
'@PHP80Migration:risky' => true,
15-
'@PHPUnit84Migration:risky' => true,
13+
'@PHP8x0Migration' => true,
14+
'@PHP8x0Migration:risky' => true,
15+
'@PHPUnit8x4Migration:risky' => true,
1616
'declare_strict_types' => false,
17-
'native_function_invocation' => ['include' => ['@all']],
17+
'native_function_invocation' => ['include' => ['@internal']],
1818
])
1919
->setFinder($finder)
2020
;

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ move_end:
5050
## Usage
5151
5252
You can inject a service implementing `\PChess\ChessBundle\ChessProviderInterface` in your controller, then
53-
implement different actions, using provided `\PChess\Chess\Chess` object.
53+
implement different actions, using the provided `\PChess\Chess\Chess` object.
5454

5555
In your template, you can use the Twig function `chess_render(chess)` to render the board.
5656
If you need to pass an identifier, use `chess_render(chess, identifier)` instead.
@@ -80,7 +80,7 @@ The final result should be something like this:
8080

8181
### Persisting a Chess object
8282

83-
You can easily save a `Chess` object into Doctrine (or other kind of mapping libraries), using two fields/properties:
83+
You can easily save a `Chess` object into Doctrine (or other kinds of mapping libraries), using two fields/properties:
8484
`fen`, and `history`.
8585
The first one is a simple string. The second one can be a `simple_array` (for Doctrine), where you should put
8686
the result of `Mover::getHistoryStrings()` method.

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
],
2121
"require": {
2222
"php": "^8.1",
23-
"p-chess/chess": "^0.7",
24-
"symfony/config": "^6.4 || ^7.0",
25-
"symfony/dependency-injection": "^6.4 || ^7.0",
26-
"symfony/http-kernel": "^6.4 || ^7.0",
27-
"symfony/routing": "^6.4 || ^7.0",
28-
"twig/twig": "^3.18"
23+
"p-chess/chess": "^1.0",
24+
"symfony/config": "^6.4 || ^7.4 || ^8.0",
25+
"symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0",
26+
"symfony/http-kernel": "^6.4 || ^7.4 || ^8.0",
27+
"symfony/routing": "^6.4 || ^7.4 || ^8.0",
28+
"twig/twig": "^3.22"
2929
},
3030
"require-dev": {
3131
"dg/bypass-finals": "^1.9",
32-
"phpunit/phpunit": "^10.5 || ^11.5 || ^12.3",
33-
"symfony/phpunit-bridge": "^7.3"
32+
"phpunit/phpunit": "^10.5 || ^11.5 || ^12.5",
33+
"symfony/phpunit-bridge": "^8.0"
3434
},
3535
"config": {
3636
"sort-packages": true

config/services.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
use PChess\ChessBundle\SessionChessProvider;
6+
use PChess\ChessBundle\SimpleChessProvider;
7+
use PChess\ChessBundle\Twig\ChessExtension;
8+
use PChess\ChessBundle\Twig\ChessRuntime;
9+
10+
return static function (ContainerConfigurator $configurator): void {
11+
$services = $configurator->services();
12+
13+
$services
14+
->set(SessionChessProvider::class)
15+
->arg('$requestStack', service('request_stack'))
16+
->arg('$name', '%chess.session_name%')
17+
;
18+
19+
$services->set(SimpleChessProvider::class);
20+
21+
$services
22+
->set(ChessExtension::class)
23+
->tag('twig.extension')
24+
;
25+
26+
$services
27+
->set(ChessRuntime::class)
28+
->arg('$output', abstract_arg('should be defined by Pass'))
29+
->tag('twig.runtime')
30+
;
31+
};

config/services.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

phpstan-baseline.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
4+
message: "#^Call to an undefined method#"
55
count: 1
66
path: src/DependencyInjection/Configuration.php
77

88
-
99
message: "#^Cannot call method getSession\\(\\) on Symfony\\\\Component\\\\HttpFoundation\\\\Request\\|null\\.$#"
1010
count: 1
1111
path: tests/SessionChessProviderTest.php
12-

src/DependencyInjection/ChessExtension.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@
99

1010
final class ChessExtension extends Extension
1111
{
12-
/**
13-
* @param array<string, mixed> $configs
14-
*/
1512
public function load(array $configs, ContainerBuilder $container): void
1613
{
1714
$configuration = new Configuration();
1815
$config = $this->processConfiguration($configuration, $configs);
1916
$container->setParameter('chess.output_service', $config['output_service']);
2017
$container->setParameter('chess.session_name', $config['session_name']);
21-
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
22-
$loader->load('services.xml');
18+
$loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../../config'));
19+
$loader->load('services.php');
2320
}
2421
}

src/Twig/ChessRuntime.php

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

99
final class ChessRuntime extends AbstractExtension
1010
{
11-
public function __construct(private HtmlOutput $output)
11+
public function __construct(private readonly HtmlOutput $output)
1212
{
1313
}
1414

tests/DependencyInjection/ChessExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ final class ChessExtensionTest extends TestCase
1010
{
1111
public function testLoadSetParameters(): void
1212
{
13-
/** @var ContainerBuilder&\PHPUnit\Framework\MockObject\MockObject $container */
14-
$container = $this->createMock(ContainerBuilder::class);
13+
/** @var ContainerBuilder&\PHPUnit\Framework\MockObject\Stub $container */
14+
$container = $this->createStub(ContainerBuilder::class);
1515
$extension = new ChessExtension();
1616
$extension->load(['chess' => ['output_service' => 'foo']], $container);
1717
self::assertNotNull($extension);

0 commit comments

Comments
 (0)