diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index a70b74226..45f2d4d96 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -844,10 +844,10 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function parseValue(string $type, $value) + private static function parseValue(string $type, $value = null) { // todo: checking for string === string and is_* is slow. maybe only check type or only string - if (is_null($value)) { + if ($value === null) { return null; } elseif ($type === 'DateTime' || $value instanceof \DateTime) { return $value->format('Y-m-d H:i:s'); @@ -2503,9 +2503,9 @@ class DataMapperAbstract implements DataMapperInterface */ public static function getByRequest(RequestAbstract $request) { - if (!is_null($request->getData('id'))) { + if ($request->getData('id') !== null) { $result = static::get((int) $request->getData('id')); - } elseif (!is_null($filter = ((string) $request->getData('filter')))) { + } elseif (($filter = ((string) $request->getData('filter'))) !== null) { $filter = strtolower($filter); if ($filter === 'all') { @@ -2515,8 +2515,8 @@ class DataMapperAbstract implements DataMapperInterface $result = static::get(json_decode($list, true)); } else { $limit = (int) ($request->getData('limit') ?? 1); - $from = !is_null($request->getData('from')) ? new \DateTime((string) $request->getData('from')) : null; - $to = !is_null($request->getData('to')) ? new \DateTime((string) $request->getData('to')) : null; + $from = $request->getData('from') === null ? null : new \DateTime((string) $request->getData('from')); + $to = $request->getData('to') === null ? null : new \DateTime((string) $request->getData('to')); $query = static::getQuery(); $query->limit($limit); diff --git a/DataStorage/Database/Query/Grammar/Grammar.php b/DataStorage/Database/Query/Grammar/Grammar.php index 93b22ec04..f6108ca2b 100644 --- a/DataStorage/Database/Query/Grammar/Grammar.php +++ b/DataStorage/Database/Query/Grammar/Grammar.php @@ -345,7 +345,7 @@ class Grammar extends GrammarAbstract return '(' . rtrim($values, ', ') . ')'; } elseif ($value instanceof \DateTime) { return $query->quote($value->format('Y-m-d H:i:s')); - } elseif (is_null($value)) { + } elseif ($value === null) { return 'NULL'; } elseif (is_bool($value)) { return (string) ((int) $value); diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index e6a7a2f37..f138d6139 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -300,7 +300,7 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function offsetSet($offset, $value) { - if (is_null($offset)) { + if (!isset($offset)) { $this->addNode($value); } else { $this->nodes[$offset] = $value; diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index 2f6715a9f..49911fe02 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -470,7 +470,7 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function offsetSet($offset, $value) { - if (is_null($offset)) { + if (!isset($offset)) { $this->addNode($value); } else { $this->nodes[$offset] = $value; diff --git a/Utils/Parser/Php/ArrayParser.php b/Utils/Parser/Php/ArrayParser.php index b9c7d8fd3..192b66bf4 100644 --- a/Utils/Parser/Php/ArrayParser.php +++ b/Utils/Parser/Php/ArrayParser.php @@ -68,7 +68,7 @@ class ArrayParser return '"' . $value . '"'; } elseif (is_scalar($value)) { return (string) $value; - } elseif (is_null($value)) { + } elseif (!isset($value)) { return 'null'; } elseif (is_bool($value)) { return $value ? 'true' : 'false';