Skip to content
Permalink
Browse files

Added array_fill_keys support (#2512)

* Added array_fill_keys support

* Removed unnecessary array_fill_keys phpdoc
  • Loading branch information
vudaltsov authored and muglug committed Dec 27, 2019
1 parent 6b81f8c commit 006f788d6a5b7b605e35822a6dff2ff1c054b4a7
@@ -1187,7 +1187,6 @@ public function setIssuesToFix(array $issues)

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 @@ private function readResultsFromChildren()

// 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 @@ function getCharPairs(string $line) : array {
);
}'
],
'arrayFillKeys' => [
'<?php
$keys = [1, 2, 3];
$result = array_fill_keys($keys, true);',
'assertions' => [
'$result' => 'array<int, true>',
],
],
];
}

0 comments on commit 006f788

Please sign in to comment.
You can’t perform that action at this time.