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

Bump PHPStan to level 7 #467

Merged
merged 1 commit into from
Nov 28, 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
24 changes: 20 additions & 4 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
parameters:
excludePaths:
# Contains an error that is impossible to ignore
- tests/IntegrationTest.php

ignoreErrors:
-
message: "#^Method class@anonymous/src/Command/LoadDataFixturesDoctrineCommand\\.php\\:140\\:\\:log\\(\\) has parameter \\$message with no type specified\\.$#"
count: 1
path: src/Command/LoadDataFixturesDoctrineCommand.php

-
message: "#^Call to an undefined method Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyFixturesLoader\\:\\:getFixture\\(\\)\\.$#"
count: 1
Expand All @@ -19,12 +20,27 @@ parameters:
count: 1
path: src/Loader/SymfonyFixturesLoader.php

-
message: "#^Method Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyFixturesLoader\\:\\:createFixture\\(\\) has parameter \\$class with no type specified\\.$#"
count: 1
path: src/Loader/SymfonyFixturesLoader.php

-
message: "#^Class Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyFixturesLoader does not have a constructor and must be instantiated without any parameters\\.$#"
count: 2
path: tests/Command/LoadDataFixturesDoctrineCommandTest.php

-
message: "#^Dead catch \\- TypeError is never thrown in the try block\\.$#"
count: 1
path: tests/Command/LoadDataFixturesDoctrineCommandTest.php

-
message: "#^Constructor of class Doctrine\\\\Bundle\\\\FixturesBundle\\\\Tests\\\\Fixtures\\\\FooBundle\\\\DataFixtures\\\\RequiredConstructorArgsFixtures has an unused parameter \\$fooRequiredArg\\.$#"
count: 1
path: tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php

-
message: "#^Method Doctrine\\\\Bundle\\\\FixturesBundle\\\\Tests\\\\IntegrationTestKernel\\:\\:registerBundles\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: tests/IntegrationTestKernel.php
5 changes: 4 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
parameters:
phpVersion: 80100
level: 3
level: 7
paths:
- src
- tests
excludePaths:
# Contains an issue that cannot be ignored
- tests/IntegrationTest.php

includes:
- phpstan-baseline.neon
4 changes: 3 additions & 1 deletion src/Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\Bundle\FixturesBundle\Purger\ORMPurgerFactory;
use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurgerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Psr\Log\AbstractLogger;
Expand Down Expand Up @@ -128,12 +129,13 @@ private function doExecute(InputInterface $input, OutputInterface $output): int
$factory = $this->purgerFactories[$input->getOption('purger')];
}

$purger = $factory->createForEntityManager(
$purger = $factory->createForEntityManager(
$input->getOption('em'),
$em,
$input->getOption('purge-exclusions'),
$input->getOption('purge-with-truncate'),
);
assert($purger instanceof ORMPurgerInterface);
$executor = new ORMExecutor($em, $purger);
$executor->setLogger(new class ($ui) extends AbstractLogger {
private SymfonyStyle $ui;
Expand Down