mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 02:28:35 +08:00 
			
		
		
		
	Fix PHPStan errors (#20603)
This commit is contained in:
		| @ -55,7 +55,7 @@ abstract class ErrorHandler extends Component | |||||||
|     public $silentExitOnException; |     public $silentExitOnException; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @var string Used to reserve memory for fatal error handler. |      * @var string|null Used to reserve memory for fatal error handler. | ||||||
|      */ |      */ | ||||||
|     private $_memoryReserve; |     private $_memoryReserve; | ||||||
|     /** |     /** | ||||||
| @ -67,7 +67,7 @@ abstract class ErrorHandler extends Component | |||||||
|      */ |      */ | ||||||
|     private $_registered = false; |     private $_registered = false; | ||||||
|     /** |     /** | ||||||
|      * @var string the current working directory |      * @var string|null the current working directory | ||||||
|      */ |      */ | ||||||
|     private $_workingDirectory; |     private $_workingDirectory; | ||||||
|  |  | ||||||
|  | |||||||
| @ -95,11 +95,11 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg | |||||||
|     public const EVENT_AFTER_VALIDATE = 'afterValidate'; |     public const EVENT_AFTER_VALIDATE = 'afterValidate'; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @var array validation errors (attribute name => array of errors) |      * @var array|null validation errors (attribute name => array of errors) | ||||||
|      */ |      */ | ||||||
|     private $_errors; |     private $_errors; | ||||||
|     /** |     /** | ||||||
|      * @var ArrayObject list of validators |      * @var ArrayObject|null list of validators | ||||||
|      */ |      */ | ||||||
|     private $_validators; |     private $_validators; | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -68,11 +68,11 @@ class BatchQueryResult extends Component implements \Iterator | |||||||
|     public $each = false; |     public $each = false; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @var DataReader the data reader associated with this batch query. |      * @var DataReader|null the data reader associated with this batch query. | ||||||
|      */ |      */ | ||||||
|     private $_dataReader; |     private $_dataReader; | ||||||
|     /** |     /** | ||||||
|      * @var array the data retrieved in the current batch |      * @var array|null the data retrieved in the current batch | ||||||
|      */ |      */ | ||||||
|     private $_batch; |     private $_batch; | ||||||
|     /** |     /** | ||||||
| @ -80,7 +80,7 @@ class BatchQueryResult extends Component implements \Iterator | |||||||
|      */ |      */ | ||||||
|     private $_value; |     private $_value; | ||||||
|     /** |     /** | ||||||
|      * @var string|int the key for the current iteration |      * @var string|int|null the key for the current iteration | ||||||
|      */ |      */ | ||||||
|     private $_key; |     private $_key; | ||||||
|  |  | ||||||
|  | |||||||
| @ -71,7 +71,9 @@ class Command extends \yii\db\Command | |||||||
|      * or `false` if there's a single statement. |      * or `false` if there's a single statement. | ||||||
|      * @param string $sql |      * @param string $sql | ||||||
|      * @param array $params |      * @param array $params | ||||||
|      * @return string[]|false |      * @return array[]|false | ||||||
|  |      * | ||||||
|  |      * @phpstan-return list<array{string, array}>|false | ||||||
|      */ |      */ | ||||||
|     private function splitStatements($sql, $params) |     private function splitStatements($sql, $params) | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -436,7 +436,9 @@ class DbManager extends BaseManager | |||||||
|  |  | ||||||
|         $items = []; |         $items = []; | ||||||
|         foreach ($query->all($this->db) as $row) { |         foreach ($query->all($this->db) as $row) { | ||||||
|             $items[$row['name']] = $this->populateItem($row); |             /** @var Role|Permission */ | ||||||
|  |             $item = $this->populateItem($row); | ||||||
|  |             $items[$row['name']] = $item; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $items; |         return $items; | ||||||
|  | |||||||
| @ -325,7 +325,7 @@ class PhpManager extends BaseManager | |||||||
|         $items = []; |         $items = []; | ||||||
|  |  | ||||||
|         foreach ($this->items as $name => $item) { |         foreach ($this->items as $name => $item) { | ||||||
|             /** @var Item $item */ |             /** @var Role|Permission $item */ | ||||||
|             if ($item->type == $type) { |             if ($item->type == $type) { | ||||||
|                 $items[$name] = $item; |                 $items[$name] = $item; | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -149,7 +149,10 @@ class AssetBundle extends BaseObject | |||||||
|      */ |      */ | ||||||
|     public static function register($view) |     public static function register($view) | ||||||
|     { |     { | ||||||
|         return $view->registerAssetBundle(get_called_class()); |         /** @var static */ | ||||||
|  |         $result = $view->registerAssetBundle(get_called_class()); | ||||||
|  |  | ||||||
|  |         return $result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Maksim Spirkov
					Maksim Spirkov