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

Revise PHPCS rules relating to PHP compatibility (min: PHP 7.0) #1091

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

barryhughes
Copy link
Member

Tweaks our PHPCS config so that we allow valid PHP 7.0+ syntax (sometimes, currently, we warn about various constructs that are invalid only when using PHP 5.6 or lower).

Steps to replicate

  1. Checkout the current trunk code (ie, without this change) and run PHPCS.
  2. If you specifically run composer run phpcs classes/WP_CLI/ActionScheduler_WPCLI_Clean_Command.php you will see various warnings. For the purposes of this PR, we are interested errors such as this one:
  84 | ERROR | [ ] 'int' type declaration is not present in PHP version 5.6 or earlier
     |       |     (PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations.intFound)
  1. This should not be an error: type declarations are desirable and not something we want to remove. The above is flagged because our PHPCS config is looking for code that is incompatible with PHP 5.6, which is no longer a concern for this project.
  2. Check out this branch, and re-run the above command: those particular warnings should no longer appear.

Changelog

No changelog needed, this is a dev-facing change.

@barryhughes barryhughes requested review from a team and vedanshujain and removed request for a team August 22, 2024 23:25
@barryhughes barryhughes requested review from a team, ctarda, rrennick and Konamiman and removed request for vedanshujain, a team, ctarda and rrennick August 23, 2024 22:16
@barryhughes
Copy link
Member Author

Sorry for the noise re reviewer selection ... had to post some changes to the round-robin rules.

@Konamiman
Copy link
Contributor

Looks good and tests as advertised, so merging.

@Konamiman Konamiman merged commit c828347 into trunk Aug 26, 2024
46 checks passed
@Konamiman Konamiman deleted the fix/phpcs-min-php branch August 26, 2024 14:07
@coreymckrill coreymckrill added this to the 3.8.2 milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants