Skip to content

Commit 500451a

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: 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 [Validator] [WordCount] Treat 0 as one character word and do not exclude it Unnecessary cast, return, semicolon and comma Fix ServiceMethodsSubscriberTrait for nullable service [Notifier] [Discord] Fix value limits Fix ServiceMethodsSubscriberTrait for nullable service
2 parents 0457632 + 6881082 commit 500451a

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/LegacyLazyGhostTraitTest.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
/**
@@ -321,6 +322,28 @@ public function testPropertyHooks()
321322
$this->assertSame(345, $object->backed);
322323
}
323324

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

0 commit comments

Comments
 (0)