Commit 84dd19d7 by Qiang Xue

Fixed the issue that Object/Component doesn't support using anonymous function…

Fixed the issue that Object/Component doesn't support using anonymous function as normal property values.
parent c6f4dac2
...@@ -193,9 +193,8 @@ class Component extends Object ...@@ -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 ...@@ -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);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment