Skip to content

Commit

Permalink
Merge branch refs/heads/1.12.x into 2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
phpstan-bot authored Jan 15, 2025
2 parents 4811a1a + d38ed50 commit c53ed37
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Type/ObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Type;

use ArrayAccess;
use ArrayObject;
use Closure;
use Countable;
use Iterator;
Expand Down Expand Up @@ -615,6 +616,7 @@ public function toArray(): Type

if (
!$classReflection->getNativeReflection()->isUserDefined()
|| $classReflection->is(ArrayObject::class)
|| UniversalObjectCratesClassReflectionExtension::isUniversalObjectCrate(
$reflectionProvider,
$classReflection,
Expand Down
19 changes: 19 additions & 0 deletions tests/PHPStan/Analyser/nsrt/bug-12182.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php // lint >= 8.0

namespace Bug12182;

use ArrayObject;
use function PHPStan\Testing\assertType;

/**
* @extends ArrayObject<int, string>
*/
class HelloWorld extends ArrayObject
{
public function __construct(private int $a = 42) {
}
}

function (HelloWorld $hw): void {
assertType('array', (array) $hw);
};

0 comments on commit c53ed37

Please sign in to comment.