@@ -58,7 +58,7 @@ class LazyProxyTraitTest extends TestCase
5858 public function testGetter ()
5959 {
6060 $ initCounter = 0 ;
61- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
61+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
6262 ++$ initCounter ;
6363
6464 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -83,7 +83,7 @@ public function testGetter()
8383 public function testInitialize ()
8484 {
8585 $ initCounter = 0 ;
86- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
86+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
8787 ++$ initCounter ;
8888
8989 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -103,7 +103,7 @@ public function testInitialize()
103103 public function testClone ()
104104 {
105105 $ initCounter = 0 ;
106- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
106+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
107107 ++$ initCounter ;
108108
109109 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -124,7 +124,7 @@ public function testClone()
124124 public function testUnserialize ()
125125 {
126126 $ initCounter = 0 ;
127- $ proxy = $ this ->createLazyProxy (TestUnserializeClass::class, function () use (&$ initCounter ) {
127+ $ proxy = $ this ->createLazyProxy (TestUnserializeClass::class, static function () use (&$ initCounter ) {
128128 ++$ initCounter ;
129129
130130 return new TestUnserializeClass ((object ) ['hello ' => 'world ' ]);
@@ -146,7 +146,7 @@ public function testUnserialize()
146146 public function testWakeup ()
147147 {
148148 $ initCounter = 0 ;
149- $ proxy = $ this ->createLazyProxy (TestWakeupClass::class, function () use (&$ initCounter ) {
149+ $ proxy = $ this ->createLazyProxy (TestWakeupClass::class, static function () use (&$ initCounter ) {
150150 ++$ initCounter ;
151151
152152 return new TestWakeupClass ((object ) ['hello ' => 'world ' ]);
@@ -166,7 +166,7 @@ public function testWakeup()
166166 public function testDestruct ()
167167 {
168168 $ initCounter = 0 ;
169- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
169+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
170170 ++$ initCounter ;
171171
172172 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -175,7 +175,7 @@ public function testDestruct()
175175 unset($ proxy );
176176 $ this ->assertSame (0 , $ initCounter );
177177
178- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
178+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
179179 ++$ initCounter ;
180180
181181 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -189,7 +189,7 @@ public function testDestruct()
189189 public function testDynamicProperty ()
190190 {
191191 $ initCounter = 0 ;
192- $ proxy = $ this ->createLazyProxy (TestClass::class, function () use (&$ initCounter ) {
192+ $ proxy = $ this ->createLazyProxy (TestClass::class, static function () use (&$ initCounter ) {
193193 ++$ initCounter ;
194194
195195 return new TestClass ((object ) ['hello ' => 'world ' ]);
@@ -207,21 +207,21 @@ public function testDynamicProperty()
207207
208208 public function testStringMagicGet ()
209209 {
210- $ proxy = $ this ->createLazyProxy (StringMagicGetClass::class, fn () => new StringMagicGetClass ());
210+ $ proxy = $ this ->createLazyProxy (StringMagicGetClass::class, static fn () => new StringMagicGetClass ());
211211
212212 $ this ->assertSame ('abc ' , $ proxy ->abc );
213213 }
214214
215215 public function testFinalPublicClass ()
216216 {
217217 $ this ->expectException (LogicException::class, 'Cannot generate lazy proxy: method "Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\FinalPublicClass::increment()" is final. ' );
218- $ this ->createLazyProxy (FinalPublicClass::class, fn () => new FinalPublicClass ());
218+ $ this ->createLazyProxy (FinalPublicClass::class, static fn () => new FinalPublicClass ());
219219 }
220220
221221 public function testOverwritePropClass ()
222222 {
223223 $ this ->expectException (LogicException::class, 'Cannot generate lazy proxy: method "Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\FinalPublicClass::increment()" is final. ' );
224- $ this ->createLazyProxy (TestOverwritePropClass::class, fn () => new TestOverwritePropClass ('123 ' , 5 ));
224+ $ this ->createLazyProxy (TestOverwritePropClass::class, static fn () => new TestOverwritePropClass ('123 ' , 5 ));
225225 }
226226
227227 public function testWither ()
@@ -237,7 +237,7 @@ public function withFoo($foo): static
237237 return $ clone ;
238238 }
239239 };
240- $ proxy = $ this ->createLazyProxy ($ obj ::class, fn () => $ obj );
240+ $ proxy = $ this ->createLazyProxy ($ obj ::class, static fn () => $ obj );
241241
242242 $ clone = $ proxy ->withFoo (234 );
243243 $ this ->assertSame ($ clone ::class, $ proxy ::class);
@@ -257,7 +257,7 @@ public function setFoo($foo): static
257257 return $ this ;
258258 }
259259 };
260- $ proxy = $ this ->createLazyProxy ($ obj ::class, fn () => $ obj );
260+ $ proxy = $ this ->createLazyProxy ($ obj ::class, static fn () => $ obj );
261261
262262 $ this ->assertSame ($ proxy ->setFoo (234 ), $ proxy );
263263 $ this ->assertSame (234 , $ proxy ->foo );
@@ -268,7 +268,7 @@ public function testIndirectModification()
268268 $ obj = new class extends \stdClass {
269269 public array $ foo ;
270270 };
271- $ proxy = $ this ->createLazyProxy ($ obj ::class, fn () => $ obj );
271+ $ proxy = $ this ->createLazyProxy ($ obj ::class, static fn () => $ obj );
272272
273273 $ proxy ->foo [] = 123 ;
274274
@@ -282,14 +282,14 @@ public function testReadOnlyClass()
282282 $ this ->expectExceptionMessage ('Cannot generate lazy proxy with PHP < 8.3: class "Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\ReadOnlyClass" is readonly. ' );
283283 }
284284
285- $ proxy = $ this ->createLazyProxy (ReadOnlyClass::class, fn () => new ConcreteReadOnlyClass (123 ));
285+ $ proxy = $ this ->createLazyProxy (ReadOnlyClass::class, static fn () => new ConcreteReadOnlyClass (123 ));
286286
287287 $ this ->assertSame (123 , $ proxy ->foo );
288288 }
289289
290290 public function testNormalization ()
291291 {
292- $ object = $ this ->createLazyProxy (SimpleObject::class, fn () => new SimpleObject ());
292+ $ object = $ this ->createLazyProxy (SimpleObject::class, static fn () => new SimpleObject ());
293293
294294 $ loader = new AttributeLoader ();
295295 $ metadataFactory = new ClassMetadataFactory ($ loader );
@@ -302,23 +302,23 @@ public function testNormalization()
302302
303303 public function testReinitRegularLazyProxy ()
304304 {
305- $ object = $ this ->createLazyProxy (RegularClass::class, fn () => new RegularClass (123 ));
305+ $ object = $ this ->createLazyProxy (RegularClass::class, static fn () => new RegularClass (123 ));
306306
307307 $ this ->assertSame (123 , $ object ->foo );
308308
309- $ object ::createLazyProxy (fn () => new RegularClass (234 ), $ object );
309+ $ object ::createLazyProxy (static fn () => new RegularClass (234 ), $ object );
310310
311311 $ this ->assertSame (234 , $ object ->foo );
312312 }
313313
314314 #[RequiresPhp('>=8.3 ' )]
315315 public function testReinitReadonlyLazyProxy ()
316316 {
317- $ object = $ this ->createLazyProxy (ReadOnlyClass::class, fn () => new ConcreteReadOnlyClass (123 ));
317+ $ object = $ this ->createLazyProxy (ReadOnlyClass::class, static fn () => new ConcreteReadOnlyClass (123 ));
318318
319319 $ this ->assertSame (123 , $ object ->foo );
320320
321- $ object ::createLazyProxy (fn () => new ConcreteReadOnlyClass (234 ), $ object );
321+ $ object ::createLazyProxy (static fn () => new ConcreteReadOnlyClass (234 ), $ object );
322322
323323 $ this ->assertSame (234 , $ object ->foo );
324324 }
@@ -327,7 +327,7 @@ public function testReinitReadonlyLazyProxy()
327327 public function testConcretePropertyHooks ()
328328 {
329329 $ initialized = false ;
330- $ object = $ this ->createLazyProxy (Hooked::class, function () use (&$ initialized ) {
330+ $ object = $ this ->createLazyProxy (Hooked::class, static function () use (&$ initialized ) {
331331 $ initialized = true ;
332332
333333 return new Hooked ();
@@ -339,7 +339,7 @@ public function testConcretePropertyHooks()
339339 $ this ->assertTrue ($ initialized );
340340
341341 $ initialized = false ;
342- $ object = $ this ->createLazyProxy (Hooked::class, function () use (&$ initialized ) {
342+ $ object = $ this ->createLazyProxy (Hooked::class, static function () use (&$ initialized ) {
343343 $ initialized = true ;
344344
345345 return new Hooked ();
@@ -354,7 +354,7 @@ public function testConcretePropertyHooks()
354354 public function testAbstractPropertyHooks ()
355355 {
356356 $ initialized = false ;
357- $ object = $ this ->createLazyProxy (AbstractHooked::class, function () use (&$ initialized ) {
357+ $ object = $ this ->createLazyProxy (AbstractHooked::class, static function () use (&$ initialized ) {
358358 $ initialized = true ;
359359
360360 return new class extends AbstractHooked {
@@ -368,7 +368,7 @@ public function testAbstractPropertyHooks()
368368 $ this ->assertTrue ($ initialized );
369369
370370 $ initialized = false ;
371- $ object = $ this ->createLazyProxy (AbstractHooked::class, function () use (&$ initialized ) {
371+ $ object = $ this ->createLazyProxy (AbstractHooked::class, static function () use (&$ initialized ) {
372372 $ initialized = true ;
373373
374374 return new class extends AbstractHooked {
@@ -385,14 +385,14 @@ public function testAbstractPropertyHooks()
385385 #[RequiresPhp('>=8.4 ' )]
386386 public function testAsymmetricVisibility ()
387387 {
388- $ object = $ this ->createLazyProxy (AsymmetricVisibility::class, function () {
388+ $ object = $ this ->createLazyProxy (AsymmetricVisibility::class, static function () {
389389 return new AsymmetricVisibility (123 , 234 );
390390 });
391391
392392 $ this ->assertSame (123 , $ object ->foo );
393393 $ this ->assertSame (234 , $ object ->getBar ());
394394
395- $ object = $ this ->createLazyProxy (AsymmetricVisibility::class, function () {
395+ $ object = $ this ->createLazyProxy (AsymmetricVisibility::class, static function () {
396396 return new AsymmetricVisibility (123 , 234 );
397397 });
398398
@@ -404,7 +404,7 @@ public function testInternalClass()
404404 {
405405 $ now = new \DateTimeImmutable ();
406406 $ initialized = false ;
407- $ object = $ this ->createLazyProxy (\DateTimeImmutable::class, function () use ($ now , &$ initialized ) {
407+ $ object = $ this ->createLazyProxy (\DateTimeImmutable::class, static function () use ($ now , &$ initialized ) {
408408 $ initialized = true ;
409409
410410 return $ now ;
0 commit comments