WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/25/2019 01:46:55 PM (2 months ago)
Author:
desrosj
Message:

Build/Test Tools: Introduce automated PHP compatibility checking.

This change introduces a new Composer script, compat that will scan the codebase for (detectable) potential PHP compatibility issues using the PHP_CodeSniffer and a custom ruleset based off of the PHPCompayibilityWP ruleset (phpcompat.xml.dist).

The command will be run as a separate job within each Travis build. While many compatibility issues and false positives have already been corrected in this commit and other Trac tickets, there are still some remaining. For that reason, the job is allowed to fail while the remainder of the potential compatibility issues are investigated and addressed. After those are resolved, the job should be set as required to pass to help prevent new compatibility issues from being introduced.

Props desrosj, jrf, all PHPCompatibilityWP and PHPCompatibility contributors.
Fixes #46152.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r46214 r46290  
    57445744 * @return true True.
    57455745 */
    5746 function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5746function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    57475747    return true;
    57485748}
     
    57595759 * @return false False.
    57605760 */
    5761 function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5761function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    57625762    return false;
    57635763}
     
    57725772 * @return int 0.
    57735773 */
    5774 function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5774function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    57755775    return 0;
    57765776}
     
    57855785 * @return array Empty array.
    57865786 */
    5787 function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5787function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    57885788    return array();
    57895789}
     
    57985798 * @return null Null value.
    57995799 */
    5800 function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5800function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    58015801    return null;
    58025802}
     
    58135813 * @return string Empty string.
    58145814 */
    5815 function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
     5815function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    58165816    return '';
    58175817}
Note: See TracChangeset for help on using the changeset viewer.