diff --git a/composer.json b/composer.json index 159923d..1b236ce 100644 --- a/composer.json +++ b/composer.json @@ -28,9 +28,9 @@ "require-dev": { "behat/behat": "^3.0", "friendsofphp/php-cs-fixer": "^3.27", - "phpstan/phpstan": "^1.2", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "symfony/phpunit-bridge": "^6.3", + "symfony/phpunit-bridge": "^7.2", "symfony/process": "^5.4 || ^6.3 || ^7.0", "symfony/yaml": "^5.4 || ^6.3 || ^7.0" }, diff --git a/phpstan.neon b/phpstan.neon index 4bc85c4..1349e0f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,7 +2,6 @@ parameters: treatPhpDocTypesAsCertain: false excludePaths: - %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/DependencyInjection/Configuration.php - - %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php - %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php - %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticDriver.php - %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnection.php diff --git a/src/DAMA/DoctrineTestBundle/DependencyInjection/ModifyDoctrineConfigCompilerPass.php b/src/DAMA/DoctrineTestBundle/DependencyInjection/ModifyDoctrineConfigCompilerPass.php index 0977d5a..ee9e20b 100644 --- a/src/DAMA/DoctrineTestBundle/DependencyInjection/ModifyDoctrineConfigCompilerPass.php +++ b/src/DAMA/DoctrineTestBundle/DependencyInjection/ModifyDoctrineConfigCompilerPass.php @@ -91,7 +91,7 @@ private function modifyConnectionService(ContainerBuilder $container, $connectio private function getModifiedConnectionOptions( array $connectionOptions, $connectionKey, - string $name + string $name, ): array { if (!isset($connectionOptions['primary'])) { if (is_array($connectionKey)) { @@ -128,7 +128,7 @@ private function getModifiedConnectionOptions( private function registerStaticCache( ContainerBuilder $container, Definition $originalCacheServiceDefinition, - string $cacheServiceId + string $cacheServiceId, ): void { $cache = new Definition(); $namespace = sha1($cacheServiceId); diff --git a/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnectionTrait.php b/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnectionTrait.php index a6fc1f2..199f258 100644 --- a/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnectionTrait.php +++ b/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnectionTrait.php @@ -7,6 +7,8 @@ /** * @internal + * + * @phpstan-ignore trait.unused */ trait StaticConnectionTrait { diff --git a/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php b/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php index d34ac52..e0d6c99 100644 --- a/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php +++ b/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php @@ -44,14 +44,14 @@ public static function rollBack(): void public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void { - $facade->registerSubscriber(new class() implements TestRunnerStartedSubscriber { + $facade->registerSubscriber(new class implements TestRunnerStartedSubscriber { public function notify(TestRunnerStartedEvent $event): void { StaticDriver::setKeepStaticConnections(true); } }); - $facade->registerSubscriber(new class() implements TestStartedSubscriber { + $facade->registerSubscriber(new class implements TestStartedSubscriber { public function notify(TestStartedEvent $event): void { StaticDriver::beginTransaction(); @@ -59,7 +59,7 @@ public function notify(TestStartedEvent $event): void } }); - $facade->registerSubscriber(new class() implements SkippedSubscriber { + $facade->registerSubscriber(new class implements SkippedSubscriber { public function notify(Skipped $event): void { // this is a workaround to allow skipping tests within the setUp() method @@ -68,14 +68,14 @@ public function notify(Skipped $event): void } }); - $facade->registerSubscriber(new class() implements TestFinishedSubscriber { + $facade->registerSubscriber(new class implements TestFinishedSubscriber { public function notify(TestFinishedEvent $event): void { PHPUnitExtension::rollBack(); } }); - $facade->registerSubscriber(new class() implements ErroredSubscriber { + $facade->registerSubscriber(new class implements ErroredSubscriber { public function notify(Errored $event): void { // needed as for errored tests the "Finished" event is not triggered @@ -83,7 +83,7 @@ public function notify(Errored $event): void } }); - $facade->registerSubscriber(new class() implements TestRunnerFinishedSubscriber { + $facade->registerSubscriber(new class implements TestRunnerFinishedSubscriber { public function notify(TestRunnerFinishedEvent $event): void { StaticDriver::setKeepStaticConnections(false); diff --git a/tests/DAMA/DoctrineTestBundle/Doctrine/DBAL/MockDriverTrait.php b/tests/DAMA/DoctrineTestBundle/Doctrine/DBAL/MockDriverTrait.php index c1c03a8..436d3e4 100644 --- a/tests/DAMA/DoctrineTestBundle/Doctrine/DBAL/MockDriverTrait.php +++ b/tests/DAMA/DoctrineTestBundle/Doctrine/DBAL/MockDriverTrait.php @@ -8,6 +8,9 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\AbstractSchemaManager; +/** + * @phpstan-ignore trait.unused + */ trait MockDriverTrait { private $connection; @@ -22,7 +25,7 @@ trait MockDriverTrait public function __construct( $connection, $schemaManager, - $exceptionConverter + $exceptionConverter, ) { $this->connection = $connection; $this->schemaManager = $schemaManager; diff --git a/tests/Functional/PhpunitTest.php b/tests/Functional/PhpunitTest.php index f27c3bc..15655bb 100644 --- a/tests/Functional/PhpunitTest.php +++ b/tests/Functional/PhpunitTest.php @@ -144,7 +144,7 @@ public function testSkippedTest(): void public function testSkippedTestDuringSetup(): void { - $this->assertTrue(true); + $this->expectNotToPerformAssertions(); } public function testMarkIncomplete(): void