fix: phpstan level=5

This commit is contained in:
origami11@yandex.ru 2024-01-24 17:13:38 +03:00
parent 1638d558c5
commit 2947e4aac3
8 changed files with 13 additions and 32 deletions

View file

@ -6,14 +6,15 @@
*/
namespace ctiso\Controller;
use ctiso\Controller\Action,
ctiso\Settings,
ctiso\Database,
ctiso\Registry,
ctiso\Database,
ctiso\Collection,
ctiso\Filter\ActionAccess,
ctiso\Filter\ActionLogger,
ctiso\Path,
ctiso\UserMessageException,
ctiso\HttpRequest;
ctiso\HttpRequest,
ctiso\Role\User;
class Front extends Action
{
@ -23,10 +24,7 @@ class Front extends Action
protected $modules = array();
/**
* @param Settings $config
*/
public function __construct($db, $config, $user, $default) {
public function __construct(Database $db, Registry $config, User $user, $default) {
parent::__construct();
$this->config = $config;
$this->db = $db;

View file

@ -8,7 +8,6 @@ class StatementIterator implements \Iterator
private $result;
private $pos = 0;
private $fetchmode;
private $row_count;
public function __construct($rs/*: PDOStatement*/) {

View file

@ -252,8 +252,8 @@ class Table
$rows = $this->getRows();
$doc->startElement('Table');
$doc->writeAttribute('ss:ExpandedColumnCount', $columns);
$doc->writeAttribute('ss:ExpandedRowCount', $rows);
$doc->writeAttribute('ss:ExpandedColumnCount', (string)$columns);
$doc->writeAttribute('ss:ExpandedRowCount', (string)$rows);
// Переписать цыкл !!!!!!!
for ($i = 1; $i <= $rows; $i++) {
@ -306,9 +306,9 @@ class Table
$doc->writeElement('TopRowBottomPane', $this->_splitHorizontal);
}
if ($this->_splitHorizontal && $this->_splitVertical) {
$doc->writeElement('ActivePane', 0);
$doc->writeElement('ActivePane', (string)0);
} else if($this->_splitHorizontal) {
$doc->writeElement('ActivePane', 2);
$doc->writeElement('ActivePane', (string)2);
}
$doc->endElement();
}

View file

@ -42,8 +42,7 @@ class Authorization {
static function getBrowserSign()
{
$rawSign = self::SESSION_BROWSER_SIGN_SECRET;
// $signParts = array('HTTP_USER_AGENT', 'HTTP_ACCEPT_ENCODING');
$signParts = array();
$signParts = ['HTTP_USER_AGENT'];
foreach ($signParts as $signPart) {
$rawSign .= '::' . (isset($_SERVER[$signPart]) ? $_SERVER[$signPart] : 'none');

View file

@ -66,13 +66,10 @@ class Path
* Возвращает расширение файла
*
* @param string $fileName Полное имя файла
*
* @return string
*/
static function getExtension($fileName)
{
assert(is_string($fileName) || is_null($fileName));
return pathinfo($fileName, PATHINFO_EXTENSION);
}

View file

@ -73,8 +73,8 @@ class Primitive {
$tmp = array();
if (preg_match('/(\d+)-(\d+)-(\d+)T(\d+):(\d+)Z/', $value, $tmp)) {
if (checkdate($tmp[2], $tmp[3], $tmp[1])) {
$result = mktime($tmp[4], $tmp[5], 0, $tmp[2], $tmp[3], $tmp[1]);
if (checkdate((int)$tmp[2], (int)$tmp[3], (int)$tmp[1])) {
$result = mktime((int)$tmp[4], (int)$tmp[5], 0, (int)$tmp[2], (int)$tmp[3], (int)$tmp[1]);
}
}
return $result;

View file

@ -9,8 +9,6 @@ use ctiso\Validator\Rule\AbstractRule,
class Date extends AbstractRule
{
private $split = "\\/";
public function getErrorMsg()
{
return "Неверный формат даты";
@ -21,7 +19,7 @@ class Date extends AbstractRule
$pattern = "/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})$/";
$matches = [];
return (preg_match($pattern, $container->get($this->field), $matches)
&& checkdate($matches[2], $matches[1], $matches[3]));
&& checkdate((int)$matches[2], (int)$matches[1], (int)$matches[3]));
}
}

View file

@ -18,16 +18,6 @@ class Top extends Composite
return implode(" - ", array_filter($this->doTree('_title', false), array($this, 'isNotNull')));
}
private function findGroup($groups, $file)
{
foreach ($groups as $key => $group) {
if (in_array($file, $group)) {
return $key;
}
}
return false;
}
function getId($pref)
{
$this->mid++;