Skip to content

Modernize for PHP >= 8.2: native types, PHPUnit 11, PHPStan - #9

Merged
antfroger merged 4 commits into
mainfrom
php-82
Sep 10, 2026
Merged

Modernize for PHP >= 8.2: native types, PHPUnit 11, PHPStan#9
antfroger merged 4 commits into
mainfrom
php-82

Conversation

@antfroger

@antfroger antfroger commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

Modernizes the library for PHP >= 8.2,
and raises the internal quality tooling accordingly.

⚠️ Breaking changes

  • PHP >= 8.2 required (was ^8.1)
  • RuleInterface::decide() signature unified: now decide(ParameterBagInterface $bag, mixed $params = null): bool.
    Implementations must accept the config value as a single mixed argument instead of custom optional parameters
    (bool $value = false, array $rules = [], variadics...). Runtime behavior is unchanged: the raw config value
    is passed as-is, whatever its type.
  • Custom rules store the callable as a Closure (converted internally via first-class callables — public APIs still accept callable)
  • Rule classes are now final readonly; Progressive is final
  • Constructor promotion and native property types throughout src/

Changed

  • composer: php ^8.2, phpunit ^11, php-cs-fixer ^3.26
  • New autoload-dev PSR-4 mapping for tests (Progressive\Tests\)
  • PHPUnit 11: metadata migrated from docblocks to attributes (#[DataProvider]), data providers are static
    generator-based functions with named keys
  • phpunit.xml.dist migrated to the PHPUnit 11 schema

Added

  • PHPStan at level 8, including checked-exception validation, on src/ and tests/
  • Complete @throws documentation of the public API (ValidateException, RuleNotFoundException, ParameterNotFoundException)
  • Unit tests covering custom rules with scalar, string, array and null config values

- composer.json: bump php to ^8.2, phpunit to ^11
- Native property types, constructor promotion, final readonly classes
- Store custom rules as Closure (converts callable via first-class callables)
- Migrate test suite: PHPUnit 11 attributes, static providers,
  generator-based data sets with named keys
@antfroger antfroger changed the title Update the lib for PHP >= 8.2 Modernize for PHP >= 8.2: native types, PHPUnit 11, PHPStan Sep 10, 2026
@antfroger
antfroger merged commit 5de1aca into main Sep 10, 2026
16 checks passed
@antfroger
antfroger deleted the php-82 branch September 10, 2026 12:12
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