From 067b27f14332a7abadfc3b9ae4609c8b8d9dca34 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 18 Aug 2017 18:46:56 +0200 Subject: [PATCH] small fixes --- src/CodeCoverage/Generators/AbstractGenerator.php | 4 ++-- src/Framework/Assert.php | 6 +++--- src/Framework/Environment.php | 2 +- src/Framework/FileMock.php | 2 +- src/Framework/TestCase.php | 2 +- src/Runner/CliTester.php | 2 +- src/Runner/Job.php | 2 +- src/Runner/PhpInterpreter.php | 2 +- src/Runner/Runner.php | 6 +++--- src/Runner/Test.php | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CodeCoverage/Generators/AbstractGenerator.php b/src/CodeCoverage/Generators/AbstractGenerator.php index 57bc0ba8..67bf7a2c 100644 --- a/src/CodeCoverage/Generators/AbstractGenerator.php +++ b/src/CodeCoverage/Generators/AbstractGenerator.php @@ -19,7 +19,7 @@ abstract class AbstractGenerator CODE_TESTED = 1; /** @var array */ - public $acceptFiles = ['php', 'phpc', 'phpt', 'phtml']; + public $acceptFiles = ['php', 'phpt', 'phtml']; /** @var array */ protected $data; @@ -103,7 +103,7 @@ public function getCoveredPercent() /** - * @return \CallbackFilterIterator + * @return \Iterator */ protected function getSourceIterator() { diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index 2dede78c..24eed9ea 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -283,7 +283,7 @@ public static function type($type, $value, $description = null) * @param string class * @param string message * @param int code - * @return \Exception + * @return \Exception|\Throwable */ public static function exception(callable $function, $class, $message = null, $code = null) { @@ -312,7 +312,7 @@ public static function exception(callable $function, $class, $message = null, $c /** * Checks if the function throws exception, alias for exception(). - * @return \Exception + * @return \Exception|\Throwable */ public static function throws(callable $function, $class, $message = null, $code = null) { @@ -325,7 +325,7 @@ public static function throws(callable $function, $class, $message = null, $code * @param callable * @param int|string|array * @param string message - * @return null|\Exception + * @return null|\Exception|\Throwable */ public static function error(callable $function, $expectedType, $expectedMessage = null) { diff --git a/src/Framework/Environment.php b/src/Framework/Environment.php index cfa9f85d..a463a37f 100644 --- a/src/Framework/Environment.php +++ b/src/Framework/Environment.php @@ -85,7 +85,7 @@ public static function setupColors() */ public static function setupErrors() { - error_reporting(E_ALL | E_STRICT); + error_reporting(E_ALL); ini_set('display_errors', '1'); ini_set('html_errors', '0'); ini_set('log_errors', '0'); diff --git a/src/Framework/FileMock.php b/src/Framework/FileMock.php index 3361fc88..0e7d2da2 100644 --- a/src/Framework/FileMock.php +++ b/src/Framework/FileMock.php @@ -40,7 +40,7 @@ class FileMock /** * @return string file name */ - public static function create($content, $extension = null) + public static function create($content = '', $extension = null) { self::register(); diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index cdf14497..8bacec5c 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -159,7 +159,7 @@ public function runTest($method, array $args = null) /** - * @return array + * @return mixed */ protected function getData($provider) { diff --git a/src/Runner/CliTester.php b/src/Runner/CliTester.php index 8643273a..15fcaaed 100644 --- a/src/Runner/CliTester.php +++ b/src/Runner/CliTester.php @@ -207,7 +207,7 @@ private function createRunner() $runner->outputHandlers[] = new Output\JUnitPrinter; break; default: - $runner->outputHandlers[] = new Output\ConsolePrinter($runner, $this->options['-s']); + $runner->outputHandlers[] = new Output\ConsolePrinter($runner, (bool) $this->options['-s']); } } diff --git a/src/Runner/Job.php b/src/Runner/Job.php index 4dce3a06..ce8328dc 100644 --- a/src/Runner/Job.php +++ b/src/Runner/Job.php @@ -95,7 +95,7 @@ public function getEnvironmentVariable($name) * @param int self::RUN_ASYNC | self::RUN_COLLECT_ERRORS * @return void */ - public function run($flags = null) + public function run($flags = 0) { foreach ($this->envVars as $name => $value) { putenv("$name=$value"); diff --git a/src/Runner/PhpInterpreter.php b/src/Runner/PhpInterpreter.php index 7516a142..cd7857ac 100644 --- a/src/Runner/PhpInterpreter.php +++ b/src/Runner/PhpInterpreter.php @@ -85,7 +85,7 @@ public function __construct($path, array $args = []) /** * @param string * @param string - * @return self + * @return static */ public function withPhpIniOption($name, $value = null) { diff --git a/src/Runner/Runner.php b/src/Runner/Runner.php index 41d3f981..0a4b115d 100644 --- a/src/Runner/Runner.php +++ b/src/Runner/Runner.php @@ -131,7 +131,7 @@ public function run() $running[] = $job = array_shift($this->jobs); $async = $this->threadCount > 1 && (count($running) + count($this->jobs) > 1); $job->setEnvironmentVariable(Environment::THREAD, array_shift($threads)); - $job->run($async ? $job::RUN_ASYNC : null); + $job->run($async ? $job::RUN_ASYNC : 0); } if (count($running) > 1) { @@ -203,7 +203,7 @@ public function addJob(Job $job) public function prepareTest(Test $test) { foreach ($this->outputHandlers as $handler) { - $handler->prepare(clone $test); + $handler->prepare($test); } } @@ -217,7 +217,7 @@ public function finishTest(Test $test) $this->result = $this->result && ($test->getResult() !== Test::FAILED); foreach ($this->outputHandlers as $handler) { - $handler->finish(clone $test); + $handler->finish($test); } if ($this->tempDir) { diff --git a/src/Runner/Test.php b/src/Runner/Test.php index ca61100c..c06bab16 100644 --- a/src/Runner/Test.php +++ b/src/Runner/Test.php @@ -126,7 +126,7 @@ public function withArguments(array $args) /** * @param int - * @param string + * @param string|null * @return static */ public function withResult($result, $message)