Skip to content

Commit

Permalink
Replace DummyLogger with the built-in psr/log NullLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
firstred committed Jul 5, 2024
1 parent 9b85dce commit e62027c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/PostNL.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

use DateTimeInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\NullLogger;
use Throwable;
use Firstred\PostNL\Entity\Barcode;
use Firstred\PostNL\Entity\Customer;
Expand Down Expand Up @@ -109,7 +110,6 @@
use Firstred\PostNL\Service\ShippingStatusServiceInterface;
use Firstred\PostNL\Service\TimeframeService;
use Firstred\PostNL\Service\TimeframeServiceInterface;
use Firstred\PostNL\Util\DummyLogger;
use Firstred\PostNL\Util\RFPdi;
use Firstred\PostNL\Util\Util;
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
Expand Down Expand Up @@ -538,7 +538,7 @@ public function setLogger(LoggerInterface $logger): void
*/
public function resetLogger(): static
{
$this->logger = new DummyLogger();
$this->logger = new NullLogger();

return $this;
}
Expand Down
1 change: 1 addition & 0 deletions src/Util/DummyLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* Class DummyLogger.
*
* @internal
* @deprecated since 2.0.9. Use the NullLogger from psr/log instead.
*/
class DummyLogger implements LoggerInterface
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Misc/PostNLRestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
use Firstred\PostNL\Exception\InvalidArgumentException;
use Firstred\PostNL\HttpClient\MockHttpClient;
use Firstred\PostNL\PostNL;
use Firstred\PostNL\Util\DummyLogger;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\Error;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;

#[TestDox(text: 'The PostNL object')]
class PostNLRestTest extends TestCase
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testSetNullLogger(): void
{
$this->postnl->resetLogger();

$this->assertInstanceOf(expected: DummyLogger::class, actual: $this->postnl->getLogger());
$this->assertInstanceOf(expected: NullLogger::class, actual: $this->postnl->getLogger());
}

/** @throws */
Expand Down

0 comments on commit e62027c

Please sign in to comment.