Skip to content

Commit c53ed37

Browse files
authored
Merge branch refs/heads/1.12.x into 2.1.x
2 parents 4811a1a + d38ed50 commit c53ed37

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Type/ObjectType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\Type;
44

55
use ArrayAccess;
6+
use ArrayObject;
67
use Closure;
78
use Countable;
89
use Iterator;
@@ -615,6 +616,7 @@ public function toArray(): Type
615616

616617
if (
617618
!$classReflection->getNativeReflection()->isUserDefined()
619+
|| $classReflection->is(ArrayObject::class)
618620
|| UniversalObjectCratesClassReflectionExtension::isUniversalObjectCrate(
619621
$reflectionProvider,
620622
$classReflection,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug12182;
4+
5+
use ArrayObject;
6+
use function PHPStan\Testing\assertType;
7+
8+
/**
9+
* @extends ArrayObject<int, string>
10+
*/
11+
class HelloWorld extends ArrayObject
12+
{
13+
public function __construct(private int $a = 42) {
14+
}
15+
}
16+
17+
function (HelloWorld $hw): void {
18+
assertType('array', (array) $hw);
19+
};

0 commit comments

Comments
 (0)