Skip to content

Commit ea03d07

Browse files
phpstan-botclaude
authored andcommitted
Use playground reproducer for bug 5271 test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cabf58f commit ea03d07

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-5271.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,19 @@ class Banner
1818
/** @var list<BannerPatternLayer> */
1919
private array $patterns = [];
2020

21-
public function test(): void
22-
{
23-
$this->patterns = array_filter($this->patterns, fn($v) => $v instanceof BannerPatternLayer);
21+
/**
22+
* @param BannerPatternLayer[] $patterns
23+
*
24+
* @phpstan-param list<BannerPatternLayer> $patterns
25+
* @return $this
26+
*/
27+
public function setPatterns(array $patterns) : self{
28+
$checked = array_filter($patterns, fn($v) => $v instanceof BannerPatternLayer);
29+
if(count($checked) !== count($patterns)){
30+
throw new \TypeError("Deque must only contain " . BannerPatternLayer::class . " objects");
31+
}
32+
$this->patterns = $checked;
33+
return $this;
2434
}
2535

2636
public function testClosure(): void

0 commit comments

Comments
 (0)