Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add regression test for ArrayObject generics after an offset write
Closes phpstan/phpstan#10783

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
  • Loading branch information
phpstan-bot and claude committed Sep 2, 2026
commit 7c56e06b5a601a29722f748c6c8ac064873d50bb
20 changes: 20 additions & 0 deletions tests/PHPStan/Analyser/nsrt/bug-10783.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types = 1);

namespace Bug10783;

use ArrayObject;
use function PHPStan\Testing\assertType;

class HelloWorld
{
public function sayHello(): bool
{
$a = new ArrayObject([]);
assertType('ArrayObject<*NEVER*, *NEVER*>', $a);
$a[] = 'test';
assertType('ArrayObject<(int|string), mixed>', $a);
assertType('array<mixed>', $a->getArrayCopy());

return empty($a->getArrayCopy());
}
}