@@ -29,13 +29,8 @@ protected function tearDown(): void
29
29
30
30
/**
31
31
* Shortcut for quickly defining services. The returned Definition object can be further modified if necessary.
32
- *
33
- * @param $serviceId
34
- * @param $class
35
- *
36
- * @return Definition
37
32
*/
38
- protected function registerService ($ serviceId , $ class )
33
+ protected function registerService (string $ serviceId , string $ class ): Definition
39
34
{
40
35
$ definition = new Definition ($ class );
41
36
@@ -46,41 +41,34 @@ protected function registerService($serviceId, $class)
46
41
47
42
/**
48
43
* Set a service definition you manually created.
49
- *
50
- * @param $serviceId
51
- * @param Definition $definition
52
44
*/
53
- protected function setDefinition ($ serviceId , Definition $ definition )
45
+ protected function setDefinition (string $ serviceId , Definition $ definition ): void
54
46
{
55
47
$ this ->container ->setDefinition ($ serviceId , $ definition );
56
48
}
57
49
58
50
/**
59
51
* Set a parameter.
60
52
*
61
- * @param $parameterId
62
- * @param $parameterValue
53
+ * @param mixed $parameterValue
63
54
*/
64
- protected function setParameter ($ parameterId , $ parameterValue )
55
+ protected function setParameter (string $ parameterId , $ parameterValue ): void
65
56
{
66
57
$ this ->container ->setParameter ($ parameterId , $ parameterValue );
67
58
}
68
59
69
60
/**
70
61
* Call this method to compile the ContainerBuilder, to test if any problems would occur at runtime.
71
62
*/
72
- protected function compile ()
63
+ protected function compile (): void
73
64
{
74
65
$ this ->container ->compile ();
75
66
}
76
67
77
68
/**
78
69
* Assert that the ContainerBuilder for this test has a service definition with the given id and class.
79
- *
80
- * @param $serviceId
81
- * @param $expectedClass
82
70
*/
83
- protected function assertContainerBuilderHasService ($ serviceId , $ expectedClass = null )
71
+ protected function assertContainerBuilderHasService (string $ serviceId , ? string $ expectedClass = null ): void
84
72
{
85
73
$ checkExpectedClass = (func_num_args () > 1 );
86
74
@@ -92,10 +80,8 @@ protected function assertContainerBuilderHasService($serviceId, $expectedClass =
92
80
93
81
/**
94
82
* Assert that the ContainerBuilder for this test does not have a service definition with the given id.
95
- *
96
- * @param $serviceId
97
83
*/
98
- protected function assertContainerBuilderNotHasService ($ serviceId )
84
+ protected function assertContainerBuilderNotHasService (string $ serviceId ): void
99
85
{
100
86
self ::assertThat (
101
87
$ this ->container ,
@@ -105,10 +91,8 @@ protected function assertContainerBuilderNotHasService($serviceId)
105
91
106
92
/**
107
93
* Assert that the ContainerBuilder for this test has a synthetic service with the given id.
108
- *
109
- * @param $serviceId
110
94
*/
111
- protected function assertContainerBuilderHasSyntheticService ($ serviceId )
95
+ protected function assertContainerBuilderHasSyntheticService (string $ serviceId ): void
112
96
{
113
97
self ::assertThat (
114
98
$ this ->container ,
@@ -118,11 +102,8 @@ protected function assertContainerBuilderHasSyntheticService($serviceId)
118
102
119
103
/**
120
104
* Assert that the ContainerBuilder for this test has an alias and that it is an alias for the given service id.
121
- *
122
- * @param $aliasId
123
- * @param $expectedServiceId
124
105
*/
125
- protected function assertContainerBuilderHasAlias ($ aliasId , $ expectedServiceId = null )
106
+ protected function assertContainerBuilderHasAlias (string $ aliasId , ? string $ expectedServiceId = null ): void
126
107
{
127
108
self ::assertThat (
128
109
$ this ->container ,
@@ -133,10 +114,9 @@ protected function assertContainerBuilderHasAlias($aliasId, $expectedServiceId =
133
114
/**
134
115
* Assert that the ContainerBuilder for this test has a parameter and that its value is the given value.
135
116
*
136
- * @param $parameterName
137
- * @param $expectedParameterValue
117
+ * @param mixed $expectedParameterValue
138
118
*/
139
- protected function assertContainerBuilderHasParameter ($ parameterName , $ expectedParameterValue = null )
119
+ protected function assertContainerBuilderHasParameter (string $ parameterName , $ expectedParameterValue = null ): void
140
120
{
141
121
$ checkParameterValue = (func_num_args () > 1 );
142
122
@@ -150,15 +130,13 @@ protected function assertContainerBuilderHasParameter($parameterName, $expectedP
150
130
* Assert that the ContainerBuilder for this test has a service definition with the given id, which has an argument
151
131
* at the given index, and its value is the given value.
152
132
*
153
- * @param $serviceId
154
- * @param $argumentIndex
155
- * @param $expectedValue
133
+ * @param mixed $expectedValue
156
134
*/
157
135
protected function assertContainerBuilderHasServiceDefinitionWithArgument (
158
- $ serviceId ,
136
+ string $ serviceId ,
159
137
$ argumentIndex ,
160
138
$ expectedValue = null
161
- ) {
139
+ ): void {
162
140
$ definition = $ this ->container ->findDefinition ($ serviceId );
163
141
$ checkValue = (func_num_args () > 2 );
164
142
@@ -172,15 +150,14 @@ protected function assertContainerBuilderHasServiceDefinitionWithArgument(
172
150
* Assert that the ContainerBuilder for this test has a service definition with the given id, which has an argument
173
151
* at the given index, and its value is a ServiceLocator with a reference-map equal to the given value.
174
152
*
175
- * @param string $serviceId
176
153
* @param int|string $argumentIndex
177
154
* @param array $expectedServiceMap an array of service-id references and their key in the map
178
155
*/
179
156
protected function assertContainerBuilderHasServiceDefinitionWithServiceLocatorArgument (
180
- $ serviceId ,
157
+ string $ serviceId ,
181
158
$ argumentIndex ,
182
159
array $ expectedValue
183
- ) {
160
+ ): void {
184
161
self ::assertThat (
185
162
$ this ->container ,
186
163
new DefinitionArgumentEqualsServiceLocatorConstraint ($ serviceId , $ argumentIndex , $ expectedValue )
@@ -191,17 +168,14 @@ protected function assertContainerBuilderHasServiceDefinitionWithServiceLocatorA
191
168
* Assert that the ContainerBuilder for this test has a service definition with the given id, which has a method
192
169
* call to the given method with the given arguments.
193
170
*
194
- * @param string $serviceId
195
- * @param string $method
196
- * @param array $arguments
197
171
* @param int|null $index
198
172
*/
199
173
protected function assertContainerBuilderHasServiceDefinitionWithMethodCall (
200
- $ serviceId ,
201
- $ method ,
174
+ string $ serviceId ,
175
+ string $ method ,
202
176
array $ arguments = [],
203
177
$ index = null
204
- ) {
178
+ ): void {
205
179
$ definition = $ this ->container ->findDefinition ($ serviceId );
206
180
207
181
self ::assertThat ($ definition , new DefinitionHasMethodCallConstraint ($ method , $ arguments , $ index ));
@@ -210,16 +184,12 @@ protected function assertContainerBuilderHasServiceDefinitionWithMethodCall(
210
184
/**
211
185
* Assert that the ContainerBuilder for this test has a service definition with the given id, which has a tag
212
186
* with the given attributes.
213
- *
214
- * @param string $serviceId
215
- * @param string $tag
216
- * @param array $attributes
217
187
*/
218
188
protected function assertContainerBuilderHasServiceDefinitionWithTag (
219
- $ serviceId ,
220
- $ tag ,
189
+ string $ serviceId ,
190
+ string $ tag ,
221
191
array $ attributes = []
222
- ) {
192
+ ): void {
223
193
$ definition = $ this ->container ->findDefinition ($ serviceId );
224
194
225
195
self ::assertThat ($ definition , new DefinitionHasTagConstraint ($ tag , $ attributes ));
@@ -228,11 +198,8 @@ protected function assertContainerBuilderHasServiceDefinitionWithTag(
228
198
/**
229
199
* Assert that the ContainerBuilder for this test has a service definition with the given id which is a decorated
230
200
* service and it has the given parent service.
231
- *
232
- * @param $serviceId
233
- * @param $parentServiceId
234
201
*/
235
- protected function assertContainerBuilderHasServiceDefinitionWithParent ($ serviceId , $ parentServiceId )
202
+ protected function assertContainerBuilderHasServiceDefinitionWithParent (string $ serviceId , string $ parentServiceId ): void
236
203
{
237
204
$ definition = $ this ->container ->findDefinition ($ serviceId );
238
205
@@ -242,10 +209,9 @@ protected function assertContainerBuilderHasServiceDefinitionWithParent($service
242
209
/**
243
210
* Assert that the ContainerBuilder for this test has a ServiceLocator service definition with the given id.
244
211
*
245
- * @param string $serviceId
246
- * @param array $expectedServiceMap an array of service-id references and their key in the map
212
+ * @param array $expectedServiceMap an array of service-id references and their key in the map
247
213
*/
248
- protected function assertContainerBuilderHasServiceLocator (string $ serviceId , array $ expectedServiceMap = [])
214
+ protected function assertContainerBuilderHasServiceLocator (string $ serviceId , array $ expectedServiceMap = []): void
249
215
{
250
216
$ definition = $ this ->container ->findDefinition ($ serviceId );
251
217
0 commit comments