Skip to content

Commit e5081a2

Browse files
committed
upgrade to phpstan ^2
1 parent 1f81a28 commit e5081a2

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"require-dev": {
2929
"behat/behat": "^3.0",
3030
"friendsofphp/php-cs-fixer": "^3.27",
31-
"phpstan/phpstan": "^1.2",
31+
"phpstan/phpstan": "^2.0",
3232
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0",
33-
"symfony/phpunit-bridge": "^6.3",
33+
"symfony/phpunit-bridge": "^7.2",
3434
"symfony/process": "^5.4 || ^6.3 || ^7.0",
3535
"symfony/yaml": "^5.4 || ^6.3 || ^7.0"
3636
},

phpstan.neon

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ parameters:
22
treatPhpDocTypesAsCertain: false
33
excludePaths:
44
- %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/DependencyInjection/Configuration.php
5-
- %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php
65
- %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php
76
- %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticDriver.php
87
- %currentWorkingDirectory%/src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnection.php

src/DAMA/DoctrineTestBundle/DependencyInjection/ModifyDoctrineConfigCompilerPass.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private function modifyConnectionService(ContainerBuilder $container, $connectio
9191
private function getModifiedConnectionOptions(
9292
array $connectionOptions,
9393
$connectionKey,
94-
string $name
94+
string $name,
9595
): array {
9696
if (!isset($connectionOptions['primary'])) {
9797
if (is_array($connectionKey)) {
@@ -128,7 +128,7 @@ private function getModifiedConnectionOptions(
128128
private function registerStaticCache(
129129
ContainerBuilder $container,
130130
Definition $originalCacheServiceDefinition,
131-
string $cacheServiceId
131+
string $cacheServiceId,
132132
): void {
133133
$cache = new Definition();
134134
$namespace = sha1($cacheServiceId);

src/DAMA/DoctrineTestBundle/Doctrine/DBAL/StaticConnectionTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* @internal
10+
*
11+
* @phpstan-ignore trait.unused
1012
*/
1113
trait StaticConnectionTrait
1214
{

src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ public static function rollBack(): void
4444

4545
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
4646
{
47-
$facade->registerSubscriber(new class() implements TestRunnerStartedSubscriber {
47+
$facade->registerSubscriber(new class implements TestRunnerStartedSubscriber {
4848
public function notify(TestRunnerStartedEvent $event): void
4949
{
5050
StaticDriver::setKeepStaticConnections(true);
5151
}
5252
});
5353

54-
$facade->registerSubscriber(new class() implements TestStartedSubscriber {
54+
$facade->registerSubscriber(new class implements TestStartedSubscriber {
5555
public function notify(TestStartedEvent $event): void
5656
{
5757
StaticDriver::beginTransaction();
5858
PHPUnitExtension::$transactionStarted = true;
5959
}
6060
});
6161

62-
$facade->registerSubscriber(new class() implements SkippedSubscriber {
62+
$facade->registerSubscriber(new class implements SkippedSubscriber {
6363
public function notify(Skipped $event): void
6464
{
6565
// this is a workaround to allow skipping tests within the setUp() method
@@ -68,22 +68,22 @@ public function notify(Skipped $event): void
6868
}
6969
});
7070

71-
$facade->registerSubscriber(new class() implements TestFinishedSubscriber {
71+
$facade->registerSubscriber(new class implements TestFinishedSubscriber {
7272
public function notify(TestFinishedEvent $event): void
7373
{
7474
PHPUnitExtension::rollBack();
7575
}
7676
});
7777

78-
$facade->registerSubscriber(new class() implements ErroredSubscriber {
78+
$facade->registerSubscriber(new class implements ErroredSubscriber {
7979
public function notify(Errored $event): void
8080
{
8181
// needed as for errored tests the "Finished" event is not triggered
8282
PHPUnitExtension::rollBack();
8383
}
8484
});
8585

86-
$facade->registerSubscriber(new class() implements TestRunnerFinishedSubscriber {
86+
$facade->registerSubscriber(new class implements TestRunnerFinishedSubscriber {
8787
public function notify(TestRunnerFinishedEvent $event): void
8888
{
8989
StaticDriver::setKeepStaticConnections(false);

tests/DAMA/DoctrineTestBundle/Doctrine/DBAL/MockDriverTrait.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Doctrine\DBAL\Platforms\AbstractPlatform;
99
use Doctrine\DBAL\Schema\AbstractSchemaManager;
1010

11+
/**
12+
* @phpstan-ignore trait.unused
13+
*/
1114
trait MockDriverTrait
1215
{
1316
private $connection;
@@ -22,7 +25,7 @@ trait MockDriverTrait
2225
public function __construct(
2326
$connection,
2427
$schemaManager,
25-
$exceptionConverter
28+
$exceptionConverter,
2629
) {
2730
$this->connection = $connection;
2831
$this->schemaManager = $schemaManager;

tests/Functional/PhpunitTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function testSkippedTest(): void
144144

145145
public function testSkippedTestDuringSetup(): void
146146
{
147-
$this->assertTrue(true);
147+
$this->expectNotToPerformAssertions();
148148
}
149149

150150
public function testMarkIncomplete(): void

0 commit comments

Comments
 (0)