Skip to content

Commit

Permalink
lint + phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioGattolla committed Jan 28, 2025
1 parent 849c5d1 commit a04aae5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/DTO/OrderInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function toArray(): array
'name' => $this->name,
'phone_number' => $this->phoneNumber,
'email' => $this->email,
'shipping_address' => $this->shippingAddress->toArray(),
'shipping_address' => $this->shippingAddress?->toArray(),
], fn ($value) => $value !== null);
}
}
4 changes: 2 additions & 2 deletions src/DTO/PreCheckoutQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private function __construct()
* id:int,
* from:array<string, mixed>,
* currency:string,
* total_amount:string,
* total_amount:int,
* invoice_payload:string,
* shipping_option_id?:string,
* order_info?:array<string,mixed>
Expand Down Expand Up @@ -72,7 +72,7 @@ public function currency(): string
return $this->currency;
}

public function totalAmount(): string
public function totalAmount(): int
{
return $this->totalAmount;
}
Expand Down
10 changes: 5 additions & 5 deletions src/DTO/ShippingAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ public function countryCode(): string
return $this->countryCode;
}

public function state(): int
public function state(): string
{
return $this->state;
}

public function city(): ?string
public function city(): string
{
return $this->city;
}

public function streetLine1(): ?string
public function streetLine1(): string
{
return $this->streetLine1;
}

public function streetLine2(): ?string
public function streetLine2(): string
{
return $this->streetLine1;
}

public function postCode(): ?int
public function postCode(): string
{
return $this->postCode;
}
Expand Down
12 changes: 6 additions & 6 deletions src/DTO/SuccessfulPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ private function __construct()
/**
* @param array{
* currency:string,
* total_amount:string,
* total_amount:int,
* invoice_payload:string,
* subscription_expiration_date?:string,
* is_recurring:bool,
* is_first_recurring:bool,
* subscription_expiration_date?:int,
* is_recurring?:bool,
* is_first_recurring?:bool,
* shipping_option_id?:string,
* order_info?:array<string,mixed>,
* telegram_payment_charge_id:string,
Expand Down Expand Up @@ -70,7 +70,7 @@ public function currency(): string
return $this->currency;
}

public function totalAmount(): string
public function totalAmount(): int
{
return $this->totalAmount;
}
Expand All @@ -80,7 +80,7 @@ public function invoicePayload(): string
return $this->invoicePayload;
}

public function subscriptionExpirationDate(): string
public function subscriptionExpirationDate(): ?int
{
return $this->subscriptionExpirationDate;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Handlers/WebhookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ protected function handlePreCheckoutQuery(PreCheckoutQuery $preCheckoutQuery): v
$this->bot->answerPreCheckoutQuery($preCheckoutQuery->id(), true)->send();
}

protected function handleSuccessfulPayment(SuccessfulPayment $successfulPayment)
protected function handleSuccessfulPayment(SuccessfulPayment $successfulPayment): void
{
// .. handle SuccessfulPayment
}
Expand Down
3 changes: 2 additions & 1 deletion src/Models/TelegraphBot.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
class TelegraphBot extends Model implements Storable
{
/** @use HasFactory<TelegraphBotFactory> */
use HasFactory;

Check failure on line 40 in src/Models/TelegraphBot.php

View workflow job for this annotation

GitHub Actions / phpstan

PHPDoc tag @use contains generic type Illuminate\Database\Eloquent\Factories\HasFactory<DefStudio\Telegraph\Database\Factories\TelegraphBotFactory> but trait Illuminate\Database\Eloquent\Factories\HasFactory is not generic.
use HasStorage;

Expand Down Expand Up @@ -93,7 +94,7 @@ public static function fromToken(string $token): TelegraphBot
}

/**
* @return HasMany<TelegraphChat>
* @return HasMany<TelegraphChat, $this>
*/
public function chats(): HasMany

Check failure on line 99 in src/Models/TelegraphBot.php

View workflow job for this annotation

GitHub Actions / phpstan

Generic type Illuminate\Database\Eloquent\Relations\HasMany<DefStudio\Telegraph\Models\TelegraphChat, $this(DefStudio\Telegraph\Models\TelegraphBot)> in PHPDoc tag @return specifies 2 template types, but class Illuminate\Database\Eloquent\Relations\HasMany supports only 1: TRelatedModel
{
Expand Down
1 change: 1 addition & 0 deletions src/Models/TelegraphChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
class TelegraphChat extends Model implements Storable
{
/** @use HasFactory<TelegraphChatFactory> */
use HasFactory;

Check failure on line 40 in src/Models/TelegraphChat.php

View workflow job for this annotation

GitHub Actions / phpstan

PHPDoc tag @use contains generic type Illuminate\Database\Eloquent\Factories\HasFactory<DefStudio\Telegraph\Database\Factories\TelegraphChatFactory> but trait Illuminate\Database\Eloquent\Factories\HasFactory is not generic.
use HasStorage;

Expand Down

0 comments on commit a04aae5

Please sign in to comment.