Skip to content

Commit

Permalink
Remove recursive calls (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Feb 3, 2024
1 parent 60cb712 commit a80cd2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 4 additions & 6 deletions src/Fixer/PhpdocArrayStyleFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ public function getPriority(): int

protected function fixType(string $type): string
{
$newType = Preg::replace('/([\\\\a-zA-Z0-9_>]+)\[\]/', 'array<$1>', $type);
do {
$type = Preg::replace('/([\\\\a-zA-Z0-9_>]+)\[\]/', 'array<$1>', $type, -1, $count);
} while ($count > 0);

if ($newType === $type) {
return $type;
}

return $this->fixType($newType);
return $type;
}
}
8 changes: 1 addition & 7 deletions src/Fixer/PhpdocTypesCommaSpacesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ public function getPriority(): int

protected function fixType(string $type): string
{
$newType = Preg::replace('/\h*,\s*/', ', ', $type);

if ($newType === $type) {
return $type;
}

return $this->fixType($newType);
return Preg::replace('/\h*,\s*/', ', ', $type);
}
}

0 comments on commit a80cd2b

Please sign in to comment.