File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Safemood \Workflow ;
4
4
5
+ use Safemood \Workflow \Enums \ActionState ;
6
+
5
7
abstract class Action
6
8
{
7
9
private $ state ;
@@ -19,20 +21,20 @@ abstract public function handle(array &$context);
19
21
/**
20
22
* Get the state of the action.
21
23
*
22
- * @return mixed
24
+ * @return ActionState|null
23
25
*/
24
- public function getState ()
26
+ public function getState (): ? ActionState
25
27
{
26
28
return $ this ->state ;
27
29
}
28
30
29
31
/**
30
32
* Set the state of the action.
31
33
*
32
- * @param mixed $state
34
+ * @param ActionState $state
33
35
* @return void
34
36
*/
35
- public function setState ($ state )
37
+ public function setState (ActionState $ state ): void
36
38
{
37
39
$ this ->state = $ state ;
38
40
}
@@ -42,7 +44,7 @@ public function setState($state)
42
44
*
43
45
* @return \Exception|null
44
46
*/
45
- public function getException ()
47
+ public function getException (): ? \ Exception
46
48
{
47
49
return $ this ->exception ;
48
50
}
@@ -53,7 +55,7 @@ public function getException()
53
55
* @param \Exception|null $exception
54
56
* @return void
55
57
*/
56
- public function setException ($ exception )
58
+ public function setException (? \ Exception $ exception ): void
57
59
{
58
60
$ this ->exception = $ exception ;
59
61
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Safemood \Workflow \Enums ;
4
4
5
- class ActionState
5
+ enum ActionState: string
6
6
{
7
- const PENDING = 'pending ' ;
8
-
9
- const RUNNING = 'running ' ;
10
-
11
- const SUCCESS = 'success ' ;
12
-
13
- const FAILED = 'failed ' ;
7
+ case PENDING = 'pending ' ;
8
+ case RUNNING = 'running ' ;
9
+ case SUCCESS = 'success ' ;
10
+ case FAILED = 'failed ' ;
14
11
}
You can’t perform that action at this time.
0 commit comments