Skip to content

chore(phpstan): upgrade phpstan to 2.x - #287

Merged
jacquesbh merged 1 commit into
3.xfrom
chore/phpstan-2-upgrade
Sep 30, 2026
Merged

jacquesbh merged 1 commit into
3.xfrom
chore/phpstan-2-upgrade

Conversation

@jacquesbh

@jacquesbh jacquesbh commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

What

  • Bump dev tooling: phpstan/phpstan ^1.8.4 → ^2.2, phpstan/phpstan-doctrine ^1.3.2 → ^2.0, phpstan/phpstan-webmozart-assert ^1.1 → ^2.0 (installed: 2.2.16 / 2.0.28 / 2.0.0)
  • phpstan.neon: remove the now-unmatched missingType.generics ignore (keep missingType.iterableValue)
  • Quote @SuppressWarnings("PHPMD.*") annotations across 9 files: PHPStan 2 strictly parses PHPDoc and flags the unquoted form; PHPMD behaviour verified unchanged (quoted form honoured)
  • Add @return class-string<\Symfony\Component\Form\FormTypeInterface> docblocks on the conditional form-type getters (ImageType::getImageType(), VideoType::getImageType() / getVideoType()) so FormBuilderInterface::add() accepts them
  • WysiwygType: drop a redundant ?? self::DEFAULT_LOCALE (explode()[0] is never null) — behaviour-identical
  • Run the fixer on 2 pre-existing phpcs-flagged files (src/UiElement/Metadata.php, src/Form/Type/UiElement/SeparatorType.php: closures → static closures)

No runtime behavior changes.

Verification

  • composer validate --strict, phpmd, phpcs, phpspec (2 specs / 14 examples), yaml, twig, schema and container lints: all green
  • phpstan (level 8, PHPStan 2.2.16): 7 remaining errors, all in src/Uploader/FixtureFileUploader.php (Gaufrette class.notFound ×6 + alreadyNarrowedType ×1). These are exactly what Replace Gaufrette by FlySystem #286 fixes; this PR intentionally does not touch that file to avoid overlap. Rebase/merge after Replace Gaufrette by FlySystem #286.

Notes

  • Fresh dependency resolution installs sylius/sylius 2.3.0, which no longer ships Gaufrette — hence the errors above exist on 3.x today, independent of this upgrade.

Update: rebased onto #286's head so this PR runs on top of the Flysystem migration and CI can be green. Until #286 merges, this PR's diff also contains #286's three files (config.yaml, services.yaml, FixtureFileUploader.php). Once #286 merges, this branch will be rebased onto the new 3.x tip and the diff will show only the PHPStan upgrade.

CI note: the php (8.2) job failed at make test.schema due to doctrine/orm 3.7 (fresh resolution — sylius-standard v2.1.4 has no lock file) tripping on Sylius's unused ShipmentUnit mapping (Sylius/Sylius#19235). The Makefile now pins doctrine/orm ~3.5.0 in the test application, matching what the 8.3 job already installs from sylius-standard v2.1.6's lock. Unrelated to the PHPStan upgrade itself (php 8.3 passes the full suite).

@jacquesbh
jacquesbh force-pushed the chore/phpstan-2-upgrade branch 3 times, most recently from 7ea71cd to a692926 Compare September 30, 2026 10:40
@jacquesbh
jacquesbh force-pushed the chore/phpstan-2-upgrade branch from a692926 to 67cb8f7 Compare September 30, 2026 21:21
@jacquesbh
jacquesbh merged commit da5c6db into 3.x Sep 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant