[buddypress-trac] [BuddyPress Trac] #7997: PHP version compatibility sniffs
buddypress-trac
noreply at wordpress.org
Tue Nov 6 19:57:49 UTC 2018
#7997: PHP version compatibility sniffs
------------------------------+-----------------------
Reporter: boonebgorges | Owner: netweb
Type: defect (bug) | Status: new
Priority: normal | Milestone: Up Next
Component: Build/Test Tools | Version:
Severity: normal | Keywords: has-patch
------------------------------+-----------------------
Previously, we introduced PHP linting into our build/test process: #7926.
Leveraging `php -l` is a good start for catching blatant syntax errors,
but it's very limited in terms of what it catches. Removed functions and
invalid (but syntactically correct) constructs are a few examples of
things that can only be caught by tokenized analysis. See eg #7925.
I propose that we switch to using PHPCS with the PHPCompatibilityWP
sniffs. This change provides us with dramatically better coverage of
deprecated usages, on a per-PHP-version basis. It's sensitive to WP's
polyfills (for functions like `hash_equals()`). And it combines all of the
version compatibility checks into a single run, so that the checks only
need to be run once in the Travis matrix (instead of separately on each
version of PHP).
The incoming patch shows an implementation of this. It does the following:
- Installs phpcompatibility-wp and its dependencies via Composer
- Adds a Grunt task `exec:phpcompat`. (There's a `grunt-phpcs` package,
but it doesn't let you pass `--runtime-set` flags.) I called it
`phpcompat` because we will likely want to introduce a `phpcs` task in the
future for coding standards more generally.
- Adds `exec:phpcompat` to the `grunt commit` task, replacing the now-
redudant `phplint`
- Adds a Grunt task `travis:phpcompat` task, paralleling
`travis:codecoverage` and `travis:grunt`, so that all PHP compatibility
checks happen in their own job
To run locally, `composer update` (or `install`) && `npm update`, then
`grunt exec:phpcompat`. To see in action on TravisCI,
https://travis-ci.org/boonebgorges/BuddyPress (Note that we don't
currently pass! That'll be the subject for another ticket.)
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7997>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list