Commit ee81915a by Paul Kofmann

Removed redundant code in detachBehaviors()

After ensureBehaviors() call $this->_behaviors is an array already. And since detachBehavior() unsets elements in $this->_behaviors, $this->_behaviors turns out to be an empty array after all iterations.
parent 369b9c27
......@@ -543,12 +543,9 @@ class Component extends Object
public function detachBehaviors()
{
$this->ensureBehaviors();
if ($this->_behaviors !== null) {
foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name);
}
foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name);
}
$this->_behaviors = [];
}
/**
......
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