Replace usage of is_null() with strict comparison operator

This commit is contained in:
Zach Borboa
2019-05-11 11:57:32 -07:00
parent 03d4ffea4f
commit 1e615d340e
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ class Url
if (!isset($b['path'])) {
$b['path'] = '/';
}
if (is_null($this->relativeUrl)) {
if ($this->relativeUrl === null) {
return $this->unparseUrl($b);
}
$r = $this->parseUrl($this->relativeUrl);
+7
View File
@@ -122,6 +122,13 @@ if [[ ! -z "${elses}" ]]; then
((errors++))
fi
# Prohibit use of "is_null" and suggest using the strict comparison operator.
is_null=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --color=always --line-number -H -e "is_null" {} \;)
if [[ ! -z "${is_null}" ]]; then
echo -e "${is_null}" | perl -pe 's/^(.*)$/is_null found in \1. Replace with strict comparison (e.g. "\$x === null")./'
((errors++))
fi
# Detect coding standard violations.
phpcs --version
phpcs \