Skip to content

Commit 37e4872

Browse files
authored
Merge pull request #40 from YieldStudio/feat/laravel-12
feat: Adds support for Laravel 12
2 parents ab408f0 + 76a6ba8 commit 37e4872

13 files changed

+28
-31
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php: ["8.3", "8.2", "8.1"]
15-
laravel: ["^11.0", "^10.0", "^9.0"]
14+
php: ["8.4", "8.3", "8.2", "8.1"]
15+
laravel: ["^12.0", "^11.0", "^10.0", "^9.0"]
1616
dependency-version: [ prefer-lowest, prefer-stable ]
1717
exclude:
18+
- laravel: "^12.0"
19+
php: "8.1"
1820
- laravel: "^11.0"
1921
php: "8.1"
2022
include:
23+
- laravel: "^12.0"
24+
testbench: 10.*
2125
- laravel: "^11.0"
2226
testbench: 9.*
2327
- laravel: "^10.0"
@@ -29,10 +33,10 @@ jobs:
2933

3034
steps:
3135
- name: Checkout code
32-
uses: actions/checkout@v2
36+
uses: actions/checkout@v4
3337

3438
- name: Cache dependencies
35-
uses: actions/cache@v2
39+
uses: actions/cache@v4
3640
with:
3741
path: ~/.composer/cache/files
3842
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@
2727
],
2828
"require": {
2929
"php": "^8.1",
30-
"illuminate/database": "^9.0|^10.0|^11.0",
31-
"illuminate/support": "^9.0|^10.0|^11.0",
30+
"illuminate/database": "^9.0|^10.0|^11.0|^12.0",
31+
"illuminate/support": "^9.0|^10.0|^11.0|^12.0",
3232
"nesbot/carbon": ">=2.62.1"
3333
},
3434
"require-dev": {
35-
"ciareis/bypass": "^1.0",
3635
"dg/bypass-finals": "^1.4",
3736
"guzzlehttp/guzzle": "^7.8",
3837
"laravel/pint": "^1.3",
39-
"orchestra/testbench": "^7.0|^8.0|^9.0.2",
40-
"pestphp/pest": "^1.21|^2.0",
38+
"orchestra/testbench": "^7.0|^8.0|^9.0.2|^10.0",
39+
"pestphp/pest": "^1.21|^2.0|^3.0",
4140
"phpunit/phpunit": "^9.4 || ^10.5 || ^11.0"
4241
},
4342
"autoload": {

database/migrations/2022_12_21_091846_add_unique_to_expo_tokens.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Illuminate\Database\Schema\Blueprint;
77
use Illuminate\Support\Facades\Schema;
88

9-
return new class() extends Migration
9+
return new class extends Migration
1010
{
1111
public function up(): void
1212
{

src/Dto/ExpoMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class ExpoMessage implements Arrayable, Jsonable
4747

4848
public static function create(): ExpoMessage
4949
{
50-
return new ExpoMessage();
50+
return new ExpoMessage;
5151
}
5252

5353
public function to(?array $value): self
@@ -183,7 +183,7 @@ public static function fromJson($jsonData): ExpoMessage
183183
{
184184
$data = json_decode($jsonData, true);
185185

186-
$expoMessage = new self();
186+
$expoMessage = new self;
187187
foreach ($data as $key => $value) {
188188
if ($key === 'data') {
189189
$expoMessage->jsonData($value);

src/Dto/ExpoNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class ExpoNotification implements Arrayable
1414

1515
public static function make(int|string $id, ExpoMessage $message): ExpoNotification
1616
{
17-
return (new ExpoNotification())
17+
return (new ExpoNotification)
1818
->id($id)
1919
->message($message);
2020
}

src/Dto/ExpoTicket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class ExpoTicket implements Arrayable
1414

1515
public static function make(int|string $id, string $token): ExpoTicket
1616
{
17-
return (new ExpoTicket())
17+
return (new ExpoTicket)
1818
->id($id)
1919
->token($token);
2020
}

src/Dto/ExpoToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ExpoToken implements Arrayable
1717

1818
public static function make(int|string $id, string $value, Model $owner): ExpoToken
1919
{
20-
return (new ExpoToken())
20+
return (new ExpoToken)
2121
->id($id)
2222
->value($value)
2323
->owner($owner);

src/Events/InvalidExpoToken.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66

77
final class InvalidExpoToken
88
{
9-
public function __construct(public readonly string $token)
10-
{
11-
}
9+
public function __construct(public readonly string $token) {}
1210
}

src/ExpoNotificationsChannel.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ final class ExpoNotificationsChannel
1313
{
1414
public function __construct(
1515
protected readonly ExpoNotificationsServiceInterface $expoNotificationsService,
16-
) {
17-
}
16+
) {}
1817

1918
/**
2019
* @throws ExpoNotificationsException

src/ExpoNotificationsService.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ public function __construct(
5454
];
5555

5656
if ($accessToken) {
57-
$headers['Authorization'] = 'Bearer ' . $accessToken;
57+
$headers['Authorization'] = 'Bearer '.$accessToken;
5858
}
5959

6060
$this->http = Http::withHeaders($headers)->baseUrl($apiUrl);
6161

62-
6362
// https://expo.dev/blog/expo-adds-support-for-fcm-http-v1-api
6463
if (config('expo-notifications.service.use_fcm_legacy_api')) {
6564
$this->http->withQueryParameters([
@@ -107,7 +106,7 @@ public function receipts(Collection|array $tokenIds): Collection
107106
}
108107

109108
return collect($data['data'])->map(function ($responseItem, $id) {
110-
$data = (new PushReceiptResponse())
109+
$data = (new PushReceiptResponse)
111110
->id($id)
112111
->status($responseItem['status']);
113112

@@ -204,14 +203,14 @@ private function setTicketsFromData(array $data): ExpoNotificationsService
204203
->each(function ($responseItem) {
205204
if ($responseItem['status'] === ExpoResponseStatus::ERROR->value) {
206205
$this->tickets->push(
207-
(new PushTicketResponse())
206+
(new PushTicketResponse)
208207
->status($responseItem['status'])
209208
->message($responseItem['message'])
210209
->details($responseItem['details'])
211210
);
212211
} else {
213212
$this->tickets->push(
214-
(new PushTicketResponse())
213+
(new PushTicketResponse)
215214
->status($responseItem['status'])
216215
->ticketId($responseItem['id'])
217216
);

0 commit comments

Comments
 (0)