1 | <?php |
||
8 | class StateConfig |
||
9 | { |
||
10 | /** @var string */ |
||
11 | public $field; |
||
12 | |||
13 | /** @var string|\Spatie\ModelStates\State */ |
||
14 | public $stateClass; |
||
15 | |||
16 | /** @var string[] */ |
||
17 | public $allowedTransitions = []; |
||
18 | |||
19 | /** @var string|null */ |
||
20 | public $defaultStateClass; |
||
21 | |||
22 | public function __construct(string $field, string $stateClass) |
||
32 | |||
33 | public function default(string $defaultStateClass): StateConfig |
||
39 | |||
40 | /** |
||
41 | * @param string|array $from |
||
42 | * @param string $to |
||
43 | * @param string|null $transition |
||
44 | * |
||
45 | * @return \Spatie\ModelStates\StateConfig |
||
46 | */ |
||
47 | public function allowTransition($from, string $to, string $transition = null): StateConfig |
||
73 | |||
74 | public function allowTransitions(array $transitions): StateConfig |
||
82 | |||
83 | public function transitionableStates(string $fromClass): array |
||
99 | |||
100 | /** |
||
101 | * @param string $from |
||
102 | * @param string $to |
||
103 | * |
||
104 | * @return string|\Spatie\ModelStates\Transition|null |
||
105 | */ |
||
106 | public function resolveTransition(Model $model, string $from, string $to) |
||
121 | |||
122 | private function createTransitionKey(string $from, string $to): string |
||
126 | } |
||
127 |
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.