Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to phpstan ^2 #309

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
],
'phpdoc_var_annotation_correct_order' => true,
'void_return' => true,
'trailing_comma_in_multiline' => false,
])
;
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* @internal
*
* @phpstan-ignore trait.unused
*/
trait StaticConnectionTrait
{
Expand Down
12 changes: 6 additions & 6 deletions src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ 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();
PHPUnitExtension::$transactionStarted = true;
}
});

$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
Expand All @@ -68,22 +68,22 @@ 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
PHPUnitExtension::rollBack();
}
});

$facade->registerSubscriber(new class() implements TestRunnerFinishedSubscriber {
$facade->registerSubscriber(new class implements TestRunnerFinishedSubscriber {
public function notify(TestRunnerFinishedEvent $event): void
{
StaticDriver::setKeepStaticConnections(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;

/**
* @phpstan-ignore trait.unused
*/
trait MockDriverTrait
{
private $connection;
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/PhpunitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function testSkippedTest(): void

public function testSkippedTestDuringSetup(): void
{
$this->assertTrue(true);
$this->expectNotToPerformAssertions();
}

public function testMarkIncomplete(): void
Expand Down
Loading