File tree Expand file tree Collapse file tree 4 files changed +93
-0
lines changed
tests/PHPStan/Rules/PhpDoc Expand file tree Collapse file tree 4 files changed +93
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,33 @@ public function testBug12458(): void
205205 $ this ->analyse ([__DIR__ . '/data/bug-12458.php ' ], []);
206206 }
207207
208+ public function testBug11015 (): void
209+ {
210+ $ this ->checkTypeAgainstNativeType = true ;
211+ $ this ->checkTypeAgainstPhpDocType = true ;
212+ $ this ->strictWideningCheck = true ;
213+
214+ $ this ->analyse ([__DIR__ . '/data/bug-11015.php ' ], []);
215+ }
216+
217+ public function testBug10861 (): void
218+ {
219+ $ this ->checkTypeAgainstNativeType = true ;
220+ $ this ->checkTypeAgainstPhpDocType = true ;
221+ $ this ->strictWideningCheck = true ;
222+
223+ $ this ->analyse ([__DIR__ . '/data/bug-10861.php ' ], []);
224+ }
225+
226+ public function testBug11535 (): void
227+ {
228+ $ this ->checkTypeAgainstNativeType = true ;
229+ $ this ->checkTypeAgainstPhpDocType = true ;
230+ $ this ->strictWideningCheck = true ;
231+
232+ $ this ->analyse ([__DIR__ . '/data/bug-11535.php ' ], []);
233+ }
234+
208235 public function testEnums (): void
209236 {
210237 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