Update Controller.php and Module.php

beforeAction() code style:

1. Return early on error
2. Don't else-after-return

close #7804
This commit is contained in:
tom--
2015-03-20 11:18:39 -04:00
committed by Carsten Brandt
parent 3d403ad074
commit 70fa53a20f
2 changed files with 10 additions and 8 deletions

View File

@@ -584,12 +584,13 @@ class Module extends ServiceLocator
* ```php
* public function beforeAction($action)
* {
* if (parent::beforeAction($action)) {
* // your custom code here
* return true; // or false if needed
* } else {
* if (!parent::beforeAction($action)) {
* return false;
* }
*
* // your custom code here
*
* return true; // or false to not run the action
* }
* ```
*