Skip to content

Commit 96f81af

Browse files
Merge branch '7.3' into 7.4
* 7.3: [Validator] Update Romanian translations fix tests [JsonStreamer] Fix decoding iterable lists [String][Inflector] Fix edge cases [Security] Fix attribute-based chained user providers [Intl] Fix Intl::getIcuStubVersion()
2 parents 63367ed + e9fb44f commit 96f81af

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
@@ -87,7 +87,7 @@ public function testReadCollection()
8787
$this->assertRead($reader, function (mixed $read) {
8888
$this->assertIsIterable($read);
8989
$this->assertSame([true, false], iterator_to_array($read));
90-
}, '{"0": true, "1": false}', Type::iterable(Type::bool(), Type::int()));
90+
}, '[true, false]', Type::iterable(Type::bool(), Type::int()));
9191
}
9292

9393
public function testReadObject()

0 commit comments

Comments
 (0)