Skip to content

Commit

Permalink
Add type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 15, 2017
1 parent 7b16723 commit 7e9e3aa
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 65 deletions.
20 changes: 10 additions & 10 deletions src/Framework/TestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface TestListener
* @param \Throwable $t
* @param float $time
*/
public function addError(Test $test, \Throwable $t, $time);
public function addError(Test $test, \Throwable $t, float $time): void;

/**
* A warning occurred.
Expand All @@ -30,7 +30,7 @@ public function addError(Test $test, \Throwable $t, $time);
* @param Warning $e
* @param float $time
*/
public function addWarning(Test $test, Warning $e, $time);
public function addWarning(Test $test, Warning $e, float $time): void;

/**
* A failure occurred.
Expand All @@ -39,7 +39,7 @@ public function addWarning(Test $test, Warning $e, $time);
* @param AssertionFailedError $e
* @param float $time
*/
public function addFailure(Test $test, AssertionFailedError $e, $time);
public function addFailure(Test $test, AssertionFailedError $e, float $time): void;

/**
* Incomplete test.
Expand All @@ -48,7 +48,7 @@ public function addFailure(Test $test, AssertionFailedError $e, $time);
* @param \Throwable $t
* @param float $time
*/
public function addIncompleteTest(Test $test, \Throwable $t, $time);
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void;

/**
* Risky test.
Expand All @@ -57,7 +57,7 @@ public function addIncompleteTest(Test $test, \Throwable $t, $time);
* @param \Throwable $t
* @param float $time
*/
public function addRiskyTest(Test $test, \Throwable $t, $time);
public function addRiskyTest(Test $test, \Throwable $t, float $time): void;

/**
* Skipped test.
Expand All @@ -66,34 +66,34 @@ public function addRiskyTest(Test $test, \Throwable $t, $time);
* @param \Throwable $t
* @param float $time
*/
public function addSkippedTest(Test $test, \Throwable $t, $time);
public function addSkippedTest(Test $test, \Throwable $t, float $time): void;

/**
* A test suite started.
*
* @param TestSuite $suite
*/
public function startTestSuite(TestSuite $suite);
public function startTestSuite(TestSuite $suite): void;

/**
* A test suite ended.
*
* @param TestSuite $suite
*/
public function endTestSuite(TestSuite $suite);
public function endTestSuite(TestSuite $suite): void;

/**
* A test started.
*
* @param Test $test
*/
public function startTest(Test $test);
public function startTest(Test $test): void;

/**
* A test ended.
*
* @param Test $test
* @param float $time
*/
public function endTest(Test $test, $time);
public function endTest(Test $test, float $time): void;
}
14 changes: 7 additions & 7 deletions src/TextUI/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function printWaitPrompt(): void
* @param \Throwable $t
* @param float $time
*/
public function addError(Test $test, \Throwable $t, $time): void
public function addError(Test $test, \Throwable $t, float $time): void
{
$this->writeProgressWithColor('fg-red, bold', 'E');
$this->lastTestFailed = true;
Expand All @@ -220,7 +220,7 @@ public function addError(Test $test, \Throwable $t, $time): void
* @param AssertionFailedError $e
* @param float $time
*/
public function addFailure(Test $test, AssertionFailedError $e, $time): void
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$this->writeProgressWithColor('bg-red, fg-white', 'F');
$this->lastTestFailed = true;
Expand All @@ -233,7 +233,7 @@ public function addFailure(Test $test, AssertionFailedError $e, $time): void
* @param Warning $e
* @param float $time
*/
public function addWarning(Test $test, Warning $e, $time): void
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->writeProgressWithColor('fg-yellow, bold', 'W');
$this->lastTestFailed = true;
Expand All @@ -246,7 +246,7 @@ public function addWarning(Test $test, Warning $e, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addIncompleteTest(Test $test, \Throwable $t, $time): void
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
{
$this->writeProgressWithColor('fg-yellow, bold', 'I');
$this->lastTestFailed = true;
Expand All @@ -259,7 +259,7 @@ public function addIncompleteTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addRiskyTest(Test $test, \Throwable $t, $time): void
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
{
$this->writeProgressWithColor('fg-yellow, bold', 'R');
$this->lastTestFailed = true;
Expand All @@ -272,7 +272,7 @@ public function addRiskyTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addSkippedTest(Test $test, \Throwable $t, $time): void
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
{
$this->writeProgressWithColor('fg-cyan, bold', 'S');
$this->lastTestFailed = true;
Expand Down Expand Up @@ -324,7 +324,7 @@ public function startTest(Test $test): void
* @param Test $test
* @param float $time
*/
public function endTest(Test $test, $time): void
public function endTest(Test $test, float $time): void
{
if ($this->debug) {
$this->write(
Expand Down
16 changes: 7 additions & 9 deletions src/Util/Log/JUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function flush(): void
* @param \Throwable $t
* @param float $time
*/
public function addError(Test $test, \Throwable $t, $time): void
public function addError(Test $test, \Throwable $t, float $time): void
{
$this->doAddFault($test, $t, $time, 'error');
$this->testSuiteErrors[$this->testSuiteLevel]++;
Expand All @@ -151,7 +151,7 @@ public function addError(Test $test, \Throwable $t, $time): void
* @param Warning $e
* @param float $time
*/
public function addWarning(Test $test, Warning $e, $time): void
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->doAddFault($test, $e, $time, 'warning');
$this->testSuiteFailures[$this->testSuiteLevel]++;
Expand All @@ -164,7 +164,7 @@ public function addWarning(Test $test, Warning $e, $time): void
* @param AssertionFailedError $e
* @param float $time
*/
public function addFailure(Test $test, AssertionFailedError $e, $time): void
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$this->doAddFault($test, $e, $time, 'failure');
$this->testSuiteFailures[$this->testSuiteLevel]++;
Expand All @@ -177,7 +177,7 @@ public function addFailure(Test $test, AssertionFailedError $e, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addIncompleteTest(Test $test, \Throwable $t, $time): void
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
{
$this->doAddSkipped($test);
}
Expand All @@ -189,7 +189,7 @@ public function addIncompleteTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addRiskyTest(Test $test, \Throwable $t, $time): void
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
{
if (!$this->reportUselessTests || $this->currentTestCase === null) {
return;
Expand Down Expand Up @@ -217,7 +217,7 @@ public function addRiskyTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addSkippedTest(Test $test, \Throwable $t, $time): void
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
{
$this->doAddSkipped($test);
}
Expand Down Expand Up @@ -310,8 +310,6 @@ public function endTestSuite(TestSuite $suite): void
* A test started.
*
* @param Test $test
*
* @throws \ReflectionException
*/
public function startTest(Test $test): void
{
Expand Down Expand Up @@ -341,7 +339,7 @@ public function startTest(Test $test): void
* @param Test $test
* @param float $time
*/
public function endTest(Test $test, $time): void
public function endTest(Test $test, float $time): void
{
if ($test instanceof TestCase) {
$numAssertions = $test->getNumAssertions();
Expand Down
18 changes: 11 additions & 7 deletions src/Util/Log/TeamCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function printResult(TestResult $result): void
* @param \Throwable $t
* @param float $time
*/
public function addError(Test $test, \Throwable $t, $time): void
public function addError(Test $test, \Throwable $t, float $time): void
{
$this->printEvent(
'testFailed',
Expand All @@ -80,7 +80,7 @@ public function addError(Test $test, \Throwable $t, $time): void
* @param Warning $e
* @param float $time
*/
public function addWarning(Test $test, Warning $e, $time): void
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->printEvent(
'testFailed',
Expand All @@ -99,7 +99,7 @@ public function addWarning(Test $test, Warning $e, $time): void
* @param AssertionFailedError $e
* @param float $time
*/
public function addFailure(Test $test, AssertionFailedError $e, $time): void
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$parameters = [
'name' => $test->getName(),
Expand Down Expand Up @@ -141,7 +141,7 @@ public function addFailure(Test $test, AssertionFailedError $e, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addIncompleteTest(Test $test, \Throwable $t, $time): void
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
{
$this->printIgnoredTest($test->getName(), $t);
}
Expand All @@ -153,7 +153,7 @@ public function addIncompleteTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addRiskyTest(Test $test, \Throwable $t, $time): void
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
{
$this->addError($test, $t, $time);
}
Expand All @@ -165,7 +165,7 @@ public function addRiskyTest(Test $test, \Throwable $t, $time): void
* @param \Throwable $t
* @param float $time
*/
public function addSkippedTest(Test $test, \Throwable $t, $time): void
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
{
$testName = $test->getName();
if ($this->startedTestName !== $testName) {
Expand Down Expand Up @@ -193,6 +193,8 @@ public function printIgnoredTest($testName, \Throwable $t): void
* A testsuite started.
*
* @param TestSuite $suite
*
* @throws \ReflectionException
*/
public function startTestSuite(TestSuite $suite): void
{
Expand Down Expand Up @@ -265,6 +267,8 @@ public function endTestSuite(TestSuite $suite): void
* A test started.
*
* @param Test $test
*
* @throws \ReflectionException
*/
public function startTest(Test $test): void
{
Expand All @@ -287,7 +291,7 @@ public function startTest(Test $test): void
* @param Test $test
* @param float $time
*/
public function endTest(Test $test, $time): void
public function endTest(Test $test, float $time): void
{
parent::endTest($test, $time);

Expand Down
16 changes: 8 additions & 8 deletions src/Util/TestDox/CliTestDoxPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function (string $color, string $buffer) {
parent::startTest($test);
}

public function endTest(Test $test, $time): void
public function endTest(Test $test, float $time): void
{
if (!$test instanceof TestCase && !$test instanceof PhptTestCase) {
return;
Expand All @@ -111,31 +111,31 @@ public function endTest(Test $test, $time): void
}
}

public function addError(Test $test, \Throwable $t, $time): void
public function addError(Test $test, \Throwable $t, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-yellow', ''),
(string) $t
);
}

public function addWarning(Test $test, Warning $e, $time): void
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-yellow', ''),
(string) $e
);
}

public function addFailure(Test $test, AssertionFailedError $e, $time): void
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-red', ''),
(string) $e
);
}

public function addIncompleteTest(Test $test, \Throwable $t, $time): void
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-yellow', ''),
Expand All @@ -144,7 +144,7 @@ public function addIncompleteTest(Test $test, \Throwable $t, $time): void
);
}

public function addRiskyTest(Test $test, \Throwable $t, $time): void
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-yellow', ''),
Expand All @@ -153,11 +153,11 @@ public function addRiskyTest(Test $test, \Throwable $t, $time): void
);
}

public function addSkippedTest(Test $test, \Throwable $e, $time): void
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
{
$this->currentTestResult->fail(
$this->formatWithColor('fg-yellow', ''),
(string) $e,
(string) $t,
true
);
}
Expand Down
Loading

0 comments on commit 7e9e3aa

Please sign in to comment.