Skip to content

[6.x] Support PHP 8's reflection API - #33039

Merged
taylorotwell merged 2 commits into
6.xfrom
php8-reflection
Jun 1, 2020
Merged

[6.x] Support PHP 8's reflection API#33039
taylorotwell merged 2 commits into
6.xfrom
php8-reflection

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

->getClass() was actually never documented in PHP 5/7 and was never intended to be used by the public. It has been deprecated in PHP 8 for removal soon after. We should use the documented reflection parameter APIs only.

This fixes, for example:

ErrorException: Method ReflectionParameter::getClass() is deprecated
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:873
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:836
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:687
.../vendor/laravel/framework/src/Illuminate/Foundation/Application.php:796
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:265
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:801
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:687
.../vendor/laravel/framework/src/Illuminate/Foundation/Application.php:796
.../vendor/laravel/framework/src/Illuminate/Container/Container.php:633
.../vendor/laravel/framework/src/Illuminate/Foundation/Application.php:781
.../vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php:328
.../vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php:203
.../vendor/orchestra/testbench-core/src/TestCase.php:73
.../vendor/orchestra/testbench-core/src/Concerns/Testing.php:68
.../vendor/orchestra/testbench-core/src/TestCase.php:41

@taylorotwell
taylorotwell merged commit 1af0632 into 6.x Jun 1, 2020
@GrahamCampbell
GrahamCampbell deleted the php8-reflection branch June 1, 2020 14:41
{
if (array_key_exists($parameter->name, $parameters)) {
$dependencies[] = $parameters[$parameter->name];
if (array_key_exists($parameter->getName(), $parameters)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was ->name changed to ->getName() everywhere? If that property no longer exists, that wasn't intentional and should be fixed on our side.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't a fix, per say. It was just a move to use the documented methods for getting the name. :)

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.

3 participants