From f59461165675c7be75b3cac110956add3e71aa46 Mon Sep 17 00:00:00 2001 From: "origami11@yandex.ru" Date: Mon, 22 Jan 2024 14:00:52 +0300 Subject: [PATCH] fix: phpstan level=3 --- src/Controller/Action.php | 2 +- src/Model/BaseMapper.php | 3 ++- src/Role/User.php | 4 ++-- src/Validator/Validator.php | 2 +- src/View/Composite.php | 1 + src/View/View.php | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Controller/Action.php b/src/Controller/Action.php index f3496e5..7e7eafa 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -104,7 +104,7 @@ class Action * @param string $viewClass * @return Composite */ - public function getView($name, $viewClass = 'ctiso\\View\\Composite') + public function getView($name, $viewClass = Composite::class) { $file = $name . self::TEMPLATE_EXTENSION; diff --git a/src/Model/BaseMapper.php b/src/Model/BaseMapper.php index 50cad30..88a3572 100644 --- a/src/Model/BaseMapper.php +++ b/src/Model/BaseMapper.php @@ -2,5 +2,6 @@ namespace ctiso\Model; -class BaseMapper { +abstract class BaseMapper { + abstract function getAllAsOptions(): array; } \ No newline at end of file diff --git a/src/Role/User.php b/src/Role/User.php index a22cb13..818c318 100644 --- a/src/Role/User.php +++ b/src/Role/User.php @@ -31,7 +31,7 @@ class User implements UserInterface } function isLogged() { - return \ctiso\Filter\Authorization::isLogged(); + return \ctiso\Filter\Authorization::isLogged(); } @@ -41,7 +41,7 @@ class User implements UserInterface if ($result->next()) { $this->access = $this->groups[$result->getString('access')]; $this->name = $result->getString('login'); - $this->id = $result->getInt('id_user'); + $this->id = $result->getInt('id_user'); $this->password = $result->getString('password'); $this->fullname = implode(' ', array( $result->getString('surname'), diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index 1d625e0..2e003d7 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -91,7 +91,7 @@ class Validator if ($rule->skipEmpty()) { $data = $container->get($rule->field); if (!is_array($data)) { - $value = trim($data); + $value = trim($data ?: ''); return $value == ''; } } diff --git a/src/View/Composite.php b/src/View/Composite.php index ff659ef..aa2890a 100644 --- a/src/View/Composite.php +++ b/src/View/Composite.php @@ -8,6 +8,7 @@ namespace ctiso\View; use ctiso\View\View, PHPTAL; + class Composite extends View { private $tal; diff --git a/src/View/View.php b/src/View/View.php index e03ffef..7acbebb 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -3,7 +3,7 @@ namespace ctiso\View; use Exception; -class View +class View extends \stdClass { protected $_section = array(); // Вложенные шаблоны // Блоки