WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 6 days ago

#53359 new task (blessed)

Coding Standards fixes for WP 5.9

Reported by: desrosj Owned by:
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Previously:

Change History (65)

@kapilpaul
4 months ago

Patch for PHPCS fixing in bundled themes.

#1 @kapilpaul
4 months ago

In 53359.diff mostly fixed the strict comparison. here is the GitHub PR

#2 @SergeyBiryukov
4 months ago

In 51285:

Coding Standards: Remove redundant type casting to array in WP_Query::get_posts().

This brings some consistency with other instances of using get_post_stati() in core.

get_post_stati() always returns an array, so the type casting is not needed.

Follow-up to [13172].

See #53359.

#3 @SergeyBiryukov
4 months ago

In 51381:

Coding Standards: Remove wrapping HTML tags from translatable strings.

This fixes a "Strings should not be wrapped in HTML" WPCS warning in help tabs for Export Personal Data and Erase Personal Data screens.

Follow-up to [50147].

See #53359.

#4 @SergeyBiryukov
3 months ago

In 51399:

Coding Standards: Rename the $ID variable to $user_id in wp_insert_user() and wp_update_user().

This fixes a "Variable $ID is not in valid snake_case format" WPCS warning.

Follow-up to [2872].

See #53359.

#5 @SergeyBiryukov
3 months ago

In 51400:

Bundled Themes: Correct comment formatting in inc/block-patterns.php.

Follow-up to [51045], [51103].

Props kapilpaul.
See #53359, #52627.

#6 @SergeyBiryukov
3 months ago

In 51401:

Twenty Fifteen: Use strict comparison in inc/custom-header.php.

Props kapilpaul.
See #53359.

#7 @desrosj
3 months ago

In 51406:

Bundled Themes: Correct comment formatting in inc/block-patterns.php.

Follow-up to [51045], [51103].

Props kapilpaul, SergeyBiryukov.
See #53359, #52627.

This ticket was mentioned in PR #1509 on WordPress/wordpress-develop by jrfnl.


3 months ago

  • Keywords has-patch has-unit-tests added

#9 @jrf
3 months ago

I've just uploaded 9 CS related patches to fix some low hanging fruit. To verify, one PR containing all these patches has been opened on GH and the build is passing: https://github.com/WordPress/wordpress-develop/pull/1509

#10 @prbot
3 months ago

hellofromtonya commented on PR #1509:

@jrfnl Is this PR complete and ready for code review?

#11 @prbot
3 months ago

jrfnl commented on PR #1509:

@hellofromtonya There will always be more fixes to make, but the fixes as pulled here are ready for commit as far as I'm concerned.

#12 @jrf
3 months ago

Added three more patches related to the ignore annotation review done for #53477. As the changes in ignore annotations are not related to the PHPCS update in #53477, I'm adding the patches here.

This ticket was mentioned in PR #1510 on WordPress/wordpress-develop by jrfnl.


3 months ago

Update the PHP_CodeSniffer dependency from version 3.5.5 to version 3.6.0.

I have also verified the ignore annotations, but no changes are needed there which are directly related to the PHPCS update. Changes which could be made have been added to #53359.

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

#14 @hellofromTonya
3 months ago

  • Keywords commit added

Marking submitted patches from [https://github.com/WordPress/wordpress-develop/pull/1509 PR 1509) ready for commit.

#15 @prbot
3 months ago

jrfnl commented on PR #1510:

Closing as merged via changeset https://core.trac.wordpress.org/changeset/51470

#16 @SergeyBiryukov
3 months ago

In 51526:

Coding Standards: Fix typo in the JS function name for handling the password reset button.

Follow-up to [50129].

See #53359.

#17 @SergeyBiryukov
3 months ago

In 51534:

Coding Standards: Correct DateTimeZone class name in WP_Customize_Date_Time_Control::get_timezone_info().

Follow-up to [41626].

See #53359.

#18 @peterwilsoncc
3 months ago

In 51548:

Coding Standards: Use strict comparisons in wp-admin/options-discussion.php.

See #53359.

#19 @peterwilsoncc
3 months ago

In 51549:

Coding Standards: Use strict comparisons in wp-admin/upload.php.

See #53359.

#20 @SergeyBiryukov
3 months ago

In 51550:

Coding Standards: Fix incorrect comment indent in safecss_filter_attr().

Props jrf.
See #53359.

#21 @SergeyBiryukov
3 months ago

In 51551:

Coding Standards: Fix incorrect alignment in two comment blocks.

Tabs should only be used for indentation and not for mid-line alignment.

Props jrf.
See #53359.

#22 @SergeyBiryukov
3 months ago

In 51552:

Coding Standards: Remove redundant semicolons after closing curly brackets.

Props jrf.
See #53359.

#23 @SergeyBiryukov
3 months ago

In 51553:

Bundled Themes: Remove redundant semicolons after closing curly brackets.

Includes a few minor indentation fixes.

Props jrf.
See #53359.

#24 @SergeyBiryukov
3 months ago

In 51554:

Twenty Thirteen: Remove wrapping HTML tag from translatable string.

This fixes a "Strings should not be wrapped in HTML" WPCS warning.

Props jrf.
See #53359.

#25 @SergeyBiryukov
3 months ago

In 51556:

Twenty Thirteen: Correct indentation in image.php template.

Props jrf.
See #53359.

#26 @SergeyBiryukov
3 months ago

In 51557:

Coding Standards: Silence a WPCS warning in date_i18n().

This fixes a "Calling current_time() with a $type of timestamp or U is strongly discouraged as it will not return a Unix (UTC) timestamp" warning.

Props jrf.
See #53359.

This ticket was mentioned in PR #1552 on WordPress/wordpress-develop by jrfnl.


3 months ago

If a closure doesn't use $this, it can be made static for improved performance.

Static closures are supported in PHP since PHP 5.4.

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

#28 @jrf
3 months ago

I've just opened PR 1552 with two more patches to fix all closures not using $this to be static (performance tweak).

#29 @prbot
3 months ago

jrfnl commented on PR #1509:

I've rebased the remaining commits in this PR to solve the merge conflicts and make the patches commitable again.

#30 @hellofromTonya
2 months ago

PR 1552 is ready for commit.

cc @SergeyBiryukov

#31 @hellofromTonya
2 months ago

PR 1509 is also ready for commit.

cc @SergeyBiryukov

#32 @hellofromTonya
8 weeks ago

In 51657:

Coding Standards: Use static closures when not using $this.

When a closure does not use $this, it can be made static for improved performance.

Static closures are supported in PHP since PHP 5.4. ​

Props jrf, hellofromTonya, swissspidy, SergeyBiryukov.
See #53359.

#34 @hellofromTonya
8 weeks ago

In 51658:

Coding Standards: Update the config for WordPress.PHP.NoSilencedErrors in PHPCS ruleset.

Follow-up to [45611].

Props jrf, hellofromTonya.
See #53359.

#35 @hellofromTonya
8 weeks ago

In 51659:

Coding Standards: Update the config for WordPress.PHP.FileName in PHPCS ruleset.

The WPCS sniff already takes the test classes in the tests/phpunit/includes directory into account.

Only the test cases outside of that directory, i.e. in the tests/phpunit/tests directory need to be listed here.

Includes alphabetizing the list.

Follow-up to [42346], [45607].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53359.

#36 @SergeyBiryukov
8 weeks ago

Just noting that some of the patches here make changes to the wp-includes/blocks directory. However, these changes can be overwritten later with package updates from Gutenberg, so they would have to be made upstream in the Gutenberg repo first. The latest commits will skip those changes for now.

#37 @hellofromTonya
8 weeks ago

In 51660:

Coding Standards: Remove redundant ignore annotation in populate_options().

Follow-up to [43627], [43628].

Props jrf, hellofromTonya.
See #53359.

#38 @hellofromTonya
8 weeks ago

In 51661:

Coding Standards: Make ignore annotation more specific in WP_Site_Health_Auto_Updates::test_vcs_abspath().

Follow-up to [44986].

Props jrf, hellofromTonya.
See #53359.

#39 @hellofromTonya
8 weeks ago

In 51662:

Coding Standards: Fix indentation and remove ignore annotation in wp_privacy_send_personal_data_export_email().

Follow-up to [51129], [51410].

Props jrf, hellofromTonya.
See #53359.

#40 @desrosj
8 weeks ago

In 51693:

Coding Standards: Apply some minor alignment fixes.

These are updates caused by running composer format.

Follow up to [51501], [51599], [51618], [51653].
See #53359, #50542, #53238, #53668, #53690.

#41 @prbot
7 weeks ago

jrfnl commented on PR #1509:

Closing as fully committed via a variety of changesets.

#42 @SergeyBiryukov
5 weeks ago

In 51822:

Coding Standards: Use strict comparison in wp-inclues/class-wp-http-cookie.php.

Follow-up to [10512].

See #53359.

#43 @SergeyBiryukov
5 weeks ago

In 51823:

Coding Standards: Rename the $arrURL variable to $parsed_url in WP_Http::request().

This fixes a Variable "$arrURL" is not in valid snake_case format WPCS warning.

Follow-up to [10509], [45667].

See #53359.

#44 @SergeyBiryukov
5 weeks ago

In 51824:

Coding Standards: Rename the $arrURL variable to $parsed_url in WP_Http_Cookie::__construct().

This fixes a Variable "$arrURL" is not in valid snake_case format WPCS warning.

Follow-up to [10509], [25044], [45667], [51823].

See #53359.

#45 @SergeyBiryukov
5 weeks ago

In 51825:

Coding Standards: Rename the $arrURL variable to $parsed_url in WP_Http_Streams::request().

This fixes a Variable "$arrURL" is not in valid snake_case format WPCS warning.

Follow-up to [8620], [10509], [25044], [25224], [45667], [51823], [51824].

See #53359.

#46 @SergeyBiryukov
5 weeks ago

In 51826:

Coding Standards: Rename the $processedHeaders variable to $processed_headers in WP_Http::request().

This fixes a Variable "$processedHeaders" is not in valid snake_case format WPCS warning.

Follow-up to [8620], [51823].

See #53359.

This ticket was mentioned in Slack in #core by sergey. View the logs.


4 weeks ago

#48 @costdev
4 weeks ago

Posting related ticket for visibility: #54177

#49 @SergeyBiryukov
3 weeks ago

In 51877:

Coding Standards: Use strict comparison in wp-includes/class-http.php.

Follow-up to [10625], [10864], [13274], [29661], [33748], [47508], [47808].

See #53359.

#50 @SergeyBiryukov
3 weeks ago

In 51879:

Coding Standards: Use strict comparison in wp-includes/class-wp-http-ixr-client.php.

Follow-up to [16064], [16871], [17928].

See #53359.

#51 @hellofromTonya
2 weeks ago

In 51888:

Coding Standards: Use strict type check for in_array() in register_block_script_handle().

Follow-up to [51501].

Props aristath, sergeybiryukov.
Fixes #54206. See #53359.

#52 @johnbillion
6 days ago

  • Keywords commit removed
Note: See TracTickets for help on using tickets.