new Совместимость с php8

This commit is contained in:
origami11@yandex.ru 2023-04-19 11:25:28 +03:00
parent 2edd65d145
commit 5748ea9148
7 changed files with 17 additions and 30 deletions

View file

@ -79,22 +79,22 @@ class Collection implements \ArrayAccess
$this->data = array();
}
public function offsetSet($key, $value)
public function offsetSet($key, $value): void
{
$this->data[$key] = $value;
}
public function offsetExists($key)
public function offsetExists($key): bool
{
return isset($this->data[$key]);
}
public function offsetUnset($key)
public function offsetUnset($key): void
{
unset($this->data[$key]);
}
public function offsetGet($key)
public function offsetGet($key): mixed
{
return isset($this->data[$key]) ? $this->data[$key] : null;
}

View file

@ -30,7 +30,7 @@ class Action
public $modulePath = null; // Путь к модулю
public $moduleTitle = '';
public $viewPathPrefix = null; // Путь к шаблонам контроллера
public $viewPathPrefix = ''; // Путь к шаблонам контроллера
/**
* Соединение с базой данных

View file

@ -30,8 +30,8 @@ class Database/*<Database_PDOStatement>*/ extends PDO
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('ctiso\\Database\\PDOStatement', array()));
}
function prepare($sql, $args = []) {
$result/*: PDOStatement*/ = parent::prepare($sql, $args);
function prepare(string $sql, array $options = []): PDOStatement|false {
$result/*: PDOStatement*/ = parent::prepare($sql, $options);
return $result;
}

View file

@ -103,7 +103,7 @@ class PDOStatement extends \PDOStatement implements \IteratorAggregate
return count($this->cache);
}
function execute($args = null) {
function execute($args = null): bool {
$result = parent::execute($args);
return $result;
}

View file

@ -16,26 +16,26 @@ class StatementIterator implements \Iterator
$this->row_count = $rs->getRecordCount();
}
function rewind() {
function rewind(): void{
$this->pos = 0;
}
function valid() {
function valid(): bool {
return ($this->pos < $this->row_count);
}
function key() {
function key(): mixed {
return $this->pos;
}
function current() {
function current(): mixed{
if (!isset($this->result->cache[$this->pos])) {
$this->result->cache[$this->pos] = $this->result->fetch(PDO::FETCH_ASSOC);
}
return $this->result->cache[$this->pos];
}
function next() {
function next(): void{
$this->pos++;
}

View file

@ -10,7 +10,7 @@ use Exception,
ctiso\Session;
// HTTPRequest = ArrayAccess
class HttpRequest extends Collection implements ArrayAccess
class HttpRequest extends Collection
{
public $_session;
@ -117,19 +117,6 @@ class HttpRequest extends Collection implements ArrayAccess
exit();
}
public function offsetSet($key, $value) {
}
public function offsetExists($key) {
}
public function offsetUnset($key) {
}
public function offsetGet($key) {
}
static function getProtocol() {
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
}

View file

@ -16,10 +16,9 @@ class Path
protected $url = array();
protected $absolute = false;
public function __construct($path)
public function __construct($path = '')
{
//assert(is_string($path));
$this->url = parse_url($path);
if (isset($this->url['path'])) {
@ -289,6 +288,7 @@ class Path
*/
static function fromJoin($_rest) {
$args = func_get_args();
$result = array();
$parts0 = new Path(array_shift($args));
$result [] = $parts0->getParts();