1212
1313class SpecifyTest implements Test, SelfDescribing
1414{
15- protected $ name ;
15+ protected string $ name = '' ;
1616
17- protected $ test ;
17+ /** @var callable */
18+ protected $ test = null ;
1819
19- protected $ example ;
20+ protected array $ example = [] ;
2021
22+ /**
23+ * @var mixed|null
24+ */
2125 protected $ throws ;
2226
23- public function __construct ($ test )
27+ public function __construct (callable $ test )
2428 {
2529 $ this ->test = $ test ;
2630 }
2731
28- public function setName ($ name )
32+ public function setName (string $ name ): void
2933 {
3034 $ this ->name = $ name ;
3135 }
3236
33- public function toString () : string
37+ public function toString (): string
3438 {
3539 return $ this ->name ;
3640 }
@@ -49,8 +53,7 @@ public function getName($withDataSet = true): string
4953 * Count elements of an object
5054 * @link http://php.net/manual/en/countable.count.php
5155 * @return int The custom count as an integer.
52- * </p>
53- * <p>
56+ *
5457 * The return value is cast to an integer.
5558 * @since 5.1.0
5659 */
@@ -61,33 +64,27 @@ public function count(): int
6164
6265 /**
6366 * Runs a test and collects its result in a TestResult instance.
64- *
65- * @param TestResult|null $result
66- *
67- * @return TestResult
6867 */
6968 public function run (TestResult $ result = null ): TestResult
7069 {
7170 try {
7271 call_user_func_array ($ this ->test , $ this ->example );
73- } catch (AssertionFailedError $ e ) {
74- $ result ->addFailure (clone ($ this ), $ e , $ result ->time ());
72+ } catch (AssertionFailedError $ error ) {
73+ $ result ->addFailure (clone ($ this ), $ error , $ result ->time ());
7574 }
75+
7676 return $ result ;
7777 }
7878
79- /**
80- * @param mixed $example
81- */
82- public function setExample ($ example )
79+ public function setExample (array $ example ): void
8380 {
8481 $ this ->example = $ example ;
8582 }
8683
8784 /**
8885 * @param mixed $throws
8986 */
90- public function setThrows ($ throws )
87+ public function setThrows ($ throws ): void
9188 {
9289 $ this ->throws = $ throws ;
9390 }
0 commit comments