WPTT / WPThemeReview

PHP_CodeSniffer rules (sniffs) to enforce WordPress theme review coding conventions
MIT License
209 stars 37 forks source link

Warning for using include or require #67

Closed khacoder closed 8 years ago

khacoder commented 8 years ago

Issue #66 Check if include(_once) or require(_once) is used, and issue a warning to see if get_template_part() or locate_template() is more appropriate.

grappler commented 8 years ago

I have made the requested changes.

jrfnl commented 8 years ago

@grappler Nearly there.

$file_blacklist is now still a variable within the function while it does not need to be redefined every time the function is called, it doesn't change between function calls after all, so it should be a class property which is defined only once (if we could use PHP 5.6 we could even make it a class constant, unfortunately arrays can not be used with class constants until then).

Secondly, it is not a blacklist, but a whitelist. If the file name is in the whitelist of files which are logical places/in which a require/include is allowed to exist, no warning will be thrown.

grappler commented 8 years ago

I hope it is all good now 😄

jrfnl commented 8 years ago

Nearly there, just dotting the i's now...

grappler commented 8 years ago

Getting closer minute by minute.