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

Use PHP 7.2 features in Optimization Detective #1162

Merged
merged 6 commits into from
Apr 19, 2024

Conversation

westonruter
Copy link
Member

In #1130 the PHP version was bumped to 7.2. This allows us to make use of new PHP language features which further harden static analysis (related to #775). Changes in this PR include:

  • Use the void return type
  • Use the nullable type
  • Add value types for arrays
  • Add improved typing to prevent having to ignore the following errors in PHPStan level 6:
    • #^(Function|Method) .+? return type has no value type specified in iterable type array#
    • #^(Function|Method) .+? has parameter .+? with no value type specified in iterable type array#
    • #^(Function|Method) .+? has no return type specified#

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels Apr 18, 2024
Copy link

github-actions bot commented Apr 18, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: thelovekesh <thelovekesh@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

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

Just one suggestion, but looks good. Pre-approving.

plugins/optimization-detective/class-od-url-metric.php Outdated Show resolved Hide resolved
@@ -27,7 +27,7 @@
* @access private
* @link https://core.trac.wordpress.org/ticket/43258
*
* @param string $passthrough Optional. Filter value. Default null.
* @param string $passthrough Value for the template_include filter which is passed through.
Copy link
Member

Choose a reason for hiding this comment

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

Good catch ✨

Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com>
@westonruter westonruter merged commit 181cf6f into trunk Apr 19, 2024
21 checks passed
@westonruter westonruter deleted the update/od-php72-features branch April 19, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants