We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c2c1e2 commit d7ba1e3Copy full SHA for d7ba1e3
src/Analyser/MutatingScope.php
@@ -1853,6 +1853,10 @@ private function getTypeFromArrayDimFetch(
1853
throw new ShouldNotHappenException();
1854
}
1855
1856
+ if ($offsetAccessibleType instanceof NeverType) {
1857
+ return $offsetAccessibleType;
1858
+ }
1859
+
1860
if (!$offsetAccessibleType->isArray()->yes() && (new ObjectType(ArrayAccess::class))->isSuperTypeOf($offsetAccessibleType)->yes()) {
1861
return $this->getType(
1862
new MethodCall(
tests/PHPStan/Analyser/data/bug-9307.php
@@ -31,7 +31,7 @@ public function test(): void
31
32
33
34
- assertType('array', $objects);
+ assertType('array<int, Bug9307\Item>', $objects);
35
36
$this->acceptObjects($objects);
37
0 commit comments