diff --git a/tools/phpcs/Sniffs/PHP/RestrictedEmptyConstructSniff.php b/tools/phpcs/Sniffs/PHP/RestrictedEmptyConstructSniff.php new file mode 100644 index 0000000000..3963eb20cf --- /dev/null +++ b/tools/phpcs/Sniffs/PHP/RestrictedEmptyConstructSniff.php @@ -0,0 +1,40 @@ +addWarning( + 'Usage of empty() can mask code problems. Consider explicit checks instead.', + $stackPtr, + 'EmptyConstructUsage' + ); + } +} diff --git a/tools/phpcs/phpcs.ruleset.xml b/tools/phpcs/phpcs.ruleset.xml index 5d00f48b6d..f19fbbd484 100644 --- a/tools/phpcs/phpcs.ruleset.xml +++ b/tools/phpcs/phpcs.ruleset.xml @@ -113,6 +113,14 @@ + + + ./Sniffs/* + + + ./Sniffs/* + + ./build/*