diff --git a/src/Curl/Url.php b/src/Curl/Url.php index 9c8df63..3c5b0f3 100644 --- a/src/Curl/Url.php +++ b/src/Curl/Url.php @@ -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); diff --git a/tests/script.sh b/tests/script.sh index 61b3786..ec41cc0 100755 --- a/tests/script.sh +++ b/tests/script.sh @@ -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 \