8000 Merge branch '5.3' into 5.4 · Seldaek/symfony@2b410e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b410e9

Browse files
Merge branch '5.3' into 5.4
* 5.3: Remove more dynamic properties [Serializer] fix support for unset properties on PHP < 7.4
2 parents 2b31f0b + 22e688b commit 2b410e9

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ function () use ($file) {
7474
$containerRef = new \ReflectionClass($containerClass);
7575
$containerFile = \dirname($containerRef->getFileName(), 2).'/'.$containerClass.'.php';
7676
$containerMetaFile = $containerFile.'.meta';
77-
$this->kernelRef = new \ReflectionObject($this->kernel);
78-
$this->kernelFile = $this->kernelRef->getFileName();
77+
$kernelRef = new \ReflectionObject($this->kernel);
78+
$kernelFile = $kernelRef->getFileName();
7979
/** @var ResourceInterface[] $meta */
8080
$meta = unserialize(file_get_contents($containerMetaFile));
8181
$found = false;
8282
foreach ($meta as $resource) {
83-
if ((string) $resource === $this->kernelFile) {
83+
if ((string) $resource === $kernelFile) {
8484
$found = true;
8585
break;
8686
}

src/Symfony/Component/HttpClient/Internal/AmpBody.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
class AmpBody implements RequestBody, InputStream
2727
{
2828
private $body;
29+
private $info;
2930
private $onProgress;
3031
private $offset = 0;
3132
private $length = -1;

src/Symfony/Component/HttpClient/RetryableHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function request(string $method, string $url, array $options = []): Respo
7373
if ('' !== $context->getInfo('primary_ip')) {
7474
$shouldRetry = $this->strategy->shouldRetry($context, null, $exception);
7575
if (null === $shouldRetry) {
76-
throw new \LogicException(sprintf('The "%s::shouldRetry()" method must not return null when called with an exception.', \get_class($this->decider)));
76+
throw new \LogicException(sprintf('The "%s::shouldRetry()" method must not return null when called with an exception.', \get_class($this->strategy)));
7777
}
7878

7979
if (false === $shouldRetry) {

src/Symfony/Component/RateLimiter/Policy/TokenBucket.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
final class TokenBucket implements LimiterStateInterface
2222
{
23+
private $stringRate;
2324
private $id;
2425
private $rate;
2526

@@ -46,6 +47,8 @@ final class TokenBucket implements LimiterStateInterface
4647
*/
4748
public function __construct(string $id, int $initialTokens, Rate $rate, float $timer = null)
4849
{
50+
unset($this->stringRate);
51+
4952
if ($initialTokens < 1) {
5053
throw new \InvalidArgumentException(sprintf('Cannot set the limit of "%s" to 0, as that would never accept any hit.', TokenBucketLimiter::class));
5154
}

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ public function testNormalizeObjectWithUninitializedProperties()
137137
);
138138
}
139139

140+
public function testNormalizeObjectWithUnsetProperties()
141+
{
142+
$obj = new ObjectInner();
143+
unset($obj->foo);
144+
$this->assertEquals(
145+
['bar' => null],
146+
$this->normalizer->normalize($obj, 'any')
147+
);
148+
}
149+
140150
/**
141151
* @requires PHP 7.4
142152
*/

src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ public function testNormalizeObjectWithUninitializedProperties()
105105
);
106106
}
107107

108+
public function testNormalizeObjectWithUnsetProperties()
109+
{
110+
$obj = new PropertyDummy();
111+
unset($obj->foo);
112+
$this->assertEquals(
113+
['bar' => null, 'camelCase' => null],
114+
$this->normalizer->normalize($obj, 'any')
115+
);
116+
}
117+
108118
public function testDenormalize()
109119
{
110120
$obj = $this->normalizer->denormalize(

0 commit comments

Comments
 (0)
0