Skip to content

Commit

Permalink
Use opinionated Pint
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightwatson committed Mar 17, 2024
1 parent dc24546 commit 0460330
Show file tree
Hide file tree
Showing 31 changed files with 115 additions and 56 deletions.
14 changes: 0 additions & 14 deletions pint.json

This file was deleted.

4 changes: 3 additions & 1 deletion src/Casts/AsExpoPushToken.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Casts;

Expand Down
4 changes: 3 additions & 1 deletion src/Exceptions/CouldNotSendNotification.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Exceptions;

Expand Down
8 changes: 6 additions & 2 deletions src/ExpoChannel.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand All @@ -21,7 +23,9 @@
/**
* Create a new channel instance.
*/
public function __construct(private ExpoGateway $gateway, private Dispatcher $events) {}
public function __construct(private ExpoGateway $gateway, private Dispatcher $events)
{
}

/**
* Send the notification to Expo's Push API.
Expand Down
8 changes: 6 additions & 2 deletions src/ExpoError.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand All @@ -11,7 +13,9 @@ private function __construct(
public ExpoErrorType $type,
public ExpoPushToken $token,
public string $message,
) {}
) {
//
}

/**
* @see __construct()
Expand Down
4 changes: 3 additions & 1 deletion src/ExpoErrorType.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand Down
4 changes: 3 additions & 1 deletion src/ExpoMessage.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand Down
4 changes: 3 additions & 1 deletion src/ExpoPushToken.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand Down
4 changes: 3 additions & 1 deletion src/ExpoServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo;

Expand Down
8 changes: 5 additions & 3 deletions src/Gateway/ExpoEnvelope.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Gateway;

Expand All @@ -14,7 +16,7 @@
/**
* Create a new ExpoEnvelope instance.
*
* @param array<int, ExpoPushToken> $recipients
* @param array<int, ExpoPushToken> $recipients
*/
private function __construct(public array $recipients, public ExpoMessage $message)
{
Expand Down Expand Up @@ -45,7 +47,7 @@ public function toArray(): array
/**
* Convert the ExpoEnvelope instance to its JSON representation.
*
* @param int $options
* @param int $options
*/
public function toJson($options = 0): string
{
Expand Down
4 changes: 3 additions & 1 deletion src/Gateway/ExpoGateway.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Gateway;

Expand Down
7 changes: 4 additions & 3 deletions src/Gateway/ExpoGatewayUsingGuzzle.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Gateway;

Expand Down Expand Up @@ -114,8 +116,7 @@ private function getDefaultHeaders(#[SensitiveParameter] ?string $accessToken):
/**
* Get an array of potential errors responded by the service.
*
* @param $tokens array<int, ExpoPushToken>
*
* @param $tokens array<int, ExpoPushToken>
* @return array<int, ExpoError>
*/
private function getPotentialErrors(array $tokens, array $tickets): array
Expand Down
12 changes: 9 additions & 3 deletions src/Gateway/ExpoResponse.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Gateway;

Expand All @@ -8,18 +10,22 @@
final readonly class ExpoResponse
{
private const string FAILED = 'failed';

private const string FATAL = 'fatal';

private const string OK = 'ok';

/**
* Create a new ExpoResponse instance.
*/
private function __construct(private string $type, private array|string|null $context = null) {}
private function __construct(private string $type, private array|string|null $context = null)
{
}

/**
* Create a "failed" ExpoResponse instance.
*
* @param $errors array<int, ExpoError>
* @param $errors array<int, ExpoError>
*/
public static function failed(array $errors): self
{
Expand Down
4 changes: 3 additions & 1 deletion src/Validation/ExpoPushTokenRule.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace NotificationChannels\Expo\Validation;

Expand Down
4 changes: 3 additions & 1 deletion tests/ExpoTokensDataset.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests;

Expand Down
5 changes: 4 additions & 1 deletion tests/Feature/NotificationTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Feature;

Expand Down Expand Up @@ -58,6 +60,7 @@ final class User extends Authenticatable
use Notifiable;

protected $casts = ['token' => ExpoPushToken::class];

protected $guarded = [];

public function routeNotificationForExpo(): ?ExpoPushToken
Expand Down
4 changes: 3 additions & 1 deletion tests/Feature/ValidationTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Feature;

Expand Down
4 changes: 3 additions & 1 deletion tests/InMemoryExpoGateway.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests;

Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/ExpoGatewayUsingGuzzleTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Integration;

Expand Down
4 changes: 3 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/CastingTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
17 changes: 12 additions & 5 deletions tests/Unit/ChannelTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down Expand Up @@ -31,7 +33,7 @@ protected function setUp(): void
parent::setUp();

$this->gateway = new InMemoryExpoGateway();
$this->events = new EventFake(new NullDispatcher(new Dispatcher())) ;
$this->events = new EventFake(new NullDispatcher(new Dispatcher()));
$this->channel = new ExpoChannel($this->gateway, $this->events);
}

Expand Down Expand Up @@ -70,7 +72,8 @@ public function it_dispatches_failed_events_when_something_goes_wrong(): void

$this->channel->send($notifiable, $notification);

$this->events->assertDispatched(NotificationFailed::class,
$this->events->assertDispatched(
NotificationFailed::class,
static fn (NotificationFailed $event) => $event->channel === 'expo' && $event->data instanceof ExpoError
);
}
Expand Down Expand Up @@ -126,9 +129,13 @@ public function toExpo(mixed $notifiable): ExpoMessage
}
}

final class CarHasCrashed extends Notification {}
final class CarHasCrashed extends Notification
{
}

final class Guest {}
final class Guest
{
}

final class Customer
{
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/EnvelopeTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ErrorTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ExpoErrorTypeTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ExpoGatewayContractTests.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ExpoMessageTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ExpoPushTokenTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ExpoResponseTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/InMemoryExpoGatewayTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/ValidationRuleTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Tests\Unit;

Expand Down

0 comments on commit 0460330

Please sign in to comment.