Some minor fixes in Progress, FileUploader for phpstan level 9

This commit is contained in:
Clemens Schwaighofer
2021-11-02 14:42:20 +09:00
parent f622d59ed9
commit 6001934d9c
3 changed files with 10 additions and 9 deletions

View File

@@ -242,6 +242,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
private $int_pk_name; // primary key, only internal usage private $int_pk_name; // primary key, only internal usage
/** @var array<mixed> */ /** @var array<mixed> */
public $reference_array = []; // reference arrays -> stored in $this->reference_array[$table_name] => []; public $reference_array = []; // reference arrays -> stored in $this->reference_array[$table_name] => [];
// NOTE: should be changed to this @var mixed[]
/** @var array<mixed> */ /** @var array<mixed> */
public $element_list; // element list for elements next to each other as a special sub group public $element_list; // element list for elements next to each other as a special sub group
/** @var array<mixed> */ /** @var array<mixed> */
@@ -651,8 +652,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
if ( if (
isset($this->security_level['delete']) && isset($this->security_level['delete']) &&
$this->base_acl_level >= $this->security_level['delete'] && $this->base_acl_level >= $this->security_level['delete'] &&
(!isset($this->table_array['protected']['value']) || empty($this->table_array['protected']['value']) &&
(isset($this->table_array['protected']['value']) && !$this->table_array['protected']['value'])) &&
!$this->error !$this->error
) { ) {
if (!is_array($element_list)) { if (!is_array($element_list)) {
@@ -663,7 +663,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// . is_array($this->element_list[$element_list[$i]]['read_data']) . ' | ' // . is_array($this->element_list[$element_list[$i]]['read_data']) . ' | '
// . $this->element_list[$element_list[$i]]['delete']); // . $this->element_list[$element_list[$i]]['delete']);
// if prefix, set it // if prefix, set it
$prfx = ($this->element_list[$element_list[$i]]['prefix']) ? $prfx = !empty($this->element_list[$element_list[$i]]['prefix']) ?
$this->element_list[$element_list[$i]]['prefix'] . '_' : $this->element_list[$element_list[$i]]['prefix'] . '_' :
''; '';
// get the primary key // get the primary key

View File

@@ -28,7 +28,7 @@ class ProgressBar
public $status = 'new'; // current status (new,show,hide) public $status = 'new'; // current status (new,show,hide)
/** @var float|int */ /** @var float|int */
public $step = 0; // current step public $step = 0; // current step
/** @var array<string,?int> */ /** @var array<string,null|int|float> */
public $position = [ // current bar position public $position = [ // current bar position
'left' => null, 'left' => null,
'top' => null, 'top' => null,
@@ -72,7 +72,7 @@ class ProgressBar
/** @var string */ /** @var string */
public $direction = 'right'; // direction of motion (right,left,up,down) public $direction = 'right'; // direction of motion (right,left,up,down)
/** @var array<string,mixed> */ /** @var array<string,string|bool|int> */
public $frame = ['show' => false]; // ProgressBar Frame public $frame = ['show' => false]; // ProgressBar Frame
/* 'show' => false, # frame show (true/false) /* 'show' => false, # frame show (true/false)
'left' => 200, # frame position from left 'left' => 200, # frame position from left
@@ -84,7 +84,8 @@ class ProgressBar
'brd_color' => '#dfdfdf #404040 #404040 #dfdfdf' # frame border color 'brd_color' => '#dfdfdf #404040 #404040 #dfdfdf' # frame border color
*/ */
/** @var array<mixed> */ /** @#var array{string}{string: string|int} */
/** @var mixed[][] */
public $label = []; // ProgressBar Labels public $label = []; // ProgressBar Labels
/* 'name' => [ # label name /* 'name' => [ # label name
'type' => 'text', # label type (text,button,step,percent,crossbar) 'type' => 'text', # label type (text,button,step,percent,crossbar)
@@ -164,7 +165,7 @@ class ProgressBar
/** /**
* calculate position in bar step * calculate position in bar step
* @param float $step percent step to do * @param float $step percent step to do
* @return array<mixed> bar position as array * @return array<string,int|float> bar position as array
*/ */
private function __calculatePosition(float $step): array private function __calculatePosition(float $step): array
{ {

View File

@@ -21,12 +21,12 @@ class qqFileUploader // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
/** /**
* Undocumented function * Undocumented function
* *
* @param array<mixed> $allowedExtensions * @param array<string> $allowedExtensions
* @param integer $sizeLimit * @param integer $sizeLimit
*/ */
public function __construct(array $allowedExtensions = [], int $sizeLimit = 10485760) public function __construct(array $allowedExtensions = [], int $sizeLimit = 10485760)
{ {
$allowedExtensions = array_map("strtolower", $allowedExtensions); $allowedExtensions = array_map('strtolower', $allowedExtensions);
$this->allowedExtensions = $allowedExtensions; $this->allowedExtensions = $allowedExtensions;
$this->sizeLimit = $sizeLimit; $this->sizeLimit = $sizeLimit;