Skip to content

Commit

Permalink
Merge branch '6.0' into 6.1
Browse files Browse the repository at this point in the history
* 6.0:
  Fix CS
  Fix CS
  quote address names if they contain parentheses
  [FrameworkBundle] Fail gracefully when forms use disabled CSRF
  [Mime] Fix inline parts when added via attachPart()
  Fail gracefully when attempting to autowire composite types
  [VarDumper] Add a test case for nesting intersection and union types
  Fix #46592 - Ignore getter with required parameters
  [Serializer] Fix inconsistent behaviour of nullable objects in key/value arrays
  • Loading branch information
derrabus committed Jul 19, 2022
2 parents e81fb3e + 805d447 commit 4386618
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
41 changes: 40 additions & 1 deletion Tests/Caster/ReflectionCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionIntersectionTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionNamedTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeWithIntersectionFixture;

/**
* @author Nicolas Grekas <[email protected]>
Expand Down Expand Up @@ -94,7 +95,7 @@ public function testClosureCaster()
$b: & 123
}
file: "%sReflectionCasterTest.php"
line: "87 to 87"
line: "88 to 88"
}
EOTXT
, $var
Expand Down Expand Up @@ -318,6 +319,44 @@ public function testReflectionIntersectionType()
);
}

/**
* @requires PHP 8.2
*/
public function testReflectionUnionTypeWithIntersection()
{
$var = (new \ReflectionProperty(ReflectionUnionTypeWithIntersectionFixture::class, 'a'))->getType();
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionUnionType {
allowsNull: true
types: array:2 [
0 => ReflectionIntersectionType {
allowsNull: false
types: array:2 [
0 => ReflectionNamedType {
name: "Traversable"
allowsNull: false
isBuiltin: false
}
1 => ReflectionNamedType {
name: "Countable"
allowsNull: false
isBuiltin: false
}
]
}
1 => ReflectionNamedType {
name: "null"
allowsNull: true
isBuiltin: true
}
]
}
EOTXT
, $var
);
}

public function testExtendsReflectionType()
{
$var = new ExtendsReflectionTypeFixture();
Expand Down
8 changes: 8 additions & 0 deletions Tests/Fixtures/ReflectionUnionTypeWithIntersectionFixture.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Symfony\Component\VarDumper\Tests\Fixtures;

class ReflectionUnionTypeWithIntersectionFixture
{
public (\Traversable&\Countable)|null $a;
}

0 comments on commit 4386618

Please sign in to comment.