Improve sniff handling of modern PHP code #764

jrfnl opened this Issue Jan 1, 2017 · 1 comment


None yet

1 participant

jrfnl commented Jan 1, 2017

While WP still has a minimum requirement of PHP 5.2 and a lot of related projects code accordingly, there are also numerous projects out there which have set their plugin/theme minimum requirement at PHP 5.3 or higher.

Most sniffs currently don't take things like namespaces into account so the below code would trigger an error (even though the fwrite function in this case is namespaced).

While this may not be the best example (or good practice in the first place), I would like to suggest we review code to see if we can make it more forward compatible with modern PHP code.

namespace MyNamespace;

function fwrite() {
	// A compat layer or something.

class My_Class {
	function do_something() {
		fwrite( $param );
jrfnl commented Jan 2, 2017

Another typical one which is currently not or hardly taken into account: T_HEREDOC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment