Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix array_column() with null as $column_key
Fixes phpstan/phpstan#6497
- Loading branch information
1 parent
b833073
commit 28179f2
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bug6497; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function bug6497(): void { | ||
/** @var array<int, array{foo: string, bar: int}> */ | ||
$array = [ | ||
['foo' => 'baz', 'bar' => 3], | ||
]; | ||
|
||
$array2 = array_column($array, null, 'foo'); | ||
|
||
assertType('array<string, array{foo: string, bar: int}>', $array2); | ||
} |