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)
|
public function __call($name, $params)
|
||||||
{
|
{
|
||||||
$getter = 'get' . $name;
|
if ($this->canGetProperty($name)) {
|
||||||
if (method_exists($this, $getter)) {
|
$func = $this->$name;
|
||||||
$func = $this->$getter();
|
|
||||||
if ($func instanceof \Closure) {
|
if ($func instanceof \Closure) {
|
||||||
return call_user_func_array($func, $params);
|
return call_user_func_array($func, $params);
|
||||||
}
|
}
|
||||||
|
@ -155,9 +155,8 @@ class Object implements Arrayable
|
|||||||
*/
|
*/
|
||||||
public function __call($name, $params)
|
public function __call($name, $params)
|
||||||
{
|
{
|
||||||
$getter = 'get' . $name;
|
if ($this->canGetProperty($name)) {
|
||||||
if (method_exists($this, $getter)) {
|
$func = $this->$name;
|
||||||
$func = $this->$getter();
|
|
||||||
if ($func instanceof \Closure) {
|
if ($func instanceof \Closure) {
|
||||||
return call_user_func_array($func, $params);
|
return call_user_func_array($func, $params);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user