From 5b21b3f59b501140be9801fab7fa8982b64cbd71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 28 Nov 2024 08:21:42 +0100 Subject: [PATCH 1/4] Update branch metadata - 3.6.x is no longer maintained. - There is no 3.8.x because 4.0.x is going to be released soon. --- .symfony.bundle.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.symfony.bundle.yaml b/.symfony.bundle.yaml index 736b508..8ce96f9 100644 --- a/.symfony.bundle.yaml +++ b/.symfony.bundle.yaml @@ -5,7 +5,6 @@ branches: - "3.6.x" - "3.7.x" maintained_branches: - - "3.6.x" - "3.7.x" doc_dir: "docs/" dev_branch: "3.7.x" From 58b88ec0300a8fe5c2a9130aedc327a4550bb514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 28 Nov 2024 13:36:04 +0100 Subject: [PATCH 2/4] Bump PHPStan to level 7 I addressed what I could, and the issues I baselined are caused by compatibility layers that should disappear in 4.0. --- phpstan-baseline.neon | 24 +++++++++++++++---- phpstan.neon.dist | 5 +++- .../LoadDataFixturesDoctrineCommand.php | 4 +++- 3 files changed, 27 insertions(+), 6 deletions(-) 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; From 5a5d13cd74e32fe5a31fc622a842ac8b4306377e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 28 Nov 2024 13:44:33 +0100 Subject: [PATCH 3/4] Drop Psalm As per the decision we took at the Hackathon. --- .gitattributes | 2 -- .github/workflows/static-analysis.yml | 2 +- composer.json | 3 +-- psalm.xml | 28 --------------------------- src/Loader/SymfonyFixturesLoader.php | 4 ++-- src/Purger/PurgerFactory.php | 2 +- 6 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 psalm.xml diff --git a/.gitattributes b/.gitattributes index fc0636b..9777239 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,5 +6,3 @@ /phpunit.xml.dist export-ignore /phpstan.neon.dist export-ignore /phpstan-baseline.neon export-ignore -/psalm.xml export-ignore -/psalm-baseline.xml export-ignore diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 1097318..196e958 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -11,4 +11,4 @@ on: jobs: static-analysis: - uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.3.0" + uses: "doctrine/.github/.github/workflows/phpstan.yml@5.3.0" diff --git a/composer.json b/composer.json index 371829d..422363a 100644 --- a/composer.json +++ b/composer.json @@ -36,8 +36,7 @@ "doctrine/coding-standard": "^12", "phpstan/phpstan": "^1.10.39", "phpunit/phpunit": "^9.6.13", - "symfony/phpunit-bridge": "^6.3.6", - "vimeo/psalm": "^5.15" + "symfony/phpunit-bridge": "^6.3.6" }, "conflict": { "doctrine/dbal": "< 3" diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 0d64635..0000000 --- a/psalm.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/src/Loader/SymfonyFixturesLoader.php b/src/Loader/SymfonyFixturesLoader.php index 17bb73a..fb4b289 100644 --- a/src/Loader/SymfonyFixturesLoader.php +++ b/src/Loader/SymfonyFixturesLoader.php @@ -27,7 +27,7 @@ final class SymfonyFixturesLoader extends SymfonyBridgeLoader /** * @internal * - * @psalm-param list}> $fixtures + * @phpstan-param list}> $fixtures */ public function addFixtures(array $fixtures): void { @@ -134,7 +134,7 @@ private function addGroupsFixtureMapping(string $className, array $groups): void /** * Collect any dependent fixtures from the given classes. * - * @psalm-return array + * @phpstan-return array */ private function collectDependencies(string ...$fixtureClass): array { diff --git a/src/Purger/PurgerFactory.php b/src/Purger/PurgerFactory.php index b625888..ac37f1b 100644 --- a/src/Purger/PurgerFactory.php +++ b/src/Purger/PurgerFactory.php @@ -9,7 +9,7 @@ interface PurgerFactory { - /** @psalm-param list $excluded */ + /** @phpstan-param list $excluded */ public function createForEntityManager( ?string $emName, EntityManagerInterface $em, From 081f397f108bb1ab8817385cd9c427cf4cd60d2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 23:20:44 +0000 Subject: [PATCH 4/4] Bump doctrine/.github from 5.3.0 to 6.0.0 Bumps [doctrine/.github](https://github.com/doctrine/.github) from 5.3.0 to 6.0.0. - [Release notes](https://github.com/doctrine/.github/releases) - [Commits](https://github.com/doctrine/.github/compare/5.3.0...6.0.0) --- updated-dependencies: - dependency-name: doctrine/.github dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/release-on-milestone-closed.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 9fb3dc0..3857b06 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,4 +12,4 @@ on: jobs: coding-standards: name: "Coding Standards" - uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.3.0" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@6.0.0" diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 429cc0b..af9efcd 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -8,7 +8,7 @@ on: jobs: release: name: "Git tag, release & create merge-up PR" - uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.3.0" + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@6.0.0" secrets: GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 196e958..20a3e5c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -11,4 +11,4 @@ on: jobs: static-analysis: - uses: "doctrine/.github/.github/workflows/phpstan.yml@5.3.0" + uses: "doctrine/.github/.github/workflows/phpstan.yml@6.0.0"