[VarExporter] fix for change in PHP 7.4.6

This commit is contained in:
Nicolas Grekas 2020-05-16 12:04:25 +02:00
parent cc519aa5a9
commit 1e9486de89
6 changed files with 10 additions and 3 deletions

View File

@ -14,6 +14,7 @@ return \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
123,
],
[],
null,
],
]
);

View File

@ -16,6 +16,7 @@ return \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
[
"\0".'Symfony\\Component\\VarExporter\\Tests\\MyArrayObject'."\0".'unused' => 123,
],
null,
],
]
);

View File

@ -18,11 +18,13 @@ return \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
[
'foo' => $o[1],
],
null,
],
-1 => [
0,
[],
[],
null,
],
]
);

View File

@ -12,6 +12,7 @@ return \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
0,
[],
[],
null,
],
]
);

View File

@ -87,10 +87,12 @@ class VarExporterTest extends TestCase
$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);

View File

@ -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\\": "" },