File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
src/Symfony/Component/VarExporter Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ public static function getSimpleHydrator($class)
166
166
$ object ->$ name = $ value ;
167
167
$ object ->$ name = &$ value ;
168
168
} elseif (true !== $ noRef ) {
169
- $ notByRef ($ object , $ value );
169
+ $ noRef ($ object , $ value );
170
170
} else {
171
171
$ object ->$ name = $ value ;
172
172
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 27
27
use Symfony \Component \VarExporter \Tests \Fixtures \LazyGhost \TestClass ;
28
28
use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \AsymmetricVisibility ;
29
29
use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \Hooked ;
30
+ use Symfony \Component \VarExporter \Tests \Fixtures \LazyProxy \HookedWithDefaultValue ;
30
31
use Symfony \Component \VarExporter \Tests \Fixtures \SimpleObject ;
31
32
32
33
class LazyGhostTraitTest extends TestCase
@@ -505,6 +506,28 @@ public function testPropertyHooks()
505
506
$ this ->assertSame (345 , $ object ->backed );
506
507
}
507
508
509
+ /**
510
+ * @requires PHP 8.4
511
+ */
512
+ public function testPropertyHooksWithDefaultValue ()
513
+ {
514
+ $ initialized = false ;
515
+ $ object = $ this ->createLazyGhost (HookedWithDefaultValue::class, function ($ instance ) use (&$ initialized ) {
516
+ $ initialized = true ;
517
+ });
518
+
519
+ $ this ->assertSame (321 , $ object ->backedWithDefault );
520
+ $ this ->assertTrue ($ initialized );
521
+
522
+ $ initialized = false ;
523
+ $ object = $ this ->createLazyGhost (HookedWithDefaultValue::class, function ($ instance ) use (&$ initialized ) {
524
+ $ initialized = true ;
525
+ });
526
+ $ object ->backedWithDefault = 654 ;
527
+ $ this ->assertTrue ($ initialized );
528
+ $ this ->assertSame (654 , $ object ->backedWithDefault );
529
+ }
530
+
508
531
/**
509
532
* @requires PHP 8.4
510
533
*/
You can’t perform that action at this time.
0 commit comments