Skip to content

Commit 7461428

Browse files
committed
chore: allow framework bundle:^6
1 parent 17fa743 commit 7461428

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ jobs:
124124
steps:
125125
- name: Checkout
126126
uses: actions/checkout@v4
127+
# https://github.com/staabm/phpstan-todo-by#prerequisite
128+
- name: Get tags
129+
run: git fetch --tags origin
127130
- name: Setup PHP
128131
uses: shivammathur/setup-php@v2
129132
with:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
"symfony/expression-language": "^6.4 || ^7.0",
177177
"symfony/finder": "^6.4 || ^7.0",
178178
"symfony/form": "^6.4 || ^7.0",
179-
"symfony/framework-bundle": "7.4.x-dev",
179+
"symfony/framework-bundle": "^6.4 || ^7.0 || 7.4.x-dev",
180180
"symfony/http-client": "^6.4 || ^7.0",
181181
"symfony/intl": "^6.4 || ^7.0",
182182
"symfony/json-streamer": "7.4.x-dev",

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ parameters:
1515
# We're aliasing classes for phpunit in this file, it needs to be added here see phpstan/#2194
1616
- src/Symfony/Bundle/Test/Constraint/ArraySubset.php
1717
- tests/Fixtures/app/AppKernel.php
18+
1819
excludePaths:
1920
# uses larastan
2021
- src/Laravel

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
use Doctrine\Persistence\ManagerRegistry;
5151
use PHPStan\PhpDocParser\Parser\PhpDocParser;
5252
use Ramsey\Uuid\Uuid;
53+
use Symfony\Bundle\FrameworkBundle\Controller\ControllerHelper;
5354
use Symfony\Component\Config\FileLocator;
5455
use Symfony\Component\Config\Resource\DirectoryResource;
5556
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -62,6 +63,7 @@
6263
use Symfony\Component\DependencyInjection\Reference;
6364
use Symfony\Component\Finder\Finder;
6465
use Symfony\Component\HttpClient\ScopingHttpClient;
66+
use Symfony\Component\JsonStreamer\JsonStreamWriter;
6567
use Symfony\Component\ObjectMapper\ObjectMapper;
6668
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;
6769
use Symfony\Component\Uid\AbstractUid;
@@ -989,6 +991,15 @@ private function registerJsonStreamerConfiguration(ContainerBuilder $container,
989991
return;
990992
}
991993

994+
if (!class_exists(JsonStreamWriter::class)) {
995+
throw new RuntimeException('symfony/json-streamer is not installed.');
996+
}
997+
998+
// @TODO symfony/json-streamer:>=7.4.1 add composer conflict
999+
if (!class_exists(ControllerHelper::class)) {
1000+
throw new RuntimeException('Symfony symfony/json-stream:^7.4 is needed.');
1001+
}
1002+
9921003
if (isset($formats['jsonld'])) {
9931004
$container->setParameter('.json_streamer.stream_writers_dir.jsonld', '%kernel.cache_dir%/json_streamer/stream_writer/jsonld');
9941005
$container->setParameter('.json_streamer.stream_readers_dir.jsonld', '%kernel.cache_dir%/json_streamer/stream_reader/jsonld');

src/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Doctrine\ORM\EntityManagerInterface;
2525
use Doctrine\ORM\OptimisticLockException;
2626
use GraphQL\GraphQL;
27+
use Symfony\Bundle\FrameworkBundle\Controller\ControllerHelper;
2728
use Symfony\Bundle\FullStack;
2829
use Symfony\Bundle\MakerBundle\MakerBundle;
2930
use Symfony\Bundle\MercureBundle\MercureBundle;
@@ -109,7 +110,7 @@ public function getConfigTreeBuilder(): TreeBuilder
109110
->end()
110111
->booleanNode('handle_symfony_errors')->defaultFalse()->info('Allows to handle symfony exceptions.')->end()
111112
->booleanNode('enable_swagger')->defaultTrue()->info('Enable the Swagger documentation and export.')->end()
112-
->booleanNode('enable_json_streamer')->defaultValue(class_exists(JsonStreamWriter::class))->info('Enable json streamer.')->end()
113+
->booleanNode('enable_json_streamer')->defaultValue(class_exists(ControllerHelper::class) && class_exists(JsonStreamWriter::class))->info('Enable json streamer.')->end()
113114
->booleanNode('enable_swagger_ui')->defaultValue(class_exists(TwigBundle::class))->info('Enable Swagger UI')->end()
114115
->booleanNode('enable_re_doc')->defaultValue(class_exists(TwigBundle::class))->info('Enable ReDoc')->end()
115116
->booleanNode('enable_entrypoint')->defaultTrue()->info('Enable the entrypoint')->end()

src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ApiPlatformExtensionTest extends TestCase
4242
'title' => 'title',
4343
'description' => 'description',
4444
'version' => 'version',
45-
'enable_json_streamer' => true,
45+
'enable_json_streamer' => false,
4646
'serializer' => ['hydra_prefix' => true],
4747
'formats' => [
4848
'json' => ['mime_types' => ['json']],

0 commit comments

Comments
 (0)