Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use array_fill_keys() #7661

Merged
merged 1 commit into from Feb 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 4 additions & 19 deletions src/Psalm/Internal/Provider/StatementsProvider.php
Expand Up @@ -21,7 +21,7 @@
use Throwable;

use function abs;
use function array_flip;
use function array_fill_keys;
use function array_intersect_key;
use function array_map;
use function array_merge;
Expand Down Expand Up @@ -216,15 +216,8 @@ public function getStatementsForFile(
$file_contents
);

$unchanged_members = array_map(
fn(int $_): bool => true,
array_flip($unchanged_members)
);

$unchanged_signature_members = array_map(
fn(int $_): bool => true,
array_flip($unchanged_signature_members)
);
$unchanged_members = array_fill_keys($unchanged_members, true);
$unchanged_signature_members = array_fill_keys($unchanged_signature_members, true);

$file_path_hash = md5($file_path);

Expand All @@ -239,15 +232,7 @@ function (string $key) use ($file_path_hash): string {
$changed_members
);

$changed_members = array_map(
/**
* @param int $_
*
* @return bool
*/
fn($_): bool => true,
array_flip($changed_members)
);
$changed_members = array_fill_keys($changed_members, true);

if (isset($this->unchanged_members[$file_path])) {
$this->unchanged_members[$file_path] = array_intersect_key(
Expand Down