Skip to content

Commit

Permalink
Php 8.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad committed Jul 18, 2023
1 parent f9c150b commit 513f9de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Database
protected $name;
protected $options = [
'flags' => SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE,
'encryption_key' => null,
'encryption_key' => '',
'busy_timeout' => 30,
'journal_mode' => 'WAL',
'synchronous' => 'NORMAL',
Expand Down
36 changes: 18 additions & 18 deletions src/Queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
namespace Ufee\Sqlite3;

class Queries implements \IteratorAggregate
class Queries implements \Countable, \IteratorAggregate
{
protected $items;
protected $_callback = false;
Expand All @@ -18,26 +18,12 @@ public function __construct(Array $elements = [])
{
$this->items = $elements;
}

/**
* Set listen callback
* @param callable|bool $callback
* @return Queries
*/
public function listen($callback)
{
if (!is_callable($callback) && !is_bool($callback)) {
throw new \Exception('Invalid callback, must be callable or boolean');
}
$this->_callback = $callback;
return $this;
}


/**
* Collection iterator
* @return ArrayIterator
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->items);
}
Expand All @@ -46,11 +32,25 @@ public function getIterator()
* Get count elements
* @return integer
*/
public function count()
public function count(): int
{
return count($this->items);
}

/**
* Set listen callback
* @param callable|bool $callback
* @return Queries
*/
public function listen($callback)
{
if (!is_callable($callback) && !is_bool($callback)) {
throw new \Exception('Invalid callback, must be callable or boolean');
}
$this->_callback = $callback;
return $this;
}

/**
* Get all elements
* @return array
Expand Down

0 comments on commit 513f9de

Please sign in to comment.