Skip to content
Permalink
Browse files

Add return early statements for redirecting in controllers.

  • Loading branch information...
dereuromark committed Jan 4, 2014
1 parent 3cee3b0 commit 3e48d2e082ae6207e0a64841defb870f5f1dba87
Showing with 26 additions and 0 deletions.
  1. +26 −0 lib/Cake/Console/Command/UpgradeShell.php
@@ -500,6 +500,29 @@ public function constants() {
$this->_filesRegexpUpdate($patterns);
}
/**
* Update controllers.
*
* - Make redirect statements return early.
*
* @return void
*/
public function controllers() {
$this->_paths = App::Path('Controller');
if (!empty($this->params['plugin'])) {
$this->_paths = App::Path('Controller', $this->params['plugin']);
}
$patterns = array(
array(
'$this->redirect() to return $this->redirect()',
'/\t\$this-\>redirect\(/',
"\t" . 'return $this->redirect('
),
);
$this->_filesRegexpUpdate($patterns);
}
/**
* Update components.
*
@@ -840,6 +863,9 @@ public function getOptionParser() {
))->addSubcommand('constants', array(
'help' => __d('cake_console', "Replace Obsolete constants"),
'parser' => $subcommandParser
))->addSubcommand('controllers', array(
'help' => __d('cake_console', 'Update controllers.'),
'parser' => $subcommandParser
))->addSubcommand('components', array(
'help' => __d('cake_console', 'Update components to extend Component class.'),
'parser' => $subcommandParser

0 comments on commit 3e48d2e

Please sign in to comment.
You can’t perform that action at this time.