mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Added array_fill_keys support (#2512)
* Added array_fill_keys support * Removed unnecessary array_fill_keys phpdoc
This commit is contained in:
parent
6b81f8c64a
commit
006f788d6a
@ -1187,7 +1187,6 @@ class ProjectAnalyzer
|
||||
|
||||
public function setAllIssuesToFix(): void
|
||||
{
|
||||
/** @var array<string, true> $keyed_issues */
|
||||
$keyed_issues = array_fill_keys(static::getSupportedIssuesToFix(), true);
|
||||
|
||||
$this->setIssuesToFix($keyed_issues);
|
||||
|
@ -287,7 +287,6 @@ class Pool
|
||||
|
||||
// Create an array for the content received on each stream,
|
||||
// indexed by resource id.
|
||||
/** @var array<int, string> $content */
|
||||
$content = array_fill_keys(array_keys($streams), '');
|
||||
|
||||
$terminationMessages = [];
|
||||
|
@ -217,3 +217,17 @@ function array_key_exists($key, array $search) : bool
|
||||
function array_merge_recursive(array $arr, array ...$arr2)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-template TKey as array-key
|
||||
* @psalm-template TValue
|
||||
*
|
||||
* @param array<TKey> $keys
|
||||
* @param TValue $value
|
||||
*
|
||||
* @return array<TKey, TValue>
|
||||
* @psalm-pure
|
||||
*/
|
||||
function array_fill_keys(array $keys, $value): array
|
||||
{
|
||||
}
|
||||
|
@ -2334,6 +2334,14 @@ class FunctionCallTest extends TestCase
|
||||
);
|
||||
}'
|
||||
],
|
||||
'arrayFillKeys' => [
|
||||
'<?php
|
||||
$keys = [1, 2, 3];
|
||||
$result = array_fill_keys($keys, true);',
|
||||
'assertions' => [
|
||||
'$result' => 'array<int, true>',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user