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

Trac #61574 - remove some more redundant code/docs #6975

Closed

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 5, 2024

Remove redundant PHP version check

What with the minimum supported PHP version currently being PHP 7.2.x, this check has become redundant.

Docs: remove redundant comments [1]

This commit removes various comments containing "hints" of things to do after a particular PHP version drop. These hints are incorrect/not actionable for various reasons (see below), so have no value.

Some typical reasons:

  • Even though a function could be turned into a closure, removing the function would be a BC-break which is not acceptable, so this suggestion is not actionable.
  • Short ternaries are forbidden by the coding standard exactly to prevent the faulty code suggested in the comment from getting into the codebase.

Docs: remove redundant comments [2]

This commit removes various comments referencing PHP versions which are no longer supported. These PHP version references have no value anymore now support for those PHP versions has been dropped.

wp_is_ini_value_changeable(): minor simplification

This commit reverts the code to the code from before the bug fix related to PHP 5.2.6-5.2.17.
As support for PHP 5.2 has been dropped, the work-around for the PHP 5.2 bug is no longer needed.

Refs:

Trac ticket: https://core.trac.wordpress.org/ticket/61574


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

jrfnl added 3 commits July 5, 2024 13:28
What with the minimum supported PHP version currently being PHP 7.2.x, this check has become redundant.
This commit removes various comments containing "hints" of things to do after a particular PHP version drop. These hints are incorrect/not actionable for various reasons (see below), so have no value.

Some typical reasons:
* Even though a function could be turned into a closure, removing the function would be a BC-break which is not acceptable, so this suggestion is not actionable.
* Short ternaries are forbidden by the coding standard exactly to prevent the faulty code suggested in the comment from getting into the codebase.
This commit removes various comments referencing PHP versions which are no longer supported. These PHP version references have no value anymore no support for those PHP versions has been dropped.
Copy link

github-actions bot commented Jul 5, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jrf, ayeshrajans.

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

This commit reverts the code to the code from before the bug fix related to PHP 5.2.6-5.2.17.
As support for PHP 5.2 has been dropped, the work-around for the PHP 5.2 bug is no longer needed.

Refs:
* 78789be
* SVN commit 38017
@jrfnl jrfnl force-pushed the trac-61574/remove-more-redundant-checks branch from cdbe1f3 to 8826ea3 Compare July 5, 2024 11:36
Copy link

github-actions bot commented Jul 5, 2024

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link

@Ayesh Ayesh left a comment

Choose a reason for hiding this comment

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

The changes look great! Thank you.

This is perhaps outside of the scope of this ticket/PR, but I was wondering what's your opinion on simplifying methods such as \WpOrg\Requests\Utility\InputValidator::is_iterable to use the now-available is_iterable.

I also noticed a few substr(PHP_OS, 0, 3) checks that we can simplify with (PHP 7.2+) PHP_OS_FAMILY. Perhaps in a separate ticket? because these are not strictly removals.

@jrfnl
Copy link
Member Author

jrfnl commented Jul 5, 2024

This is perhaps outside of the scope of this ticket/PR, but I was wondering what's your opinion on simplifying methods such as \WpOrg\Requests\Utility\InputValidator::is_iterable to use the now-available is_iterable.

Well, for one, Requests is an external library, so that's out of scope. Additionally, Requests still has a PHP 5.6 minimum, so again, no go.

I also noticed a few substr(PHP_OS, 0, 3) checks that we can simplify with (PHP 7.2+) PHP_OS_FAMILY. Perhaps in a separate ticket? because these are not strictly removals.

That sounds like a perfectly sensible change to make and would really simplify some code snippets. In my opinion, it's fine to do that under the same ticket umbrella as it's along the same lines, i.e. "removing work-arounds which were needed to support PHP < 7.2".

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in r58682 and r58683.

@jrfnl jrfnl deleted the trac-61574/remove-more-redundant-checks branch July 6, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants