Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 30, 2022
1 parent f8af5dc commit 6315635
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Expand Up @@ -348,4 +348,9 @@ public function testRuleWithNullsafeVariant(): void
]);
}

public function testBug4926(): void
{
$this->analyse([__DIR__ . '/data/bug-4926.php'], []);
}

}
17 changes: 17 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-4926.php
@@ -0,0 +1,17 @@
<?php

namespace Bug4926;

/**
* @phpstan-type Data array{customer?: array{first_name: string}}
*/
class Foo
{
/** @var Data */
private array $data = [];

public function getFirstName(): ?string
{
return $this->data['customer']['first_name'] ?? null;
}
}

0 comments on commit 6315635

Please sign in to comment.