diff --git a/src/ExpoChannel.php b/src/ExpoChannel.php index 198d23a9777a94aa785d8470f507bbcbdb8e0d92..0de0b06a29f66215c890a982ef76385e3f477fc0 100644 --- a/src/ExpoChannel.php +++ b/src/ExpoChannel.php @@ -37,7 +37,7 @@ final readonly class ExpoChannel { $tokens = $this->getTokens($notifiable, $notification); - if (! count($tokens)) { + if (!count($tokens)) { return; } @@ -71,7 +71,7 @@ final readonly class ExpoChannel */ private function getMessage(object $notifiable, Notification $notification): ExpoMessage { - if (! method_exists($notification, 'toExpo')) { + if (!method_exists($notification, 'toExpo')) { throw CouldNotSendNotification::becauseTheMessageIsMissing(); } @@ -81,13 +81,13 @@ final readonly class ExpoChannel /** * Get the recipients that the message should be delivered to. * - * @return array - * * @throws CouldNotSendNotification + * + * @return array */ private function getTokens(object $notifiable, Notification $notification): array { - if (! method_exists($notifiable, 'routeNotificationFor')) { + if (!method_exists($notifiable, 'routeNotificationFor')) { throw CouldNotSendNotification::becauseNotifiableIsInvalid(); } diff --git a/src/ExpoMessage.php b/src/ExpoMessage.php index e5b87f293a0b4102f633f4c9f4b66cbf1b838378..e0159e668a95345f6a6860ff51ba3fc133b5b22c 100644 --- a/src/ExpoMessage.php +++ b/src/ExpoMessage.php @@ -327,7 +327,7 @@ final class ExpoMessage implements Arrayable, JsonSerializable { $value = strtolower($value); - if (! in_array($value, self::PRIORITIES)) { + if (!in_array($value, self::PRIORITIES)) { throw new InvalidArgumentException('The priority must be default, normal or high.'); } diff --git a/src/ExpoPushToken.php b/src/ExpoPushToken.php index 2179c8d6b06875a4eb6ac9b7d05224b534d84aee..92457b1dbe81b9e127cbb23a990752a00cd02ce3 100644 --- a/src/ExpoPushToken.php +++ b/src/ExpoPushToken.php @@ -34,11 +34,11 @@ final readonly class ExpoPushToken implements Castable, JsonSerializable, String throw new InvalidArgumentException("{$value} is not a valid push token."); } - if (! str_starts_with($value, 'ExponentPushToken[') && ! str_starts_with($value, 'ExpoPushToken[')) { + if (!str_starts_with($value, 'ExponentPushToken[') && !str_starts_with($value, 'ExpoPushToken[')) { throw new InvalidArgumentException("{$value} is not a valid push token."); } - if (! str_ends_with($value, ']')) { + if (!str_ends_with($value, ']')) { throw new InvalidArgumentException("{$value} is not a valid push token."); } diff --git a/src/ExpoServiceProvider.php b/src/ExpoServiceProvider.php index 64e05f069b1d73f3db4f6966500a1b518369466b..757c871f1cba6c7a2bcec46e868c735337125cce 100644 --- a/src/ExpoServiceProvider.php +++ b/src/ExpoServiceProvider.php @@ -35,7 +35,7 @@ final class ExpoServiceProvider extends ServiceProvider $accessToken = $config->get('services.expo.access_token'); - if (! is_null($accessToken) && ! is_string($accessToken)) { + if (!is_null($accessToken) && !is_string($accessToken)) { throw new InvalidArgumentException('The provided access token is not a valid Expo Access Token.'); } diff --git a/src/Gateway/ExpoEnvelope.php b/src/Gateway/ExpoEnvelope.php index 556263247a741e392d9c92356bb27572575e7b12..1c72876a3f3723c25314ec6bcace2579abb47120 100644 --- a/src/Gateway/ExpoEnvelope.php +++ b/src/Gateway/ExpoEnvelope.php @@ -16,11 +16,11 @@ final readonly class ExpoEnvelope implements Arrayable, Jsonable /** * Create a new ExpoEnvelope instance. * - * @param array $recipients + * @param array $recipients */ private function __construct(public array $recipients, public ExpoMessage $message) { - if (! count($recipients)) { + if (!count($recipients)) { throw new InvalidArgumentException('There must be at least 1 recipient.'); } } @@ -47,7 +47,7 @@ final readonly class ExpoEnvelope implements Arrayable, Jsonable /** * Convert the ExpoEnvelope instance to its JSON representation. * - * @param int $options + * @param int $options */ public function toJson($options = 0): string { diff --git a/src/Gateway/ExpoGatewayUsingGuzzle.php b/src/Gateway/ExpoGatewayUsingGuzzle.php index 897db8c610a74ead499baff383d5337f27404c2d..4db853612b579c6e5cdc25162602afcd5a329c4e 100644 --- a/src/Gateway/ExpoGatewayUsingGuzzle.php +++ b/src/Gateway/ExpoGatewayUsingGuzzle.php @@ -57,8 +57,8 @@ final readonly class ExpoGatewayUsingGuzzle implements ExpoGateway [$headers, $body] = $this->compressUsingGzip($envelope->toJson()); $response = $this->http->post(self::BASE_URL, [ - RequestOptions::BODY => $body, - RequestOptions::HEADERS => $headers, + RequestOptions::BODY => $body, + RequestOptions::HEADERS => $headers, RequestOptions::HTTP_ERRORS => false, ]); @@ -77,7 +77,7 @@ final readonly class ExpoGatewayUsingGuzzle implements ExpoGateway */ private function compressUsingGzip(string $payload): array { - if (! extension_loaded('zlib')) { + if (!extension_loaded('zlib')) { return [[], $payload]; } @@ -100,10 +100,10 @@ final readonly class ExpoGatewayUsingGuzzle implements ExpoGateway private function getDefaultHeaders(#[SensitiveParameter] ?string $accessToken): array { $headers = [ - 'Accept' => 'application/json', + 'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', - 'Content-Type' => 'application/json', - 'Host' => 'exp.host', + 'Content-Type' => 'application/json', + 'Host' => 'exp.host', ]; if (is_string($accessToken)) { @@ -116,7 +116,8 @@ final readonly class ExpoGatewayUsingGuzzle implements ExpoGateway /** * Get an array of potential errors responded by the service. * - * @param $tokens array + * @param $tokens array + * * @return array */ private function getPotentialErrors(array $tokens, array $tickets): array diff --git a/src/Gateway/ExpoResponse.php b/src/Gateway/ExpoResponse.php index eced87fc723cf8b4fd1c8d48143e739c76f3ffe4..66ad8e0b36ebdc2fa6bfd28859282885c7a385dc 100644 --- a/src/Gateway/ExpoResponse.php +++ b/src/Gateway/ExpoResponse.php @@ -26,7 +26,7 @@ final readonly class ExpoResponse /** * Create a "failed" ExpoResponse instance. * - * @param $errors array + * @param $errors array */ public static function failed(array $errors): self { diff --git a/src/Validation/ExpoPushTokenRule.php b/src/Validation/ExpoPushTokenRule.php index 52247f67f18f221354fbf3f040d75eb96aa86d25..19caef89cfe47791f38454c6e6c657367a7821cd 100644 --- a/src/Validation/ExpoPushTokenRule.php +++ b/src/Validation/ExpoPushTokenRule.php @@ -24,7 +24,7 @@ final readonly class ExpoPushTokenRule implements ValidationRule */ public function validate(string $attribute, mixed $value, Closure $fail): void { - if (! is_string($value)) { + if (!is_string($value)) { $fail('validation.string')->translate(); return; diff --git a/tests/InMemoryExpoGateway.php b/tests/InMemoryExpoGateway.php index 28063991e6d2e02f3cc9cb7ec5a473681acb2507..80a6fa91230bd25ba86a7bbeb74b6c3f731d03fe 100644 --- a/tests/InMemoryExpoGateway.php +++ b/tests/InMemoryExpoGateway.php @@ -51,7 +51,7 @@ final class InMemoryExpoGateway implements ExpoGateway $errors = []; foreach ($envelope->recipients as $token) { - if (! $token->equals(self::VALID_TOKEN)) { + if (!$token->equals(self::VALID_TOKEN)) { $errors[] = $this->newDeviceError($token); } } diff --git a/tests/Unit/EnvelopeTest.php b/tests/Unit/EnvelopeTest.php index 699e1f33e63686fcd16fbf3b00cb471f91ac48f3..1edd692871595670fd9ac623ccaabc8edfa9d0cb 100644 --- a/tests/Unit/EnvelopeTest.php +++ b/tests/Unit/EnvelopeTest.php @@ -38,13 +38,13 @@ final class EnvelopeTest extends TestCase $array = $envelope->toArray(); $this->assertSame($data = [ - 'title' => 'iOS', - 'body' => 'Android', - 'priority' => 'default', - 'sound' => 'default', - 'badge' => 1337, + 'title' => 'iOS', + 'body' => 'Android', + 'priority' => 'default', + 'sound' => 'default', + 'badge' => 1337, 'mutableContent' => false, - 'to' => ['ExponentPushToken[FtT1dBIc5Wp92HEGuJUhL4]'], + 'to' => ['ExponentPushToken[FtT1dBIc5Wp92HEGuJUhL4]'], ], $array); $this->assertSame(json_encode($data), $envelope->toJson()); diff --git a/tests/Unit/ExpoMessageTest.php b/tests/Unit/ExpoMessageTest.php index fd2bed40c4b9c12b555f59f794b7707bd1129e4d..317958e2c3541fc117b1483ba2e2e3fa3bea1746 100644 --- a/tests/Unit/ExpoMessageTest.php +++ b/tests/Unit/ExpoMessageTest.php @@ -302,12 +302,12 @@ final class ExpoMessageTest extends TestCase $jsonSerializable = $msg->jsonSerialize(); $this->assertSame($data = [ - 'title' => 'Exponent', - 'body' => 'Firebase Cloud Messaging', - 'ttl' => 120, - 'priority' => 'high', - 'sound' => 'default', - 'badge' => 3, + 'title' => 'Exponent', + 'body' => 'Firebase Cloud Messaging', + 'ttl' => 120, + 'priority' => 'high', + 'sound' => 'default', + 'badge' => 3, 'mutableContent' => false, ], $arrayable);