mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 18:47:33 +08:00 
			
		
		
		
	Fix #20579: Add PHPStan/Psalm annotations for HeaderCollection::get
				
					
				
			This commit is contained in:
		| @ -45,6 +45,7 @@ Yii Framework 2 Change Log | ||||
| - Bug #20571: Fix `@var` annotation for `yii\web\Response::$stream` (max-s-lab) | ||||
| - Bug #20569: Fix `@param` annotation for `$default` in `HeaderCollection::get` (max-s-lab) | ||||
| - Bug #20576: Fix `@var` annotation for `StringValidator::$length` (max-s-lab) | ||||
| - Enh #20579: Add PHPStan/Psalm annotations for `HeaderCollection::get` (max-s-lab) | ||||
|  | ||||
|  | ||||
| 2.0.53 June 27, 2025 | ||||
|  | ||||
| @ -22,10 +22,14 @@ class HeaderCollection extends BaseObject implements \IteratorAggregate, \ArrayA | ||||
| { | ||||
|     /** | ||||
|      * @var array the headers in this collection (indexed by the normalized header names) | ||||
|      * | ||||
|      * @phpstan-var array<string, string[]> | ||||
|      */ | ||||
|     private $_headers = []; | ||||
|     /** | ||||
|      * @var array the original names of the headers (indexed by the normalized header names) | ||||
|      * | ||||
|      * @phpstan-var array<string, string> | ||||
|      */ | ||||
|     private $_originalHeaderNames = []; | ||||
|  | ||||
| @ -72,6 +76,12 @@ class HeaderCollection extends BaseObject implements \IteratorAggregate, \ArrayA | ||||
|      * If false, all headers of the specified name will be returned. | ||||
|      * @return string|array|null the named header(s). If `$first` is true, a string will be returned; | ||||
|      * If `$first` is false, an array will be returned. | ||||
|      * | ||||
|      * @phpstan-param ($first is true ? string|null : string[]|null) $default | ||||
|      * @psalm-param ($first is true ? string|null : string[]|null) $default | ||||
|      * | ||||
|      * @phpstan-return ($first is true ? string|null : string[]|null) | ||||
|      * @psalm-return ($first is true ? string|null : string[]|null) | ||||
|      */ | ||||
|     public function get($name, $default = null, $first = true) | ||||
|     { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Maksim Spirkov
					Maksim Spirkov