Skip to content

fix: remove setAccessible() calls deprecated in PHP 8.5 - #1253

Open
ThomasSimplis wants to merge 1 commit into
overblog:masterfrom
ThomasSimplis:fix/php85-setaccessible-deprecation
Open

ThomasSimplis wants to merge 1 commit into
overblog:masterfrom
ThomasSimplis:fix/php85-setaccessible-deprecation

Conversation

@ThomasSimplis

@ThomasSimplis ThomasSimplis commented Dec 3, 2026 •

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes (no change from master; see below)
Documented? no
Fixed tickets -
License MIT

ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() have had no effect since PHP 8.1 and are deprecated since PHP 8.5. On PHP 8.5, validating an input therefore triggers:

Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1
Method ReflectionMethod::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1

from Validator\Mapping\ObjectMetadata (twice) and Validator\Mapping\PropertyMetadata. The bundle requires PHP >= 8.1, so the calls can simply be removed. Private members stay readable and invokable through reflection without them.

Tests: on PHP 8.5.13, bin/phpunit gives the same result on this branch as on master (714 tests). The 7 errors and 28 deprecations it reports on both come from react/promise v2 in the dev dependencies on PHP 8.5, not from this change. php-cs-fixer reports nothing on the changed files.

ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible()
have had no effect since PHP 8.1 and are deprecated since PHP 8.5. The
bundle requires PHP >= 8.1, so the calls can be dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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