Skip to content

Commit 0ec6ac5

Browse files
committed
Fix PHPDoc type annotations
1 parent 55fab78 commit 0ec6ac5

File tree

12 files changed

+144
-11
lines changed

12 files changed

+144
-11
lines changed

src/Framework/BaseTestListener.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,102 @@
1717
*/
1818
abstract class PHPUnit_Framework_BaseTestListener implements PHPUnit_Framework_TestListener
1919
{
20+
/**
21+
* An error occurred.
22+
*
23+
* @param PHPUnit_Framework_Test $test
24+
* @param \Exception|\Throwable $e
25+
* @param float $time
26+
*/
2027
public function addError(PHPUnit_Framework_Test $test, $e, $time)
2128
{
2229
}
2330

31+
/**
32+
* A failure occurred.
33+
*
34+
* @param PHPUnit_Framework_Test $test
35+
* @param PHPUnit_Framework_AssertionFailedError $e
36+
* @param float $time
37+
*/
2438
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
2539
{
2640
}
2741

42+
/**
43+
* Incomplete test.
44+
*
45+
* @param PHPUnit_Framework_Test $test
46+
* @param \Exception|\Throwable $e
47+
* @param float $time
48+
*/
2849
public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time)
2950
{
3051
}
3152

53+
/**
54+
* Risky test.
55+
*
56+
* @param PHPUnit_Framework_Test $test
57+
* @param \Exception|\Throwable $e
58+
* @param float $time
59+
*
60+
* @since Method available since Release 4.0.0
61+
*/
3262
public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time)
3363
{
3464
}
3565

66+
/**
67+
* Skipped test.
68+
*
69+
* @param PHPUnit_Framework_Test $test
70+
* @param \Exception|\Throwable $e
71+
* @param float $time
72+
*
73+
* @since Method available since Release 3.0.0
74+
*/
3675
public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time)
3776
{
3877
}
3978

79+
/**
80+
* A testsuite started.
81+
*
82+
* @param PHPUnit_Framework_TestSuite $suite
83+
*
84+
* @since Method available since Release 2.2.0
85+
*/
4086
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
4187
{
4288
}
4389

90+
/**
91+
* A testsuite ended.
92+
*
93+
* @param PHPUnit_Framework_TestSuite $suite
94+
*
95+
* @since Method available since Release 2.2.0
96+
*/
4497
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
4598
{
4699
}
47100

101+
/**
102+
* A test started.
103+
*
104+
* @param PHPUnit_Framework_Test $test
105+
*/
48106
public function startTest(PHPUnit_Framework_Test $test)
49107
{
50108
}
51109

110+
/**
111+
* A test ended.
112+
*
113+
* @param PHPUnit_Framework_Test $test
114+
* @param float $time
115+
*/
52116
public function endTest(PHPUnit_Framework_Test $test, $time)
53117
{
54118
}

src/Framework/Constraint/Count.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function matches($other)
4343
/**
4444
* @param mixed $other
4545
*
46-
* @return bool
46+
* @return int|void
4747
*/
4848
protected function getCountOf($other)
4949
{

src/Framework/Constraint/GreaterThan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
class PHPUnit_Framework_Constraint_GreaterThan extends PHPUnit_Framework_Constraint
1818
{
1919
/**
20-
* @var numeric
20+
* @var int|float
2121
*/
2222
protected $value;
2323

2424
/**
25-
* @param numeric $value
25+
* @param int|float $value
2626
*/
2727
public function __construct($value)
2828
{

src/Framework/Constraint/LessThan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
class PHPUnit_Framework_Constraint_LessThan extends PHPUnit_Framework_Constraint
1818
{
1919
/**
20-
* @var numeric
20+
* @var int|float
2121
*/
2222
protected $value;
2323

2424
/**
25-
* @param numeric $value
25+
* @param int|float $value
2626
*/
2727
public function __construct($value)
2828
{

src/Framework/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public function hasFailed()
602602
*
603603
* @param PHPUnit_Framework_TestResult $result
604604
*
605-
* @return PHPUnit_Framework_TestResult
605+
* @return PHPUnit_Framework_TestResult|null
606606
*
607607
* @throws PHPUnit_Framework_Exception
608608
*/
@@ -623,7 +623,7 @@ public function run(PHPUnit_Framework_TestResult $result = null)
623623
}
624624

625625
if (!$this instanceof PHPUnit_Framework_Warning && !$this->handleDependencies()) {
626-
return;
626+
return null;
627627
}
628628

629629
if ($this->runTestInSeparateProcess === true &&

src/Runner/BaseTestRunner.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getLoader()
4242
* @param string $suiteClassFile
4343
* @param mixed $suffixes
4444
*
45-
* @return PHPUnit_Framework_Test
45+
* @return PHPUnit_Framework_Test|null
4646
*/
4747
public function getTest($suiteClassName, $suiteClassFile = '', $suffixes = '')
4848
{
@@ -68,7 +68,7 @@ public function getTest($suiteClassName, $suiteClassFile = '', $suffixes = '')
6868
} catch (PHPUnit_Framework_Exception $e) {
6969
$this->runFailed($e->getMessage());
7070

71-
return;
71+
return null;
7272
}
7373

7474
try {
@@ -79,7 +79,7 @@ public function getTest($suiteClassName, $suiteClassFile = '', $suffixes = '')
7979
'suite() method must be static.'
8080
);
8181

82-
return;
82+
return null;
8383
}
8484

8585
try {
@@ -92,7 +92,7 @@ public function getTest($suiteClassName, $suiteClassFile = '', $suffixes = '')
9292
)
9393
);
9494

95-
return;
95+
return null;
9696
}
9797
} catch (ReflectionException $e) {
9898
try {

src/TextUI/TestRunner.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ private function showExtensionNotLoadedWarning($extension, $message = '')
10411041

10421042
/**
10431043
* @return PHP_CodeCoverage_Filter
1044+
* @suppress PhanUndeclaredConstant
10441045
*/
10451046
private function getCodeCoverageFilter()
10461047
{

src/Util/Filter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class PHPUnit_Util_Filter
2222
* @param bool $asString
2323
*
2424
* @return string
25+
* @suppress PhanUndeclaredConstant
2526
*/
2627
public static function getFilteredStacktrace(Exception $e, $asString = true)
2728
{

src/Util/GlobalState.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static function getIncludedFilesAsString()
4343
return static::processIncludedFilesAsString(get_included_files());
4444
}
4545

46+
/** @suppress PhanUndeclaredConstant */
4647
public static function processIncludedFilesAsString(array $files)
4748
{
4849
$blacklist = new PHPUnit_Util_Blacklist;

tests/Framework/TestListenerTest.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,109 @@ class Framework_TestListenerTest extends PHPUnit_Framework_TestCase implements P
2323
protected $result;
2424
protected $startCount;
2525

26+
/**
27+
* An error occurred.
28+
*
29+
* @param PHPUnit_Framework_Test $test
30+
* @param \Exception|\Throwable $e
31+
* @param float $time
32+
*/
2633
public function addError(PHPUnit_Framework_Test $test, $e, $time)
2734
{
2835
assert($e instanceof \Exception || $e instanceof \Error);
2936
$this->errorCount++;
3037
}
3138

39+
/**
40+
* A failure occurred.
41+
*
42+
* @param PHPUnit_Framework_Test $test
43+
* @param PHPUnit_Framework_AssertionFailedError $e
44+
* @param float $time
45+
*/
3246
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
3347
{
3448
$this->failureCount++;
3549
}
3650

51+
/**
52+
* Incomplete test.
53+
*
54+
* @param PHPUnit_Framework_Test $test
55+
* @param \Exception|\Throwable $e
56+
* @param float $time
57+
*/
3758
public function addIncompleteTest(PHPUnit_Framework_Test $test, $e, $time)
3859
{
3960
$this->notImplementedCount++;
4061
}
4162

63+
/**
64+
* Risky test.
65+
*
66+
* @param PHPUnit_Framework_Test $test
67+
* @param \Exception|\Throwable $e
68+
* @param float $time
69+
*
70+
* @since Method available since Release 4.0.0
71+
*/
4272
public function addRiskyTest(PHPUnit_Framework_Test $test, $e, $time)
4373
{
4474
$this->riskyCount++;
4575
}
4676

77+
/**
78+
* Skipped test.
79+
*
80+
* @param PHPUnit_Framework_Test $test
81+
* @param \Exception|\Throwable $e
82+
* @param float $time
83+
*
84+
* @since Method available since Release 3.0.0
85+
*/
4786
public function addSkippedTest(PHPUnit_Framework_Test $test, $e, $time)
4887
{
4988
$this->skippedCount++;
5089
}
5190

91+
/**
92+
* A testsuite started.
93+
*
94+
* @param PHPUnit_Framework_TestSuite $suite
95+
*
96+
* @since Method available since Release 2.2.0
97+
*/
5298
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
5399
{
54100
}
55101

102+
/**
103+
* A testsuite ended.
104+
*
105+
* @param PHPUnit_Framework_TestSuite $suite
106+
*
107+
* @since Method available since Release 2.2.0
108+
*/
56109
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
57110
{
58111
}
59112

113+
/**
114+
* A test started.
115+
*
116+
* @param PHPUnit_Framework_Test $test
117+
*/
60118
public function startTest(PHPUnit_Framework_Test $test)
61119
{
62120
$this->startCount++;
63121
}
64122

123+
/**
124+
* A test ended.
125+
*
126+
* @param PHPUnit_Framework_Test $test
127+
* @param float $time
128+
*/
65129
public function endTest(PHPUnit_Framework_Test $test, $time)
66130
{
67131
$this->endCount++;

0 commit comments

Comments
 (0)