Skip to content

Commit

Permalink
Code Modernization: Remove obsolete comments about older PHP versions.
Browse files Browse the repository at this point in the history
This commit:
* Removes various comments referencing PHP versions which are no longer supported.
* Removes various comments containing “hints” of things to do after a particular PHP version drop. These hints are incorrect/not actionable for various reasons, so have no value:
 * Even though a function could be turned into a closure, removing the function would be a backward compatibility 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.

Follow-up to [1243/tests], [6543], [11816], [29861], [29864], [34928], [35369], [36698], [38694], [50786], [58678].

Props jrf, ayeshrajans.
See #61574.

git-svn-id: https://develop.svn.wordpress.org/trunk@58682 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jul 6, 2024
1 parent f90c8bf commit 9de2177
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/includes/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
}

$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
$link_rel = isset( $link->link_rel ) ? $link->link_rel : '';
$link_rels = preg_split( '/\s+/', $link_rel );

// Mark the specified value as checked if it matches the current link's relationship.
Expand Down
3 changes: 1 addition & 2 deletions src/wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6141,8 +6141,7 @@ public function _sanitize_external_header_video( $value ) {
* This method exists because the partial object and context data are passed
* into a partial's render_callback so we cannot use get_custom_logo() as
* the render_callback directly since it expects a blog ID as the first
* argument. When WP no longer supports PHP 5.3, this method can be removed
* in favor of an anonymous function.
* argument.
*
* @see WP_Customize_Manager::register_controls()
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class WP_Object_Cache {
private $multisite;

/**
* Sets up object properties; PHP 5 style constructor.
* Sets up object properties.
*
* @since 2.0.8
*/
Expand Down
8 changes: 2 additions & 6 deletions src/wp-includes/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,8 @@ function ms_allowed_http_request_hosts( $is_external, $host ) {
* A wrapper for PHP's parse_url() function that handles consistency in the return values
* across PHP versions.
*
* PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute URLs, including
* schemeless and relative URLs with "://" in the path. This function works around
* those limitations providing a standard output on PHP 5.2~5.4+.
*
* Secondly, across various PHP versions, schemeless URLs containing a ":" in the query
* are being handled inconsistently. This function works around those differences as well.
* Across various PHP versions, schemeless URLs containing a ":" in the query
* are being handled inconsistently. This function works around those differences.
*
* @since 4.4.0
* @since 4.7.0 The `$component` parameter was added for parity with PHP's `parse_url()`.
Expand Down
2 changes: 0 additions & 2 deletions src/wp-includes/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ function wp_is_maintenance_mode() {
/**
* Gets the time elapsed so far during this PHP script.
*
* Uses REQUEST_TIME_FLOAT that appeared in PHP 5.4.0.
*
* @since 5.8.0
*
* @return float Seconds since the PHP script started.
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/rest-api/class-wp-rest-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ protected function parse_json_params() {
* Parses the request body parameters.
*
* Parses out URL-encoded bodies for request methods that aren't supported
* natively by PHP. In PHP 5.x, only POST has these parsed automatically.
* natively by PHP.
*
* @since 4.4.0
*/
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/tests/formatting/escTextarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public function charset_iso_8859_1() {
}

/*
* Only fails in PHP 5.4 onwards
* @ticket 23688
*/
public function test_esc_textarea_charset_iso_8859_1() {
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/tests/formatting/wpHtmleditPre.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function charset_iso_8859_1() {
}

/*
* Only fails in PHP 5.4 onwards
* @ticket 23688
*/
public function test_wp_htmledit_pre_charset_iso_8859_1() {
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/tests/formatting/wpRicheditPre.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function charset_iso_8859_1() {
}

/*
* Only fails in PHP 5.4 onwards
* @ticket 23688
*/
public function test_wp_richedit_pre_charset_iso_8859_1() {
Expand Down
12 changes: 6 additions & 6 deletions tests/phpunit/tests/http/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function data_wp_parse_url() {
),
),

// < PHP 5.4.7: Schemeless URL.
// Schemeless URL.
array(
'//example.com/path/',
array(
Expand All @@ -138,7 +138,7 @@ public function data_wp_parse_url() {
),
),

// < PHP 5.4.7: Scheme separator in the URL.
// Scheme separator in the URL.
array(
'http://example.com/http://example.net/',
array(
Expand All @@ -149,7 +149,7 @@ public function data_wp_parse_url() {
),
array( '/path/http://example.net/', array( 'path' => '/path/http://example.net/' ) ),

// < PHP 5.4.7: IPv6 literals in schemeless URLs are handled incorrectly.
// IPv6 literals in schemeless URLs.
array(
'//[::FFFF::127.0.0.1]/',
array(
Expand Down Expand Up @@ -238,21 +238,21 @@ public function data_wp_parse_url_with_component() {
array( self::FULL_TEST_URL, PHP_URL_QUERY, 'arg1=value1&arg2=value2' ),
array( self::FULL_TEST_URL, PHP_URL_FRAGMENT, 'anchor' ),

// < PHP 5.4.7: Schemeless URL.
// Schemeless URL.
array( '//example.com/path/', PHP_URL_HOST, 'example.com' ),
array( '//example.com/path/', PHP_URL_PATH, '/path/' ),
array( '//example.com/', PHP_URL_HOST, 'example.com' ),
array( '//example.com/', PHP_URL_PATH, '/' ),
array( 'http://example.com//path/', PHP_URL_HOST, 'example.com' ),
array( 'http://example.com//path/', PHP_URL_PATH, '//path/' ),

// < PHP 5.4.7: Scheme separator in the URL.
// Scheme separator in the URL.
array( 'http://example.com/http://example.net/', PHP_URL_HOST, 'example.com' ),
array( 'http://example.com/http://example.net/', PHP_URL_PATH, '/http://example.net/' ),
array( '/path/http://example.net/', PHP_URL_HOST, null ),
array( '/path/http://example.net/', PHP_URL_PATH, '/path/http://example.net/' ),

// < PHP 5.4.7: IPv6 literals in schemeless URLs are handled incorrectly.
// IPv6 literals in schemeless URLs.
array( '//[::FFFF::127.0.0.1]/', PHP_URL_HOST, '[::FFFF::127.0.0.1]' ),
array( '//[::FFFF::127.0.0.1]/', PHP_URL_PATH, '/' ),

Expand Down

0 comments on commit 9de2177

Please sign in to comment.