Skip to content

Commit

Permalink
Fix CS (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Oct 28, 2023
1 parent b993129 commit fab1ff2
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/Firebase/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getUser(Stringable|string $uid): UserRecord

public function getUsers(array $uids): array
{
$uids = array_map(static fn ($uid) => Uid::fromString($uid)->value, $uids);
$uids = array_map(static fn($uid) => Uid::fromString($uid)->value, $uids);

$users = array_fill_keys($uids, null);

Expand Down Expand Up @@ -490,7 +490,7 @@ public function unlinkProvider($uid, $provider): UserRecord
$provider = array_values(
array_filter(
array_map('strval', (array) $provider),
static fn (string $value) => $value !== '',
static fn(string $value) => $value !== '',
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function fromArray(array $settings): self
{
$instance = new self();

$settings = array_filter($settings, static fn ($value) => $value !== null);
$settings = array_filter($settings, static fn($value) => $value !== null);

foreach ($settings as $key => $value) {
switch (mb_strtolower($key)) {
Expand Down Expand Up @@ -116,6 +116,6 @@ public function toArray(): array
'androidMinimumVersion' => $this->androidMinimumVersion,
'androidInstallApp' => $this->androidInstallApp,
'iOSBundleId' => $this->iOSBundleId,
], static fn ($value) => is_bool($value) || (is_string($value) && $value !== ''));
], static fn($value) => is_bool($value) || (is_string($value) && $value !== ''));
}
}
2 changes: 1 addition & 1 deletion src/Firebase/Auth/UserRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private static function mfaInfoFromResponseData(array $data): ?MfaInfo
private static function userInfoFromResponseData(array $data): array
{
return array_map(
static fn (array $userInfoData) => UserInfo::fromResponseData($userInfoData),
static fn(array $userInfoData) => UserInfo::fromResponseData($userInfoData),
$data['providerUserInfo'],
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Database/Query/Sorter/OrderByChild.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function modifyValue($value): mixed

$expression = str_replace('/', '.', $this->childKey);

uasort($value, static fn ($a, $b) => search($expression, $a) <=> search($expression, $b));
uasort($value, static fn($a, $b) => search($expression, $a) <=> search($expression, $b));

return $value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Firebase/DynamicLink/EventStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public function appReOpens(): self

public function filterByType(string $type): self
{
return $this->filter(static fn (array $event) => ($event['event'] ?? null) === $type);
return $this->filter(static fn(array $event) => ($event['event'] ?? null) === $type);
}

public function filterByPlatform(string $platform): self
{
return $this->filter(static fn (array $event) => ($event['platform'] ?? null) === $platform);
return $this->filter(static fn(array $event) => ($event['platform'] ?? null) === $platform);
}

public function filter(callable $filter): self
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase/Http/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Middleware
*/
public static function ensureJsonSuffix(): callable
{
return static fn (callable $handler) => static function (RequestInterface $request, ?array $options = null) use ($handler) {
return static fn(callable $handler) => static function (RequestInterface $request, ?array $options = null) use ($handler) {
$uri = $request->getUri();
$path = '/'.ltrim($uri->getPath(), '/');

Expand All @@ -47,7 +47,7 @@ public static function ensureJsonSuffix(): callable
*/
public static function addDatabaseAuthVariableOverride(?array $override): callable
{
return static fn (callable $handler) => static function (RequestInterface $request, ?array $options = null) use ($handler, $override) {
return static fn(callable $handler) => static function (RequestInterface $request, ?array $options = null) use ($handler, $override) {
$uri = $request->getUri();

$uri = $uri->withQuery(Query::build(
Expand All @@ -60,7 +60,7 @@ public static function addDatabaseAuthVariableOverride(?array $override): callab

public static function log(LoggerInterface $logger, MessageFormatter $formatter, string $logLevel, string $errorLogLevel): callable
{
return static fn (callable $handler) => static fn ($request, array $options) => $handler($request, $options)->then(
return static fn(callable $handler) => static fn($request, array $options) => $handler($request, $options)->then(
static function (ResponseInterface $response) use ($logger, $request, $formatter, $logLevel, $errorLogLevel) {
$message = $formatter->format($request, $response);
$messageLogLevel = $response->getStatusCode() >= StatusCode::STATUS_BAD_REQUEST ? $errorLogLevel : $logLevel;
Expand Down
4 changes: 2 additions & 2 deletions src/Firebase/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function unsubscribeFromTopic(string|Topic $topic, RegistrationTokens|Reg
public function unsubscribeFromTopics(array $topics, RegistrationTokens|RegistrationToken|array|string $registrationTokenOrTokens): array
{
$topics = array_map(
static fn ($topic) => $topic instanceof Topic ? $topic : Topic::fromValue($topic),
static fn($topic) => $topic instanceof Topic ? $topic : Topic::fromValue($topic),
$topics,
);

Expand All @@ -188,7 +188,7 @@ public function unsubscribeFromAllTopics($registrationTokenOrTokens): array

return array_keys($this->unsubscribeFromTopics($topics, $token));
})
->otherwise(static fn (Throwable $e) => $e->getMessage())
->otherwise(static fn(Throwable $e) => $e->getMessage())
;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/AndroidConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function withNotificationVisibility(string $notificationVisibility): self

public function jsonSerialize(): array
{
return array_filter($this->config, static fn ($value) => $value !== null && $value !== []);
return array_filter($this->config, static fn($value) => $value !== null && $value !== []);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/ApnsConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function data(): array
*/
public function toArray(): array
{
$filter = static fn ($value): bool => $value !== null && $value !== [];
$filter = static fn($value): bool => $value !== null && $value !== [];

return array_filter([
'headers' => array_filter($this->headers, $filter),
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/AppInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function isSubscribedToTopic(Topic|string $topic): bool
$topic = $topic instanceof Topic ? $topic : Topic::fromValue($topic);

return $this->topicSubscriptions
->filter(static fn (TopicSubscription $subscription) => $topic->value() === $subscription->topic()->value())
->filter(static fn(TopicSubscription $subscription) => $topic->value() === $subscription->topic()->value())
->count() > 0
;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase/Messaging/AppInstanceApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function subscribeToTopics(array $topics, RegistrationTokens $tokens): ar
'registration_tokens' => $tokenStrings,
],
])
->then(static fn (ResponseInterface $response) => Json::decode((string) $response->getBody(), true))
->then(static fn(ResponseInterface $response) => Json::decode((string) $response->getBody(), true))
;
}

Expand Down Expand Up @@ -114,7 +114,7 @@ public function unsubscribeFromTopics(array $topics, RegistrationTokens $tokens)
'registration_tokens' => $tokenStrings,
],
])
->then(static fn (ResponseInterface $response) => Json::decode((string) $response->getBody(), true))
->then(static fn(ResponseInterface $response) => Json::decode((string) $response->getBody(), true))
;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ public function getAppInstanceAsync(RegistrationToken $registrationToken): Promi

return AppInstance::fromRawData($registrationToken, $data);
})
->otherwise(fn (Throwable $e) => Create::rejectionFor($this->errorHandler->convertException($e)))
->otherwise(fn(Throwable $e) => Create::rejectionFor($this->errorHandler->convertException($e)))
;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/CloudMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function jsonSerialize(): array

return array_filter(
$data,
static fn ($value) => $value !== null && $value !== [],
static fn($value) => $value !== null && $value !== [],
);
}

Expand Down
16 changes: 8 additions & 8 deletions src/Firebase/Messaging/MulticastSendReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function getItems(): array

public function successes(): self
{
return $this->filter(static fn (SendReport $item) => $item->isSuccess());
return $this->filter(static fn(SendReport $item) => $item->isSuccess());
}

public function failures(): self
{
return $this->filter(static fn (SendReport $item) => $item->isFailure());
return $this->filter(static fn(SendReport $item) => $item->isFailure());
}

public function hasFailures(): bool
Expand Down Expand Up @@ -77,8 +77,8 @@ public function map(callable $callback): array
public function validTokens(): array
{
return $this->successes()
->filter(static fn (SendReport $report) => $report->target()->type() === MessageTarget::TOKEN)
->map(static fn (SendReport $report) => $report->target()->value())
->filter(static fn(SendReport $report) => $report->target()->type() === MessageTarget::TOKEN)
->map(static fn(SendReport $report) => $report->target()->value())
;
}

Expand All @@ -90,8 +90,8 @@ public function validTokens(): array
public function unknownTokens(): array
{
return $this
->filter(static fn (SendReport $report) => $report->messageWasSentToUnknownToken())
->map(static fn (SendReport $report) => $report->target()->value())
->filter(static fn(SendReport $report) => $report->messageWasSentToUnknownToken())
->map(static fn(SendReport $report) => $report->target()->value())
;
}

Expand All @@ -103,8 +103,8 @@ public function unknownTokens(): array
public function invalidTokens(): array
{
return $this
->filter(static fn (SendReport $report) => $report->messageTargetWasInvalid())
->map(static fn (SendReport $report) => $report->target()->value())
->filter(static fn(SendReport $report) => $report->messageTargetWasInvalid())
->map(static fn(SendReport $report) => $report->target()->value())
;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ public function jsonSerialize(): array
'title' => $this->title,
'body' => $this->body,
'image' => $this->imageUrl,
], static fn ($value) => $value !== null);
], static fn($value) => $value !== null);
}
}
2 changes: 1 addition & 1 deletion src/Firebase/Messaging/WebPushConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function withUrgency(string $urgency): self
public function jsonSerialize(): array
{
// @phpstan-ignore-next-line
return array_filter($this->config, static fn ($value) => $value !== null);
return array_filter($this->config, static fn($value) => $value !== null);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase/RemoteConfig/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function withCondition(Condition $condition): self
public function conditionNames(): array
{
return array_values(array_unique(
array_map(static fn (Condition $c) => $c->name(), $this->conditions),
array_map(static fn(Condition $c) => $c->name(), $this->conditions),
));
}

Expand All @@ -190,7 +190,7 @@ public function withRemovedCondition(string $name): self
{
$template = clone $this;
$template->conditions = array_values(
array_filter($this->conditions, static fn (Condition $c) => $c->name() !== $name),
array_filter($this->conditions, static fn(Condition $c) => $c->name() !== $name),
);

return $template;
Expand Down Expand Up @@ -260,7 +260,7 @@ private static function buildParameterGroup(string $name, array $parameterGroupD

private function assertThatAllConditionalValuesAreValid(Parameter $parameter): void
{
$conditionNames = array_map(static fn (Condition $c) => $c->name(), $this->conditions);
$conditionNames = array_map(static fn(Condition $c) => $c->name(), $this->conditions);

foreach ($parameter->conditionalValues() as $conditionalValue) {
if (!in_array($conditionalValue->conditionName(), $conditionNames, true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Request/EditUserTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function prepareJsonSerialize(): array
'phoneNumber' => $this->phoneNumber,
'photoUrl' => $this->photoUrl,
'password' => $this->clearTextPassword,
], static fn ($value) => $value !== null);
], static fn($value) => $value !== null);
}

public function hasUid(): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase/Request/UpdateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static function withProperties(array $properties): self
case 'removeproviders':
$request = array_reduce(
(array) $value,
static fn (self $request, $provider) => $request->withRemovedProvider($provider),
static fn(self $request, $provider) => $request->withRemovedProvider($provider),
$request,
);

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Http/HttpClientOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function itRetainsPreviouslySetGuzzleConfigOptions(): void
#[Test]
public function itAcceptsSingleCallableMiddlewares(): void
{
$options = HttpClientOptions::default()->withGuzzleMiddleware(static fn () => 'Foo', 'name');
$options = HttpClientOptions::default()->withGuzzleMiddleware(static fn() => 'Foo', 'name');

$middlewares = $options->guzzleMiddlewares();

Expand All @@ -110,8 +110,8 @@ public function itAcceptsMultipleMiddlewares(): void
{
$options = HttpClientOptions::default()
->withGuzzleMiddlewares([
static fn () => 'Foo',
['middleware' => static fn () => 'Foo', 'name' => 'Foo'],
static fn() => 'Foo',
['middleware' => static fn() => 'Foo', 'name' => 'Foo'],
])
;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Http/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class MiddlewareTest extends UnitTestCase
protected function setUp(): void
{
$this->request = new Request('GET', 'http://domain.tld');
$this->handler = static fn (RequestInterface $request) => $request;
$this->handler = static fn(RequestInterface $request) => $request;
}

#[Test]
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/RemoteConfig/TemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function withFluidConfiguration(): void
->withParameterGroup($uiColors)
;

$conditionNames = array_map(static fn (Condition $c) => $c->name(), $template->conditions());
$conditionNames = array_map(static fn(Condition $c) => $c->name(), $template->conditions());

$this->assertContains('lang_german', $conditionNames);
$this->assertContains('lang_french', $conditionNames);
Expand Down

0 comments on commit fab1ff2

Please sign in to comment.