Skip to content

Commit

Permalink
Merge pull request #15 from YieldStudio/bugfix/dto-id-type
Browse files Browse the repository at this point in the history
fix: dto id type
  • Loading branch information
JamesHemery authored Dec 21, 2022
2 parents 1e5d435 + 2877996 commit fd3c198
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
public function up(): void
{
Schema::table('expo_tokens', function (Blueprint $table) {
Expand Down
6 changes: 3 additions & 3 deletions src/Dto/ExpoNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

final class ExpoNotification implements Arrayable
{
public int $id;
public int|string $id;

public ExpoMessage $message;

public static function make(int $id, ExpoMessage $message): ExpoNotification
public static function make(int|string $id, ExpoMessage $message): ExpoNotification
{
return (new ExpoNotification())
->id($id)
->message($message);
}

public function id(int $value): self
public function id(int|string $value): self
{
$this->id = $value;

Expand Down
6 changes: 3 additions & 3 deletions src/Dto/ExpoTicket.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

final class ExpoTicket implements Arrayable
{
public string $id;
public int|string $id;

public string $token;

public static function make(string $id, string $token): ExpoTicket
public static function make(int|string $id, string $token): ExpoTicket
{
return (new ExpoTicket())
->id($id)
->token($token);
}

public function id(string $id): self
public function id(int|string $id): self
{
$this->id = $id;

Expand Down
7 changes: 4 additions & 3 deletions src/Dto/ExpoToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@

final class ExpoToken implements Arrayable
{
public string $id;
public int|string $id;

public string $value;

public Model $owner;

public static function make(string $id, string $value, Model $owner): ExpoToken
public static function make(int|string $id, string $value, Model $owner): ExpoToken
{
return (new ExpoToken())
->id($id)
->value($value)
->owner($owner);
}

public function id(string $id): self
public function id(int|string $id): self
{
$this->id = $id;

Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ExpoNotificationsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class ExpoNotificationsException extends Exception
{
public function __construct(private ResponseInterface $response)
public function __construct(private readonly ResponseInterface $response)
{
parent::__construct(sprintf(
'Expo service error: HTTP `%s` response: %s',
Expand Down

0 comments on commit fd3c198

Please sign in to comment.