Skip to content

Fix PHP 8.5 reflection deprecations#19

Open
kalifg wants to merge 2 commits intomasterfrom
php85-reflection-deprecations
Open

Fix PHP 8.5 reflection deprecations#19
kalifg wants to merge 2 commits intomasterfrom
php85-reflection-deprecations

Conversation

@kalifg
Copy link
Copy Markdown
Member

@kalifg kalifg commented Apr 29, 2026

Summary

  • Remove deprecated ReflectionMethod::setAccessible() and ReflectionProperty::setAccessible() calls from the loader path.
  • Replace ReflectionParameter::getClass() usage with ReflectionParameter::getType() / ReflectionNamedType handling.
  • Target the maintained fork at PHP ^8.4, upgrade the dev test runner to PHPUnit 11, and clean up PHPUnit/PHP deprecations in the tests.
  • Add GitHub Actions coverage for PHP 8.4 and 8.5.

Verification

  • composer validate --strict --no-check-lock
  • php -l src/Nelmio/Alice/Loader/Base.php && php -l tests/Nelmio/Alice/Loader/BaseTest.php && php -l tests/Nelmio/Alice/FixturesTest.php && php -l tests/Nelmio/Alice/fixtures/User.php && php -l phpunit.xml.dist
  • rg -n '@expectedException|setExpectedException|getMock\\(|assertRegExp|returnValue\\(|setAccessible|getClass\\(' src tests phpunit.xml.dist || true
  • vendor/bin/phpunit --display-all-issues --fail-on-phpunit-deprecation on PHP 8.4.7
  • docker run --rm -v "$PWD":/app -w /app php:8.5-cli php vendor/bin/phpunit --display-all-issues --fail-on-phpunit-deprecation on PHP 8.5.5

Notes

  • This intentionally stays scoped to PHP 8.4/8.5 readiness for the existing fork. It does not attempt an upstream Alice migration. I feel like this is the path of least resistance for PHP 8.5 even though hopefully soon (after ORM 3.x and Symfony 7) we will get compatible with modern Alice abandon this fork.

@kalifg kalifg requested a review from umpirsky April 29, 2026 15:46
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.

2 participants