ソースを参照

Fix signatures.

mscherer 6 年 前
コミット
adcb81960e
2 ファイル変更11 行追加10 行削除
  1. 5 4
      src/TestSuite/ConsoleOutput.php
  2. 6 6
      src/TestSuite/ToolsTestTrait.php

+ 5 - 4
src/TestSuite/ConsoleOutput.php

@@ -3,7 +3,6 @@
 namespace Tools\TestSuite;
 namespace Tools\TestSuite;
 
 
 use Cake\Console\ConsoleOutput as CakeConsoleOutput;
 use Cake\Console\ConsoleOutput as CakeConsoleOutput;
-use Tools\TestSuite\ToolsTestTrait;
 
 
 /**
 /**
  * Use for testing as
  * Use for testing as
@@ -29,7 +28,7 @@ class ConsoleOutput extends CakeConsoleOutput {
 	/**
 	/**
 	 * Holds all output messages.
 	 * Holds all output messages.
 	 *
 	 *
-	 * @var array
+	 * @var string[]
 	 */
 	 */
 	public $output = [];
 	public $output = [];
 
 
@@ -39,9 +38,11 @@ class ConsoleOutput extends CakeConsoleOutput {
 	 * @param string $message
 	 * @param string $message
 	 * @return void
 	 * @return void
 	 */
 	 */
-	protected function _write($message) {
+	protected function _write(string $message): int {
 		$this->debug($message);
 		$this->debug($message);
 		$this->output[] = $message;
 		$this->output[] = $message;
+
+		return 0;
 	}
 	}
 
 
 	/**
 	/**
@@ -49,7 +50,7 @@ class ConsoleOutput extends CakeConsoleOutput {
 	 *
 	 *
 	 * @return string
 	 * @return string
 	 */
 	 */
-	public function output() {
+	public function output(): string {
 		return implode('', $this->output);
 		return implode('', $this->output);
 	}
 	}
 
 

+ 6 - 6
src/TestSuite/ToolsTestTrait.php

@@ -15,7 +15,7 @@ trait ToolsTestTrait {
 	 * @param string $string
 	 * @param string $string
 	 * @return string
 	 * @return string
 	 */
 	 */
-	protected static function osFix($string) {
+	protected static function osFix(string $string): string {
 		return str_replace(["\r\n", "\r"], "\n", $string);
 		return str_replace(["\r\n", "\r"], "\n", $string);
 	}
 	}
 
 
@@ -27,7 +27,7 @@ trait ToolsTestTrait {
 	 *
 	 *
 	 * @return bool Success
 	 * @return bool Success
 	 */
 	 */
-	protected static function isDebug() {
+	protected static function isDebug(): bool {
 		return !empty($_SERVER['argv']) && in_array('--debug', $_SERVER['argv'], true);
 		return !empty($_SERVER['argv']) && in_array('--debug', $_SERVER['argv'], true);
 	}
 	}
 
 
@@ -40,7 +40,7 @@ trait ToolsTestTrait {
 	 * @param bool $onlyVeryVerbose If only -vv should be counted.
 	 * @param bool $onlyVeryVerbose If only -vv should be counted.
 	 * @return bool Success
 	 * @return bool Success
 	 */
 	 */
-	protected static function isVerbose($onlyVeryVerbose = false) {
+	protected static function isVerbose($onlyVeryVerbose = false): bool {
 		if (empty($_SERVER['argv'])) {
 		if (empty($_SERVER['argv'])) {
 			return false;
 			return false;
 		}
 		}
@@ -63,7 +63,7 @@ trait ToolsTestTrait {
 	 * @param mixed $data
 	 * @param mixed $data
 	 * @return void
 	 * @return void
 	 */
 	 */
-	protected static function debug($data) {
+	protected static function debug($data): void {
 		if (!static::isVerbose()) {
 		if (!static::isVerbose()) {
 			return;
 			return;
 		}
 		}
@@ -87,7 +87,7 @@ trait ToolsTestTrait {
 	 *
 	 *
 	 * @return mixed Method return.
 	 * @return mixed Method return.
 	 */
 	 */
-	protected function invokeMethod(&$object, $methodName, array $parameters = []) {
+	protected function invokeMethod(&$object, string $methodName, array $parameters = []) {
 		$reflection = new ReflectionClass(get_class($object));
 		$reflection = new ReflectionClass(get_class($object));
 		$method = $reflection->getMethod($methodName);
 		$method = $reflection->getMethod($methodName);
 		$method->setAccessible(true);
 		$method->setAccessible(true);
@@ -109,7 +109,7 @@ trait ToolsTestTrait {
 	 *
 	 *
 	 * @return mixed Property value.
 	 * @return mixed Property value.
 	 */
 	 */
-	protected function invokeProperty(&$object, $name) {
+	protected function invokeProperty(&$object, string $name) {
 		$reflection = new ReflectionClass(get_class($object));
 		$reflection = new ReflectionClass(get_class($object));
 		$property = $reflection->getProperty($name);
 		$property = $reflection->getProperty($name);
 		$property->setAccessible(true);
 		$property->setAccessible(true);