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

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

Merged
merged 2 commits into from
Jun 1, 2020
Merged

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

merged 2 commits into from
Jun 1, 2020

Conversation

GrahamCampbell
Copy link
Member

->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

@@ -157,16 +157,20 @@ protected static function getCallReflector($callback)
protected static function addDependencyForCallParameter($container, $parameter,
array &$parameters, &$dependencies)
{
if (array_key_exists($parameter->name, $parameters)) {
$dependencies[] = $parameters[$parameter->name];
if (array_key_exists($parameter->getName(), $parameters)) {
Copy link
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
Member 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.

None yet

3 participants