Removed the support for calling anonymous function returned as a property value.

This commit is contained in:
Qiang Xue
2013-09-12 20:10:06 -04:00
parent a2b946e4d3
commit 91b6e2945a
3 changed files with 2 additions and 23 deletions

View File

@@ -179,9 +179,8 @@ class Component extends Object
/**
* Calls the named method which is not a class method.
* If the name refers to a component property whose value is
* an anonymous function, the method will execute the function.
* Otherwise, it will check if any attached behavior has
*
* This method will check if any attached behavior has
* the named method and will execute it if available.
*
* Do not call this method directly as it is a PHP magic method that
@@ -193,13 +192,6 @@ class Component extends Object
*/
public function __call($name, $params)
{
if ($this->canGetProperty($name)) {
$func = $this->$name;
if ($func instanceof \Closure) {
return call_user_func_array($func, $params);
}
}
$this->ensureBehaviors();
foreach ($this->_behaviors as $object) {
if ($object->hasMethod($name)) {

View File

@@ -143,8 +143,6 @@ class Object implements Arrayable
/**
* Calls the named method which is not a class method.
* If the name refers to a component property whose value is
* an anonymous function, the method will execute the function.
*
* Do not call this method directly as it is a PHP magic method that
* will be implicitly called when an unknown method is being invoked.
@@ -155,12 +153,6 @@ class Object implements Arrayable
*/
public function __call($name, $params)
{
if ($this->canGetProperty($name)) {
$func = $this->$name;
if ($func instanceof \Closure) {
return call_user_func_array($func, $params);
}
}
throw new UnknownMethodException('Unknown method: ' . get_class($this) . "::$name()");
}