Skip to content

Commit 7295d7a

Browse files
minor #62381 [FrameworkBundle] Fix wiring JsonStreamReader (nicolas-grekas)
This PR was merged into the 7.3 branch. Discussion ---------- [FrameworkBundle] Fix wiring JsonStreamReader | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Providing FC/BC to #62063 Commits ------- 215caa3 [FrameworkBundle] Fix wiring JsonStreamReader
2 parents 84fcf2f + 215caa3 commit 7295d7a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/json_streamer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\JsonStreamer\Mapping\Read\DateTimeTypePropertyMetadataLoader as ReadDateTimeTypePropertyMetadataLoader;
2222
use Symfony\Component\JsonStreamer\Mapping\Write\AttributePropertyMetadataLoader as WriteAttributePropertyMetadataLoader;
2323
use Symfony\Component\JsonStreamer\Mapping\Write\DateTimeTypePropertyMetadataLoader as WriteDateTimeTypePropertyMetadataLoader;
24+
use Symfony\Component\JsonStreamer\StreamerDumper;
2425
use Symfony\Component\JsonStreamer\ValueTransformer\DateTimeToStringValueTransformer;
2526
use Symfony\Component\JsonStreamer\ValueTransformer\StringToDateTimeValueTransformer;
2627

@@ -39,8 +40,8 @@
3940
tagged_locator('json_streamer.value_transformer'),
4041
service('json_streamer.read.property_metadata_loader'),
4142
param('.json_streamer.stream_readers_dir'),
43+
class_exists(StreamerDumper::class) ? service('config_cache_factory')->ignoreOnInvalid() : param('.json_streamer.lazy_ghosts_dir'),
4244
param('.json_streamer.lazy_ghosts_dir'),
43-
service('config_cache_factory')->ignoreOnInvalid(),
4445
])
4546
->alias(JsonStreamWriter::class, 'json_streamer.stream_writer')
4647
->alias(JsonStreamReader::class, 'json_streamer.stream_reader')

src/Symfony/Component/JsonStreamer/JsonStreamReader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ public function __construct(
4646
private ContainerInterface $valueTransformers,
4747
PropertyMetadataLoaderInterface $propertyMetadataLoader,
4848
string $streamReadersDir,
49+
ConfigCacheFactoryInterface|string|null $configCacheFactory = null,
4950
?string $lazyGhostsDir = null,
50-
?ConfigCacheFactoryInterface $configCacheFactory = null,
5151
) {
52+
if (\is_string($configCacheFactory)) {
53+
$lazyGhostsDir = $configCacheFactory;
54+
$configCacheFactory = null;
55+
}
5256
$this->streamReaderGenerator = new StreamReaderGenerator($propertyMetadataLoader, $streamReadersDir, $configCacheFactory);
5357
$this->instantiator = new Instantiator();
5458
$this->lazyInstantiator = new LazyInstantiator($lazyGhostsDir);

0 commit comments

Comments
 (0)