Skip to content

Commit

Permalink
[VarExporter] fix for change in PHP 7.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed May 16, 2020
1 parent cc519aa commit 1e9486d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
123,
],
[],
null,
],
]
);
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
[
"\0".'Symfony\\Component\\VarExporter\\Tests\\MyArrayObject'."\0".'unused' => 123,
],
null,
],
]
);
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
[
'foo' => $o[1],
],
null,
],
-1 => [
0,
[],
[],
null,
],
]
);
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
0,
[],
[],
null,
],
]
);
6 changes: 4 additions & 2 deletions src/Symfony/Component/VarExporter/Tests/VarExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ public function testExport(string $testName, $value, bool $staticValueExpected =
$dump = "<?php\n\nreturn ".$marshalledValue.";\n";
$dump = str_replace(var_export(__FILE__, true), "\\dirname(__DIR__).\\DIRECTORY_SEPARATOR.'VarExporterTest.php'", $dump);

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

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarExporter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^7.1.3"
},
"require-dev": {
"symfony/var-dumper": "^4.1.1|^5.0"
"symfony/var-dumper": "^4.4.9|^5.0.9"
},
"autoload": {
"psr-4": { "Symfony\\Component\\VarExporter\\": "" },
Expand Down

0 comments on commit 1e9486d

Please sign in to comment.