Skip to content

Commit

Permalink
Fix CodingStandard
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Mar 6, 2021
1 parent 0869156 commit 679b5e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Api/UserEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public function actionDefault(
'currentUserId' => $currentUserId,
'statusCount' => [
'all' => \count($allUsers = $this->getAllUsers()),
'active' => \count(array_filter($allUsers, static fn (array $item): bool => $item['active'] === true)),
'deleted' => \count(array_filter($allUsers, static fn (array $item): bool => $item['active'] === false)),
'active' => \count(array_filter($allUsers, static fn(array $item): bool => $item['active'] === true)),
'deleted' => \count(array_filter($allUsers, static fn(array $item): bool => $item['active'] === false)),
],
'paginator' => (new Paginator)
->setItemCount(\count($allUsers))
Expand Down Expand Up @@ -522,7 +522,7 @@ public function postSavePermissions(string $id, array $roles, array $permissions

return;
}
$roles = array_map(fn (string $role): string => strtolower($role), $roles);
$roles = array_map(fn(string $role): string => strtolower($role), $roles);
if ($user->isAdmin() === false && \in_array('admin', $roles, true) === true) {
$this->sendError('You cannot set the administrator role manually. To maintain security, use the "Set as admin" button.');
}
Expand Down
10 changes: 5 additions & 5 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function formatApiMethod(string $signal): string
{
$return = 'action' . str_replace('.', '', Strings::firstUpper($signal));

$return = (string) preg_replace_callback('/-([a-z])/', static fn (array $match): string => mb_strtoupper($match[1], 'UTF-8'), $return);
$return = (string) preg_replace_callback('/-([a-z])/', static fn(array $match): string => mb_strtoupper($match[1], 'UTF-8'), $return);

return $return;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ public static function getOtp(string $secret, string $timeSlot): int

public static function checkAuthenticatorOtpCodeManually(string $otpCode, int $code): bool
{
$checker = static fn (int $timeSlot): bool => self::getOtp($otpCode, (string) $timeSlot) === $code;
$checker = static fn(int $timeSlot): bool => self::getOtp($otpCode, (string) $timeSlot) === $code;

return $checker($slot = (int) floor(time() / 30)) || $checker($slot - 1) || $checker($slot + 1);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ public static function nameParser(string $name): array

public static function formatPresenterNameToUri(string $name): string
{
return trim((string) preg_replace_callback('/([A-Z])/', static fn (array $match): string => '-' . mb_strtolower($match[1], 'UTF-8'), $name), '-');
return trim((string) preg_replace_callback('/([A-Z])/', static fn(array $match): string => '-' . mb_strtolower($match[1], 'UTF-8'), $name), '-');
}


Expand All @@ -206,7 +206,7 @@ public static function formatActionNameByUri(string $name): string
*/
public static function formatPresenter(string $haystack): string
{
return (string) preg_replace_callback('/-([a-z])/', static fn (array $match): string => mb_strtoupper($match[1], 'UTF-8'), $haystack);
return (string) preg_replace_callback('/-([a-z])/', static fn(array $match): string => mb_strtoupper($match[1], 'UTF-8'), $haystack);
}


Expand Down Expand Up @@ -245,7 +245,7 @@ public static function minifyHtml(string $haystack): string
{
$return = (string) preg_replace_callback(
'#[ \t\r\n]+|<(/)?(textarea|pre)(?=\W)#i',
fn (array $match): string => empty($match[2]) ? ' ' : $match[0],
fn(array $match): string => empty($match[2]) ? ' ' : $match[0],
$haystack,
);
$return = (string) preg_replace('/(\w|;)\s+({|})\s+(\w|\.|#)/', '$1$2$3', $return);
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/MenuManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getItems(): array
}
}

usort($return, fn (array $a, array $b): int => $a['priority'] < $b['priority'] ? 1 : -1);
usort($return, fn(array $a, array $b): int => $a['priority'] < $b['priority'] ? 1 : -1);

return $return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/User/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function resetPrivileges(): void
*/
public function getPrivileges(): array
{
return array_filter($this->privileges ?? [], fn (string $item): bool => trim($item) !== '');
return array_filter($this->privileges ?? [], fn(string $item): bool => trim($item) !== '');
}


Expand Down

0 comments on commit 679b5e5

Please sign in to comment.