Skip to content

Commit

Permalink
Utilize ?-> (null safe) operator instead of conditional check (#51328)
Browse files Browse the repository at this point in the history
  • Loading branch information
saMahmoudzadeh authored May 8, 2024
1 parent 7e6fb42 commit 192ec66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
16 changes: 4 additions & 12 deletions src/Illuminate/Database/Migrations/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ public function runPending(array $migrations, array $options = [])

$this->fireMigrationEvent(new MigrationsEnded('up'));

if ($this->output) {
$this->output->writeln('');
}
$this->output?->writeln('');
}

/**
Expand Down Expand Up @@ -242,9 +240,7 @@ public function rollback($paths = [], array $options = [])
}

return tap($this->rollbackMigrations($migrations, $paths, $options), function () {
if ($this->output) {
$this->output->writeln('');
}
$this->output?->writeln('');
});
}

Expand Down Expand Up @@ -331,9 +327,7 @@ public function reset($paths = [], $pretend = false)
}

return tap($this->resetMigrations($migrations, Arr::wrap($paths), $pretend), function () {
if ($this->output) {
$this->output->writeln('');
}
$this->output?->writeln('');
});
}

Expand Down Expand Up @@ -760,8 +754,6 @@ protected function write($component, ...$arguments)
*/
public function fireMigrationEvent($event)
{
if ($this->events) {
$this->events->dispatch($event);
}
$this->events?->dispatch($event);
}
}
8 changes: 3 additions & 5 deletions src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,9 @@ protected function shouldSendMessage($message, $data = [])
*/
protected function dispatchSentEvent($message, $data = [])
{
if ($this->events) {
$this->events->dispatch(
new MessageSent($message, $data)
);
}
$this->events?->dispatch(
new MessageSent($message, $data)
);
}

/**
Expand Down

0 comments on commit 192ec66

Please sign in to comment.