forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-11234.php
More file actions
55 lines (44 loc) · 1.55 KB
/
bug-11234.php
File metadata and controls
55 lines (44 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php // lint >= 8.0
namespace Bug11234;
use function PHPStan\Testing\assertType;
class Payload {}
/** @param array{0|1|2|3, int|Payload|string|null}&array{int, Payload} $x */
function testIntersectConstantUnionWithInt(mixed $x): void
{
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
}
/** @param array{int, Payload}&array{0|1|2|3, int|Payload|string|null} $x */
function testIntersectConstantUnionWithIntReverse(mixed $x): void
{
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
}
/** @param array{0|1|2|3, int|Payload|string|null}&array{0|1|2|3, Payload} $x */
function testIntersectBothConstantUnion(mixed $x): void
{
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
}
/** @param array{int, int|Payload|string|null}&array{int, Payload} $y */
function testIntersectPlainInt(mixed $y): void
{
assertType('array{int, Bug11234\Payload}', $y);
}
/** @param array{0|1, string|int, Payload|null}&array{int, string, Payload} $z */
function testIntersectThreePositions(mixed $z): void
{
assertType('array{0|1, string, Bug11234\Payload}', $z);
}
/** @param array{'a'|'b', int|Payload|string|null}&array{string, Payload} $w */
function testIntersectStringConstantUnion(mixed $w): void
{
assertType("array{'a'|'b', Bug11234\Payload}", $w);
}
/** @param array{0|1, int|string}&array{int, int, extra?: bool} $v */
function testIntersectOptionalKey(mixed $v): void
{
assertType('array{0|1, int}', $v);
}
/** @param array{true|false, int|string}&array{bool, string} $u */
function testIntersectBoolConstantUnion(mixed $u): void
{
assertType('array{bool, string}', $u);
}