Skip to content

Commit 9daae6d

Browse files
Add 10861 regression test
1 parent e4327da commit 9daae6d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ public function testBug11015(): void
206206
$this->analyse([__DIR__ . '/data/bug-11015.php'], []);
207207
}
208208

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+
209218
public function testEnums(): void
210219
{
211220
if (PHP_VERSION_ID < 80100) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

0 commit comments

Comments
 (0)