avoid type juggling in conditions, always use explicit boolean conditions

This commit is contained in:
Dylan K. Taylor
2020-02-05 15:44:06 +00:00
parent b96bb7d824
commit e5a2cfb65f
17 changed files with 43 additions and 43 deletions

View File

@@ -478,7 +478,7 @@ class Utils{
$hash = 0;
for($i = 0, $len = strlen($string); $i < $len; $i++){
$ord = ord($string[$i]);
if($ord & 0x80){
if(($ord & 0x80) !== 0){
$ord -= 0x100;
}
$hash = 31 * $hash + $ord;
@@ -671,7 +671,7 @@ class Utils{
* @throws \ErrorException
*/
public static function errorExceptionHandler(int $severity, string $message, string $file, int $line) : bool{
if(error_reporting() & $severity){
if((error_reporting() & $severity) !== 0){
throw new \ErrorException($message, 0, $severity, $file, $line);
}