Skip to content

Commit 6881082

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: add translations for the Twig constraint drop the Date header using the Postmark API transport [VarExporter] Fix: Use correct closure call for property-specific logic in $notByRef Unnecessary cast, return, semicolon and comma [Notifier] [Discord] Fix value limits Fix ServiceMethodsSubscriberTrait for nullable service
2 parents f56f171 + f0bc90a commit 6881082

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

Internal/Hydrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static function getSimpleHydrator($class)
160160
$object->$name = $value;
161161
$object->$name = &$value;
162162
} elseif (true !== $noRef) {
163-
$notByRef($object, $value);
163+
$noRef($object, $value);
164164
} else {
165165
$object->$name = $value;
166166
}
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\VarExporter\Tests\Fixtures\LazyProxy;
4+
5+
class HookedWithDefaultValue
6+
{
7+
public int $backedWithDefault = 321 {
8+
get => $this->backedWithDefault;
9+
set => $this->backedWithDefault = $value;
10+
}
11+
}

Tests/LazyGhostTraitTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Symfony\Component\VarExporter\Tests\Fixtures\LazyGhost\TestClass;
2727
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\AsymmetricVisibility;
2828
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\Hooked;
29+
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\HookedWithDefaultValue;
2930
use Symfony\Component\VarExporter\Tests\Fixtures\SimpleObject;
3031

3132
class LazyGhostTraitTest extends TestCase
@@ -318,6 +319,28 @@ public function testPropertyHooks()
318319
$this->assertSame(345, $object->backed);
319320
}
320321

322+
/**
323+
* @requires PHP 8.4
324+
*/
325+
public function testPropertyHooksWithDefaultValue()
326+
{
327+
$initialized = false;
328+
$object = $this->createLazyGhost(HookedWithDefaultValue::class, function ($instance) use (&$initialized) {
329+
$initialized = true;
330+
});
331+
332+
$this->assertSame(321, $object->backedWithDefault);
333+
$this->assertTrue($initialized);
334+
335+
$initialized = false;
336+
$object = $this->createLazyGhost(HookedWithDefaultValue::class, function ($instance) use (&$initialized) {
337+
$initialized = true;
338+
});
339+
$object->backedWithDefault = 654;
340+
$this->assertTrue($initialized);
341+
$this->assertSame(654, $object->backedWithDefault);
342+
}
343+
321344
/**
322345
* @requires PHP 8.4
323346
*/

0 commit comments

Comments
 (0)