1
1
<?php
2
+ declare (strict_types=1 );
2
3
3
4
namespace JohnKary \PHPUnit \Listener ;
4
5
@@ -187,7 +188,7 @@ public function endTestSuite(TestSuite $suite)
187
188
* @param int $slowThreshold Test execution time at which a test should be considered slow (milliseconds)
188
189
* @return bool
189
190
*/
190
- protected function isSlow ($ time , $ slowThreshold )
191
+ protected function isSlow (int $ time , int $ slowThreshold ) : bool
191
192
{
192
193
return $ time >= $ slowThreshold ;
193
194
}
@@ -196,9 +197,9 @@ protected function isSlow($time, $slowThreshold)
196
197
* Stores a test as slow.
197
198
*
198
199
* @param TestCase $test
199
- * @param int $time Test execution time in milliseconds
200
+ * @param int $time Test execution time in milliseconds
200
201
*/
201
- protected function addSlowTest (TestCase $ test , $ time )
202
+ protected function addSlowTest (TestCase $ test , int $ time )
202
203
{
203
204
$ label = $ this ->makeLabel ($ test );
204
205
@@ -210,7 +211,7 @@ protected function addSlowTest(TestCase $test, $time)
210
211
*
211
212
* @return bool
212
213
*/
213
- protected function hasSlowTests ()
214
+ protected function hasSlowTests () : bool
214
215
{
215
216
return !empty ($ this ->slow );
216
217
}
@@ -221,7 +222,7 @@ protected function hasSlowTests()
221
222
* @param float $time
222
223
* @return int
223
224
*/
224
- protected function toMilliseconds ($ time )
225
+ protected function toMilliseconds (float $ time ) : int
225
226
{
226
227
return (int ) round ($ time * 1000 );
227
228
}
@@ -232,7 +233,7 @@ protected function toMilliseconds($time)
232
233
* @param TestCase $test
233
234
* @return string
234
235
*/
235
- protected function makeLabel (TestCase $ test )
236
+ protected function makeLabel (TestCase $ test ) : string
236
237
{
237
238
return sprintf ('%s:%s ' , get_class ($ test ), $ test ->getName ());
238
239
}
@@ -242,7 +243,7 @@ protected function makeLabel(TestCase $test)
242
243
*
243
244
* @return int
244
245
*/
245
- protected function getReportLength ()
246
+ protected function getReportLength () : int
246
247
{
247
248
return min (count ($ this ->slow ), $ this ->reportLength );
248
249
}
@@ -253,7 +254,7 @@ protected function getReportLength()
253
254
*
254
255
* @return int
255
256
*/
256
- protected function getHiddenCount ()
257
+ protected function getHiddenCount () : int
257
258
{
258
259
$ total = count ($ this ->slow );
259
260
$ showing = $ this ->getReportLength ();
@@ -327,10 +328,10 @@ protected function loadOptions(array $options)
327
328
* @param TestCase $test
328
329
* @return int
329
330
*/
330
- protected function getSlowThreshold (TestCase $ test )
331
+ protected function getSlowThreshold (TestCase $ test ) : int
331
332
{
332
333
$ ann = $ test ->getAnnotations ();
333
334
334
- return isset ($ ann ['method ' ]['slowThreshold ' ][0 ]) ? $ ann ['method ' ]['slowThreshold ' ][0 ] : $ this ->slowThreshold ;
335
+ return isset ($ ann ['method ' ]['slowThreshold ' ][0 ]) ? ( int ) $ ann ['method ' ]['slowThreshold ' ][0 ] : $ this ->slowThreshold ;
335
336
}
336
337
}
0 commit comments