mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-06 07:24:44 +01:00
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:
@@ -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
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user