diff --git a/src/Mysql/MysqlStorage.php b/src/Mysql/MysqlStorage.php index e10d1b0..c194bc8 100644 --- a/src/Mysql/MysqlStorage.php +++ b/src/Mysql/MysqlStorage.php @@ -135,8 +135,9 @@ class MysqlStorage implements MysqlStorageInterface { } /** @inheritDoc */ - public function findOne(string $sql) : array { + public function findOne(string $sql) : bool|array { $result = $this->query($sql); + if (!$result || $result->num_rows == 0) return false; $data = new MysqlStorageData($result); return $data->fetchOne(); } diff --git a/src/Mysql/MysqlStorageInterface.php b/src/Mysql/MysqlStorageInterface.php index 478aebe..42b9a93 100644 --- a/src/Mysql/MysqlStorageInterface.php +++ b/src/Mysql/MysqlStorageInterface.php @@ -86,7 +86,7 @@ interface MysqlStorageInterface { * @param string $sql * @return array */ - public function findOne(string $sql) : array; + public function findOne(string $sql) : bool|array; /** * Метод экранирования данных с учетом текущего подключения в т.ч для LIKE