Skip to content

Commit

Permalink
feat: upgrade php-cs-fixer to v3.35.1
Browse files Browse the repository at this point in the history
  • Loading branch information
storyn26383 committed Oct 25, 2023
1 parent a7f493d commit 2c78563
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"hyperf/session": "Required to use session guard. (^3.1)"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.26.0",
"friendsofphp/php-cs-fixer": "3.35.1",
"hyperf/redis": "^3.1",
"mockery/mockery": "^1.5.1",
"phpunit/phpunit": "^10.0.7",
Expand Down
2 changes: 1 addition & 1 deletion src/auth/src/Access/AuthorizationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AuthorizationException extends Exception
/**
* Create a new authorization exception instance.
*/
public function __construct(?string $message = null, int|string|null $code = null, ?Throwable $previous = null)
public function __construct(?string $message = null, null|int|string $code = null, ?Throwable $previous = null)
{
parent::__construct($message ?? 'This action is unauthorized.', 0, $previous);

Expand Down
14 changes: 7 additions & 7 deletions src/auth/src/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Gate implements GateContract
/**
* The default denial response for gates and policies.
*/
protected Response|null $defaultDenialResponse;
protected null|Response $defaultDenialResponse;

/**
* Create a new gate instance.
Expand Down Expand Up @@ -74,7 +74,7 @@ public function has(array|string $ability): bool
*
* @throws AuthorizationException
*/
public function allowIf(Response|Closure|bool $condition, ?string $message = null, ?string $code = null): Response
public function allowIf(bool|Closure|Response $condition, ?string $message = null, ?string $code = null): Response
{
return $this->authorizeOnDemand($condition, $message, $code, true);
}
Expand All @@ -84,7 +84,7 @@ public function allowIf(Response|Closure|bool $condition, ?string $message = nul
*
* @throws AuthorizationException
*/
public function denyIf(Response|Closure|bool $condition, ?string $message = null, ?string $code = null): Response
public function denyIf(bool|Closure|Response $condition, ?string $message = null, ?string $code = null): Response
{
return $this->authorizeOnDemand($condition, $message, $code, false);
}
Expand All @@ -94,7 +94,7 @@ public function denyIf(Response|Closure|bool $condition, ?string $message = null
*
* @throws AuthorizationException
*/
protected function authorizeOnDemand(Response|Closure|bool $condition, ?string $message, ?string $code, bool $allowWhenResponseIs): Response
protected function authorizeOnDemand(bool|Closure|Response $condition, ?string $message, ?string $code, bool $allowWhenResponseIs): Response
{
$user = $this->resolveUser();

Expand Down Expand Up @@ -399,7 +399,7 @@ protected function parameterAllowsGuests(ReflectionParameter $parameter): bool
/**
* Resolve and call the appropriate authorization callback.
*/
protected function callAuthCallback(?Authenticatable $user, string $ability, array $arguments): bool|null|Response
protected function callAuthCallback(?Authenticatable $user, string $ability, array $arguments): null|bool|Response
{
$callback = $this->resolveAuthCallback($user, $ability, $arguments);

Expand Down Expand Up @@ -427,7 +427,7 @@ protected function callBeforeCallbacks(?Authenticatable $user, string $ability,
/**
* Call all of the after callbacks with check result.
*/
protected function callAfterCallbacks(?Authenticatable $user, string $ability, array $arguments, bool|null|Response $result): bool|null|Response
protected function callAfterCallbacks(?Authenticatable $user, string $ability, array $arguments, null|bool|Response $result): null|bool|Response
{
foreach ($this->afterCallbacks as $after) {
if (! $this->canBeCalledWithUser($user, $after)) {
Expand All @@ -445,7 +445,7 @@ protected function callAfterCallbacks(?Authenticatable $user, string $ability, a
/**
* Dispatch a gate evaluation event.
*/
protected function dispatchGateEvaluatedEvent(?Authenticatable $user, string $ability, array $arguments, bool|null|Response $result): void
protected function dispatchGateEvaluatedEvent(?Authenticatable $user, string $ability, array $arguments, null|bool|Response $result): void
{
if (! $this->container->has(EventDispatcherInterface::class)) {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/auth/src/Access/HandlesAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ trait HandlesAuthorization
/**
* Create a new access response.
*/
protected function allow(?string $message = null, int|string|null $code = null): Response
protected function allow(?string $message = null, null|int|string $code = null): Response
{
return Response::allow($message, $code);
}

/**
* Throws an unauthorized exception.
*/
protected function deny(?string $message = null, int|string|null $code = null): Response
protected function deny(?string $message = null, null|int|string $code = null): Response
{
return Response::deny($message, $code);
}

/**
* Deny with a HTTP status code.
*/
public function denyWithStatus(int $status, ?string $message = null, int|string|null $code = null): Response
public function denyWithStatus(int $status, ?string $message = null, null|int|string $code = null): Response
{
return Response::denyWithStatus($status, $message, $code);
}

/**
* Deny with a 404 HTTP status code.
*/
public function denyAsNotFound(?string $message = null, int|string|null $code = null): Response
public function denyAsNotFound(?string $message = null, null|int|string $code = null): Response
{
return Response::denyWithStatus(404, $message, $code);
}
Expand Down
12 changes: 6 additions & 6 deletions src/auth/src/Access/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Response implements Arrayable, Stringable
public function __construct(
protected bool $allowed,
protected ?string $message = '',
protected int|string|null $code = null
protected null|int|string $code = null
) {
$this->code = $code;
$this->allowed = $allowed;
Expand All @@ -34,31 +34,31 @@ public function __construct(
/**
* Create a new "allow" Response.
*/
public static function allow(?string $message = null, int|string|null $code = null): static
public static function allow(?string $message = null, null|int|string $code = null): static
{
return new static(true, $message, $code);
}

/**
* Create a new "deny" Response.
*/
public static function deny(?string $message = null, int|string|null $code = null): static
public static function deny(?string $message = null, null|int|string $code = null): static
{
return new static(false, $message, $code);
}

/**
* Create a new "deny" Response with a HTTP status code.
*/
public static function denyWithStatus(int $status, ?string $message = null, int|string|null $code = null): static
public static function denyWithStatus(int $status, ?string $message = null, null|int|string $code = null): static
{
return static::deny($message, $code)->withStatus($status);
}

/**
* Create a new "deny" Response with a 404 HTTP status code.
*/
public static function denyAsNotFound(?string $message = null, int|string|null $code = null): static
public static function denyAsNotFound(?string $message = null, null|int|string $code = null): static
{
return static::denyWithStatus(404, $message, $code);
}
Expand Down Expand Up @@ -90,7 +90,7 @@ public function message(): ?string
/**
* Get the response code / reason.
*/
public function code(): int|string|null
public function code(): null|int|string
{
return $this->code;
}
Expand Down
2 changes: 1 addition & 1 deletion src/auth/src/Contracts/Guard.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function user(): ?Authenticatable;
/**
* Get the ID for the currently authenticated user.
*/
public function id(): int|string|null;
public function id(): null|int|string;

/**
* Validate a user's credentials.
Expand Down
2 changes: 1 addition & 1 deletion src/auth/src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Get auth guard or auth manager.
*/
function auth(?string $guard = null): Guard|FactoryContract
function auth(?string $guard = null): FactoryContract|Guard
{
$auth = ApplicationContext::getContainer()
->get(AuthManager::class);
Expand Down
2 changes: 1 addition & 1 deletion src/auth/src/Guards/GuardHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function guest(?string $token = null): bool
return ! $this->check($token);
}

public function id(): int|string|null
public function id(): null|int|string
{
if ($this->user()) {
return $this->user()->getAuthIdentifier();
Expand Down
4 changes: 2 additions & 2 deletions src/auth/src/Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
/**
* Get the arguments parameter for the gate.
*/
protected function getGateArguments(ServerRequestInterface $request, array $models): array|string|Model
protected function getGateArguments(ServerRequestInterface $request, array $models): array|Model|string
{
if (is_null($models)) {
return [];
Expand All @@ -61,7 +61,7 @@ protected function getGateArguments(ServerRequestInterface $request, array $mode
/**
* Get the model to authorize.
*/
protected function getModel(ServerRequestInterface $request, string $model): string|Model|null
protected function getModel(ServerRequestInterface $request, string $model): null|Model|string
{
if ($this->isClassName($model)) {
return trim($model);
Expand Down
4 changes: 2 additions & 2 deletions src/cache/src/Contracts/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public function putMany(array $values, int $seconds): bool;
/**
* Increment the value of an item in the cache.
*/
public function increment(string $key, int $value = 1): int|bool;
public function increment(string $key, int $value = 1): bool|int;

/**
* Decrement the value of an item in the cache.
*/
public function decrement(string $key, int $value = 1): int|bool;
public function decrement(string $key, int $value = 1): bool|int;

/**
* Store an item in the cache indefinitely.
Expand Down
4 changes: 2 additions & 2 deletions src/cache/src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __clone()
/**
* Determine if an item exists in the cache.
*/
public function has(string|array $key): bool
public function has(array|string $key): bool
{
return ! is_null($this->get($key));
}
Expand All @@ -97,7 +97,7 @@ public function missing(string $key): bool
* @param (Closure(): TCacheValue)|TCacheValue $default
* @return (TCacheValue is null ? mixed : TCacheValue)
*/
public function get(string|array $key, mixed $default = null): mixed
public function get(array|string $key, mixed $default = null): mixed
{
if (is_array($key)) {
return $this->many($key);
Expand Down
4 changes: 2 additions & 2 deletions src/cache/src/StackStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function putMany(array $values, int $seconds): bool
return true;
}

public function increment(string $key, int $value = 1): int|bool
public function increment(string $key, int $value = 1): bool|int
{
$record = $this->getOrRestoreRecord($key);

Expand All @@ -66,7 +66,7 @@ public function increment(string $key, int $value = 1): int|bool
return false;
}

public function decrement(string $key, int $value = 1): int|bool
public function decrement(string $key, int $value = 1): bool|int
{
return $this->increment($key, $value * -1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/cache/src/StackStoreProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public function putMany(array $values, int $seconds): bool
return $this->call(__FUNCTION__, func_get_args());
}

public function increment(string $key, int $value = 1): int|bool
public function increment(string $key, int $value = 1): bool|int
{
return $this->call(__FUNCTION__, func_get_args());
}

public function decrement(string $key, int $value = 1): int|bool
public function decrement(string $key, int $value = 1): bool|int
{
return $this->call(__FUNCTION__, func_get_args());
}
Expand Down
2 changes: 1 addition & 1 deletion src/foundation/src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function now($tz = null): Carbon
*
* @return Closure|ContainerInterface|T
*/
function resolve(string|callable $abstract, array $parameters = [])
function resolve(callable|string $abstract, array $parameters = [])
{
if (is_callable($abstract)) {
return \Closure::fromCallable($abstract);
Expand Down
18 changes: 9 additions & 9 deletions src/log/src/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public function getChannels(): array
*
* @param string $message
*/
public function emergency(Stringable|string $message, array $context = []): void
public function emergency(string|Stringable $message, array $context = []): void
{
$this->driver()->emergency($message, $context);
}
Expand All @@ -506,7 +506,7 @@ public function emergency(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function alert(Stringable|string $message, array $context = []): void
public function alert(string|Stringable $message, array $context = []): void
{
$this->driver()->alert($message, $context);
}
Expand All @@ -518,7 +518,7 @@ public function alert(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function critical(Stringable|string $message, array $context = []): void
public function critical(string|Stringable $message, array $context = []): void
{
$this->driver()->critical($message, $context);
}
Expand All @@ -529,7 +529,7 @@ public function critical(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function error(Stringable|string $message, array $context = []): void
public function error(string|Stringable $message, array $context = []): void
{
$this->driver()->error($message, $context);
}
Expand All @@ -542,7 +542,7 @@ public function error(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function warning(Stringable|string $message, array $context = []): void
public function warning(string|Stringable $message, array $context = []): void
{
$this->driver()->warning($message, $context);
}
Expand All @@ -552,7 +552,7 @@ public function warning(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function notice(Stringable|string $message, array $context = []): void
public function notice(string|Stringable $message, array $context = []): void
{
$this->driver()->notice($message, $context);
}
Expand All @@ -564,7 +564,7 @@ public function notice(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function info(Stringable|string $message, array $context = []): void
public function info(string|Stringable $message, array $context = []): void
{
$this->driver()->info($message, $context);
}
Expand All @@ -574,7 +574,7 @@ public function info(Stringable|string $message, array $context = []): void
*
* @param string $message
*/
public function debug(Stringable|string $message, array $context = []): void
public function debug(string|Stringable $message, array $context = []): void
{
$this->driver()->debug($message, $context);
}
Expand All @@ -585,7 +585,7 @@ public function debug(Stringable|string $message, array $context = []): void
* @param mixed $level
* @param string $message
*/
public function log($level, Stringable|string $message, array $context = []): void
public function log($level, string|Stringable $message, array $context = []): void
{
$this->driver()->log($level, $message, $context);
}
Expand Down
2 changes: 1 addition & 1 deletion src/object-pool/src/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(protected int $size)
$this->queue = new SplQueue();
}

public function pop(float $timeout): object|false
public function pop(float $timeout): false|object
{
if ($this->isCoroutine()) {
return $this->channel->pop($timeout);
Expand Down
2 changes: 1 addition & 1 deletion src/object-pool/src/ObjectPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class ObjectPool implements ObjectPoolInterface

protected ObjectPoolOption $option;

protected null|LowFrequencyInterface|FrequencyInterface $frequency = null;
protected null|FrequencyInterface|LowFrequencyInterface $frequency = null;

protected int $currentObjectNumber = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/router/src/Middleware/SubstituteBindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
/**
* @return ReflectionType[]
*/
protected function getDefinitions(Closure|string|array $callback): array
protected function getDefinitions(array|Closure|string $callback): array
{
if ($callback instanceof Closure) {
return $this->getClosureDefinitions($callback);
Expand Down

0 comments on commit 2c78563

Please sign in to comment.