Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daVitekPL committed Jul 24, 2024
1 parent 5ebf8f0 commit 671a7a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/Core/SmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ private static function sendMessage(User $user, array $sections): bool
}

try {
// @phpstan-ignore-next-line
Sms::send($sections['content'])->to($user->phone)->dispatch();
} catch (\Exception $exception) {
Log::error('[' . __CLASS__ . '] ' . $exception->getMessage());
Expand Down
10 changes: 5 additions & 5 deletions src/Testing/SmsFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ public function dispatch(): void
$this->sms[] = new Sms($this->recipient, $this->body, [], []);
}

public function assertSent(Closure|string $callback): void
public function assertSent(Closure|string|null $callback): void
{
PHPUnit::assertTrue(
$this->sent($callback)->count() > 0,
);
}

public function assertSentTimes(Closure|string $callback, int $times = 1): void
public function assertSentTimes(Closure|string|null $callback, int $times = 1): void
{
PHPUnit::assertCount(
$times, $this->sent($callback)
);
}

public function assertNotSent(Closure|string $callback): void
public function assertNotSent(Closure|string|null $callback): void
{
PHPUnit::assertCount(
0, $this->sent($callback)
Expand All @@ -63,13 +63,13 @@ public function assertNotSent(Closure|string $callback): void
/**
* @return Collection<int, Sms>
*/
private function sent(Closure|string $callback = null): Collection
private function sent(Closure|string|null $callback = null): Collection
{
$callback = $this->prepare($callback);
return (new Collection($this->sms))->filter($callback);
}

private function prepare(Closure|string $callback = null): Closure
private function prepare(Closure|string|null $callback = null): Closure
{
if ($callback instanceof Closure) {
$callback = function (Sms $sms) use ($callback) {
Expand Down

0 comments on commit 671a7a3

Please sign in to comment.