mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
Revert "fix ArrayHelper::getValue() to throw exception on invalid input"
This reverts commit e963b2af6486dd79c26a460148c63efb580f53fc because of BC breaking reported in #13248. To know more about the reasons of commit revertinvg, visit https://github.com/yiisoft/yii2/issues/13248
This commit is contained in:
@ -178,15 +178,10 @@ class BaseArrayHelper
|
||||
* The possibility to pass an array of keys is available since version 2.0.4.
|
||||
* @param mixed $default the default value to be returned if the specified array key does not exist. Not used when
|
||||
* getting value from an object.
|
||||
* @return mixed the value of the element if found, default value otherwise.
|
||||
* @throws InvalidParamException if $array is neither an array nor an object.
|
||||
* @return mixed the value of the element if found, default value otherwise
|
||||
*/
|
||||
public static function getValue($array, $key, $default = null)
|
||||
{
|
||||
if (!is_array($array) && !is_object($array)) {
|
||||
throw new InvalidParamException('Argument passed to getValue() must be an array or object.');
|
||||
}
|
||||
|
||||
if ($key instanceof \Closure) {
|
||||
return $key($array, $default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user