mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-18 01:07:37 +08:00
Fixed the issue that Object/Component doesn't support using anonymous function as normal property values.
This commit is contained in:
@ -193,9 +193,8 @@ class Component extends Object
|
||||
*/
|
||||
public function __call($name, $params)
|
||||
{
|
||||
$getter = 'get' . $name;
|
||||
if (method_exists($this, $getter)) {
|
||||
$func = $this->$getter();
|
||||
if ($this->canGetProperty($name)) {
|
||||
$func = $this->$name;
|
||||
if ($func instanceof \Closure) {
|
||||
return call_user_func_array($func, $params);
|
||||
}
|
||||
|
@ -155,9 +155,8 @@ class Object implements Arrayable
|
||||
*/
|
||||
public function __call($name, $params)
|
||||
{
|
||||
$getter = 'get' . $name;
|
||||
if (method_exists($this, $getter)) {
|
||||
$func = $this->$getter();
|
||||
if ($this->canGetProperty($name)) {
|
||||
$func = $this->$name;
|
||||
if ($func instanceof \Closure) {
|
||||
return call_user_func_array($func, $params);
|
||||
}
|
||||
|
Reference in New Issue
Block a user