File tree 4 files changed +93
-0
lines changed
tests/PHPStan/Rules/PhpDoc
4 files changed +93
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,33 @@ public function testBug12458(): void
197
197
$ this ->analyse ([__DIR__ . '/data/bug-12458.php ' ], []);
198
198
}
199
199
200
+ public function testBug11015 (): void
201
+ {
202
+ $ this ->checkTypeAgainstNativeType = true ;
203
+ $ this ->checkTypeAgainstPhpDocType = true ;
204
+ $ this ->strictWideningCheck = true ;
205
+
206
+ $ this ->analyse ([__DIR__ . '/data/bug-11015.php ' ], []);
207
+ }
208
+
209
+ public function testBug10861 (): void
210
+ {
211
+ $ this ->checkTypeAgainstNativeType = true ;
212
+ $ this ->checkTypeAgainstPhpDocType = true ;
213
+ $ this ->strictWideningCheck = true ;
214
+
215
+ $ this ->analyse ([__DIR__ . '/data/bug-10861.php ' ], []);
216
+ }
217
+
218
+ public function testBug11535 (): void
219
+ {
220
+ $ this ->checkTypeAgainstNativeType = true ;
221
+ $ this ->checkTypeAgainstPhpDocType = true ;
222
+ $ this ->strictWideningCheck = true ;
223
+
224
+ $ this ->analyse ([__DIR__ . '/data/bug-11535.php ' ], []);
225
+ }
226
+
200
227
public function testEnums (): void
201
228
{
202
229
if (PHP_VERSION_ID < 80100 ) {
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug10861 ;
4
+
5
+ class HelloWorld
6
+ {
7
+ /**
8
+ *
9
+ * @param array<string,mixed> $array1
10
+ * @param-out array<string,mixed> $array1
11
+ */
12
+ public function sayHello (array &$ array1 ): void
13
+ {
14
+ $ values_1 = $ array1 ;
15
+
16
+ $ values_1 = array_filter ($ values_1 , function (mixed $ value ): bool {
17
+ return $ value !== [];
18
+ });
19
+
20
+ /** @var array<string,mixed> $values_1 */
21
+ $ array1 = $ values_1 ;
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug11015 ;
4
+
5
+ class HelloWorld
6
+ {
7
+ public function sayHello (PDOStatement $ date ): void
8
+ {
9
+ $ b = $ date ->fetch ();
10
+ if (empty ($ b )) {
11
+ return ;
12
+ }
13
+
14
+ /** @var array<string, int> $b */
15
+ echo $ b ['a ' ];
16
+ }
17
+
18
+ public function sayHello2 (PDOStatement $ date ): void
19
+ {
20
+ $ b = $ date ->fetch ();
21
+
22
+ /** @var array<string, int> $b */
23
+ echo $ b ['a ' ];
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug11535 ;
4
+
5
+ /** @var \Closure(string): array<int> */
6
+ $ a = function (string $ b ) {
7
+ return [1 ,2 ,3 ];
8
+ };
9
+
10
+ /** @var \Closure(array): array */
11
+ $ a = function (array $ b ) {
12
+ return $ b ;
13
+ };
14
+
15
+ /** @var \Closure(string): string */
16
+ $ a = function (string $ b ) {
17
+ return $ b ;
18
+ };
You can’t perform that action at this time.
0 commit comments