Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Remove redundant 'setAccessible' methods #47348

Merged

Conversation

bradietilley
Copy link
Contributor

The setAccessible() method has had no effect (i.e. is redundant) as of PHP 8.1

Laravel 10 has a minimum requirement of PHP 8.1, therefore officially dropping the requirement to retain these methods.

This PR simply removes all instances of ->setAccessible(true) from all ReflectionProperty and ReflectionMethod objects throughout the src/ and tests/ directories.

Sources:

ReflectionMethod::setAccessible(): 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.

ReflectionProperty::setAccessible(): https://www.php.net/manual/en/reflectionproperty.setaccessible.php

Note: As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default.

@driesvints driesvints changed the title Remove redundant 'setAccessible' methods [10.x] Remove redundant 'setAccessible' methods Jun 5, 2023
@taylorotwell taylorotwell merged commit 0f0352e into laravel:10.x Jun 5, 2023
16 checks passed
@bradietilley bradietilley deleted the remove-setaccessible-methods branch June 5, 2023 13: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.

None yet

3 participants