Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor methods to avoid else block on returning early

  • Loading branch information...
commit f3018cc53272c11958c1017bc98723c4fb54d144 1 parent 7c856e6
@dereuromark dereuromark authored
View
3  lib/Cake/Cache/Cache.php
@@ -538,9 +538,8 @@ public static function groupConfigs($group = null) {
}
if (isset(self::$_groups[$group])) {
return array($group => self::$_groups[$group]);
- } else {
- throw new CacheException(__d('cake_dev', 'Invalid cache group %s', $group));
}
+ throw new CacheException(__d('cake_dev', 'Invalid cache group %s', $group));
}
}
View
5 lib/Cake/Console/Command/SchemaShell.php
@@ -235,10 +235,9 @@ public function dump() {
if ($File->write($contents)) {
$this->out(__d('cake_console', 'SQL dump file created in %s', $File->pwd()));
return $this->_stop();
- } else {
- $this->err(__d('cake_console', 'SQL dump could not be created'));
- return $this->_stop();
}
+ $this->err(__d('cake_console', 'SQL dump could not be created'));
+ return $this->_stop();
}
$this->out($contents);
return $contents;
View
5 lib/Cake/Model/Behavior/TreeBehavior.php
@@ -789,10 +789,9 @@ public function removeFromTree(Model $Model, $id = null, $delete = false) {
if ($node[$right] == $node[$left] + 1) {
if ($delete) {
return $Model->delete($id);
- } else {
- $Model->id = $id;
- return $Model->saveField($parent, null);
}
+ $Model->id = $id;
+ return $Model->saveField($parent, null);
} elseif ($node[$parent]) {
list($parentNode) = array_values($Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $node[$parent]),
View
6 lib/Cake/View/Helper/HtmlHelper.php
@@ -556,9 +556,8 @@ public function script($url, $options = array()) {
if (empty($options['block'])) {
return $out;
- } else {
- $this->_View->append($options['block'], $out);
}
+ $this->_View->append($options['block'], $out);
}
/**
@@ -593,9 +592,8 @@ public function scriptBlock($script, $options = array()) {
if (empty($options['block'])) {
return $out;
- } else {
- $this->_View->append($options['block'], $out);
}
+ $this->_View->append($options['block'], $out);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.