diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a948ea6..35886e5 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 @@ -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 diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ff48748..45296fa 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -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 diff --git a/src/Command/LoadDataFixturesDoctrineCommand.php b/src/Command/LoadDataFixturesDoctrineCommand.php index 4aecac9..fe62261 100644 --- a/src/Command/LoadDataFixturesDoctrineCommand.php +++ b/src/Command/LoadDataFixturesDoctrineCommand.php @@ -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; @@ -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;