Skip to content

Commit 5262451

Browse files
[VarExporter] fix for change in PHP 7.4.6
1 parent 6e95bdc commit 5262451

File tree

6 files changed

+10
-3
lines changed

6 files changed

+10
-3
lines changed

Tests/Fixtures/array-iterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
123,
1515
],
1616
[],
17+
null,
1718
],
1819
]
1920
);

Tests/Fixtures/array-object-custom.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
[
1717
"\0".'Symfony\\Component\\VarExporter\\Tests\\MyArrayObject'."\0".'unused' => 123,
1818
],
19+
null,
1920
],
2021
]
2122
);

Tests/Fixtures/array-object.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
[
1919
'foo' => $o[1],
2020
],
21+
null,
2122
],
2223
-1 => [
2324
0,
2425
[],
2526
[],
27+
null,
2628
],
2729
]
2830
);

Tests/Fixtures/final-array-iterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
0,
1313
[],
1414
[],
15+
null,
1516
],
1617
]
1718
);

Tests/VarExporterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ public function testExport(string $testName, $value, bool $staticValueExpected =
8787
$dump = "<?php\n\nreturn ".$marshalledValue.";\n";
8888
$dump = str_replace(var_export(__FILE__, true), "\\dirname(__DIR__).\\DIRECTORY_SEPARATOR.'VarExporterTest.php'", $dump);
8989

90-
if (\PHP_VERSION_ID < 70400 && \in_array($testName, ['array-object', 'array-iterator', 'array-object-custom', 'spl-object-storage', 'final-array-iterator', 'final-error'], true)) {
90+
if (\PHP_VERSION_ID >= 70406 || !\in_array($testName, ['array-object', 'array-iterator', 'array-object-custom', 'spl-object-storage', 'final-array-iterator', 'final-error'], true)) {
91+
$fixtureFile = __DIR__.'/Fixtures/'.$testName.'.php';
92+
} elseif (\PHP_VERSION_ID < 70400) {
9193
$fixtureFile = __DIR__.'/Fixtures/'.$testName.'-legacy.php';
9294
} else {
93-
$fixtureFile = __DIR__.'/Fixtures/'.$testName.'.php';
95+
$this->markAsSkipped('PHP >= 7.4.6 required.');
9496
}
9597
$this->assertStringEqualsFile($fixtureFile, $dump);
9698

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^7.1.3"
2020
},
2121
"require-dev": {
22-
"symfony/var-dumper": "^4.1.1|^5.0"
22+
"symfony/var-dumper": "^4.4.9|^5.0.9"
2323
},
2424
"autoload": {
2525
"psr-4": { "Symfony\\Component\\VarExporter\\": "" },

0 commit comments

Comments
 (0)