We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fac96bf commit c9c74c5Copy full SHA for c9c74c5
tests/PHPStan/Analyser/nsrt/bug-10650.php
@@ -0,0 +1,33 @@
1
+<?php declare(strict_types=1);
2
+
3
+namespace Bug10650;
4
5
+use function PHPStan\Testing\assertType;
6
7
+class DistFoo
8
+{
9
+ /**
10
+ * @param list<'y'> $distPoints
11
+ */
12
+ public function repro(array $distPoints): void
13
+ {
14
+ $ranges = [];
15
+ $pointPrev = null;
16
+ foreach ($distPoints as $distPoint) {
17
+ if ($pointPrev !== null) {
18
+ $ranges[] = 'x';
19
+ }
20
+ $pointPrev = $distPoint;
21
22
23
+ assertType('list<\'x\'>', $ranges);
24
25
+ foreach (array_keys($ranges) as $key) {
26
+ if (mt_rand() === 0) {
27
+ unset($ranges[$key]);
28
29
30
31
+ assertType('array<int<0, max>, \'x\'>', $ranges);
32
33
+}
0 commit comments