File tree Expand file tree Collapse file tree
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments