Skip to content

Commit

Permalink
Merge pull request #467 from greg0ire/phpstan-lvl-7
Browse files Browse the repository at this point in the history
Bump PHPStan to level 7
  • Loading branch information
SenseException authored Nov 28, 2024
2 parents 786baee + 58b88ec commit 17fff4a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
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

0 comments on commit 17fff4a

Please sign in to comment.