From 77c92ca82fb1a63c9443fffb362a1c27b2e192e8 Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Sat, 26 Jul 2025 11:26:21 +0900 Subject: [PATCH] refactor: use empty() instead of negation for result validation --- src/Job/SendMailJob.php | 2 +- tests/TestCase/Job/SendMailJobTest.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Job/SendMailJob.php b/src/Job/SendMailJob.php index da0b529..a1a9bf8 100644 --- a/src/Job/SendMailJob.php +++ b/src/Job/SendMailJob.php @@ -49,7 +49,7 @@ public function execute(Message $message): ?string Log::error(sprintf('An error has occurred processing message: %s', $e->getMessage())); } - if (!$result) { + if (empty($result)) { return Processor::REJECT; } diff --git a/tests/TestCase/Job/SendMailJobTest.php b/tests/TestCase/Job/SendMailJobTest.php index 4f02396..a702a96 100644 --- a/tests/TestCase/Job/SendMailJobTest.php +++ b/tests/TestCase/Job/SendMailJobTest.php @@ -57,7 +57,7 @@ public function setUp(): void * * @return void */ - public function testExecute() + public function testExecute(): void { $job = $this->getMockBuilder(SendMailJob::class) ->onlyMethods(['getTransport']) @@ -84,7 +84,7 @@ public function testExecute() * * @return void */ - public function testExecuteTransportName() + public function testExecuteTransportName(): void { $job = new SendMailJob(); $message = $this->createMessage('foo', [], $this->message); @@ -110,7 +110,7 @@ public function testExecuteTransportName() * * @return void */ - public function testExecuteWithAttachments() + public function testExecuteWithAttachments(): void { $emailMessage = clone $this->message; $emailMessage->addAttachments(['test.txt' => ROOT . 'files' . DS . 'test.txt']); @@ -124,7 +124,7 @@ public function testExecuteWithAttachments() * * @return void */ - public function testExecuteInvalidTransport() + public function testExecuteInvalidTransport(): void { $message = $this->createMessage('WrongTransport', [], $this->message); $actual = $this->job->execute($message); @@ -136,14 +136,14 @@ public function testExecuteInvalidTransport() * * @return void */ - public function testExecuteUnserializableMessage() + public function testExecuteUnserializableMessage(): void { $message = $this->createMessage(DebugTransport::class, [], 'unserializable'); $actual = $this->job->execute($message); $this->assertSame(Processor::REJECT, $actual); } - public function testExecuteNoAbstractTransport() + public function testExecuteNoAbstractTransport(): void { $message = $this->createMessage(Mailer::class, [], $this->message); $actual = $this->job->execute($message);