Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#41873 new enhancement

Code Editor: Add PHP linter

Reported by: westonruter's profile westonruter Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords: needs-patch
Focuses: Cc:


There is no PHP linter yet when editing PHP in the code editor (powered by CodeMirror, from [41376] for #12423). This would be a good enhancement, PHP syntax errors are the most critical thing to catch prior to saving in order to prevent whitescreening a site. Currently there are linters only for HTML, JS, CSS, and JSON.


Props to @rheinardkorf for finding !!

On GitHub:

I had previously stumbled across the project but it is empty. I didn't see the other project.

This holds great promise. The only icing on the cake here would be if the parser could be told which PHP version to use, but we could get a list of language features that are added after PHP 5.2 and mark them as errors when the version of PHP on the server is not new enough. Amazing.

See more background on the original GitHub issue:

Change History (7)

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

7 years ago

#2 @westonruter
7 years ago

  • Priority changed from normal to high

Bumping priority to high for visibility and alignment with 4.9 goals, and given proximity to beta 1 deadline.

#4 @westonruter
7 years ago

There is now an add-on for PHP linting in CodeMirror available:

Last edited 7 years ago by westonruter (previous) (diff)

#5 @westonruter
7 years ago

See also feature request to add options for targeting allowed PHP language features and functions:

#6 @westonruter
7 years ago

  • Milestone changed from 4.9 to Future Release
  • Priority changed from high to normal

There are some really exciting possibilities for PHP linting now, but we're running up against the beta1 deadline and the php-linter code is still pretty fresh and I think it should have some more time to bake. So I'm punting this for the future. Maybe WordPress 5.0.

Last edited 7 years ago by westonruter (previous) (diff)

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.

7 years ago

Note: See TracTickets for help on using tickets.