@@ -29,13 +29,19 @@ public function __construct(
29
29
);
30
30
}
31
31
32
+ public function teardown (): void
33
+ {
34
+ $ this ->channel ->close ();
35
+ $ this ->connection ->stop ();
36
+ }
37
+
32
38
public static function withoutAuthentication (
33
39
string $ stepUuid ,
34
40
string $ host ,
35
41
string $ vhost ,
36
42
string $ topic ,
37
- string $ exchange = null ,
38
- int $ port = null ,
43
+ ? string $ exchange = null ,
44
+ ? int $ port = null ,
39
45
): self {
40
46
$ connection = new Client ([
41
47
'host ' => $ host ,
@@ -56,8 +62,8 @@ public static function withAuthentication(
56
62
string $ topic ,
57
63
?string $ user ,
58
64
?string $ password ,
59
- string $ exchange = null ,
60
- int $ port = null ,
65
+ ? string $ exchange = null ,
66
+ ? int $ port = null ,
61
67
): self {
62
68
$ connection = new Client ([
63
69
'host ' => $ host ,
@@ -71,10 +77,10 @@ public static function withAuthentication(
71
77
return new self ($ connection , stepUuid: $ stepUuid , topic: $ topic , exchange: $ exchange );
72
78
}
73
79
74
- public function reject (StepCodeInterface $ step , array |object $ rejection , \Throwable $ exception = null ): void
80
+ public function reject (StepCodeInterface $ step , array |object $ rejection , ? \Throwable $ exception = null ): void
75
81
{
76
82
$ this ->channel ->publish (
77
- json_encode ([
83
+ \ json_encode ([
78
84
'item ' => $ rejection ,
79
85
'exception ' => $ exception ,
80
86
'step ' => $ this ->stepUuid ,
@@ -87,10 +93,10 @@ public function reject(StepCodeInterface $step, array|object $rejection, \Throwa
87
93
);
88
94
}
89
95
90
- public function rejectWithReason (StepCodeInterface $ step , array |object $ rejection , string $ reason , \Throwable $ exception = null ): void
96
+ public function rejectWithReason (StepCodeInterface $ step , array |object $ rejection , string $ reason , ? \Throwable $ exception = null ): void
91
97
{
92
98
$ this ->channel ->publish (
93
- json_encode ([
99
+ \ json_encode ([
94
100
'item ' => $ rejection ,
95
101
'exception ' => $ exception ,
96
102
'step ' => $ this ->stepUuid ,
@@ -113,10 +119,4 @@ public function initialize(): void
113
119
autoDelete: true ,
114
120
);
115
121
}
116
-
117
- public function teardown (): void
118
- {
119
- $ this ->channel ->close ();
120
- $ this ->connection ->stop ();
121
- }
122
122
}
0 commit comments