Skip to content

Commit

Permalink
test: add test for issue-10926
Browse files Browse the repository at this point in the history
  • Loading branch information
rajyan committed May 5, 2024
1 parent 265e0c2 commit 1057bd6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,17 @@ public function testBug8166(): void
]);
}

public function testBug10926(): void
{
$this->checkExplicitMixed = true;
$this->analyse([__DIR__ . '/data/bug-10926.php'], [
[
'Cannot access offset \'a\' on stdClass.',
10,
],
]);
}

public function testMixed(): void
{
$this->checkExplicitMixed = true;
Expand Down
12 changes: 12 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-10926.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Bug10926;

class HelloWorld
{
public function sayHello(?\stdClass $date): void
{
$date ??= new \stdClass();
echo isset($date['a']);
}
}

0 comments on commit 1057bd6

Please sign in to comment.