From bd2c03eac47434aca4b8a070b206d9a909104c8d Mon Sep 17 00:00:00 2001 From: alexmerlin Date: Thu, 20 Feb 2025 16:48:13 +0200 Subject: [PATCH] Issue #75: Replaced Psalm with PHPStan Signed-off-by: alexmerlin --- .github/workflows/static-analysis.yml | 49 +++++++++++++++++++ README.md | 1 + composer.json | 11 ++--- docs/book/v5/overview.md | 14 ++++++ phpstan.neon | 21 ++++++++ psalm.xml | 17 ------- src/Factory/WriterFactory.php | 2 +- src/Logger.php | 17 ++----- src/Manager/FilterPluginManager.php | 4 +- src/Manager/FormatterPluginManager.php | 2 +- src/Manager/ProcessorPluginManager.php | 2 +- src/Manager/WriterPluginManager.php | 2 +- src/Writer/Stream.php | 5 +- .../FilterPluginManagerFactoryTest.php | 2 +- .../FormatterPluginManagerFactoryTest.php | 2 +- .../LoggerAbstractServiceFactoryTest.php | 2 +- .../ProcessorPluginManagerFactoryTest.php | 2 +- test/Factory/WriterFactoryTest.php | 3 +- .../WriterPluginManagerFactoryTest.php | 4 +- test/Filter/LevelTest.php | 4 +- test/Filter/RegexTest.php | 2 +- test/Filter/SuppressFilterTest.php | 5 +- test/Filter/ValidatorTest.php | 2 +- test/Formatter/BaseTest.php | 4 +- test/Formatter/JsonTest.php | 2 +- test/Formatter/SimpleTest.php | 2 +- test/LoggerTest.php | 5 +- test/Manager/FilterPluginManagerTest.php | 3 +- test/Manager/FormatterPluginManagerTest.php | 3 +- test/Manager/ProcessorPluginManagerTest.php | 3 +- test/Manager/WriterPluginManagerTest.php | 3 +- test/Processor/BackTraceTest.php | 2 +- test/Writer/StreamTest.php | 3 +- 33 files changed, 136 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/static-analysis.yml create mode 100644 phpstan.neon delete mode 100644 psalm.xml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..dc4b6fa --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,49 @@ +on: + - push + +name: Run PHPStan checks + +jobs: + mutation: + name: PHPStan ${{ matrix.php }}-${{ matrix.os }} + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php: + - "8.2" + - "8.3" + - "8.4" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + coverage: pcov + ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On + tools: composer:v2, cs2pr + + - name: Determine composer cache directory + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV + + - name: Cache dependencies installed with composer + uses: actions/cache@v4 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php }}-composer- + + - name: Install dependencies with composer + run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + + - name: Run static analysis with PHPStan + run: vendor/bin/phpstan analyse diff --git a/README.md b/README.md index 8820207..0745034 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-log/. [![Build Static](https://github.com/dotkernel/dot-log/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-log/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-log/graph/badge.svg?token=JX19KTBRCZ)](https://codecov.io/gh/dotkernel/dot-log) +[![PHPStan](https://github.com/dotkernel/dot-log/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-log/actions/workflows/static-analysis.yml) ## Adding The Config Provider diff --git a/composer.json b/composer.json index 3152051..f3ed0d6 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,9 @@ }, "require-dev": { "laminas/laminas-coding-standard": "^3.0", - "phpunit/phpunit": "^10.2", - "vimeo/psalm": "^6.0" + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.2" }, "autoload": { "psr-4": { @@ -40,8 +41,7 @@ "config": { "sort-packages": true, "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, - "laminas/laminas-dependency-plugin": false + "dealerdirect/phpcodesniffer-composer-installer": true } }, "scripts": { @@ -53,7 +53,6 @@ "cs-check": "phpcs", "cs-fix": "phpcbf", "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", - "static-analysis": "psalm --shepherd --stats" + "static-analysis": "phpstan analyse --memory-limit 1G" } } diff --git a/docs/book/v5/overview.md b/docs/book/v5/overview.md index cdd20a6..2efff7a 100644 --- a/docs/book/v5/overview.md +++ b/docs/book/v5/overview.md @@ -1,3 +1,17 @@ # Overview Robust, composite PSR-3 compliant logger with filtering and formatting. + +## Badges + +![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-log) +![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-log/5.0.0) + +[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-log)](https://github.com/dotkernel/dot-log/issues) +[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-log)](https://github.com/dotkernel/dot-log/network) +[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-log)](https://github.com/dotkernel/dot-log/stargazers) +[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-log)](https://github.com/dotkernel/dot-log/blob/5.0/LICENSE.md) + +[![Build Static](https://github.com/dotkernel/dot-log/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-log/actions/workflows/continuous-integration.yml) +[![codecov](https://codecov.io/gh/dotkernel/dot-log/graph/badge.svg?token=JX19KTBRCZ)](https://codecov.io/gh/dotkernel/dot-log) +[![PHPStan](https://github.com/dotkernel/dot-log/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-log/actions/workflows/static-analysis.yml) diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..7fd8c0a --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,21 @@ +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon +parameters: + level: 5 + paths: + - src + - test + treatPhpDocTypesAsCertain: false + ignoreErrors: + - + message: '/Undefined variable: \$test/' + path: test/LoggerTest.php + - + message: '/Property Dot\\Log\\Factory\\WriterFactory::\$creationOptions is never read, only written./' + path: src/Factory/WriterFactory.php + - + message: '/Parameter #1 \$writerPlugins of method Dot\\Log\\Logger::setWriterPluginManager\(\) expects Dot\\Log\\Manager\\WriterPluginManager, Laminas\\ServiceManager\\AbstractPluginManager given./' + path: src/Logger.php + - + message: '/Parameter #1 \$plugins of method Dot\\Log\\Logger::setProcessorPluginManager\(\) expects class-string|Dot\\Log\\Manager\\ProcessorPluginManager, Laminas\\ServiceManager\\AbstractPluginManager given./' + path: src/Logger.php diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 7272b57..0000000 --- a/psalm.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/src/Factory/WriterFactory.php b/src/Factory/WriterFactory.php index a3421e3..011ed6f 100644 --- a/src/Factory/WriterFactory.php +++ b/src/Factory/WriterFactory.php @@ -15,7 +15,7 @@ class WriterFactory implements FactoryInterface /** * Options to pass to the constructor if any. */ - private null|array $creationOptions; + private ?array $creationOptions = null; public function __construct(?array $creationOptions = null) { diff --git a/src/Logger.php b/src/Logger.php index 3956ca5..3cb2380 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -147,7 +147,7 @@ public function __construct(?iterable $options = null) $this->processors = new SplPriorityQueue(); if ($options instanceof Traversable) { - $options = ArrayUtils::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray((array) $options); } if (! $options) { @@ -255,13 +255,8 @@ public function addWriter(WriterInterface|string $writer, int $level = 1, ?array { if (is_string($writer)) { $writer = $this->writerPlugin($writer, $options); - } elseif (! $writer instanceof Writer\WriterInterface) { - throw new InvalidArgumentException(sprintf( - 'Writer must implement %s\Writer\WriterInterface; received "%s"', - __NAMESPACE__, - $writer::class - )); } + $this->writers->insert($writer, $level); return $this; @@ -331,12 +326,8 @@ public function addProcessor( ): static { if (is_string($processor)) { $processor = $this->processorPlugin($processor, $options); - } elseif (! $processor instanceof Processor\ProcessorInterface) { - throw new InvalidArgumentException(sprintf( - 'Processor must implement Laminas\Log\ProcessorInterface; received "%s"', - $processor::class - )); } + $this->processors->insert($processor, $level); return $this; @@ -364,7 +355,7 @@ public function log(mixed $level, string|Stringable $message, iterable $context } if ($context instanceof Traversable) { - $context = ArrayUtils::iteratorToArray($context); + $context = ArrayUtils::iteratorToArray((array) $context); } if ($this->writers->count() === 0) { diff --git a/src/Manager/FilterPluginManager.php b/src/Manager/FilterPluginManager.php index db4f5be..bd91588 100644 --- a/src/Manager/FilterPluginManager.php +++ b/src/Manager/FilterPluginManager.php @@ -12,6 +12,7 @@ use Laminas\ServiceManager\AbstractPluginManager; use Laminas\ServiceManager\Exception\InvalidServiceException; use Laminas\ServiceManager\Factory\InvokableFactory; +use Laminas\ServiceManager\ServiceManager; use function gettype; use function is_object; @@ -20,6 +21,7 @@ /** * @template F of FilterPluginManager * @extends AbstractPluginManager + * @psalm-import-type FactoriesConfiguration from ServiceManager */ class FilterPluginManager extends AbstractPluginManager { @@ -32,7 +34,7 @@ class FilterPluginManager extends AbstractPluginManager 'validator' => Validator::class, ]; - /** @var string[]|callable[] */ + /** @inheritDoc */ protected array $factories = [ Level::class => InvokableFactory::class, Regex::class => InvokableFactory::class, diff --git a/src/Manager/FormatterPluginManager.php b/src/Manager/FormatterPluginManager.php index 43a95ba..e22e8ed 100644 --- a/src/Manager/FormatterPluginManager.php +++ b/src/Manager/FormatterPluginManager.php @@ -25,7 +25,7 @@ class FormatterPluginManager extends AbstractPluginManager 'simple' => Simple::class, ]; - /** @var string[]|callable[] */ + /** @inheritDoc */ protected array $factories = [ Simple::class => InvokableFactory::class, ]; diff --git a/src/Manager/ProcessorPluginManager.php b/src/Manager/ProcessorPluginManager.php index dd4b56c..a04fde8 100644 --- a/src/Manager/ProcessorPluginManager.php +++ b/src/Manager/ProcessorPluginManager.php @@ -31,7 +31,7 @@ class ProcessorPluginManager extends AbstractPluginManager 'requestid' => RequestId::class, ]; - /** @var string[]|callable[] */ + /** @inheritDoc */ protected array $factories = [ Backtrace::class => InvokableFactory::class, PsrPlaceholder::class => InvokableFactory::class, diff --git a/src/Manager/WriterPluginManager.php b/src/Manager/WriterPluginManager.php index 9d2c47d..5c937eb 100644 --- a/src/Manager/WriterPluginManager.php +++ b/src/Manager/WriterPluginManager.php @@ -32,7 +32,7 @@ class WriterPluginManager extends AbstractPluginManager 'laminaslogwriternull' => Noop::class, ]; - /** @var string[]|callable[] */ + /** @inheritDoc */ protected array $factories = [ Noop::class => WriterFactory::class, Stream::class => WriterFactory::class, diff --git a/src/Writer/Stream.php b/src/Writer/Stream.php index 2b29fa2..7070c32 100644 --- a/src/Writer/Stream.php +++ b/src/Writer/Stream.php @@ -8,6 +8,7 @@ use Dot\Log\Exception\RuntimeException; use ErrorException; use Laminas\Stdlib\ErrorHandler; +use Psr\Container\ContainerExceptionInterface; use Traversable; use function chmod; @@ -41,6 +42,7 @@ class Stream extends AbstractWriter protected mixed $stream; /** + * @throws ContainerExceptionInterface * @throws ErrorException */ public function __construct( @@ -73,6 +75,7 @@ public function __construct( )); } + $error = null; if (is_resource($streamOrUrl)) { if ('stream' !== get_resource_type($streamOrUrl)) { throw new InvalidArgumentException(sprintf( @@ -95,7 +98,7 @@ public function __construct( touch($streamOrUrl); chmod($streamOrUrl, $filePermissions); } - $this->stream = fopen($streamOrUrl, $mode, false); + $this->stream = fopen($streamOrUrl, $mode); $error = ErrorHandler::stop(); } diff --git a/test/Factory/FilterPluginManagerFactoryTest.php b/test/Factory/FilterPluginManagerFactoryTest.php index c153ca9..fd51de5 100644 --- a/test/Factory/FilterPluginManagerFactoryTest.php +++ b/test/Factory/FilterPluginManagerFactoryTest.php @@ -96,6 +96,6 @@ public function testWillInstantiate(): void $factory = (new FilterPluginManagerFactory())($this->container); - $this->assertInstanceOf(FilterPluginManager::class, $factory); + $this->assertSame(FilterPluginManager::class, $factory::class); } } diff --git a/test/Factory/FormatterPluginManagerFactoryTest.php b/test/Factory/FormatterPluginManagerFactoryTest.php index e66445b..23b6c0b 100644 --- a/test/Factory/FormatterPluginManagerFactoryTest.php +++ b/test/Factory/FormatterPluginManagerFactoryTest.php @@ -96,6 +96,6 @@ public function testWillInstantiate(): void $factory = (new FormatterPluginManagerFactory())($this->container); - $this->assertInstanceOf(FormatterPluginManager::class, $factory); + $this->assertSame(FormatterPluginManager::class, $factory::class); } } diff --git a/test/Factory/LoggerAbstractServiceFactoryTest.php b/test/Factory/LoggerAbstractServiceFactoryTest.php index c34affc..7a444e9 100644 --- a/test/Factory/LoggerAbstractServiceFactoryTest.php +++ b/test/Factory/LoggerAbstractServiceFactoryTest.php @@ -51,7 +51,7 @@ public function testWillInstantiate(): void $factory = (new LoggerAbstractServiceFactory())($this->container, 'dot-log.test-log'); - $this->assertInstanceOf(Logger::class, $factory); + $this->assertSame(Logger::class, $factory::class); } /** diff --git a/test/Factory/ProcessorPluginManagerFactoryTest.php b/test/Factory/ProcessorPluginManagerFactoryTest.php index ee1aeb4..9d08015 100644 --- a/test/Factory/ProcessorPluginManagerFactoryTest.php +++ b/test/Factory/ProcessorPluginManagerFactoryTest.php @@ -96,6 +96,6 @@ public function testWillInstantiate(): void $factory = (new ProcessorPluginManagerFactory())($this->container); - $this->assertInstanceOf(ProcessorPluginManager::class, $factory); + $this->assertSame(ProcessorPluginManager::class, $factory::class); } } diff --git a/test/Factory/WriterFactoryTest.php b/test/Factory/WriterFactoryTest.php index d769f0f..2a036ea 100644 --- a/test/Factory/WriterFactoryTest.php +++ b/test/Factory/WriterFactoryTest.php @@ -42,6 +42,7 @@ public function testSetCreationOptions(): void { $input = []; - $this->assertNull($this->subject->setCreationOptions($input)); + $this->expectNotToPerformAssertions(); + $this->subject->setCreationOptions($input); } } diff --git a/test/Factory/WriterPluginManagerFactoryTest.php b/test/Factory/WriterPluginManagerFactoryTest.php index f830bbb..9fe1941 100644 --- a/test/Factory/WriterPluginManagerFactoryTest.php +++ b/test/Factory/WriterPluginManagerFactoryTest.php @@ -63,7 +63,7 @@ public function testWillNotInstantiateWithoutDotLog(): void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function testWillNotInstantiateWithoutWritterConfig(): void + public function testWillNotInstantiateWithoutWriterConfig(): void { $this->container->expects($this->once()) ->method('has') @@ -96,6 +96,6 @@ public function testWillInstantiate(): void $factory = (new WriterPluginManagerFactory())($this->container); - $this->assertInstanceOf(WriterPluginManager::class, $factory); + $this->assertSame(WriterPluginManager::class, $factory::class); } } diff --git a/test/Filter/LevelTest.php b/test/Filter/LevelTest.php index 262dea2..c3a69e7 100644 --- a/test/Filter/LevelTest.php +++ b/test/Filter/LevelTest.php @@ -19,7 +19,7 @@ public function setUp(): void public function testWillInstantiateWithInt(): void { - $this->assertInstanceOf(Level::class, $this->subject); + $this->assertSame(Level::class, $this->subject::class); } public function testWillInstantiateWithArray(): void @@ -28,7 +28,7 @@ public function testWillInstantiateWithArray(): void $result = new Level($input); - $this->assertInstanceOf(Level::class, $result); + $this->assertSame(Level::class, $result::class); } public function testWillNotInstantiateWithEmptyArray(): void diff --git a/test/Filter/RegexTest.php b/test/Filter/RegexTest.php index 83a76d0..dde63a4 100644 --- a/test/Filter/RegexTest.php +++ b/test/Filter/RegexTest.php @@ -23,7 +23,7 @@ public function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(Regex::class, $this->subject); + $this->assertSame(Regex::class, $this->subject::class); } /** diff --git a/test/Filter/SuppressFilterTest.php b/test/Filter/SuppressFilterTest.php index b056262..942abde 100644 --- a/test/Filter/SuppressFilterTest.php +++ b/test/Filter/SuppressFilterTest.php @@ -19,7 +19,7 @@ public function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(SuppressFilter::class, $this->subject); + $this->assertSame(SuppressFilter::class, $this->subject::class); } public function testWillNotInstantiate(): void @@ -40,6 +40,7 @@ public function testFilter(): void public function testSuppress(): void { - $this->assertNull($this->subject->suppress(true)); + $this->expectNotToPerformAssertions(); + $this->subject->suppress(true); } } diff --git a/test/Filter/ValidatorTest.php b/test/Filter/ValidatorTest.php index 8a29a9a..1370801 100644 --- a/test/Filter/ValidatorTest.php +++ b/test/Filter/ValidatorTest.php @@ -20,7 +20,7 @@ protected function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(Validator::class, $this->subject); + $this->assertSame(Validator::class, $this->subject::class); } public function testWillNotInstantiateWithEmptyArray(): void diff --git a/test/Formatter/BaseTest.php b/test/Formatter/BaseTest.php index 216c7c6..a0096f6 100644 --- a/test/Formatter/BaseTest.php +++ b/test/Formatter/BaseTest.php @@ -19,7 +19,7 @@ protected function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(Base::class, $this->subject); + $this->assertSame(Base::class, $this->subject::class); } public function testFormat(): void @@ -38,6 +38,6 @@ public function testGetDatetimeFormat(): void public function testSetDatetimeFormat(): void { $result = $this->subject->setDateTimeFormat('Y-m-d H:i:s'); - $this->assertInstanceOf(Base::class, $result); + $this->assertSame(Base::class, $result::class); } } diff --git a/test/Formatter/JsonTest.php b/test/Formatter/JsonTest.php index 7926c5e..a80a8c3 100644 --- a/test/Formatter/JsonTest.php +++ b/test/Formatter/JsonTest.php @@ -34,6 +34,6 @@ public function testGetDatetimeFormat(): void public function testSetDatetimeFormat(): void { $result = $this->subject->setDateTimeFormat('Y-m-d H:i:s'); - $this->assertInstanceOf(Json::class, $result); + $this->assertSame(Json::class, $result::class); } } diff --git a/test/Formatter/SimpleTest.php b/test/Formatter/SimpleTest.php index 5b29257..c3bb946 100644 --- a/test/Formatter/SimpleTest.php +++ b/test/Formatter/SimpleTest.php @@ -20,7 +20,7 @@ protected function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(Simple::class, $this->subject); + $this->assertSame(Simple::class, $this->subject::class); } public function testWillNotInstantiate(): void diff --git a/test/LoggerTest.php b/test/LoggerTest.php index 8e0d425..7e9bb12 100644 --- a/test/LoggerTest.php +++ b/test/LoggerTest.php @@ -69,8 +69,7 @@ public function testSetWriters(): void $this->subject->setWriters($writers); $writers = $this->subject->getWriters(); - $this->assertInstanceOf(SplPriorityQueue::class, $writers); - $writer = $writers->extract(); + $writer = $writers->extract(); $this->assertInstanceOf(Noop::class, $writer); } @@ -83,7 +82,6 @@ public function testAddWriterWithLevel(): void $this->subject->addWriter($writer, 3); $writers = $this->subject->getWriters(); - $this->assertInstanceOf(SplPriorityQueue::class, $writers); $writer = $writers->extract(); $this->assertInstanceOf(Noop::class, $writer); } @@ -99,7 +97,6 @@ public function testAddWithSameLevel(): void $this->subject->addWriter($writer2, 1); $writers = $this->subject->getWriters(); - $this->assertInstanceOf(SplPriorityQueue::class, $writers); $writer = $writers->extract(); $this->assertInstanceOf(Noop::class, $writer); $writer = $writers->extract(); diff --git a/test/Manager/FilterPluginManagerTest.php b/test/Manager/FilterPluginManagerTest.php index e2c43a0..fc1bd43 100644 --- a/test/Manager/FilterPluginManagerTest.php +++ b/test/Manager/FilterPluginManagerTest.php @@ -27,7 +27,8 @@ protected function setUp(): void public function testValidate(): void { - $this->assertNull($this->subject->validate(new Level(47))); + $this->expectNotToPerformAssertions(); + $this->subject->validate(new Level(47)); } public function testWillNotValidate(): void diff --git a/test/Manager/FormatterPluginManagerTest.php b/test/Manager/FormatterPluginManagerTest.php index 2e400e5..bac7b3a 100644 --- a/test/Manager/FormatterPluginManagerTest.php +++ b/test/Manager/FormatterPluginManagerTest.php @@ -27,7 +27,8 @@ protected function setUp(): void public function testValidate(): void { - $this->assertNull($this->subject->validate(new Json())); + $this->expectNotToPerformAssertions(); + $this->subject->validate(new Json()); } public function testWillNotValidate(): void diff --git a/test/Manager/ProcessorPluginManagerTest.php b/test/Manager/ProcessorPluginManagerTest.php index bf9b6c8..faa3f61 100644 --- a/test/Manager/ProcessorPluginManagerTest.php +++ b/test/Manager/ProcessorPluginManagerTest.php @@ -27,7 +27,8 @@ protected function setUp(): void public function testValidate(): void { - $this->assertNull($this->subject->validate(new Backtrace())); + $this->expectNotToPerformAssertions(); + $this->subject->validate(new Backtrace()); } public function testWillNotValidate(): void diff --git a/test/Manager/WriterPluginManagerTest.php b/test/Manager/WriterPluginManagerTest.php index 7645078..117d155 100644 --- a/test/Manager/WriterPluginManagerTest.php +++ b/test/Manager/WriterPluginManagerTest.php @@ -27,7 +27,8 @@ protected function setUp(): void public function testValidate(): void { - $this->assertNull($this->subject->validate(new Noop())); + $this->expectNotToPerformAssertions(); + $this->subject->validate(new Noop()); } public function testWillNotValidate(): void diff --git a/test/Processor/BackTraceTest.php b/test/Processor/BackTraceTest.php index 9816a41..4f2853a 100644 --- a/test/Processor/BackTraceTest.php +++ b/test/Processor/BackTraceTest.php @@ -18,7 +18,7 @@ protected function setUp(): void public function testWillInstantiate(): void { - $this->assertInstanceOf(Backtrace::class, $this->subject); + $this->assertSame(Backtrace::class, $this->subject::class); } public function testProcess(): void diff --git a/test/Writer/StreamTest.php b/test/Writer/StreamTest.php index cbb43aa..9f1374d 100644 --- a/test/Writer/StreamTest.php +++ b/test/Writer/StreamTest.php @@ -92,6 +92,7 @@ public function testGetLogSeparator(): void public function testShutDown(): void { - $this->assertNull($this->subject->shutdown()); + $this->expectNotToPerformAssertions(); + $this->subject->shutdown(); } }