1 | <?php |
||
22 | class SwitchAction extends Action implements \ArrayAccess, \IteratorAggregate, \yii\base\Arrayable |
||
23 | { |
||
24 | use \hiqdev\yii2\collection\ManagerTrait; |
||
25 | |||
26 | /** |
||
27 | * @var string|callable the success message or a callback, that returns string. |
||
28 | * Gets arguments |
||
29 | */ |
||
30 | public $success; |
||
31 | |||
32 | /** |
||
33 | * @var string the error message |
||
34 | */ |
||
35 | public $error; |
||
36 | |||
37 | /** |
||
38 | * @var SwitchRule instance of the current running rule |
||
39 | */ |
||
40 | public $rule; |
||
41 | |||
42 | /** {@inheritdoc} */ |
||
43 | public function init() |
||
49 | |||
50 | /** |
||
51 | * @return array the default rules for the action. |
||
52 | * You can override this method in child classes to set own default rules. |
||
53 | */ |
||
54 | protected function getDefaultRules() |
||
58 | |||
59 | public function getItemConfig($name = null, array $config = []) |
||
71 | |||
72 | public function run() |
||
93 | |||
94 | /** |
||
95 | * Does perform only if rule has 'save' enabled. |
||
96 | */ |
||
97 | public function perform() |
||
105 | } |
||
106 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.