Skip to content

Require PHP 8.4, replace Psalm with PHPStan, upgrade Valinor to 2.x, remove PSL#24

Merged
loevgaard merged 2 commits into
1.xfrom
upgrade-php84-phpstan-valinor2
Jun 10, 2026
Merged

Require PHP 8.4, replace Psalm with PHPStan, upgrade Valinor to 2.x, remove PSL#24
loevgaard merged 2 commits into
1.xfrom
upgrade-php84-phpstan-valinor2

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

  • PHP >= 8.4: bumped the platform requirement; CI now tests PHP 8.4 and 8.5 (lowest + highest deps). symfony/options-resolver trimmed to ^6.4 || ^7.0 || ^8.0.
  • Psalm → PHPStan: setono/code-quality-pack ^3.4 brings PHPStan 2.x with strict rules, PHPUnit and webmozart-assert extensions. New phpstan.dist.neon at level max (no baseline), includes Valinor's bundled PHPStan extension so the array-shape mapping in Parser stays fully typed. All @psalm-* annotations converted to @phpstan-* equivalents or made redundant by inline narrowing.
  • Valinor ^2.0: error handling migrated from Messages::flattenFromNode($e->node()) to $e->messages(); the shared MapperBuilder now also sets allowPermissiveTypes() since Valinor 2's strict mode otherwise rejects the mixed block data.
  • azjezz/psl removed: the top-level JSON shape validation in Parser::parse() is now done by Valinor mapping to an array shape. InvalidDataException::__construct() consequently accepts CuyZ\Valinor\Mapper\MappingError instead of PSL's AssertException.
  • PHPUnit 9 → 11 (via the pack): config migrated to the new schema, annotations converted to attributes, data providers made public static.
  • Rector 2.x: config modernized with PHP 8.4 + PHPUnit attribute sets and applied (new new X()->method() chaining, explicit nullable params, etc.).

Behavior notes

  • Unknown top-level keys in the EditorJS JSON are now tolerated (PSL's shape() rejected them) — more lenient, forward-compatible with new EditorJS exports.
  • phpunit/phpunit is intentionally not a direct dev dependency (provided by the pack); the shadow-dependency finding is ignored in composer-dependency-analyser.php.

Test plan

  • vendor/bin/phpunit green on highest and lowest deps (46 tests)
  • vendor/bin/phpstan 0 errors at level max on highest and lowest deps
  • composer check-style, vendor/bin/rector --dry-run, vendor/bin/composer-dependency-analyser, composer validate --strict, composer normalize --dry-run all clean
  • Infection mutation tests run in CI

…remove PSL

- Require PHP >= 8.4 and trim symfony/options-resolver to ^6.4 || ^7.0 || ^8.0
- Replace Psalm with PHPStan (level max) via setono/code-quality-pack ^3.4
- Upgrade cuyz/valinor to ^2.0 and let it handle the top-level JSON shape
  validation previously done with azjezz/psl
- Migrate test suite to PHPUnit 11 (attributes, static data providers)
- Modernize rector.php for Rector 2.x with PHP 8.4 + PHPUnit sets
- Update CI matrices to PHP 8.4 and 8.5
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.12500% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.91%. Comparing base (9832f76) to head (55782c0).

Files with missing lines Patch % Lines
src/Exception/InvalidDataException.php 0.00% 5 Missing ⚠️
src/Exception/MappingErrorException.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                1.x      #24      +/-   ##
============================================
- Coverage     82.41%   81.91%   -0.51%     
- Complexity       83       86       +3     
============================================
  Files            29       29              
  Lines           290      293       +3     
============================================
+ Hits            239      240       +1     
- Misses           51       53       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loevgaard loevgaard merged commit f1ad562 into 1.x Jun 10, 2026
15 of 17 checks passed
@loevgaard loevgaard deleted the upgrade-php84-phpstan-valinor2 branch June 10, 2026 09:06
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