mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
removed useless type juggling and checking
This commit is contained in:
@@ -35,7 +35,7 @@ class Panel implements Tracy\IBarPanel
|
||||
|
||||
public function __construct(bool $explain = TRUE, int $filter = NULL)
|
||||
{
|
||||
$this->filter = $filter ? (int) $filter : Event::QUERY;
|
||||
$this->filter = $filter ?: Event::QUERY;
|
||||
$this->explain = $explain;
|
||||
}
|
||||
|
||||
|
@@ -331,7 +331,7 @@ class Connection
|
||||
if ($id < 1) {
|
||||
throw new Exception('Cannot retrieve last generated ID.');
|
||||
}
|
||||
return (int) $id;
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -236,7 +236,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
||||
|
||||
public function escapeBinary(string $value): string
|
||||
{
|
||||
return "X'" . bin2hex((string) $value) . "'";
|
||||
return "X'" . bin2hex($value) . "'";
|
||||
}
|
||||
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class FileLogger
|
||||
public function __construct(string $file, int $filter = NULL)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->filter = $filter ? (int) $filter : Dibi\Event::QUERY;
|
||||
$this->filter = $filter ?: Dibi\Event::QUERY;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -47,7 +47,7 @@ class FirePhpLogger
|
||||
|
||||
public function __construct(int $filter = NULL)
|
||||
{
|
||||
$this->filter = $filter ? (int) $filter : Dibi\Event::QUERY;
|
||||
$this->filter = $filter ?: Dibi\Event::QUERY;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -200,8 +200,8 @@ class Result implements IDataSource
|
||||
*/
|
||||
final public function fetchAll(int $offset = NULL, int $limit = NULL): array
|
||||
{
|
||||
$limit = $limit === NULL ? -1 : (int) $limit;
|
||||
$this->seek((int) $offset);
|
||||
$limit = $limit === NULL ? -1 : $limit;
|
||||
$this->seek($offset ?: 0);
|
||||
$row = $this->fetch();
|
||||
if (!$row) {
|
||||
return []; // empty result set
|
||||
|
@@ -95,7 +95,7 @@ class ProcedureException extends Exception
|
||||
*/
|
||||
public function __construct(string $message = NULL, int $code = 0, string $severity = NULL, $sql = NULL)
|
||||
{
|
||||
parent::__construct($message, (int) $code, $sql);
|
||||
parent::__construct($message, $code, $sql);
|
||||
$this->severity = $severity;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user