File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed
tests/PHPStan/Rules/Functions Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,16 @@ public function check(
188
188
$ arg ->getStartLine (),
189
189
];
190
190
}
191
+
192
+ if (count ($ arguments ) === 0 && $ type ->isIterableAtLeastOnce ()->yes ()) {
193
+ $ arguments [] = [
194
+ $ arg ->value ,
195
+ $ type ->getIterableValueType (),
196
+ true ,
197
+ null ,
198
+ $ arg ->getStartLine (),
199
+ ];
200
+ }
191
201
} else {
192
202
$ arguments [] = [
193
203
$ arg ->value ,
Original file line number Diff line number Diff line change @@ -2169,6 +2169,16 @@ public function testBug8922(): void
2169
2169
$ this ->analyse ([__DIR__ . '/../../Analyser/nsrt/bug-8922.php ' ], $ errors );
2170
2170
}
2171
2171
2172
+ public function testBug10020 (): void
2173
+ {
2174
+ $ this ->analyse ([__DIR__ . '/data/bug-10020.php ' ], []);
2175
+ }
2176
+
2177
+ public function testBug8506 (): void
2178
+ {
2179
+ $ this ->analyse ([__DIR__ . '/data/bug-8506.php ' ], []);
2180
+ }
2181
+
2172
2182
public function testBug13065 (): void
2173
2183
{
2174
2184
$ errors = [];
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug10020 ;
4
+
5
+ function load (string $ path , string ...$ extraPaths ): void
6
+ {
7
+ //$this->doLoad(false, \func_get_args());
8
+ }
9
+
10
+ $ projectDir = __DIR__ ;
11
+ $ environment = 'dev ' ;
12
+
13
+ $ files = array_reverse (array_filter ([
14
+ $ projectDir .'/.env ' ,
15
+ $ projectDir .'/.env. ' .$ environment ,
16
+ $ projectDir .'/.env.local ' ,
17
+ $ projectDir .'/.env. ' .$ environment .'.local ' ,
18
+ ], 'file_exists ' ));
19
+
20
+ if ($ files !== []) {
21
+ load (...$ files );
22
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug8506 ;
4
+
5
+ function a (): ?int { return rand (0 , 1 ) ? 1 : null ; }
6
+ function b (int $ i , int ...$ a ): void {}
7
+
8
+ $ arguments = array_filter ([
9
+ a (),
10
+ a (),
11
+ a (),
12
+ ]);
13
+
14
+ if (!$ arguments ) {
15
+ return ;
16
+ }
17
+
18
+ b (...$ arguments );
You can’t perform that action at this time.
0 commit comments