ReflectionMethod Adapter: Calling setAccessible() shouldn't be needed for non-public methods as of PHP 8.1
ondrejmirtes opened this issue · 1 comments
ondrejmirtes commented
https://www.php.net/manual/en/reflectionmethod.setaccessible.php
Note: As of PHP 8.1.0, calling this method has no effect; all methods are invokable by default.
But the adapter here still requires it before calling invoke()
:
BetterReflection/src/Reflection/Adapter/ReflectionMethod.php
Lines 238 to 240 in c834c79
The options IMHO are:
- Remove the
isAccessible()
check and be done with it. - Require it only when running on PHP 8 but not on PHP 8.1+.
- Remove the
isAccessible()
check and set PHP 8.1 as a new minimum version.
Originally reported: phpstan/phpstan#7429
Ocramius commented
We can just drop the check IMO.