Skip to content

Commit d71d027

Browse files
Merge branch '7.4' into 8.0
* 7.4: Fix php.net links fix version number in deprecation configuration for the storage service for the login throttling rate limiter chore: PHP CS Fixer fixes [ObjectMapper] Correctly manage constructor initialization [DoctrineBridge] Restore compatibility with Doctrine ODM by validating $class object type [Messenger] Allow any `ServiceResetterInterface` implementation in `ResetServicesListener` return early if handle has been cleaned up before chore: Increase minimum version of type-info component [FrameworkBundle] Add functional tests for the `ContainerLintCommand` command Update sponsors for Symfony 7.3 Fix precision loss when rounding large integers in `NumberToLocalizedStringTransformer` [JsonStreamer] Fix nested generated foreach loops [TypeInfo] Fix imported-only alias resolving
2 parents 381c6cc + 76e94cd commit d71d027

File tree

10 files changed

+112
-23
lines changed

10 files changed

+112
-23
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class DummyWithArray
6+
{
7+
/** @var ClassicDummy[] */
8+
public array $dummies;
9+
10+
public string $customProperty;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class DummyWithNestedArray
6+
{
7+
/** @var DummyWithArray[] */
8+
public array $dummies;
9+
10+
public string $stringProperty;
11+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
4+
try {
5+
yield '[';
6+
$prefix = '';
7+
foreach ($data as $value1) {
8+
yield $prefix;
9+
yield '{"dummies":[';
10+
$prefix = '';
11+
foreach ($value1->dummies as $value2) {
12+
yield $prefix;
13+
yield '{"dummies":[';
14+
$prefix = '';
15+
foreach ($value2->dummies as $value3) {
16+
yield $prefix;
17+
yield '{"id":';
18+
yield \json_encode($value3->id, \JSON_THROW_ON_ERROR, 506);
19+
yield ',"name":';
20+
yield \json_encode($value3->name, \JSON_THROW_ON_ERROR, 506);
21+
yield '}';
22+
$prefix = ',';
23+
}
24+
yield '],"customProperty":';
25+
yield \json_encode($value2->customProperty, \JSON_THROW_ON_ERROR, 508);
26+
yield '}';
27+
$prefix = ',';
28+
}
29+
yield '],"stringProperty":';
30+
yield \json_encode($value1->stringProperty, \JSON_THROW_ON_ERROR, 510);
31+
yield '}';
32+
$prefix = ',';
33+
}
34+
yield ']';
35+
} catch (\JsonException $e) {
36+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
37+
}
38+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
4+
try {
5+
yield '[';
6+
$prefix = '';
7+
foreach ($data as $value1) {
8+
yield $prefix;
9+
yield '{"dummies":[';
10+
$prefix = '';
11+
foreach ($value1->dummies as $value2) {
12+
yield $prefix;
13+
yield '{"id":';
14+
yield \json_encode($value2->id, \JSON_THROW_ON_ERROR, 508);
15+
yield ',"name":';
16+
yield \json_encode($value2->name, \JSON_THROW_ON_ERROR, 508);
17+
yield '}';
18+
$prefix = ',';
19+
}
20+
yield '],"customProperty":';
21+
yield \json_encode($value1->customProperty, \JSON_THROW_ON_ERROR, 510);
22+
yield '}';
23+
$prefix = ',';
24+
}
25+
yield ']';
26+
} catch (\JsonException $e) {
27+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
28+
}
29+
};

Tests/Fixtures/stream_writer/nullable_object_dict.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
if (\is_array($data)) {
99
yield '{';
1010
$prefix = '';
11-
foreach ($data as $key => $value) {
12-
$key = \substr(\json_encode($key), 1, -1);
13-
yield "{$prefix}\"{$key}\":";
11+
foreach ($data as $key1 => $value1) {
12+
$key1 = \substr(\json_encode($key1), 1, -1);
13+
yield "{$prefix}\"{$key1}\":";
1414
yield '{"@id":';
15-
yield \json_encode($value->id, \JSON_THROW_ON_ERROR, 510);
15+
yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
1616
yield ',"name":';
17-
yield \json_encode($value->name, \JSON_THROW_ON_ERROR, 510);
17+
yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
1818
yield '}';
1919
$prefix = ',';
2020
}

Tests/Fixtures/stream_writer/nullable_object_list.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
if (\is_array($data)) {
99
yield '[';
1010
$prefix = '';
11-
foreach ($data as $value) {
11+
foreach ($data as $value1) {
1212
yield $prefix;
1313
yield '{"@id":';
14-
yield \json_encode($value->id, \JSON_THROW_ON_ERROR, 510);
14+
yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
1515
yield ',"name":';
16-
yield \json_encode($value->name, \JSON_THROW_ON_ERROR, 510);
16+
yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
1717
yield '}';
1818
$prefix = ',';
1919
}

Tests/Fixtures/stream_writer/object_dict.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
try {
88
yield '{';
99
$prefix = '';
10-
foreach ($data as $key => $value) {
11-
$key = \substr(\json_encode($key), 1, -1);
12-
yield "{$prefix}\"{$key}\":";
10+
foreach ($data as $key1 => $value1) {
11+
$key1 = \substr(\json_encode($key1), 1, -1);
12+
yield "{$prefix}\"{$key1}\":";
1313
yield '{"@id":';
14-
yield \json_encode($value->id, \JSON_THROW_ON_ERROR, 510);
14+
yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
1515
yield ',"name":';
16-
yield \json_encode($value->name, \JSON_THROW_ON_ERROR, 510);
16+
yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
1717
yield '}';
1818
$prefix = ',';
1919
}

Tests/Fixtures/stream_writer/object_iterable.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
try {
88
yield '{';
99
$prefix = '';
10-
foreach ($data as $key => $value) {
11-
$key = is_int($key) ? $key : \substr(\json_encode($key), 1, -1);
12-
yield "{$prefix}\"{$key}\":";
10+
foreach ($data as $key1 => $value1) {
11+
$key1 = is_int($key1) ? $key1 : \substr(\json_encode($key1), 1, -1);
12+
yield "{$prefix}\"{$key1}\":";
1313
yield '{"id":';
14-
yield \json_encode($value->id, \JSON_THROW_ON_ERROR, 510);
14+
yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
1515
yield ',"name":';
16-
yield \json_encode($value->name, \JSON_THROW_ON_ERROR, 510);
16+
yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
1717
yield '}';
1818
$prefix = ',';
1919
}

Tests/Fixtures/stream_writer/object_list.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
try {
88
yield '[';
99
$prefix = '';
10-
foreach ($data as $value) {
10+
foreach ($data as $value1) {
1111
yield $prefix;
1212
yield '{"@id":';
13-
yield \json_encode($value->id, \JSON_THROW_ON_ERROR, 510);
13+
yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
1414
yield ',"name":';
15-
yield \json_encode($value->name, \JSON_THROW_ON_ERROR, 510);
15+
yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
1616
yield '}';
1717
$prefix = ',';
1818
}

Tests/Fixtures/stream_writer/union.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
if (\is_array($data)) {
99
yield '[';
1010
$prefix = '';
11-
foreach ($data as $value) {
11+
foreach ($data as $value1) {
1212
yield $prefix;
13-
yield \json_encode($value->value, \JSON_THROW_ON_ERROR, 511);
13+
yield \json_encode($value1->value, \JSON_THROW_ON_ERROR, 511);
1414
$prefix = ',';
1515
}
1616
yield ']';

0 commit comments

Comments
 (0)