bug #41701 [VarDumper] Fix tests for PHP 8.1 (alexandre-daubois)
This PR was merged into the 4.4 branch.
Discussion
----------
[VarDumper] Fix tests for PHP 8.1
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Part of #41552 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | N/A
Commits
-------
f2b0822401
[VarDumper] Fix tests for PHP 8.1
This commit is contained in:
commit
0c1343f4ee
@ -122,6 +122,7 @@ EOTXT
|
||||
{
|
||||
$var = new \ReflectionParameter(reflectionParameterFixture::class, 0);
|
||||
|
||||
if (\PHP_VERSION_ID < 80100) {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
@ -133,6 +134,19 @@ ReflectionParameter {
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
} else {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
+name: "arg1"
|
||||
position: 0
|
||||
allowsNull: true
|
||||
typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass"
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testReflectionParameterScalar()
|
||||
@ -406,6 +420,7 @@ EOTXT
|
||||
$generator = new GeneratorDemo();
|
||||
$generator = $generator->baz();
|
||||
|
||||
if (\PHP_VERSION_ID < 80100) {
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
@ -420,6 +435,23 @@ Generator {
|
||||
closed: false
|
||||
}
|
||||
EODUMP;
|
||||
} else {
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
trace: {
|
||||
./src/Symfony/Component/VarDumper/Tests/Fixtures/GeneratorDemo.php:13 {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz()
|
||||
› public function baz()
|
||||
› {
|
||||
› yield from bar();
|
||||
}
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $generator);
|
||||
|
||||
@ -427,6 +459,7 @@ EODUMP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID < 80100) {
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => ReflectionGenerator {
|
||||
@ -456,6 +489,39 @@ array:2 [
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
} else {
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => ReflectionGenerator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
trace: {
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:9 {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
|
||||
› {
|
||||
› yield 1;
|
||||
› }
|
||||
}
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:20 { …}
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:14 { …}
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
1 => Generator {
|
||||
trace: {
|
||||
./src/Symfony/Component/VarDumper/Tests/Fixtures/GeneratorDemo.php:9 {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo()
|
||||
› {
|
||||
› yield 1;
|
||||
› }
|
||||
}
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() {}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$r = new \ReflectionGenerator($generator);
|
||||
$this->assertDumpMatchesFormat($expectedDump, [$r, $r->getExecutingGenerator()]);
|
||||
|
Reference in New Issue
Block a user