Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cbc7c87

Browse files
committedSep 13, 2024·
add NodeScopeResolver test to make sure correct types are specified inside closures
1 parent f6b15ca commit cbc7c87

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace ArrayDiffIntersectCallbacks;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
array_diff_uassoc(
8+
[1, 2],
9+
[3, 4],
10+
static function ($a, $b) {
11+
assertType('0|1', $a);
12+
assertType('0|1', $b);
13+
14+
return 0;
15+
},
16+
);
17+
18+
array_diff_ukey(
19+
[1, 2],
20+
[3, 4],
21+
static function ($a, $b) {
22+
assertType('0|1', $a);
23+
assertType('0|1', $b);
24+
25+
return 0;
26+
},
27+
);
28+
29+
array_intersect_uassoc(
30+
[1, 2],
31+
[3, 4],
32+
static function ($a, $b) {
33+
assertType('0|1', $a);
34+
assertType('0|1', $b);
35+
36+
return 0;
37+
},
38+
);
39+
40+
array_intersect_ukey(
41+
[1, 2],
42+
[3, 4],
43+
static function ($a, $b) {
44+
assertType('0|1', $a);
45+
assertType('0|1', $b);
46+
47+
return 0;
48+
},
49+
);
50+
51+
array_udiff(
52+
[1, 2],
53+
[3, 4],
54+
static function ($a, $b) {
55+
assertType('1|2|3|4', $a);
56+
assertType('1|2|3|4', $b);
57+
58+
return 0;
59+
},
60+
);
61+
62+
array_udiff_assoc(
63+
[1, 2],
64+
[3, 4],
65+
static function ($a, $b) {
66+
assertType('1|2|3|4', $a);
67+
assertType('1|2|3|4', $b);
68+
69+
return 0;
70+
},
71+
);
72+
73+
array_udiff_uassoc(
74+
[1, 2],
75+
[3, 4],
76+
static function ($a, $b) {
77+
assertType('1|2|3|4', $a);
78+
assertType('1|2|3|4', $b);
79+
80+
return 0;
81+
},
82+
static function ($a, $b) {
83+
assertType('0|1', $a);
84+
assertType('0|1', $b);
85+
86+
return 0;
87+
},
88+
);
89+
90+
array_uintersect(
91+
[1, 2],
92+
[3, 4],
93+
static function ($a, $b) {
94+
assertType('1|2|3|4', $a);
95+
assertType('1|2|3|4', $b);
96+
97+
return 0;
98+
},
99+
);
100+
101+
array_uintersect_assoc(
102+
[1, 2],
103+
[3, 4],
104+
static function ($a, $b) {
105+
assertType('1|2|3|4', $a);
106+
assertType('1|2|3|4', $b);
107+
108+
return 0;
109+
},
110+
);
111+
112+
array_uintersect_uassoc(
113+
[1, 2],
114+
[3, 4],
115+
static function ($a, $b) {
116+
assertType('1|2|3|4', $a);
117+
assertType('1|2|3|4', $b);
118+
119+
return 0;
120+
},
121+
static function ($a, $b) {
122+
assertType('0|1', $a);
123+
assertType('0|1', $b);
124+
125+
return 0;
126+
},
127+
);

0 commit comments

Comments
 (0)
Please sign in to comment.