Skip to content

Commit 25cebc6

Browse files
[DeepClone] Avoid named-argument syntax in tests so they parse on PHP 7.x
1 parent 21e3e69 commit 25cebc6

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

tests/DeepClone/DeepCloneTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testToArrayUnsharedReferenceBecomesStatic()
146146

147147
public function testToArrayNamedClosureGlobalFunctionWireFormat()
148148
{
149-
$d = deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true);
149+
$d = deepclone_to_array(\Closure::fromCallable('strlen'), null, true);
150150

151151
$this->assertSame([null, 'strlen'], $d['prepared']);
152152
$this->assertSame(0, $d['mask']);
@@ -259,7 +259,7 @@ public function testRoundTripRecursiveHardReference()
259259

260260
public function testRoundTripNamedClosureGlobalFunction()
261261
{
262-
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true), allow_named_closures: true);
262+
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable('strlen'), null, true), null, true);
263263

264264
$this->assertSame(5, $clone('hello'));
265265
}
@@ -527,7 +527,7 @@ public function testFromArrayRejectsIntMinRefIdsWithoutWarning()
527527

528528
public function testClosureGlobalFunctionWireFormat()
529529
{
530-
$d = deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true);
530+
$d = deepclone_to_array(\Closure::fromCallable('strlen'), null, true);
531531

532532
$this->assertSame(0, $d['mask']);
533533
$this->assertNull($d['prepared'][0]);
@@ -536,48 +536,48 @@ public function testClosureGlobalFunctionWireFormat()
536536

537537
public function testClosureGlobalFunctionRoundTrip()
538538
{
539-
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true), allow_named_closures: true);
539+
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable('strlen'), null, true), null, true);
540540
$this->assertSame(5, $clone('hello'));
541541
}
542542

543543
public function testClosureStaticMethodWireFormat()
544544
{
545-
$d = deepclone_to_array(\Closure::fromCallable([ClosureFixture::class, 'staticMethod']), allow_named_closures: true);
545+
$d = deepclone_to_array(\Closure::fromCallable([ClosureFixture::class, 'staticMethod']), null, true);
546546

547547
$this->assertSame(ClosureFixture::class, $d['prepared'][0]);
548548
$this->assertSame('staticMethod', $d['prepared'][1]);
549549
}
550550

551551
public function testClosureStaticMethodRoundTrip()
552552
{
553-
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable([ClosureFixture::class, 'staticMethod']), allow_named_closures: true), allow_named_closures: true);
553+
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable([ClosureFixture::class, 'staticMethod']), null, true), null, true);
554554
$this->assertSame('static', $clone());
555555
}
556556

557557
public function testClosureInstanceMethodWireFormat()
558558
{
559559
$obj = new ClosureFixture();
560-
$d = deepclone_to_array(\Closure::fromCallable([$obj, 'instanceMethod']), allow_named_closures: true);
560+
$d = deepclone_to_array(\Closure::fromCallable([$obj, 'instanceMethod']), null, true);
561561

562562
$this->assertSame(ClosureFixture::class, $d['classes']);
563563
}
564564

565565
public function testClosureInstanceMethodRoundTrip()
566566
{
567567
$obj = new ClosureFixture();
568-
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable([$obj, 'instanceMethod']), allow_named_closures: true), allow_named_closures: true);
568+
$clone = deepclone_from_array(deepclone_to_array(\Closure::fromCallable([$obj, 'instanceMethod']), null, true), null, true);
569569
$this->assertSame('instance', $clone());
570570
}
571571

572572
public function testClosurePrivateMethodWireFormatAndRoundTrip()
573573
{
574574
$obj = new ClosureFixture();
575575
$fn = $obj->getPrivateClosure();
576-
$d = deepclone_to_array($fn, allow_named_closures: true);
576+
$d = deepclone_to_array($fn, null, true);
577577

578578
$this->assertSame(0, $d['mask']);
579579

580-
$clone = deepclone_from_array($d, allow_named_closures: true);
580+
$clone = deepclone_from_array($d, null, true);
581581
$this->assertSame('private', $clone());
582582
}
583583

@@ -592,7 +592,7 @@ public function testToArrayNamedClosureRequiresOptIn()
592592

593593
public function testFromArrayNamedClosureRequiresOptIn()
594594
{
595-
$d = deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true);
595+
$d = deepclone_to_array(\Closure::fromCallable('strlen'), null, true);
596596
$this->expectException(\ValueError::class);
597597
$this->expectExceptionMessage('resolving a closure over a named callable requires enabling the "allow_named_closures" option');
598598
deepclone_from_array($d);
@@ -602,7 +602,7 @@ public function testFromArrayNamedClosureNestedRejectedBeforeInstantiation()
602602
{
603603
$h = new \stdClass();
604604
$h->cb = \Closure::fromCallable('strlen');
605-
$d = deepclone_to_array($h, allow_named_closures: true);
605+
$d = deepclone_to_array($h, null, true);
606606

607607
try {
608608
deepclone_from_array($d);
@@ -611,7 +611,7 @@ public function testFromArrayNamedClosureNestedRejectedBeforeInstantiation()
611611
$this->assertStringContainsString('resolving a closure over a named callable requires enabling the "allow_named_closures" option', $e->getMessage());
612612
}
613613

614-
$clone = deepclone_from_array($d, allow_named_closures: true);
614+
$clone = deepclone_from_array($d, null, true);
615615
$this->assertSame(4, ($clone->cb)('abcd'));
616616
}
617617

@@ -1118,7 +1118,7 @@ public function testFromArrayAllowedClassesCaseInsensitive()
11181118

11191119
public function testFromArrayAllowedClassesRejectsClosureInMask()
11201120
{
1121-
$d = deepclone_to_array(\Closure::fromCallable('strlen'), allow_named_closures: true);
1121+
$d = deepclone_to_array(\Closure::fromCallable('strlen'), null, true);
11221122
$this->expectException(\ValueError::class);
11231123
$this->expectExceptionMessage('"Closure" is not allowed');
11241124
deepclone_from_array($d, ['stdClass']);

0 commit comments

Comments
 (0)