File tree Expand file tree Collapse file tree 3 files changed +23
-14
lines changed
src/Symfony/Component/DependencyInjection/Tests
Fixtures/CheckTypeDeclarationsPass Expand file tree Collapse file tree 3 files changed +23
-14
lines changed Original file line number Diff line number Diff line change 32
32
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \FooObject ;
33
33
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \IntersectionConstructor ;
34
34
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \UnionConstructor ;
35
- use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \UnionConstructorWithTrue ;
35
+ use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \UnionConstructorPHP82 ;
36
36
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \Waldo ;
37
37
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \WaldoFoo ;
38
38
use Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass \Wobble ;
@@ -876,10 +876,14 @@ public function testUnionTypePassesWithTrue()
876
876
{
877
877
$ container = new ContainerBuilder ();
878
878
879
- $ container ->register ('union ' , UnionConstructorWithTrue ::class)
880
- ->setFactory ([UnionConstructorWithTrue ::class, 'create ' ])
879
+ $ container ->register ('unionTrue ' , UnionConstructorPHP82 ::class)
880
+ ->setFactory ([UnionConstructorPHP82 ::class, 'createTrue ' ])
881
881
->setArguments ([true ]);
882
882
883
+ $ container ->register ('unionNull ' , UnionConstructorPHP82::class)
884
+ ->setFactory ([UnionConstructorPHP82::class, 'createNull ' ])
885
+ ->setArguments ([null ]);
886
+
883
887
(new CheckTypeDeclarationsPass (true ))->process ($ container );
884
888
885
889
$ this ->addToAssertionCount (1 );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Component \DependencyInjection \Tests \Fixtures \CheckTypeDeclarationsPass ;
4
+
5
+ class UnionConstructorPHP82
6
+ {
7
+ public static function createTrue (array |true $ arg ): static
8
+ {
9
+ return new static (0 );
10
+ }
11
+
12
+ public static function createNull (null $ arg ): static
13
+ {
14
+ return new static (0 );
15
+ }
16
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments