Fixed the issue that Object/Component doesn't support using anonymous function as normal property values.

This commit is contained in:
Qiang Xue
2013-09-11 13:42:34 -04:00
parent c6f4dac249
commit 84dd19d76f
2 changed files with 4 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}