Skip to content

Commit

Permalink
Remove unnecessary array_values usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-zacek committed Feb 14, 2024
1 parent 1ed0eac commit 7bf4f56
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions build/spl-autoload-functions-pre-php-7.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ parameters:
message: "#^PHPDoc tag @var with type array\\<callable\\(\\)\\: mixed\\>\\|false is not subtype of native type list\\<callable\\(string\\)\\: void\\>\\|false\\.$#"
count: 2
path: ../src/Command/CommandHelper.php

-
message: '#^Parameter \#1 \$array \(list<PHPStan\\Type\\Type>\) of array_values is already a list, call has no effect\.$#'
path: ../src/Type/TypeCombinator.php
2 changes: 1 addition & 1 deletion src/Type/Constant/ConstantArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function getAllArrays(): array
$keys = array_merge($requiredKeys, $combination);
sort($keys);

if ($this->isList->yes() && array_keys($keys) !== array_values($keys)) {
if ($this->isList->yes() && array_keys($keys) !== $keys) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Type/TypeCombinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ public static function intersect(Type ...$types): Type

if ($hasOffsetValueTypeCount > 32) {
$newTypes[] = new OversizedArrayType();
$types = array_values($newTypes);
$types = $newTypes;
$typesCount = count($types);
}

Expand Down

0 comments on commit 7bf4f56

Please sign in to comment.