Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make php artisan send-test-mail option --from optional #12

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/laravel-utils/releases).

## Unreleased

## v4.12.0

### Changed

- Make `php artisan send-test-mail` option `--from` optional

## v4.11.0

### Added
Expand Down
10 changes: 6 additions & 4 deletions src/Mail/SendTestMailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
$mail = new TestMail();

$from = $this->option('from');
if (! is_string($from)) {
$fromType = gettype($from);
throw new \UnexpectedValueException("Expected option --from to be string, got {$fromType}.");
if (! is_null($from)) {
if (! is_string($from)) { // @phpstan-ignore-line option values can also be arrays
$fromType = gettype($from);
throw new \UnexpectedValueException("Expected option --from to be string, got {$fromType}.");

Check warning on line 26 in src/Mail/SendTestMailCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Mail/SendTestMailCommand.php#L23-L26

Added lines #L23 - L26 were not covered by tests
}
$mail->from($from);

Check warning on line 28 in src/Mail/SendTestMailCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Mail/SendTestMailCommand.php#L28

Added line #L28 was not covered by tests
}
$mail->from($from);

$to = $this->option('to');
if (! is_string($to)) {
Expand Down
Loading