Skip to content

Commit 75fa734

Browse files
Merge branch '7.4' into 8.0
* 7.4: (31 commits) [Validator] Update Romanian translations fix tests [JsonStreamer] Fix decoding iterable lists [String][Inflector] Fix edge cases [Serializer][Validator] Add JSON schema for validating and autocompleting YAML config files [DependencyInjection] Allow adding resource tags using any config formats Fix merge Add missing Sweego Mailer Bridge webhook events [Security] Fix attribute-based chained user providers [Intl] Fix Intl::getIcuStubVersion() [Intl] Add methods to filter currencies more precisely [Notifier] Add tests for option classes Sync intl scripts [Intl] Add metadata about currencies' validtity dates Bump Symfony version to 7.3.4 Update VERSION for 7.3.3 Update CHANGELOG for 7.3.3 Bump Symfony version to 6.4.26 Update VERSION for 6.4.25 Update CONTRIBUTORS for 6.4.25 ...
2 parents 5cda9e2 + 96f81af commit 75fa734

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Read/PhpGenerator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ private function generateProviders(DataModelNodeInterface $node, bool $decodeFro
136136

137137
++$context['indentation_level'];
138138

139+
$collectionKeyType = $node->getType()->getCollectionKeyType();
140+
139141
$arguments = $decodeFromStream ? '$stream, $data' : '$data';
140-
$php .= ($decodeFromStream ? $this->line('$data = \\'.Splitter::class.'::'.($node->getType()->isList() ? 'splitList' : 'splitDict').'($stream, $offset, $length);', $context) : '')
142+
$php .= ($decodeFromStream ? $this->line('$data = \\'.Splitter::class.'::'.($collectionKeyType instanceof BuiltinType && TypeIdentifier::INT === $collectionKeyType->getTypeIdentifier() ? 'splitList' : 'splitDict').'($stream, $offset, $length);', $context) : '')
141143
.$this->line("\$iterable = static function ($arguments) use (\$options, \$valueTransformers, \$instantiator, &\$providers) {", $context)
142144
.$this->line(' foreach ($data as $k => $v) {', $context);
143145

Tests/JsonStreamReaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testReadCollection()
8080
$this->assertRead($reader, function (mixed $read) {
8181
$this->assertIsIterable($read);
8282
$this->assertSame([true, false], iterator_to_array($read));
83-
}, '{"0": true, "1": false}', Type::iterable(Type::bool(), Type::int()));
83+
}, '[true, false]', Type::iterable(Type::bool(), Type::int()));
8484
}
8585

8686
public function testReadObject()

0 commit comments

Comments
 (0)