Skip to content

Commit f732578

Browse files
staabmdg
authored andcommitted
Fix "Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect" (#49)
1 parent 5b455c0 commit f732578

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Fixer/ClassAndTraitVisibilityRequiredFixer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ protected function applyFix(SplFileInfo $file, Tokens $tokens): void
6565
* and "applyFix()" is final, there is no other way round it.
6666
*/
6767
$method = new ReflectionMethod($this->visibilityRequiredFixer, 'applyFix');
68-
$method->setAccessible(true);
68+
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
69+
$method->setAccessible(true);
70+
}
6971
$method->invoke($this->visibilityRequiredFixer, $file, $tokens);
7072
}
7173

0 commit comments

Comments
 (0)