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 b6a9e41
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ parameters:
message: "#^Parameter \\#1 (?:\\$argument|\\$objectOrClass) of class ReflectionClass constructor expects class\\-string\\<PHPStan\\\\ExtensionInstaller\\\\GeneratedConfig\\>\\|PHPStan\\\\ExtensionInstaller\\\\GeneratedConfig, string given\\.$#"
count: 1
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
- '#^Parameter \#1 \$offsetType of class PHPStan\\Type\\Accessory\\HasOffsetType constructor expects PHPStan\\Type\\Constant\\ConstantIntegerType\|PHPStan\\Type\\Constant\\ConstantStringType#'
- '#^Short ternary operator is not allowed#'
reportStaticMethodSignatures: true
Expand Down
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 b6a9e41

Please sign in to comment.