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

Update deprecated isArray() method in Controller.php #20156

Merged
merged 3 commits into from
May 16, 2024

Conversation

creativebash
Copy link
Contributor

Update deprecated ReflectionParameter::isArray() method.
Reference (PHP 8): https://php.watch/versions/8.0/deprecated-reflectionparameter-methods

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues N/A

Description:

This pull request addresses the deprecation warning related to the ReflectionParameter::isArray() method in PHP 8. Instead of using the deprecated method, the code now utilizes $param->getType() && $param->getType()->getName() === 'array' to achieve the same functionality.

Changes Made:

  • Replaced deprecated ReflectionParameter::isArray() method with $param->getType() && $param->getType()->getName() === 'array'.

Additional Notes:

  • The changes are made in accordance with the recommendations for PHP 8 compatibility.
  • No backward compatibility breaks are introduced.
  • No new features or bug fixes are included in this pull request.

Please review and merge as appropriate. Thank you!

@samdark samdark added this to the 2.0.50 milestone May 15, 2024
@rob006
Copy link
Contributor

rob006 commented May 15, 2024

IMO it makes more sense to remove if (PHP_VERSION_ID >= 80000) condition completely, as currently both branches of this if are effectively the same.

@samdark
Copy link
Member

samdark commented May 16, 2024

@rob006 applied your suggestion. Let's see if tests will pass.

@samdark
Copy link
Member

samdark commented May 16, 2024

@creativebash would you please add a line for CHANGELOG?

@rob006
Copy link
Contributor

rob006 commented May 16, 2024

@samdark I don't think that this needs a changelog entry, as this does not change behavior at all. It is just a code simplification.

@creativebash
Copy link
Contributor Author

Same thoughts @rob006. Behaviour remains the same.

Watching out for the test ...

@samdark
Copy link
Member

samdark commented May 16, 2024

Test looks alright.

@samdark samdark merged commit f2ea9be into yiisoft:master May 16, 2024
70 of 71 checks passed
@samdark
Copy link
Member

samdark commented May 16, 2024

Thanks!

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.

4 participants