aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-06 22:12:20 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-06 22:12:20 +0100
commitb5cafe1bbcdbb6ea2fb8b9bf8e290bfff0fea6ec (patch)
treed631e19efc07cde9446dcf0c69912d21318c2f14
parent273c4f2f048a44f20f395f5fdad1b56fbbe61218 (diff)
downloadConsole-b5cafe1bbcdbb6ea2fb8b9bf8e290bfff0fea6ec.zip
Console-b5cafe1bbcdbb6ea2fb8b9bf8e290bfff0fea6ec.tar.gz
Console-b5cafe1bbcdbb6ea2fb8b9bf8e290bfff0fea6ec.tar.bz2
chore(php) Move to PHP 7.
-rw-r--r--Bin/Termcap.php7
-rw-r--r--Source/Chrome/Editor.php5
-rw-r--r--Source/Chrome/Exception.php3
-rw-r--r--Source/Chrome/Pager.php15
-rw-r--r--Source/Chrome/Text.php45
-rw-r--r--Source/Console.php55
-rw-r--r--Source/Cursor.php49
-rw-r--r--Source/Dispatcher/Kit.php23
-rw-r--r--Source/Exception.php3
-rw-r--r--Source/GetOption.php21
-rw-r--r--Source/Input.php27
-rw-r--r--Source/Mouse.php25
-rw-r--r--Source/Output.php27
-rw-r--r--Source/Parser.php33
-rw-r--r--Source/Processus.php420
-rw-r--r--Source/Readline/Autocompleter/Aggregate.php9
-rw-r--r--Source/Readline/Autocompleter/Autocompleter.php5
-rw-r--r--Source/Readline/Autocompleter/Path.php19
-rw-r--r--Source/Readline/Autocompleter/Word.php9
-rw-r--r--Source/Readline/Password.php5
-rw-r--r--Source/Readline/Readline.php96
-rw-r--r--Source/Tput.php53
-rw-r--r--Source/Window.php88
-rw-r--r--Test/Unit/Console.php21
-rw-r--r--Test/Unit/Cursor.php203
-rw-r--r--Test/Unit/GetOption.php17
-rw-r--r--Test/Unit/Input.php29
-rw-r--r--Test/Unit/Mouse.php13
-rw-r--r--Test/Unit/Output.php35
-rw-r--r--Test/Unit/Parser.php15
-rw-r--r--Test/Unit/Readline/Autocompleter/Aggregate.php17
-rw-r--r--Test/Unit/Readline/Autocompleter/Path.php29
-rw-r--r--Test/Unit/Readline/Autocompleter/Word.php19
-rw-r--r--Test/Unit/Readline/Password.php5
-rw-r--r--Test/Unit/Tput.php27
-rw-r--r--Test/Unit/Window.php75
36 files changed, 625 insertions, 922 deletions
diff --git a/Bin/Termcap.php b/Bin/Termcap.php
index cb449be..9d8c50d 100644
--- a/Bin/Termcap.php
+++ b/Bin/Termcap.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
/**
* Hoa
@@ -43,7 +43,6 @@ use Hoa\Console;
*
* Get terminal capabilities.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Termcap extends Console\Dispatcher\Kit
@@ -142,7 +141,7 @@ class Termcap extends Console\Dispatcher\Kit
*
* @return void
*/
- public function usage()
+ public function usage(): void
{
echo
'Usage : console:termcap', "\n",
@@ -171,7 +170,7 @@ class Termcap extends Console\Dispatcher\Kit
* @param array $data Data.
* @return void
*/
- public static function format(array $data)
+ public static function format(array $data): void
{
$max = 0;
diff --git a/Source/Chrome/Editor.php b/Source/Chrome/Editor.php
index 837cbb8..49df5c4 100644
--- a/Source/Chrome/Editor.php
+++ b/Source/Chrome/Editor.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Console;
*
* Start an editor.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Editor
@@ -56,7 +57,7 @@ class Editor
* default).
* @return string
*/
- public static function open($file = '', $editor = null)
+ public static function open(string $file = '', string $editor = null): string
{
if (null === $editor) {
if (isset($_SERVER['EDITOR'])) {
diff --git a/Source/Chrome/Exception.php b/Source/Chrome/Exception.php
index 7781d02..a81b5e5 100644
--- a/Source/Chrome/Exception.php
+++ b/Source/Chrome/Exception.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Console;
*
* Extending the \Hoa\Console\Exception class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Exception extends Console\Exception
diff --git a/Source/Chrome/Pager.php b/Source/Chrome/Pager.php
index a0a7e8c..98f31fc 100644
--- a/Source/Chrome/Pager.php
+++ b/Source/Chrome/Pager.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -46,7 +48,6 @@ use Hoa\Console;
* ob_start('Hoa\Console\Chrome\Pager::less');
* echo file_get_contents(__FILE__);
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Pager
@@ -56,14 +57,14 @@ class Pager
*
* @const string
*/
- const LESS = 'less';
+ public const LESS = 'less';
/**
* Represent MORE(1).
*
* @const string
*/
- const MORE = 'more';
+ public const MORE = 'more';
@@ -74,7 +75,7 @@ class Pager
* @param int $mode Mode (from the output buffer).
* @return string
*/
- public static function less($output, $mode)
+ public static function less(string $output, int $mode): string
{
return self::pager($output, $mode, self::LESS);
}
@@ -86,7 +87,7 @@ class Pager
* @param int $mode Mode (from the output buffer).
* @return string
*/
- public static function more($output, $mode)
+ public static function more(string $output, int $mode): string
{
return self::pager($output, $mode, self::MORE);
}
@@ -99,7 +100,7 @@ class Pager
* @param string $type Type. Please, see self::LESS or self::MORE.
* @return string
*/
- public static function pager($output, $mode, $type = null)
+ public static function pager(string $output, int $mode, string $type = null): string
{
static $process = null;
@@ -107,7 +108,7 @@ class Pager
$pager
= null !== $type
? Console\Processus::locate($type)
- : (isset($_ENV['PAGER']) ? $_ENV['PAGER'] : null);
+ : ($_ENV['PAGER'] ?? null);
if (null === $pager) {
return $output;
diff --git a/Source/Chrome/Text.php b/Source/Chrome/Text.php
index 9311726..3ae2f28 100644
--- a/Source/Chrome/Text.php
+++ b/Source/Chrome/Text.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Console;
*
* This class builts the text layout.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Text
@@ -53,21 +54,21 @@ class Text
*
* @const int
*/
- const ALIGN_LEFT = 0;
+ public const ALIGN_LEFT = 0;
/**
* Align the text to right.
*
* @const int
*/
- const ALIGN_RIGHT = 1;
+ public const ALIGN_RIGHT = 1;
/**
* Align the text to center.
*
* @const int
*/
- const ALIGN_CENTER = 2;
+ public const ALIGN_CENTER = 2;
@@ -81,10 +82,10 @@ class Text
* @return string
*/
public static function colorize(
- $text,
- $attributesBefore,
- $attributesAfter = 'normal'
- ) {
+ string $text,
+ string $attributesBefore,
+ string $attributesAfter = 'normal'
+ ): string {
ob_start();
Console\Cursor::colorize($attributesBefore);
Console::getOutput()->writeAll($text);
@@ -125,11 +126,11 @@ class Text
*/
public static function columnize(
array $line,
- $alignement = self::ALIGN_LEFT,
- $horizontalPadding = 2,
- $verticalPadding = 0,
- $separator = null
- ) {
+ int $alignement = self::ALIGN_LEFT,
+ int $horizontalPadding = 2,
+ int $verticalPadding = 0,
+ string $separator = null
+ ): string {
if (empty($line)) {
return '';
}
@@ -149,7 +150,7 @@ class Text
$handle > $nbColumn and $nbColumn = $handle;
}
- $xtraWidth += $horizontalPadding * $nbColumn;
+ $xtraWidth += $horizontalPadding * $nbColumn;
// Get the column width.
$columnWidth = array_fill(0, $nbColumn, 0);
@@ -286,10 +287,10 @@ class Text
* @return string
*/
public static function align(
- $text,
- $alignement = self::ALIGN_LEFT,
- $width = null
- ) {
+ string $text,
+ int $alignement = self::ALIGN_LEFT,
+ int $width = null
+ ): string {
if (null === $width) {
$window = Console\Window::getSize();
$width = $window['x'];
@@ -329,7 +330,7 @@ class Text
* @param mixed $lines The line (or group of lines).
* @return int
*/
- protected static function getMaxLineWidth($lines)
+ protected static function getMaxLineWidth($lines): int
{
if (!is_array($lines)) {
$lines = [$lines];
@@ -353,7 +354,7 @@ class Text
* @param mixed $lines The line (or group of lines).
* @return int
*/
- protected static function getMaxLineNumber($lines)
+ protected static function getMaxLineNumber($lines): int
{
if (!is_array($lines)) {
$lines = [$lines];
@@ -377,7 +378,7 @@ class Text
* @param string $break String to make the break.
* @return string
*/
- public static function wordwrap($text, $width = null, $break = "\n")
+ public static function wordwrap(string $text, int $width = null, string $break = "\n"): string
{
if (null === $width) {
$window = Console\Window::getSize();
@@ -394,7 +395,7 @@ class Text
* @param string $pattern The string used to underline.
* @return string
*/
- public static function underline($text, $pattern = '*')
+ public static function underline(string $text, string $pattern = '*'): string
{
$text = explode("\n", $text);
$card = strlen($pattern);
diff --git a/Source/Console.php b/Source/Console.php
index d2f1589..c052229 100644
--- a/Source/Console.php
+++ b/Source/Console.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Consistency;
*
* A set of utils and helpers about the console.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Console
@@ -53,56 +54,56 @@ class Console
*
* @var int
*/
- const IS_FIFO = 0;
+ public const IS_FIFO = 0;
/**
* Pipe mode: character.
*
* @var int
*/
- const IS_CHARACTER = 1;
+ public const IS_CHARACTER = 1;
/**
* Pipe mode: directory.
*
* @var int
*/
- const IS_DIRECTORY = 2;
+ public const IS_DIRECTORY = 2;
/**
* Pipe mode: block.
*
* @var int
*/
- const IS_BLOCK = 3;
+ public const IS_BLOCK = 3;
/**
* Pipe mode: regular.
*
* @var int
*/
- const IS_REGULAR = 4;
+ public const IS_REGULAR = 4;
/**
* Pipe mode: link.
*
* @var int
*/
- const IS_LINK = 5;
+ public const IS_LINK = 5;
/**
* Pipe mode: socket.
*
* @var int
*/
- const IS_SOCKET = 6;
+ public const IS_SOCKET = 6;
/**
* Pipe mode: whiteout.
*
* @var int
*/
- const IS_WHITEOUT = 7;
+ public const IS_WHITEOUT = 7;
/**
* Advanced interaction is on.
@@ -154,7 +155,7 @@ class Console
* @param bool $force Force it if STDIN is not direct.
* @return bool
*/
- public static function advancedInteraction($force = false)
+ public static function advancedInteraction(bool $force = false): bool
{
if (null !== self::$_advanced) {
return self::$_advanced;
@@ -165,7 +166,7 @@ class Console
}
if (false === $force &&
- true === defined('STDIN') &&
+ true === defined('STDIN') &&
false === self::isDirect(STDIN)) {
return self::$_advanced = false;
}
@@ -181,7 +182,7 @@ class Console
*
* @return void
*/
- public static function restoreInteraction()
+ public static function restoreInteraction(): void
{
if (null === self::$_old) {
return;
@@ -199,7 +200,7 @@ class Console
* @param resource $pipe Pipe.
* @return int
*/
- public static function getMode($pipe = STDIN)
+ public static function getMode(resource $pipe = STDIN): int
{
$_pipe = (int) $pipe;
@@ -275,7 +276,7 @@ class Console
* @param resource $pipe Pipe.
* @return bool
*/
- public static function isDirect($pipe)
+ public static function isDirect(resource $pipe): bool
{
return self::IS_CHARACTER === self::getMode($pipe);
}
@@ -289,7 +290,7 @@ class Console
* @param resource $pipe Pipe.
* @return bool
*/
- public static function isPipe($pipe)
+ public static function isPipe(resource $pipe): bool
{
return self::IS_FIFO === self::getMode($pipe);
}
@@ -303,16 +304,16 @@ class Console
* @param resource $pipe Pipe.
* @return bool
*/
- public static function isRedirection($pipe)
+ public static function isRedirection(resource $pipe): bool
{
$mode = self::getMode($pipe);
return
- self::IS_REGULAR === $mode ||
+ self::IS_REGULAR === $mode ||
self::IS_DIRECTORY === $mode ||
- self::IS_LINK === $mode ||
- self::IS_SOCKET === $mode ||
- self::IS_BLOCK === $mode;
+ self::IS_LINK === $mode ||
+ self::IS_SOCKET === $mode ||
+ self::IS_BLOCK === $mode;
}
/**
@@ -321,7 +322,7 @@ class Console
* @param \Hoa\Console\Input $input Input.
* @return \Hoa\Console\Input
*/
- public static function setInput(Input $input)
+ public static function setInput(Input $input): Input
{
$old = static::$_input;
static::$_input = $input;
@@ -334,7 +335,7 @@ class Console
*
* @return \Hoa\Console\Input
*/
- public static function getInput()
+ public static function getInput(): Input
{
if (null === static::$_input) {
static::$_input = new Input();
@@ -349,7 +350,7 @@ class Console
* @param \Hoa\Console\Output $output Output.
* @return \Hoa\Console\Output
*/
- public static function setOutput(Output $output)
+ public static function setOutput(Output $output): Output
{
$old = static::$_output;
static::$_output = $output;
@@ -362,7 +363,7 @@ class Console
*
* @return \Hoa\Console\Output
*/
- public static function getOutput()
+ public static function getOutput(): Output
{
if (null === static::$_output) {
static::$_output = new Output();
@@ -377,7 +378,7 @@ class Console
* @param \Hoa\Console\Tput $tput Tput.
* @return \Hoa\Console\Tput
*/
- public static function setTput(Tput $tput)
+ public static function setTput(Tput $tput): Tput
{
$old = static::$_tput;
static::$_tput = $tput;
@@ -390,7 +391,7 @@ class Console
*
* @return \Hoa\Console\Tput
*/
- public static function getTput()
+ public static function getTput(): Tput
{
if (null === static::$_tput) {
static::$_tput = new Tput();
@@ -404,7 +405,7 @@ class Console
*
* @return bool
*/
- public static function isTmuxRunning()
+ public static function isTmuxRunning(): bool
{
return isset($_SERVER['TMUX']);
}
diff --git a/Source/Cursor.php b/Source/Cursor.php
index 36fc715..ff0c217 100644
--- a/Source/Cursor.php
+++ b/Source/Cursor.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Console;
*
* Allow to manipulate the cursor.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Cursor
@@ -63,7 +64,7 @@ class Cursor
* @param int $repeat How many times do we move?
* @return void
*/
- public static function move($steps, $repeat = 1)
+ public static function move(string $steps, int $repeat = 1): void
{
if (1 > $repeat) {
return;
@@ -167,7 +168,7 @@ class Cursor
* @param int $y Y coordinate.
* @return void
*/
- public static function moveTo($x = null, $y = null)
+ public static function moveTo(int $x = null, int $y = null): void
{
if (null === $x || null === $y) {
$position = static::getPosition();
@@ -197,7 +198,7 @@ class Cursor
*
* @return array
*/
- public static function getPosition()
+ public static function getPosition(): array
{
$tput = Console::getTput();
$user7 = $tput->get('user7');
@@ -248,7 +249,7 @@ class Cursor
*
* @return void
*/
- public static function save()
+ public static function save(): void
{
Console::getOutput()->writeAll(
Console::getTput()->get('save_cursor')
@@ -262,7 +263,7 @@ class Cursor
*
* @return void
*/
- public static function restore()
+ public static function restore(): void
{
Console::getOutput()->writeAll(
Console::getTput()->get('restore_cursor')
@@ -285,7 +286,7 @@ class Cursor
* @param string $parts Parts to clean.
* @return void
*/
- public static function clear($parts = 'all')
+ public static function clear(string $parts = 'all'): void
{
$tput = Console::getTput();
$output = Console::getOutput();
@@ -344,7 +345,7 @@ class Cursor
*
* @return void
*/
- public static function hide()
+ public static function hide(): void
{
Console::getOutput()->writeAll(
Console::getTput()->get('cursor_invisible')
@@ -358,7 +359,7 @@ class Cursor
*
* @return void
*/
- public static function show()
+ public static function show(): void
{
Console::getOutput()->writeAll(
Console::getTput()->get('cursor_visible')
@@ -398,7 +399,7 @@ class Cursor
* @param string $attributes Attributes.
* @return void
*/
- public static function colorize($attributes)
+ public static function colorize(string $attributes): void
{
static $_rgbTo256 = null;
@@ -590,28 +591,28 @@ class Cursor
default:
$_keyword = false;
- if (256 <= $tput->count('max_colors') &&
+ if (256 <= $tput->count('max_colors') &&
'#' === $m[2][0]) {
$rgb = hexdec(substr($m[2], 1));
$r = ($rgb >> 16) & 255;
- $g = ($rgb >> 8) & 255;
- $b = $rgb & 255;
+ $g = ($rgb >> 8) & 255;
+ $b = $rgb & 255;
$distance = null;
foreach ($_rgbTo256 as $i => $_rgb) {
$_rgb = hexdec($_rgb);
$_r = ($_rgb >> 16) & 255;
- $_g = ($_rgb >> 8) & 255;
- $_b = $_rgb & 255;
+ $_g = ($_rgb >> 8) & 255;
+ $_b = $_rgb & 255;
$d = sqrt(
- pow($_r - $r, 2)
- + pow($_g - $g, 2)
- + pow($_b - $b, 2)
+ ($_r - $r) ** 2
+ + ($_g - $g) ** 2
+ + ($_b - $b) ** 2
);
if (null === $distance ||
- $d <= $distance) {
+ $d <= $distance) {
$distance = $d;
$_handle = $i;
}
@@ -641,7 +642,7 @@ class Cursor
* @param int $toColor RGB color.
* @return void
*/
- public static function changeColor($fromCode, $toColor)
+ public static function changeColor(int $fromCode, int $toColor): void
{
$tput = Console::getTput();
@@ -650,8 +651,8 @@ class Cursor
}
$r = ($toColor >> 16) & 255;
- $g = ($toColor >> 8) & 255;
- $b = $toColor & 255;
+ $g = ($toColor >> 8) & 255;
+ $b = $toColor & 255;
Console::getOutput()->writeAll(
str_replace(
@@ -687,7 +688,7 @@ class Cursor
* @param bool $blink Whether the cursor is blink or steady.
* @return void
*/
- public static function setStyle($style, $blink = true)
+ public static function setStyle(int $style, bool $blink = true): void
{
if (OS_WIN) {
return;
@@ -731,7 +732,7 @@ class Cursor
*
* @return void
*/
- public static function bip()
+ public static function bip(): void
{
Console::getOutput()->writeAll(
Console::getTput()->get('bell')
diff --git a/Source/Dispatcher/Kit.php b/Source/Dispatcher/Kit.php
index c65d754..3d27742 100644
--- a/Source/Dispatcher/Kit.php
+++ b/Source/Dispatcher/Kit.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -46,7 +48,6 @@ use Hoa\View;
*
* A structure, given to action, that holds some important data.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Kit extends Dispatcher\Kit
@@ -100,7 +101,7 @@ class Kit extends Dispatcher\Kit
* @param string $short Please, see original API.
* @return mixed
*/
- public function getOption(&$optionValue, $short = null)
+ public function getOption(&$optionValue, string $short = null)
{
if (null === $this->_options && !empty($this->options)) {
$this->setOptions($this->options);
@@ -120,7 +121,7 @@ class Kit extends Dispatcher\Kit
* \Hoa\Console\GetOption.
* @return array
*/
- public function setOptions(array $options)
+ public function setOptions(array $options): array
{
$old = $this->options;
$this->options = $options;
@@ -145,7 +146,7 @@ class Kit extends Dispatcher\Kit
* associated to the definition.
* @return string
*/
- public function makeUsageOptionsList(array $definitions = [])
+ public function makeUsageOptionsList(array $definitions = []): string
{
$out = [];
@@ -160,9 +161,11 @@ class Kit extends Dispatcher\Kit
Console\GetOption::OPTIONAL_ARGUMENT
? '[=]'
: '')),
- (isset($definitions[$options[Console\GetOption::OPTION_VAL]])
+ (
+ isset($definitions[$options[Console\GetOption::OPTION_VAL]])
? $definitions[$options[Console\GetOption::OPTION_VAL]]
- : (isset($definitions[$options[0]])
+ : (
+ isset($definitions[$options[0]])
? $definitions[$options[Console\GetOption::OPTION_NAME]]
: null
)
@@ -186,7 +189,7 @@ class Kit extends Dispatcher\Kit
* @param array $solutions Solutions.
* @return void
*/
- public function resolveOptionAmbiguity(array $solutions)
+ public function resolveOptionAmbiguity(array $solutions): void
{
echo
'You have made a typo in the option ',
@@ -213,7 +216,7 @@ class Kit extends Dispatcher\Kit
* @param bool $status The operation status.
* @return void
*/
- public function status($text, $status)
+ public function status(string $text, bool $status): void
{
$window = Console\Window::getSize();
$out =
@@ -239,7 +242,7 @@ class Kit extends Dispatcher\Kit
* @param string $prefix Prefix.
* @return string
*/
- public function readLine($prefix = null)
+ public function readLine(string $prefix = null): string
{
static $_rl = null;
@@ -256,7 +259,7 @@ class Kit extends Dispatcher\Kit
* @param string $prefix Prefix.
* @return string
*/
- public function readPassword($prefix = null)
+ public function readPassword(string $prefix = null): string
{
static $_rl = null;
diff --git a/Source/Exception.php b/Source/Exception.php
index d3c6ca9..a2337a5 100644
--- a/Source/Exception.php
+++ b/Source/Exception.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Exception as HoaException;
*
* Extending the \Hoa\Exception\Exception class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Exception extends HoaException
diff --git a/Source/GetOption.php b/Source/GetOption.php
index 5e65bcc..8c2d83c 100644
--- a/Source/GetOption.php
+++ b/Source/GetOption.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -47,7 +49,6 @@ use Hoa\Ustring;
* And, of course, it proposes the getOption method, that allow user to loop
* easily the command options/arguments.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class GetOption
@@ -57,42 +58,42 @@ class GetOption
*
* @const int
*/
- const NO_ARGUMENT = 0;
+ public const NO_ARGUMENT = 0;
/**
* Argument: required.
*
* @const int
*/
- const REQUIRED_ARGUMENT = 1;
+ public const REQUIRED_ARGUMENT = 1;
/**
* Argument: optional.
*
* @const int
*/
- const OPTIONAL_ARGUMENT = 2;
+ public const OPTIONAL_ARGUMENT = 2;
/**
* Option bucket: name.
*
* @const int
*/
- const OPTION_NAME = 0;
+ public const OPTION_NAME = 0;
/**
* Option bucket: has argument.
*
* @const int
*/
- const OPTION_HAS_ARG = 1;
+ public const OPTION_HAS_ARG = 1;
/**
* Option bucket: value.
*
* @const int
*/
- const OPTION_VAL = 2;
+ public const OPTION_VAL = 2;
/**
* Describe the command options (or switches).
@@ -238,7 +239,7 @@ class GetOption
* options will be selected.
* @return mixed
*/
- public function getOption(&$optionValue, $short = null)
+ public function getOption(&$optionValue, string $short = null)
{
static $first = true;
@@ -288,7 +289,7 @@ class GetOption
*
* @return bool
*/
- public function isPipetteEmpty()
+ public function isPipetteEmpty(): bool
{
return count($this->_pipette) == 1;
}
@@ -303,7 +304,7 @@ class GetOption
* @return void
* @throws \Hoa\Console\Exception
*/
- public function resolveOptionAmbiguity(array $solutions)
+ public function resolveOptionAmbiguity(array $solutions): void
{
if (!isset($solutions['solutions']) ||
!isset($solutions['value']) ||
diff --git a/Source/Input.php b/Source/Input.php
index 9b0c5bf..6a5126b 100644
--- a/Source/Input.php
+++ b/Source/Input.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -46,7 +48,6 @@ use Hoa\Stream;
* going to be `php://stdin` but it can be `/dev/tty` if the former has been
* closed.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Input implements Stream\IStream\In
@@ -86,7 +87,7 @@ class Input implements Stream\IStream\In
*
* @return \Hoa\Stream\IStream\In
*/
- public function getStream()
+ public function getStream(): Stream\IStream\In
{
return $this->_input;
}
@@ -96,7 +97,7 @@ class Input implements Stream\IStream\In
*
* @return bool
*/
- public function eof()
+ public function eof(): bool
{
return $this->_input->eof();
}
@@ -107,7 +108,7 @@ class Input implements Stream\IStream\In
* @param int $length Length.
* @return string
*/
- public function read($length)
+ public function read(int $length): string
{
return $this->_input->read($length);
}
@@ -118,7 +119,7 @@ class Input implements Stream\IStream\In
* @param int $length Length.
* @return string
*/
- public function readString($length)
+ public function readString(int $length): string
{
return $this->_input->readString($length);
}
@@ -128,7 +129,7 @@ class Input implements Stream\IStream\In
*
* @return string
*/
- public function readCharacter()
+ public function readCharacter(): string
{
return $this->_input->readCharacter();
}
@@ -138,7 +139,7 @@ class Input implements Stream\IStream\In
*
* @return bool
*/
- public function readBoolean()
+ public function readBoolean(): bool
{
return $this->_input->readBoolean();
}
@@ -149,7 +150,7 @@ class Input implements Stream\IStream\In
* @param int $length Length.
* @return int
*/
- public function readInteger($length = 1)
+ public function readInteger(int $length = 1): int
{
return $this->_input->readInteger($length);
}
@@ -160,7 +161,7 @@ class Input implements Stream\IStream\In
* @param int $length Length.
* @return float
*/
- public function readFloat($length = 1)
+ public function readFloat(int $length = 1): float
{
return $this->_input->readFloat($length);
}
@@ -173,7 +174,7 @@ class Input implements Stream\IStream\In
* different according to the implementation).
* @return array
*/
- public function readArray($argument = null)
+ public function readArray($argument = null): array
{
return $this->_input->readArray($argument);
}
@@ -183,7 +184,7 @@ class Input implements Stream\IStream\In
*
* @return string
*/
- public function readLine()
+ public function readLine(): string
{
return $this->_input->readLine();
}
@@ -194,7 +195,7 @@ class Input implements Stream\IStream\In
* @param int $offset Offset.
* @return string
*/
- public function readAll($offset = 0)
+ public function readAll(int $offset = 0): string
{
return $this->_input->readAll($offset);
}
@@ -205,7 +206,7 @@ class Input implements Stream\IStream\In
* @param string $format Format (see printf's formats).
* @return array
*/
- public function scanf($format)
+ public function scanf(string $format): array
{
return $this->_input->scanf($format);
}
diff --git a/Source/Mouse.php b/Source/Mouse.php
index 2b0b6e6..f1a0af0 100644
--- a/Source/Mouse.php
+++ b/Source/Mouse.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Event;
*
* Allow to listen the mouse.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Mouse implements Event\Listenable
@@ -56,42 +57,42 @@ class Mouse implements Event\Listenable
*
* @const int
*/
- const BUTTON_LEFT = 0;
+ public const BUTTON_LEFT = 0;
/**
* Pointer code for the middle button.
*
* @const int
*/
- const BUTTON_MIDDLE = 1;
+ public const BUTTON_MIDDLE = 1;
/**
* Pointer code for the right button.
*
* @const int
*/
- const BUTTON_RIGHT = 2;
+ public const BUTTON_RIGHT = 2;
/**
* Pointer code for the release of the button.
*
* @const int
*/
- const BUTTON_RELEASE = 3;
+ public const BUTTON_RELEASE = 3;
/**
* Pointer code for the wheel up.
*
* @const int
*/
- const WHEEL_UP = 64;
+ public const WHEEL_UP = 64;
/**
* Pointer code for the wheel down.
*
* @const int
*/
- const WHEEL_DOWN = 65;
+ public const WHEEL_DOWN = 65;
/**
* Singleton.
@@ -135,7 +136,7 @@ class Mouse implements Event\Listenable
*
* @return \Hoa\Console\Mouse
*/
- public static function getInstance()
+ public static function getInstance(): Mouse
{
if (null === static::$_instance) {
static::$_instance = new static();
@@ -149,7 +150,7 @@ class Mouse implements Event\Listenable
*
* @return bool
*/
- public static function track()
+ public static function track(): bool
{
if (true === static::$_enabled) {
return;
@@ -207,8 +208,8 @@ class Mouse implements Event\Listenable
$bucket['x'] = $cx;
$bucket['y'] = $cy;
- $bucket['shift'] = 0 !== ($cb & 4);
- $bucket['meta'] = 0 !== ($cb & 8);
+ $bucket['shift'] = 0 !== ($cb & 4);
+ $bucket['meta'] = 0 !== ($cb & 8);
$bucket['ctrl'] = 0 !== ($cb & 16);
$cb = ($cb | 28) ^ 28; // 28 = 4 | 8 | 16
@@ -267,7 +268,7 @@ class Mouse implements Event\Listenable
*
* @return void
*/
- public static function untrack()
+ public static function untrack(): void
{
if (false === static::$_enabled) {
return;
diff --git a/Source/Output.php b/Source/Output.php
index 0c5807c..c3d7cb8 100644
--- a/Source/Output.php
+++ b/Source/Output.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Stream;
* This class represents the output of a program. Most of the time, this is
* going to be STDOUT.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Output implements Stream\IStream\Out
@@ -82,7 +83,7 @@ class Output implements Stream\IStream\Out
*
* @return \Hoa\Stream\IStream\Out
*/
- public function getStream()
+ public function getStream(): Stream\IStream\Out
{
return $this->_output;
}
@@ -95,7 +96,7 @@ class Output implements Stream\IStream\Out
* @return void
* @throws \Hoa\Console\Exception
*/
- public function write($string, $length)
+ public function write(string $string, int $length): void
{
if (0 > $length) {
throw new Exception(
@@ -131,7 +132,7 @@ class Output implements Stream\IStream\Out
* @param string $string String.
* @return void
*/
- public function writeString($string)
+ public function writeString(string $string)
{
$string = (string) $string;
@@ -144,7 +145,7 @@ class Output implements Stream\IStream\Out
* @param string $character Character.
* @return void
*/
- public function writeCharacter($character)
+ public function writeCharacter(string $character)
{
return $this->write((string) $character[0], 1);
}
@@ -155,7 +156,7 @@ class Output implements Stream\IStream\Out
* @param bool $boolean Boolean.
* @return void
*/
- public function writeBoolean($boolean)
+ public function writeBoolean(bool $boolean)
{
return $this->write(((bool) $boolean) ? '1' : '0', 1);
}
@@ -166,7 +167,7 @@ class Output implements Stream\IStream\Out
* @param int $integer Integer.
* @return void
*/
- public function writeInteger($integer)
+ public function writeInteger(int $integer)
{
$integer = (string) (int) $integer;
@@ -179,7 +180,7 @@ class Output implements Stream\IStream\Out
* @param float $float Float.
* @return void
*/
- public function writeFloat($float)
+ public function writeFloat(float $float)
{
$float = (string) (float) $float;
@@ -205,7 +206,7 @@ class Output implements Stream\IStream\Out
* @param string $line Line.
* @return void
*/
- public function writeLine($line)
+ public function writeLine(string $line)
{
if (false === $n = strpos($line, "\n")) {
return $this->write($line . "\n", strlen($line) + 1);
@@ -222,7 +223,7 @@ class Output implements Stream\IStream\Out
* @param string $string String.
* @return void
*/
- public function writeAll($string)
+ public function writeAll(string $string)
{
return $this->write($string, strlen($string));
}
@@ -233,7 +234,7 @@ class Output implements Stream\IStream\Out
* @param int $size Size.
* @return bool
*/
- public function truncate($size)
+ public function truncate(int $size): bool
{
return false;
}
@@ -244,7 +245,7 @@ class Output implements Stream\IStream\Out
* @param bool $consider Consider the multiplexer or not.
* @return bool
*/
- public function considerMultiplexer($consider)
+ public function considerMultiplexer(bool $consider): bool
{
$old = $this->_considerMultiplexer;
$this->_considerMultiplexer = $consider;
@@ -257,7 +258,7 @@ class Output implements Stream\IStream\Out
*
* @return bool
*/
- public function isMultiplexerConsidered()
+ public function isMultiplexerConsidered(): bool
{
return $this->_considerMultiplexer;
}
diff --git a/Source/Parser.php b/Source/Parser.php
index 2b2aacc..fbadf56 100644
--- a/Source/Parser.php
+++ b/Source/Parser.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -37,14 +39,9 @@
namespace Hoa\Console;
/**
- * Class \Hoa\Console\Parser.
- *
* This class parses a command line.
* See the parse() method to get more informations about command-line
* vocabulary, patterns, limitations, etc.
- *
- * @copyright Copyright © 2007-2017 Hoa community
- * @license New BSD License
*/
class Parser
{
@@ -156,7 +153,7 @@ class Parser
* @param string $command Command to parse.
* @return void
*/
- public function parse($command)
+ public function parse(string $command): void
{
unset($this->_parsed);
$this->_parsed = [
@@ -247,7 +244,7 @@ class Parser
* @param array $input Intput.
* @return void
*/
- protected function addInput(array $input)
+ protected function addInput(array $input): void
{
$handle = $input['i'];
@@ -268,7 +265,7 @@ class Parser
* @param array $switch Switch.
* @return void
*/
- protected function addBoolSwitch(array $switch)
+ protected function addBoolSwitch(array $switch): void
{
$this->addSwitch($switch['b'], true);
@@ -281,7 +278,7 @@ class Parser
* @param array $switch Switch.
* @return void
*/
- protected function addValuedSwitch(array $switch)
+ protected function addValuedSwitch(array $switch): void
{
$this->addSwitch($switch['b'], $switch['s'], $switch[4]);
@@ -296,7 +293,7 @@ class Parser
* @param string $escape Character to escape.
* @return void
*/
- protected function addSwitch($name, $value, $escape = null)
+ protected function addSwitch(string $name, string $value, string $escape = null)
{
if (substr($name, 0, 2) == '--') {
return $this->addSwitch(substr($name, 2), $value, $escape);
@@ -348,7 +345,7 @@ class Parser
* @param string $value The switch value.
* @return void
*/
- public function transferSwitchToInput($name, &$value)
+ public function transferSwitchToInput(string $name, string &$value): void
{
if (!isset($this->_parsed['switch'][$name])) {
return;
@@ -366,7 +363,7 @@ class Parser
*
* @return array
*/
- public function getInputs()
+ public function getInputs(): array
{
return $this->_parsed['input'];
}
@@ -409,7 +406,7 @@ class Parser
&$x = null,
&$y = null,
&$z = null
- ) {
+ ): void {
$inputs = $this->getInputs();
$i = 'a';
$ii = -1;
@@ -417,8 +414,6 @@ class Parser
while (isset($inputs[++$ii]) && $i <= 'z') {
${$i++} = $inputs[$ii];
}
-
- return;
}
/**
@@ -426,7 +421,7 @@ class Parser
*
* @return array
*/
- public function getSwitches()
+ public function getSwitches(): array
{
return $this->_parsed['switch'];
}
@@ -441,7 +436,7 @@ class Parser
* @todo Could be ameliorate with a ":" explode, and some eval.
* Check if operands are integer.
*/
- public function parseSpecialValue($value, array $keywords = [])
+ public function parseSpecialValue(string $value, array $keywords = []): array
{
$out = [];
@@ -492,7 +487,7 @@ class Parser
* @param bool $longonly The long-only value.
* @return bool
*/
- public function setLongOnly($longonly = false)
+ public function setLongOnly(bool $longonly = false): bool
{
$old = $this->_longonly;
$this->_longonly = $longonly;
@@ -505,7 +500,7 @@ class Parser
*
* @return bool
*/
- public function getLongOnly()
+ public function getLongOnly(): bool
{
return $this->_longonly;
}
diff --git a/Source/Processus.php b/Source/Processus.php
index 48616dc..5592b14 100644
--- a/Source/Processus.php
+++ b/Source/Processus.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -40,275 +42,192 @@ use Hoa\Event;
use Hoa\Stream;
/**
- * Class \Hoa\Console\System.
- *
* Manipulate a processus as a stream.
- *
- * @copyright Copyright © 2007-2017 Hoa community
- * @license New BSD License
*/
-class Processus
- extends Stream
- implements Stream\IStream\In,
- Stream\IStream\Out,
- Stream\IStream\Pathable
+class Processus extends Stream implements Stream\IStream\In, Stream\IStream\Out, Stream\IStream\Pathable
{
/**
* Signal: terminal line hangup (terminate process).
- *
- * @const int
*/
- const SIGHUP = 1;
+ public const SIGHUP = 1;
/**
* Signal: interrupt program (terminate process).
- *
- * @const int
*/
- const SIGINT = 2;
+ public const SIGINT = 2;
/**
* Signal: quit program (create core image).
- *
- * @const int
*/
- const SIGQUIT = 3;
+ public const SIGQUIT = 3;
/**
* Signal: illegal instruction (create core image).
- *
- * @const int
*/
- const SIGILL = 4;
+ public const SIGILL = 4;
/**
* Signal: trace trap (create core image).
- *
- * @const int
*/
- const SIGTRAP = 5;
+ public const SIGTRAP = 5;
/**
* Signal: abort program, formerly SIGIOT (create core image).
- *
- * @const int
*/
- const SIGABRT = 6;
+ public const SIGABRT = 6;
/**
* Signal: emulate instruction executed (create core image).
- *
- * @const int
*/
- const SIGEMT = 7;
+ public const SIGEMT = 7;
/**
* Signal: floating-point exception (create core image).
- *
- * @const int
*/
- const SIGFPE = 8;
+ public const SIGFPE = 8;
/**
* Signal: kill program (terminate process).
- *
- * @const int
*/
- const SIGKILL = 9;
+ public const SIGKILL = 9;
/**
* Signal: bus error.
- *
- * @const int
*/
- const SIGBUS = 10;
+ public const SIGBUS = 10;
/**
* Signal: segmentation violation (create core image).
- *
- * @const int
*/
- const SIGSEGV = 11;
+ public const SIGSEGV = 11;
/**
* Signal: non-existent system call invoked (create core image).
- *
- * @const int
*/
- const SIGSYS = 12;
+ public const SIGSYS = 12;
/**
* Signal: write on a pipe with no reader (terminate process).
- *
- * @const int
*/
- const SIGPIPE = 13;
+ public const SIGPIPE = 13;
/**
* Signal: real-time timer expired (terminate process).
- *
- * @const int
*/
- const SIGALRM = 14;
+ public const SIGALRM = 14;
/**
* Signal: software termination signal (terminate process).
- *
- * @const int
*/
- const SIGTERM = 15;
+ public const SIGTERM = 15;
/**
* Signal: urgent condition present on socket (discard signal).
- *
- * @const int
*/
- const SIGURG = 16;
+ public const SIGURG = 16;
/**
* Signal: stop, cannot be caught or ignored (stop proces).
- *
- * @const int
*/
- const SIGSTOP = 17;
+ public const SIGSTOP = 17;
/**
* Signal: stop signal generated from keyboard (stop process).
- *
- * @const int
*/
- const SIGTSTP = 18;
+ public const SIGTSTP = 18;
/**
* Signal: continue after stop (discard signal).
- *
- * @const int
*/
- const SIGCONT = 19;
+ public const SIGCONT = 19;
/**
* Signal: child status has changed (discard signal).
- *
- * @const int
*/
- const SIGCHLD = 20;
+ public const SIGCHLD = 20;
/**
* Signal: background read attempted from control terminal (stop process).
- *
- * @const int
*/
- const SIGTTIN = 21;
+ public const SIGTTIN = 21;
/**
* Signal: background write attempted to control terminal (stop process).
- *
- * @const int
*/
- const SIGTTOU = 22;
+ public const SIGTTOU = 22;
/**
* Signal: I/O is possible on a descriptor, see fcntl(2) (discard signal).
- *
- * @const int
*/
- const SIGIO = 23;
+ public const SIGIO = 23;
/**
* Signal: cpu time limit exceeded, see setrlimit(2) (terminate process).
- *
- * @const int
*/
- const SIGXCPU = 24;
+ public const SIGXCPU = 24;
/**
* Signal: file size limit exceeded, see setrlimit(2) (terminate process).
- *
- * @const int
*/
- const SIGXFSZ = 25;
+ public const SIGXFSZ = 25;
/**
* Signal: virtual time alarm, see setitimer(2) (terminate process).
- *
- * @const int
*/
- const SIGVTALRM = 26;
+ public const SIGVTALRM = 26;
/**
* Signal: profiling timer alarm, see setitimer(2) (terminate process).
- *
- * @const int
*/
- const SIGPROF = 27;
+ public const SIGPROF = 27;
/**
* Signal: Window size change (discard signal).
- *
- * @const int
*/
- const SIGWINCH = 28;
+ public const SIGWINCH = 28;
/**
* Signal: status request from keyboard (discard signal).
- *
- * @const int
*/
- const SIGINFO = 29;
+ public const SIGINFO = 29;
/**
* Signal: User defined signal 1 (terminate process).
- *
- * @const int
*/
- const SIGUSR1 = 30;
+ public const SIGUSR1 = 30;
/**
* Signal: User defined signal 2 (terminate process).
- *
- * @const int
*/
- const SIGUSR2 = 31;
+ public const SIGUSR2 = 31;
/**
* Command name.
- *
- * @var string
*/
protected $_command = null;
/**
* Command options (options => value, or input).
- *
- * @var array
*/
protected $_options = [];
/**
* Current working directory.
- *
- * @var string
*/
protected $_cwd = null;
/**
* Environment.
- *
- * @var array
*/
protected $_environment = null;
/**
* Timeout.
- *
- * @var int
*/
protected $_timeout = 30;
/**
* Descriptor.
- *
- * @var array
*/
protected $_descriptors = [
0 => ['pipe', 'r'],
@@ -318,15 +237,11 @@ class Processus
/**
* Pipe descriptors of the processus.
- *
- * @var array
*/
protected $_pipes = null;
/**
* Seekability of pipes.
- *
- * @var array
*/
protected $_seekable = [];
@@ -334,23 +249,14 @@ class Processus
/**
* Start a processus.
- *
- * @param string $command Command name.
- * @param array $options Command options.
- * @param array $descriptors Descriptors (descriptor => mode —r, w or
- * a—).
- * @param string $cwd Current working directory.
- * @param array $environment Environment.
- * @param int $timeout Timeout.
- * @throws \Hoa\Console\Exception
*/
public function __construct(
- $command,
+ string $command,
array $options = null,
array $descriptors = null,
- $cwd = null,
+ string $cwd = null,
array $environment = null,
- $timeout = 30
+ int $timeout = 30
) {
$this->setCommand($command);
@@ -390,11 +296,6 @@ class Processus
/**
* Open the stream and return the associated resource.
- *
- * @param string $streamName Stream name (e.g. path or URL).
- * @param \Hoa\Stream\Context $context Context.
- * @return resource
- * @throws \Hoa\Console\Exception
*/
protected function &_open($streamName, Stream\Context $context = null)
{
@@ -419,10 +320,8 @@ class Processus
/**
* Close the current stream.
- *
- * @return bool
*/
- protected function _close()
+ protected function _close(): bool
{
foreach ($this->_pipes as $pipe) {
@fclose($pipe);
@@ -436,10 +335,8 @@ class Processus
* timeout).
* If an event returns false, it will close the current pipe.
* For a simple run without firing events, use the $this->open() method.
- *
- * @return void
*/
- public function run()
+ public function run(): void
{
if (false === $this->isOpened()) {
$this->open();
@@ -558,12 +455,8 @@ class Processus
/**
* Get pipe resource.
- *
- * @param int $pipe Pipe descriptor.
- * @return resource
- * @throws \Hoa\Console\Exception
*/
- protected function getPipe($pipe)
+ protected function getPipe(int $pipe)
{
if (!isset($this->_pipes[$pipe])) {
throw new Exception(
@@ -578,11 +471,8 @@ class Processus
/**
* Check if a pipe is seekable or not.
- *
- * @param int $pipe Pipe descriptor.
- * @return bool
*/
- protected function isPipeSeekable($pipe)
+ protected function isPipeSeekable(int $pipe): bool
{
if (!isset($this->_seekable[$pipe])) {
$_pipe = $this->getPipe($pipe);
@@ -595,24 +485,16 @@ class Processus
/**
* Test for end-of-file.
- *
- * @param int $pipe Pipe descriptor.
- * @return bool
*/
- public function eof($pipe = 1)
+ public function eof(int $pipe = 1): bool
{
return feof($this->getPipe($pipe));
}
/**
* Read n characters.
- *
- * @param int $length Length.
- * @param int $pipe Pipe descriptor.
- * @return string
- * @throws \Hoa\Console\Exception
*/
- public function read($length, $pipe = 1)
+ public function read(int $length, int $pipe = 1): string
{
if (0 > $length) {
throw new Exception(
@@ -627,58 +509,40 @@ class Processus
/**
* Alias of $this->read().
- *
- * @param int $length Length.
- * @param int $pipe Pipe descriptor.
- * @return string
*/
- public function readString($length, $pipe = 1)
+ public function readString(int $length, int $pipe = 1): string
{
return $this->read($length, $pipe);
}
/**
* Read a character.
- *
- * @param int $pipe Pipe descriptor.
- * @return string
*/
- public function readCharacter($pipe = 1)
+ public function readCharacter(int $pipe = 1): string
{
return fgetc($this->getPipe($pipe));
}
/**
* Read a boolean.
- *
- * @param int $pipe Pipe descriptor.
- * @return bool
*/
- public function readBoolean($pipe = 1)
+ public function readBoolean(int $pipe = 1): bool
{
return (bool) $this->read(1, $pipe);
}
/**
* Read an integer.
- *
- * @param int $length Length.
- * @param int $pipe Pipe descriptor.
- * @return int
*/
- public function readInteger($length = 1, $pipe = 1)
+ public function readInteger(int $length = 1, int $pipe = 1): int
{
return (int) $this->read($length, $pipe);
}
/**
* Read a float.
- *
- * @param int $length Length.
- * @param int $pipe Pipe descriptor.
- * @return float
*/
- public function readFloat($length = 1, $pipe = 1)
+ public function readFloat(int $length = 1, int $pipe = 1): float
{
return (float) $this->read($length, $pipe);
}
@@ -686,35 +550,24 @@ class Processus
/**
* Read an array.
* Alias of the $this->scanf() method.
- *
- * @param string $format Format (see printf's formats).
- * @param int $pipe Pipe descriptor.
- * @return array
*/
- public function readArray($format = null, $pipe = 1)
+ public function readArray(string $format = null, int $pipe = 1): array
{
return $this->scanf($format, $pipe);
}
/**
* Read a line.
- *
- * @param int $pipe Pipe descriptor.
- * @return string
*/
- public function readLine($pipe = 1)
+ public function readLine(int $pipe = 1): string
{
return stream_get_line($this->getPipe($pipe), 1 << 15, "\n");
}
/**
* Read all, i.e. read as much as possible.
- *
- * @param int $offset Offset.
- * @param int $pipe Pipe descriptor.
- * @return string
*/
- public function readAll($offset = -1, $pipe = 1)
+ public function readAll(int $offset = -1, int $pipe = 1): string
{
$_pipe = $this->getPipe($pipe);
@@ -729,26 +582,16 @@ class Processus
/**
* Parse input from a stream according to a format.
- *
- * @param string $format Format (see printf's formats).
- * @param int $pipe Pipe descriptor.
- * @return array
*/
- public function scanf($format, $pipe = 1)
+ public function scanf(string $format, int $pipe = 1): array
{
return fscanf($this->getPipe($pipe), $format);
}
/**
* Write n characters.
- *
- * @param string $string String.
- * @param int $length Length.
- * @param int $pipe Pipe descriptor.
- * @return mixed
- * @throws \Hoa\Console\Exception
*/
- public function write($string, $length, $pipe = 0)
+ public function write(string $string, int $length, int $pipe = 0)
{
if (0 > $length) {
throw new Exception(
@@ -763,12 +606,8 @@ class Processus
/**
* Write a string.
- *
- * @param string $string String.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeString($string, $pipe = 0)
+ public function writeString(string $string, int $pipe = 0)
{
$string = (string) $string;
@@ -777,36 +616,24 @@ class Processus
/**
* Write a character.
- *
- * @param string $char Character.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeCharacter($char, $pipe = 0)
+ public function writeCharacter(string $char, int $pipe = 0)
{
return $this->write((string) $char[0], 1, $pipe);
}
/**
* Write a boolean.
- *
- * @param bool $boolean Boolean.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeBoolean($boolean, $pipe = 0)
+ public function writeBoolean(bool $boolean, int $pipe = 0)
{
return $this->write((string) (bool) $boolean, 1, $pipe);
}
/**
* Write an integer.
- *
- * @param int $integer Integer.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeInteger($integer, $pipe = 0)
+ public function writeInteger(int $integer, int $pipe = 0)
{
$integer = (string) (int) $integer;
@@ -815,12 +642,8 @@ class Processus
/**
* Write a float.
- *
- * @param float $float Float.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeFloat($float, $pipe = 0)
+ public function writeFloat(float $float, int $pipe = 0)
{
$float = (string) (float) $float;
@@ -829,12 +652,8 @@ class Processus
/**
* Write an array.
- *
- * @param array $array Array.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeArray(array $array, $pipe = 0)
+ public function writeArray(array $array, int $pipe = 0)
{
$array = var_export($array, true);
@@ -843,12 +662,8 @@ class Processus
/**
* Write a line.
- *
- * @param string $line Line.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeLine($line, $pipe = 0)
+ public function writeLine(string $line, int $pipe = 0)
{
if (false === $n = strpos($line, "\n")) {
return $this->write($line . "\n", strlen($line) + 1, $pipe);
@@ -861,64 +676,48 @@ class Processus
/**
* Write all, i.e. as much as possible.
- *
- * @param string $string String.
- * @param int $pipe Pipe descriptor.
- * @return mixed
*/
- public function writeAll($string, $pipe = 0)
+ public function writeAll(string $string, int $pipe = 0)
{
return $this->write($string, strlen($string), $pipe);
}
/**
* Truncate a file to a given length.
- *
- * @param int $size Size.
- * @param int $pipe Pipe descriptor.
- * @return bool
*/
- public function truncate($size, $pipe = 0)
+ public function truncate(int $size, int $pipe = 0): bool
{
return ftruncate($this->getPipe($pipe), $size);
}
/**
* Get filename component of path.
- *
- * @return string
*/
- public function getBasename()
+ public function getBasename(): string
{
return basename($this->getCommand());
}
/**
* Get directory name component of path.
- *
- * @return string
*/
- public function getDirname()
+ public function getDirname(): string
{
return dirname($this->getCommand());
}
/**
* Get status.
- *
- * @return array
*/
- public function getStatus()
+ public function getStatus(): array
{
return proc_get_status($this->getStream());
}
/**
* Get exit code (alias of $this->getStatus()['exitcode']);
- *
- * @return int
*/
- public function getExitCode()
+ public function getExitCode(): int
{
$handle = $this->getStatus();
@@ -930,7 +729,7 @@ class Processus
*
* @return boolean
*/
- public function isSuccessful()
+ public function isSuccessful(): bool
{
return 0 === $this->getExitCode();
}
@@ -938,23 +737,18 @@ class Processus
/**
* Terminate the process.
*
- * @param int $signal Signal, amongst self::SIGHUP, SIGINT, SIGQUIT,
- * SIGABRT, SIGKILL, SIGALRM and SIGTERM. Default
- * is self::SIGTERM.
- * @return bool
+ * Valid signals are self::SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGKILL,
+ * SIGALRM and SIGTERM.
*/
- public function terminate($signal = self::SIGTERM)
+ public function terminate(int $signal = self::SIGTERM): bool
{
return proc_terminate($this->getStream(), $signal);
}
/**
* Set command name.
- *
- * @param string $command Command name.
- * @return string
*/
- protected function setCommand($command)
+ protected function setCommand(string $command): string
{
$old = $this->_command;
$this->_command = escapeshellcmd($command);
@@ -964,21 +758,16 @@ class Processus
/**
* Get command name.
- *
- * @return string
*/
- public function getCommand()
+ public function getCommand(): string
{
return $this->_command;
}
/**
* Set command options.
- *
- * @param array $options Options (option => value, or input).
- * @return array
*/
- protected function setOptions(array $options)
+ protected function setOptions(array $options): array
{
foreach ($options as &$option) {
$option = escapeshellarg($option);
@@ -992,20 +781,16 @@ class Processus
/**
* Get options.
- *
- * @return array
*/
- public function getOptions()
+ public function getOptions(): array
{
return $this->_options;
}
/**
* Get command-line.
- *
- * @return string
*/
- public function getCommandLine()
+ public function getCommandLine(): string
{
$out = $this->getCommand();
@@ -1022,11 +807,8 @@ class Processus
/**
* Set current working directory of the process.
- *
- * @param string $cwd Current working directory.
- * @return string
*/
- protected function setCwd($cwd)
+ protected function setCwd(string $cwd): string
{
$old = $this->_cwd;
$this->_cwd = $cwd;
@@ -1036,21 +818,16 @@ class Processus
/**
* Get current working directory of the process.
- *
- * @return string
*/
- public function getCwd()
+ public function getCwd(): string
{
return $this->_cwd;
}
/**
* Set environment of the process.
- *
- * @param array $environment Environment.
- * @return array
*/
- protected function setEnvironment(array $environment)
+ protected function setEnvironment(array $environment): array
{
$old = $this->_environment;
$this->_environment = $environment;
@@ -1060,21 +837,16 @@ class Processus
/**
* Get environment of the process.
- *
- * @return array
*/
- public function getEnvironment()
+ public function getEnvironment(): array
{
return $this->_environment;
}
/**
* Set timeout of the process.
- *
- * @param int $timeout Timeout.
- * @return int
*/
- public function setTimeout($timeout)
+ public function setTimeout(int $timeout): int
{
$old = $this->_timeout;
$this->_timeout = $timeout;
@@ -1084,26 +856,17 @@ class Processus
/**
* Get timeout of the process.
- *
- * @return int
*/
- public function getTimeout()
+ public function getTimeout(): int
{
return $this->_timeout;
}
/**
* Set process title.
- *
- * @param string $title Title.
- * @return void
*/
- public static function setTitle($title)
+ public static function setTitle(string $title): void
{
- if (PHP_VERSION_ID < 50500) {
- return;
- }
-
cli_set_process_title($title);
return;
@@ -1111,25 +874,16 @@ class Processus
/**
* Get process title.
- *
- * @return string
*/
- public static function getTitle()
+ public static function getTitle(): string
{
- if (PHP_VERSION_ID < 50500) {
- return null;
- }
-
return cli_get_process_title();
}
/**
* Found the place of a binary.
- *
- * @param string $binary Binary.
- * @return string
*/
- public static function locate($binary)
+ public static function locate(string $binary): string
{
if (isset($_ENV['PATH'])) {
$separator = ':';
@@ -1156,12 +910,8 @@ class Processus
/**
* Quick process execution.
* Returns only the STDOUT.
- *
- * @param string $commandLine Command line to execute.
- * @param bool $escape Escape command.
- * @return string
*/
- public static function execute($commandLine, $escape = true)
+ public static function execute(string $commandLine, bool $escape = true): string
{
if (true === $escape) {
$commandLine = escapeshellcmd($commandLine);
diff --git a/Source/Readline/Autocompleter/Aggregate.php b/Source/Readline/Autocompleter/Aggregate.php
index 88dec76..0535ff2 100644
--- a/Source/Readline/Autocompleter/Aggregate.php
+++ b/Source/Readline/Autocompleter/Aggregate.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Console\Readline\Autocompleter;
*
* Aggregate several autocompleters.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Aggregate implements Autocompleter
@@ -107,7 +108,7 @@ class Aggregate implements Autocompleter
* @param array $autocompleters Auto-completers.
* @return \ArrayObject
*/
- protected function setAutocompleters(array $autocompleters)
+ protected function setAutocompleters(array $autocompleters): \ArrayObject
{
$old = $this->_autocompleters;
$this->_autocompleters = new \ArrayObject($autocompleters);
@@ -120,7 +121,7 @@ class Aggregate implements Autocompleter
*
* @return \ArrayObject
*/
- public function getAutocompleters()
+ public function getAutocompleters(): \ArrayObject
{
return $this->_autocompleters;
}
@@ -130,7 +131,7 @@ class Aggregate implements Autocompleter
*
* @return string
*/
- public function getWordDefinition()
+ public function getWordDefinition(): string
{
return '.*';
}
diff --git a/Source/Readline/Autocompleter/Autocompleter.php b/Source/Readline/Autocompleter/Autocompleter.php
index 5568258..ca1dbec 100644
--- a/Source/Readline/Autocompleter/Autocompleter.php
+++ b/Source/Readline/Autocompleter/Autocompleter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,7 +45,6 @@ use Hoa\Consistency;
*
* Interface for all auto-completers.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
interface Autocompleter
@@ -63,7 +64,7 @@ interface Autocompleter
*
* @return string
*/
- public function getWordDefinition();
+ public function getWordDefinition(): string;
}
/**
diff --git a/Source/Readline/Autocompleter/Path.php b/Source/Readline/Autocompleter/Path.php
index 5e38560..c66fe0b 100644
--- a/Source/Readline/Autocompleter/Path.php
+++ b/Source/Readline/Autocompleter/Path.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Console\Readline\Autocompleter;
*
* Path autocompleter.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Path implements Autocompleter
@@ -51,7 +52,7 @@ class Path implements Autocompleter
*
* @const string
*/
- const PWD = null;
+ public const PWD = null;
/**
* Root.
@@ -78,7 +79,7 @@ class Path implements Autocompleter
* method).
*/
public function __construct(
- $root = null,
+ string $root = null,
\Closure $iteratorFactory = null
) {
if (null === $root) {
@@ -160,7 +161,7 @@ class Path implements Autocompleter
*
* @return string
*/
- public function getWordDefinition()
+ public function getWordDefinition(): string
{
return '/?[\w\d\\_\-\.]+(/[\w\d\\_\-\.]*)*';
}
@@ -171,7 +172,7 @@ class Path implements Autocompleter
* @param string $root Root.
* @return string
*/
- public function setRoot($root)
+ public function setRoot(string $root): string
{
$old = $this->_root;
$this->_root = $root;
@@ -184,7 +185,7 @@ class Path implements Autocompleter
*
* @return string
*/
- public function getRoot()
+ public function getRoot(): string
{
return $this->_root;
}
@@ -196,7 +197,7 @@ class Path implements Autocompleter
* $path of the iterator.
* @return string
*/
- public function setIteratorFactory(\Closure $iteratorFactory)
+ public function setIteratorFactory(\Closure $iteratorFactory): string
{
$old = $this->_iteratorFactory;
$this->_iteratorFactory = $iteratorFactory;
@@ -209,7 +210,7 @@ class Path implements Autocompleter
*
* @return \Closure
*/
- public function getIteratorFactory()
+ public function getIteratorFactory(): \Closure
{
return $this->_iteratorFactory;
}
@@ -219,7 +220,7 @@ class Path implements Autocompleter
*
* @return \Closure
*/
- public static function getDefaultIteratorFactory()
+ public static function getDefaultIteratorFactory(): \Closure
{
return function ($path) {
return new \DirectoryIterator($path);
diff --git a/Source/Readline/Autocompleter/Word.php b/Source/Readline/Autocompleter/Word.php
index e00790c..a674c72 100644
--- a/Source/Readline/Autocompleter/Word.php
+++ b/Source/Readline/Autocompleter/Word.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Console\Readline\Autocompleter;
*
* The simplest auto-completer: complete a word.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Word implements Autocompleter
@@ -101,7 +102,7 @@ class Word implements Autocompleter
*
* @return string
*/
- public function getWordDefinition()
+ public function getWordDefinition(): string
{
return '\b\w+';
}
@@ -112,7 +113,7 @@ class Word implements Autocompleter
* @param array $words Words.
* @return array
*/
- public function setWords(array $words)
+ public function setWords(array $words): array
{
$old = $this->_words;
$this->_words = $words;
@@ -125,7 +126,7 @@ class Word implements Autocompleter
*
* @return array
*/
- public function getWords()
+ public function getWords(): array
{
return $this->_words;
}
diff --git a/Source/Readline/Password.php b/Source/Readline/Password.php
index a977f29..65d135a 100644
--- a/Source/Readline/Password.php
+++ b/Source/Readline/Password.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -41,7 +43,6 @@ namespace Hoa\Console\Readline;
*
* Read, edit, bind… a password from the input.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Password extends Readline
@@ -51,5 +52,5 @@ class Password extends Readline
*
* @const int
*/
- const STATE_CONTINUE = 5; // parent::STATE_CONTINUE | parent::STATE_NO_ECHO
+ public const STATE_CONTINUE = 5; // parent::STATE_CONTINUE | parent::STATE_NO_ECHO
}
diff --git a/Source/Readline/Readline.php b/Source/Readline/Readline.php
index bffd1e1..07bd57b 100644
--- a/Source/Readline/Readline.php
+++ b/Source/Readline/Readline.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,7 +47,6 @@ use Hoa\Ustring;
*
* Read, edit, bind… a line from the input.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Readline
@@ -55,21 +56,21 @@ class Readline
*
* @const int
*/
- const STATE_CONTINUE = 1;
+ public const STATE_CONTINUE = 1;
/**
* State: stop to read.
*
* @const int
*/
- const STATE_BREAK = 2;
+ public const STATE_BREAK = 2;
/**
* State: no output the current buffer.
*
* @const int
*/
- const STATE_NO_ECHO = 4;
+ public const STATE_NO_ECHO = 4;
/**
* Current editing line.
@@ -176,7 +177,7 @@ class Readline
* @param string $prefix Prefix.
* @return string
*/
- public function readLine($prefix = null)
+ public function readLine(string $prefix = null): string
{
$input = Console::getInput();
@@ -241,7 +242,7 @@ class Readline
* @param string $char Char.
* @return string
*/
- public function _readLine($char)
+ public function _readLine(string $char): string
{
if (isset($this->_mapping[$char]) &&
is_callable($this->_mapping[$char])) {
@@ -283,7 +284,7 @@ class Readline
* @param array $mappings Mappings.
* @return void
*/
- public function addMappings(array $mappings)
+ public function addMappings(array $mappings): void
{
foreach ($mappings as $key => $mapping) {
$this->addMapping($key, $mapping);
@@ -305,7 +306,7 @@ class Readline
* @param mixed $mapping Mapping (a callable).
* @return void
*/
- public function addMapping($key, $mapping)
+ public function addMapping(string $key, $mapping): void
{
if ('\e[' === substr($key, 0, 3)) {
$this->_mapping["\033[" . substr($key, 3)] = $mapping;
@@ -325,7 +326,7 @@ class Readline
* @param string $line Line.
* @return void
*/
- public function addHistory($line = null)
+ public function addHistory(string $line = null): void
{
if (empty($line)) {
return;
@@ -342,7 +343,7 @@ class Readline
*
* @return void
*/
- public function clearHistory()
+ public function clearHistory(): void
{
unset($this->_history);
$this->_history = [];
@@ -358,7 +359,7 @@ class Readline
* @param int $i Index of the entry.
* @return string
*/
- public function getHistory($i = null)
+ public function getHistory(int $i = null): string
{
if (null === $i) {
$i = $this->_historyCurrent;
@@ -376,7 +377,7 @@ class Readline
*
* @return string
*/
- public function previousHistory()
+ public function previousHistory(): string
{
if (0 >= $this->_historyCurrent) {
return $this->getHistory(0);
@@ -390,7 +391,7 @@ class Readline
*
* @return string
*/
- public function nextHistory()
+ public function nextHistory(): string
{
if ($this->_historyCurrent + 1 >= $this->_historySize) {
return $this->getLine();
@@ -404,7 +405,7 @@ class Readline
*
* @return string
*/
- public function getLine()
+ public function getLine(): string
{
return $this->_line;
}
@@ -415,9 +416,9 @@ class Readline
* @param string $append String to append.
* @return void
*/
- public function appendLine($append)
+ public function appendLine(string $append): void
{
- $this->_line .= $append;
+ $this->_line .= $append;
$this->_lineLength = mb_strlen($this->_line);
$this->_lineCurrent = $this->_lineLength;
@@ -430,7 +431,7 @@ class Readline
* @param string $insert String to insert.
* @return void
*/
- public function insertLine($insert)
+ public function insertLine(string $insert)
{
if ($this->_lineLength == $this->_lineCurrent) {
return $this->appendLine($insert);
@@ -450,7 +451,7 @@ class Readline
*
* @return void
*/
- protected function resetLine()
+ protected function resetLine(): void
{
$this->_line = null;
$this->_lineCurrent = 0;
@@ -464,7 +465,7 @@ class Readline
*
* @return int
*/
- public function getLineCurrent()
+ public function getLineCurrent(): int
{
return $this->_lineCurrent;
}
@@ -474,7 +475,7 @@ class Readline
*
* @return int
*/
- public function getLineLength()
+ public function getLineLength(): int
{
return $this->_lineLength;
}
@@ -485,7 +486,7 @@ class Readline
* @param string $prefix Prefix.
* @return void
*/
- public function setPrefix($prefix)
+ public function setPrefix(string $prefix): void
{
$this->_prefix = $prefix;
@@ -497,7 +498,7 @@ class Readline
*
* @return string
*/
- public function getPrefix()
+ public function getPrefix(): string
{
return $this->_prefix;
}
@@ -507,7 +508,7 @@ class Readline
*
* @return string
*/
- public function getBuffer()
+ public function getBuffer(): string
{
return $this->_buffer;
}
@@ -518,7 +519,7 @@ class Readline
* @param \Hoa\Console\Readline\Autocompleter $autocompleter Auto-completer.
* @return \Hoa\Console\Readline\Autocompleter
*/
- public function setAutocompleter(Autocompleter $autocompleter)
+ public function setAutocompleter(Autocompleter $autocompleter): Autocompleter
{
$old = $this->_autocompleter;
$this->_autocompleter = $autocompleter;
@@ -531,7 +532,7 @@ class Readline
*
* @return \Hoa\Console\Readline\Autocompleter
*/
- public function getAutocompleter()
+ public function getAutocompleter(): Autocompleter
{
return $this->_autocompleter;
}
@@ -542,7 +543,7 @@ class Readline
* @param int $length Length.
* @return string
*/
- public function _read($length = 512)
+ public function _read(int $length = 512): string
{
return Console::getInput()->read($length);
}
@@ -553,7 +554,7 @@ class Readline
* @param string $line Line.
* @return void
*/
- public function setLine($line)
+ public function setLine(string $line): void
{
$this->_line = $line;
$this->_lineLength = mb_strlen($this->_line);
@@ -568,7 +569,7 @@ class Readline
* @param int $current Seek.
* @return void
*/
- public function setLineCurrent($current)
+ public function setLineCurrent(int $current): void
{
$this->_lineCurrent = $current;
@@ -581,7 +582,7 @@ class Readline
* @param int $length Length.
* @return void
*/
- public function setLineLength($length)
+ public function setLineLength(int $length): void
{
$this->_lineLength = $length;
@@ -594,7 +595,7 @@ class Readline
* @param string $buffer Buffer.
* @return string
*/
- public function setBuffer($buffer)
+ public function setBuffer(string $buffer): string
{
$this->_buffer = $buffer;
@@ -608,7 +609,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindArrowUp(Readline $self)
+ public function _bindArrowUp(Readline $self): int
{
if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) {
Console\Cursor::clear('↔');
@@ -627,7 +628,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindArrowDown(Readline $self)
+ public function _bindArrowDown(Readline $self): int
{
if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) {
Console\Cursor::clear('↔');
@@ -647,7 +648,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindArrowRight(Readline $self)
+ public function _bindArrowRight(Readline $self): int
{
if ($self->getLineLength() > $self->getLineCurrent()) {
if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) {
@@ -669,7 +670,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindArrowLeft(Readline $self)
+ public function _bindArrowLeft(Readline $self): int
{
if (0 < $self->getLineCurrent()) {
if (0 === (static::STATE_CONTINUE & static::STATE_NO_ECHO)) {
@@ -691,7 +692,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindBackspace(Readline $self)
+ public function _bindBackspace(Readline $self): int
{
$buffer = null;
@@ -725,7 +726,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindControlA(Readline $self)
+ public function _bindControlA(Readline $self): int
{
for ($i = $self->getLineCurrent() - 1; 0 <= $i; --$i) {
$self->_bindArrowLeft($self);
@@ -741,7 +742,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindControlB(Readline $self)
+ public function _bindControlB(Readline $self): int
{
$current = $self->getLineCurrent();
@@ -776,7 +777,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindControlE(Readline $self)
+ public function _bindControlE(Readline $self): int
{
for (
$i = $self->getLineCurrent(), $max = $self->getLineLength();
@@ -796,7 +797,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindControlF(Readline $self)
+ public function _bindControlF(Readline $self): int
{
$current = $self->getLineCurrent();
@@ -835,7 +836,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindControlW(Readline $self)
+ public function _bindControlW(Readline $self): int
{
$current = $self->getLineCurrent();
@@ -869,7 +870,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindNewline(Readline $self)
+ public function _bindNewline(Readline $self): int
{
$self->addHistory($self->getLine());
@@ -882,7 +883,7 @@ class Readline
* @param \Hoa\Console\Readline $self Self.
* @return int
*/
- public function _bindTab(Readline $self)
+ public function _bindTab(Readline $self): int
{
$output = Console::getOutput();
$autocompleter = $self->getAutocompleter();
@@ -930,7 +931,7 @@ class Readline
$wWidth = $window['x'];
$cursor = Console\Cursor::getPosition();
- array_walk($_solution, function (&$value) use (&$cWidth) {
+ array_walk($_solution, function (&$value) use (&$cWidth): void {
$handle = mb_strlen($value);
if ($handle > $cWidth) {
@@ -939,7 +940,7 @@ class Readline
return;
});
- array_walk($_solution, function (&$value) use (&$cWidth) {
+ array_walk($_solution, function (&$value) use (&$cWidth): void {
$handle = mb_strlen($value);
if ($handle >= $cWidth) {
@@ -996,7 +997,7 @@ class Readline
&$_solution,
&$cWidth,
$output
- ) {
+ ): void {
Console\Cursor::save();
Console\Cursor::hide();
Console\Cursor::move('↓ LEFT');
@@ -1015,7 +1016,7 @@ class Readline
&$_solution,
&$cWidth,
$output
- ) {
+ ): void {
Console\Cursor::save();
Console\Cursor::hide();
Console\Cursor::move('↓ LEFT');
@@ -1032,7 +1033,7 @@ class Readline
&$mLine,
&$coord,
&$select
- ) {
+ ): void {
$mColumn = 0;
$mLine = 0;
$coord = 0;
@@ -1132,6 +1133,7 @@ class Readline
Console\Cursor::move('←', mb_strlen($tail));
}
+ // no break
default:
$mColumn = -1;
$mLine = -1;
diff --git a/Source/Tput.php b/Source/Tput.php
index ebd2a3a..2fe208d 100644
--- a/Source/Tput.php
+++ b/Source/Tput.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -43,16 +45,11 @@ namespace Hoa\Console;
* Resources:
* • http://man.cx/terminfo(5),
* • http://pubs.opengroup.org/onlinepubs/7908799/xcurses/terminfo.html,
- *
- * @copyright Copyright © 2007-2017 Hoa community
- * @license New BSD License
*/
class Tput
{
/**
* Booleans.
- *
- * @var array
*/
protected static $_booleans = [
'auto_left_margin',
@@ -104,8 +101,6 @@ class Tput
/**
* Numbers.
- *
- * @var array
*/
protected static $_numbers = [
'columns',
@@ -152,8 +147,6 @@ class Tput
/**
* Strings.
- *
- * @var array
*/
protected static $_strings = [
'back_tab',
@@ -575,8 +568,6 @@ class Tput
/**
* Computed informations.
- *
- * @var array
*/
protected $_informations = [];
@@ -584,10 +575,8 @@ class Tput
/**
* Set stream and parse.
- *
- * @param string $terminfo Terminfo file.
*/
- public function __construct($terminfo = null)
+ public function __construct(?string $terminfo = null)
{
if (null === $terminfo) {
$terminfo = static::getTerminfo();
@@ -600,12 +589,8 @@ class Tput
/**
* Parse.
- *
- * @param string $terminfo Terminfo file.
- * @return array
- * @throws \Hoa\Console\Exception
*/
- protected function parse($terminfo)
+ protected function parse(string $terminfo): array
{
if (!file_exists($terminfo)) {
throw new Exception(
@@ -639,7 +624,7 @@ class Tput
$out['description'] = $nameAndDescription[1];
// Booleans.
- $i += $headers['names_size'];
+ $i += $headers['names_size'];
$booleans = [];
$booleanNames = &static::$_booleans;
@@ -722,21 +707,16 @@ class Tput
/**
* Get all informations.
- *
- * @return array
*/
- public function getInformations()
+ public function getInformations(): array
{
return $this->_informations;
}
/**
* Get a boolean value.
- *
- * @param bool $boolean Boolean.
- * @return bool
*/
- public function has($boolean)
+ public function has(bool $boolean): bool
{
if (!isset($this->_informations['booleans'][$boolean])) {
return false;
@@ -747,11 +727,8 @@ class Tput
/**
* Get a number value.
- *
- * @param int $number Number.
- * @return int
*/
- public function count($number)
+ public function count(int $number): int
{
if (!isset($this->_informations['numbers'][$number])) {
return 0;
@@ -762,11 +739,8 @@ class Tput
/**
* Get a string value.
- *
- * @param string $string String.
- * @return int
*/
- public function get($string)
+ public function get(string $string): int
{
if (!isset($this->_informations['strings'][$string])) {
return null;
@@ -777,10 +751,8 @@ class Tput
/**
* Get current term profile.
- *
- * @return string
*/
- public static function getTerm()
+ public static function getTerm(): string
{
return
isset($_SERVER['TERM']) && !empty($_SERVER['TERM'])
@@ -790,11 +762,8 @@ class Tput
/**
* Get pathname to the current terminfo.
- *
- * @param string $term Term.
- * @return string
*/
- public static function getTerminfo($term = null)
+ public static function getTerminfo(?string $term = null): string
{
$paths = [];
diff --git a/Source/Window.php b/Source/Window.php
index da9ec64..8b84d8b 100644
--- a/Source/Window.php
+++ b/Source/Window.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -39,23 +41,16 @@ namespace Hoa\Console;
use Hoa\Event;
/**
- * Class \Hoa\Console\Window.
- *
* Allow to manipulate the window.
*
* We can listen the event channel hoa://Event/Console/Window:resize to detect
* if the window has been resized. Please, see the constructor documentation to
* get more informations.
- *
- * @copyright Copyright © 2007-2017 Hoa community
- * @license New BSD License
*/
class Window implements Event\Source
{
/**
* Singleton (only for events).
- *
- * @var \Hoa\Console\Window
*/
private static $_instance = null;
@@ -65,7 +60,6 @@ class Window implements Event\Source
* Set the event channel.
* We need to declare(ticks = 1) in the main script to ensure that the event
* is fired. Also, we need the pcntl_signal() function enabled.
- *
*/
private function __construct()
{
@@ -79,10 +73,8 @@ class Window implements Event\Source
/**
* Singleton.
- *
- * @return \Hoa\Console\Window
*/
- public static function getInstance()
+ public static function getInstance(): self
{
if (null === static::$_instance) {
static::$_instance = new static();
@@ -93,12 +85,8 @@ class Window implements Event\Source
/**
* Set size to X lines and Y columns.
- *
- * @param int $x X coordinate.
- * @param int $y Y coordinate.
- * @return void
*/
- public static function setSize($x, $y)
+ public static function setSize(int $x, int $y): void
{
if (OS_WIN) {
return;
@@ -111,21 +99,19 @@ class Window implements Event\Source
/**
* Get current size (x and y) of the window.
- *
- * @return array
*/
- public static function getSize()
+ public static function getSize(): array
{
if (OS_WIN) {
$modecon = explode("\n", ltrim(Processus::execute('mode con')));
- $_y = trim($modecon[2]);
+ $_y = trim($modecon[2]);
preg_match('#[^:]+:\s*([0-9]+)#', $_y, $matches);
- $y = (int) $matches[1];
+ $y = (int) $matches[1];
- $_x = trim($modecon[3]);
+ $_x = trim($modecon[3]);
preg_match('#[^:]+:\s*([0-9]+)#', $_x, $matches);
- $x = (int) $matches[1];
+ $x = (int) $matches[1];
return [
'x' => $x,
@@ -199,12 +185,8 @@ class Window implements Event\Source
/**
* Move to X and Y (in pixels).
- *
- * @param int $x X coordinate.
- * @param int $y Y coordinate.
- * @return void
*/
- public static function moveTo($x, $y)
+ public static function moveTo(int $x, int $y): void
{
if (OS_WIN) {
return;
@@ -218,10 +200,8 @@ class Window implements Event\Source
/**
* Get current position (x and y) of the window (in pixels).
- *
- * @return array
*/
- public static function getPosition()
+ public static function getPosition(): array
{
if (OS_WIN) {
return;
@@ -268,12 +248,8 @@ class Window implements Event\Source
* • u, up, ↑ : scroll whole page up;
* • d, down, ↓ : scroll whole page down.
* Directions can be concatenated by a single space.
- *
- * @param string $directions Directions.
- * @param int $repeat How many times do we scroll?
- * @return void
*/
- public static function scroll($directions, $repeat = 1)
+ public static function scroll(string $directions, int $repeat = 1): void
{
if (OS_WIN) {
return;
@@ -335,10 +311,8 @@ class Window implements Event\Source
/**
* Minimize the window.
- *
- * @return void
*/
- public static function minimize()
+ public static function minimize(): void
{
if (OS_WIN) {
return;
@@ -352,10 +326,8 @@ class Window implements Event\Source
/**
* Restore the window (de-minimize).
- *
- * @return void
*/
- public static function restore()
+ public static function restore(): void
{
if (OS_WIN) {
return;
@@ -368,10 +340,8 @@ class Window implements Event\Source
/**
* Raise the window to the front of the stacking order.
- *
- * @return void
*/
- public static function raise()
+ public static function raise(): void
{
if (OS_WIN) {
return;
@@ -384,10 +354,8 @@ class Window implements Event\Source
/**
* Lower the window to the bottom of the stacking order.
- *
- * @return void
*/
- public static function lower()
+ public static function lower(): void
{
if (OS_WIN) {
return;
@@ -400,11 +368,8 @@ class Window implements Event\Source
/**
* Set title.
- *
- * @param string $title Title.
- * @return void
*/
- public static function setTitle($title)
+ public static function setTitle(string $title): void
{
if (OS_WIN) {
return;
@@ -418,10 +383,8 @@ class Window implements Event\Source
/**
* Get title.
- *
- * @return string
*/
- public static function getTitle()
+ public static function getTitle(): ?string
{
if (OS_WIN) {
return;
@@ -464,10 +427,8 @@ class Window implements Event\Source
/**
* Get label.
- *
- * @return string
*/
- public static function getLabel()
+ public static function getLabel(): ?string
{
if (OS_WIN) {
return;
@@ -510,10 +471,8 @@ class Window implements Event\Source
/**
* Refresh the window.
- *
- * @return void
*/
- public static function refresh()
+ public static function refresh(): void
{
if (OS_WIN) {
return;
@@ -527,11 +486,8 @@ class Window implements Event\Source
/**
* Set clipboard value.
- *
- * @param string $data Data to copy.
- * @return void
*/
- public static function copy($data)
+ public static function copy(string $data): void
{
if (OS_WIN) {
return;
@@ -560,7 +516,7 @@ if (function_exists('pcntl_signal')) {
Window::getInstance();
pcntl_signal(
SIGWINCH,
- function () {
+ function (): void {
static $_window = null;
if (null === $_window) {
diff --git a/Test/Unit/Console.php b/Test/Unit/Console.php
index 759526f..fef6bbf 100644
--- a/Test/Unit/Console.php
+++ b/Test/Unit/Console.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,7 +47,6 @@ use Hoa\Test;
*
* Test suite of the console class.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Console extends Test\Unit\Suite
@@ -95,7 +96,7 @@ class Console extends Test\Unit\Suite
return $this->_case_get_mode_xxx(0170000, -1);
}
- protected function _case_get_mode_xxx($mask, $expect)
+ protected function _case_get_mode_xxx($mask, $expect): void
{
$this
->given($this->function->fstat = ['mode' => $mask & 0170000])
@@ -105,7 +106,7 @@ class Console extends Test\Unit\Suite
->isEqualTo($expect);
}
- public function case_set_input()
+ public function case_set_input(): void
{
$this
->given($input = new LUT\Input())
@@ -117,7 +118,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo($input);
}
- public function case_get_input()
+ public function case_get_input(): void
{
$this
->when($result = SUT::getInput())
@@ -127,7 +128,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo(SUT::getInput());
}
- public function case_set_output()
+ public function case_set_output(): void
{
$this
->given($output = new LUT\Output())
@@ -139,7 +140,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo($output);
}
- public function case_get_output()
+ public function case_get_output(): void
{
$this
->when($result = SUT::getOutput())
@@ -149,7 +150,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo(SUT::getOutput());
}
- public function case_set_tput()
+ public function case_set_tput(): void
{
$this
->given($tput = new LUT\Tput('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -161,7 +162,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo($tput);
}
- public function case_get_tput()
+ public function case_get_tput(): void
{
$this
->when($result = SUT::getTput())
@@ -171,7 +172,7 @@ class Console extends Test\Unit\Suite
->isIdenticalTo(SUT::getTput());
}
- public function case_is_tmux_running()
+ public function case_is_tmux_running(): void
{
$this
->given($_SERVER['TMUX'] = 'foo')
@@ -181,7 +182,7 @@ class Console extends Test\Unit\Suite
->isTrue();
}
- public function case_is_not_tmux_running()
+ public function case_is_not_tmux_running(): void
{
unset($_SERVER['TMUX']);
diff --git a/Test/Unit/Cursor.php b/Test/Unit/Cursor.php
index 529e6f5..f8c0241 100644
--- a/Test/Unit/Cursor.php
+++ b/Test/Unit/Cursor.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -46,12 +48,11 @@ use Hoa\Test;
*
* Test suite of the cursor.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Cursor extends Test\Unit\Suite
{
- public function beforeTestMethod($methodName)
+ public function beforeTestMethod($methodName): void
{
parent::beforeTestMethod($methodName);
LUT::setTput(new LUT\Tput('hoa://Library/Console/Source/Terminfo/78/xterm-256color'));
@@ -59,7 +60,7 @@ class Cursor extends Test\Unit\Suite
return;
}
- public function case_move_u()
+ public function case_move_u(): void
{
$this
->when(SUT::move('u'))
@@ -68,7 +69,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1A");
}
- public function case_move_up()
+ public function case_move_up(): void
{
$this
->when(SUT::move('up'))
@@ -77,7 +78,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1A");
}
- public function case_move_↑()
+ public function case_move_↑(): void
{
$this
->when(SUT::move('↑'))
@@ -86,7 +87,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1A");
}
- public function case_move_↑_repeated()
+ public function case_move_↑_repeated(): void
{
$this
->when(SUT::move('↑', 42))
@@ -95,7 +96,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42A");
}
- public function case_move_r()
+ public function case_move_r(): void
{
$this
->when(SUT::move('r'))
@@ -104,7 +105,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1C");
}
- public function case_move_right()
+ public function case_move_right(): void
{
$this
->when(SUT::move('right'))
@@ -113,7 +114,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1C");
}
- public function case_move_→()
+ public function case_move_→(): void
{
$this
->when(SUT::move('→'))
@@ -122,7 +123,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1C");
}
- public function case_move_→_repeated()
+ public function case_move_→_repeated(): void
{
$this
->when(SUT::move('→', 42))
@@ -131,7 +132,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42C");
}
- public function case_move_d()
+ public function case_move_d(): void
{
$this
->when(SUT::move('d'))
@@ -140,7 +141,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1B");
}
- public function case_move_down()
+ public function case_move_down(): void
{
$this
->when(SUT::move('down'))
@@ -149,7 +150,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1B");
}
- public function case_move_↓()
+ public function case_move_↓(): void
{
$this
->when(SUT::move('↓'))
@@ -158,7 +159,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1B");
}
- public function case_move_↓_repeated()
+ public function case_move_↓_repeated(): void
{
$this
->when(SUT::move('↓', 42))
@@ -167,7 +168,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42B");
}
- public function case_move_l()
+ public function case_move_l(): void
{
$this
->when(SUT::move('l'))
@@ -176,7 +177,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1D");
}
- public function case_move_left()
+ public function case_move_left(): void
{
$this
->when(SUT::move('left'))
@@ -185,7 +186,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1D");
}
- public function case_move_←()
+ public function case_move_←(): void
{
$this
->when(SUT::move('←'))
@@ -194,7 +195,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1D");
}
- public function case_move_←_repeated()
+ public function case_move_←_repeated(): void
{
$this
->when(SUT::move('←', 42))
@@ -203,7 +204,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42D");
}
- public function case_move_sequence()
+ public function case_move_sequence(): void
{
$this
->when(SUT::move('↑ → ↓ ←'))
@@ -212,7 +213,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1A\033[1C\033[1B\033[1D");
}
- public function case_move_to_x_y()
+ public function case_move_to_x_y(): void
{
$this
->when(SUT::moveTo(7, 42))
@@ -221,7 +222,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42;7H");
}
- public function case_move_to_x()
+ public function case_move_to_x(): void
{
$this
->given(
@@ -236,7 +237,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[6n\033[42;153H");
}
- public function case_move_to_y()
+ public function case_move_to_y(): void
{
$this
->given(
@@ -251,7 +252,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[6n\033[153;7H");
}
- public function case_get_position()
+ public function case_get_position(): void
{
$this
->given(
@@ -271,7 +272,7 @@ class Cursor extends Test\Unit\Suite
]);
}
- public function case_save()
+ public function case_save(): void
{
$this
->when(SUT::save())
@@ -280,7 +281,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\0337");
}
- public function case_restore()
+ public function case_restore(): void
{
$this
->when(SUT::restore())
@@ -289,7 +290,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\0338");
}
- public function case_clear_a()
+ public function case_clear_a(): void
{
$this
->when(SUT::clear('a'))
@@ -298,7 +299,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[H\033[2J\033[1;1H");
}
- public function case_clear_all()
+ public function case_clear_all(): void
{
$this
->when(SUT::clear('all'))
@@ -307,7 +308,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[H\033[2J\033[1;1H");
}
- public function case_clear_↕()
+ public function case_clear_↕(): void
{
$this
->when(SUT::clear('↕'))
@@ -316,7 +317,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[H\033[2J\033[1;1H");
}
- public function case_clear_u()
+ public function case_clear_u(): void
{
$this
->when(SUT::clear('u'))
@@ -325,7 +326,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1J");
}
- public function case_clear_up()
+ public function case_clear_up(): void
{
$this
->when(SUT::clear('up'))
@@ -334,7 +335,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1J");
}
- public function case_clear_↑()
+ public function case_clear_↑(): void
{
$this
->when(SUT::clear('↑'))
@@ -343,7 +344,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1J");
}
- public function case_clear_r()
+ public function case_clear_r(): void
{
$this
->when(SUT::clear('r'))
@@ -352,7 +353,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[K");
}
- public function case_clear_right()
+ public function case_clear_right(): void
{
$this
->when(SUT::clear('right'))
@@ -361,7 +362,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[K");
}
- public function case_clear_→()
+ public function case_clear_→(): void
{
$this
->when(SUT::clear('→'))
@@ -370,7 +371,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[K");
}
- public function case_clear_d()
+ public function case_clear_d(): void
{
$this
->when(SUT::clear('d'))
@@ -379,7 +380,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[J");
}
- public function case_clear_down()
+ public function case_clear_down(): void
{
$this
->when(SUT::clear('down'))
@@ -388,7 +389,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[J");
}
- public function case_clear_↓()
+ public function case_clear_↓(): void
{
$this
->when(SUT::clear('↓'))
@@ -397,7 +398,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[J");
}
- public function case_clear_l()
+ public function case_clear_l(): void
{
$this
->when(SUT::clear('l'))
@@ -406,7 +407,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1K");
}
- public function case_clear_left()
+ public function case_clear_left(): void
{
$this
->when(SUT::clear('left'))
@@ -415,7 +416,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1K");
}
- public function case_clear_←()
+ public function case_clear_←(): void
{
$this
->when(SUT::clear('←'))
@@ -424,7 +425,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1K");
}
- public function case_clear_line()
+ public function case_clear_line(): void
{
$this
->when(SUT::clear('line'))
@@ -433,7 +434,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\r\033[K");
}
- public function case_clear_↔()
+ public function case_clear_↔(): void
{
$this
->when(SUT::clear('↔'))
@@ -442,7 +443,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\r\033[K");
}
- public function case_hide()
+ public function case_hide(): void
{
$this
->when(SUT::hide())
@@ -451,7 +452,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[?25l");
}
- public function case_show()
+ public function case_show(): void
{
$this
->when(SUT::show())
@@ -460,7 +461,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[?12;25h");
}
- public function case_colorize_n()
+ public function case_colorize_n(): void
{
$this
->when(SUT::colorize('n'))
@@ -469,7 +470,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[0m");
}
- public function case_colorize_normal()
+ public function case_colorize_normal(): void
{
$this
->when(SUT::colorize('normal'))
@@ -478,7 +479,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[0m");
}
- public function case_colorize_normal_repeated()
+ public function case_colorize_normal_repeated(): void
{
$this
->when(SUT::colorize('n normal'))
@@ -487,7 +488,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[0;0m");
}
- public function case_colorize_b()
+ public function case_colorize_b(): void
{
$this
->when(SUT::colorize('b'))
@@ -496,7 +497,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1m");
}
- public function case_colorize_bold()
+ public function case_colorize_bold(): void
{
$this
->when(SUT::colorize('bold'))
@@ -505,7 +506,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1m");
}
- public function case_colorize_u()
+ public function case_colorize_u(): void
{
$this
->when(SUT::colorize('u'))
@@ -514,7 +515,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[4m");
}
- public function case_colorize_underlined()
+ public function case_colorize_underlined(): void
{
$this
->when(SUT::colorize('underlined'))
@@ -523,7 +524,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[4m");
}
- public function case_colorize_bl()
+ public function case_colorize_bl(): void
{
$this
->when(SUT::colorize('bl'))
@@ -532,7 +533,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[5m");
}
- public function case_colorize_blink()
+ public function case_colorize_blink(): void
{
$this
->when(SUT::colorize('blink'))
@@ -541,7 +542,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[5m");
}
- public function case_colorize_i()
+ public function case_colorize_i(): void
{
$this
->when(SUT::colorize('i'))
@@ -550,7 +551,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[7m");
}
- public function case_colorize_inverse()
+ public function case_colorize_inverse(): void
{
$this
->when(SUT::colorize('inverse'))
@@ -559,7 +560,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[7m");
}
- public function case_colorize_not_b()
+ public function case_colorize_not_b(): void
{
$this
->when(SUT::colorize('!b'))
@@ -568,7 +569,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[22m");
}
- public function case_colorize_not_bold()
+ public function case_colorize_not_bold(): void
{
$this
->when(SUT::colorize('!bold'))
@@ -577,7 +578,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[22m");
}
- public function case_colorize_not_u()
+ public function case_colorize_not_u(): void
{
$this
->when(SUT::colorize('!u'))
@@ -586,7 +587,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[24m");
}
- public function case_colorize_not_underlined()
+ public function case_colorize_not_underlined(): void
{
$this
->when(SUT::colorize('!underlined'))
@@ -595,7 +596,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[24m");
}
- public function case_colorize_not_bl()
+ public function case_colorize_not_bl(): void
{
$this
->when(SUT::colorize('!bl'))
@@ -604,7 +605,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[25m");
}
- public function case_colorize_not_blink()
+ public function case_colorize_not_blink(): void
{
$this
->when(SUT::colorize('!blink'))
@@ -613,7 +614,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[25m");
}
- public function case_colorize_not_i()
+ public function case_colorize_not_i(): void
{
$this
->when(SUT::colorize('!i'))
@@ -622,7 +623,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[27m");
}
- public function case_colorize_not_inverse()
+ public function case_colorize_not_inverse(): void
{
$this
->when(SUT::colorize('!inverse'))
@@ -631,7 +632,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[27m");
}
- public function case_colorize_fg_black()
+ public function case_colorize_fg_black(): void
{
$this
->when(SUT::colorize('fg(black)'))
@@ -640,7 +641,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[30m");
}
- public function case_colorize_foreground_black()
+ public function case_colorize_foreground_black(): void
{
$this
->when(SUT::colorize('foreground(black)'))
@@ -649,7 +650,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[30m");
}
- public function case_colorize_fg_red()
+ public function case_colorize_fg_red(): void
{
$this
->when(SUT::colorize('fg(red)'))
@@ -658,7 +659,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[31m");
}
- public function case_colorize_fg_green()
+ public function case_colorize_fg_green(): void
{
$this
->when(SUT::colorize('fg(green)'))
@@ -667,7 +668,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[32m");
}
- public function case_colorize_fg_yellow()
+ public function case_colorize_fg_yellow(): void
{
$this
->when(SUT::colorize('fg(yellow)'))
@@ -676,7 +677,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[33m");
}
- public function case_colorize_fg_blue()
+ public function case_colorize_fg_blue(): void
{
$this
->when(SUT::colorize('fg(blue)'))
@@ -685,7 +686,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[34m");
}
- public function case_colorize_fg_magenta()
+ public function case_colorize_fg_magenta(): void
{
$this
->when(SUT::colorize('fg(magenta)'))
@@ -694,7 +695,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[35m");
}
- public function case_colorize_fg_cyan()
+ public function case_colorize_fg_cyan(): void
{
$this
->when(SUT::colorize('fg(cyan)'))
@@ -703,7 +704,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[36m");
}
- public function case_colorize_fg_white()
+ public function case_colorize_fg_white(): void
{
$this
->when(SUT::colorize('fg(white)'))
@@ -712,7 +713,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[37m");
}
- public function case_colorize_fg_default()
+ public function case_colorize_fg_default(): void
{
$this
->when(SUT::colorize('fg(default)'))
@@ -721,7 +722,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[39m");
}
- public function case_colorize_bg_black()
+ public function case_colorize_bg_black(): void
{
$this
->when(SUT::colorize('bg(black)'))
@@ -730,7 +731,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[40m");
}
- public function case_colorize_background_black()
+ public function case_colorize_background_black(): void
{
$this
->when(SUT::colorize('background(black)'))
@@ -739,7 +740,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[40m");
}
- public function case_colorize_bg_red()
+ public function case_colorize_bg_red(): void
{
$this
->when(SUT::colorize('bg(red)'))
@@ -748,7 +749,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[41m");
}
- public function case_colorize_bg_green()
+ public function case_colorize_bg_green(): void
{
$this
->when(SUT::colorize('bg(green)'))
@@ -757,7 +758,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[42m");
}
- public function case_colorize_bg_yellow()
+ public function case_colorize_bg_yellow(): void
{
$this
->when(SUT::colorize('bg(yellow)'))
@@ -766,7 +767,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[43m");
}
- public function case_colorize_bg_blue()
+ public function case_colorize_bg_blue(): void
{
$this
->when(SUT::colorize('bg(blue)'))
@@ -775,7 +776,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[44m");
}
- public function case_colorize_bg_magenta()
+ public function case_colorize_bg_magenta(): void
{
$this
->when(SUT::colorize('bg(magenta)'))
@@ -784,7 +785,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[45m");
}
- public function case_colorize_bg_cyan()
+ public function case_colorize_bg_cyan(): void
{
$this
->when(SUT::colorize('bg(cyan)'))
@@ -793,7 +794,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[46m");
}
- public function case_colorize_bg_white()
+ public function case_colorize_bg_white(): void
{
$this
->when(SUT::colorize('bg(white)'))
@@ -802,7 +803,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[47m");
}
- public function case_colorize_bg_default()
+ public function case_colorize_bg_default(): void
{
$this
->when(SUT::colorize('bg(default)'))
@@ -811,7 +812,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[49m");
}
- public function case_colorize_foreground_ff0066()
+ public function case_colorize_foreground_ff0066(): void
{
$this
->when(SUT::colorize('foreground(#ff0066)'))
@@ -820,7 +821,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[38;5;197m");
}
- public function case_colorize_background_ff0066()
+ public function case_colorize_background_ff0066(): void
{
$this
->when(SUT::colorize('background(#ff0066)'))
@@ -829,7 +830,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[48;5;197m");
}
- public function case_colorize_foreground_color_index()
+ public function case_colorize_foreground_color_index(): void
{
$this
->when(SUT::colorize('foreground(42)'))
@@ -838,7 +839,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[38;5;42m");
}
- public function case_change_color()
+ public function case_change_color(): void
{
$this
->when(SUT::changeColor(35, 0xff0066))
@@ -847,7 +848,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033]4;35;ff0066\033\\");
}
- public function case_set_style_b()
+ public function case_set_style_b(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -857,7 +858,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1 q");
}
- public function case_set_style_block()
+ public function case_set_style_block(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -867,7 +868,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1 q");
}
- public function case_set_style_▋()
+ public function case_set_style_▋(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -877,7 +878,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[1 q");
}
- public function case_set_style_block_no_blink()
+ public function case_set_style_block_no_blink(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -887,7 +888,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[2 q");
}
- public function case_set_style_u()
+ public function case_set_style_u(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -897,7 +898,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[2 q");
}
- public function case_set_style_underline()
+ public function case_set_style_underline(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -907,7 +908,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[2 q");
}
- public function case_set_style__()
+ public function case_set_style__(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -917,7 +918,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[2 q");
}
- public function case_set_style_underline_no_blink()
+ public function case_set_style_underline_no_blink(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -927,7 +928,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[3 q");
}
- public function case_set_style_v()
+ public function case_set_style_v(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -937,7 +938,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[5 q");
}
- public function case_set_style_vertical()
+ public function case_set_style_vertical(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -947,7 +948,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[5 q");
}
- public function case_set_style_pipe()
+ public function case_set_style_pipe(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -957,7 +958,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[5 q");
}
- public function case_set_style_vertical_no_blink()
+ public function case_set_style_vertical_no_blink(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -967,7 +968,7 @@ class Cursor extends Test\Unit\Suite
->isEqualTo("\033[6 q");
}
- public function case_set_style_on_windows()
+ public function case_set_style_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -977,7 +978,7 @@ class Cursor extends Test\Unit\Suite
->isEmpty();
}
- public function case_bip()
+ public function case_bip(): void
{
$this
->when(SUT::bip())
diff --git a/Test/Unit/GetOption.php b/Test/Unit/GetOption.php
index 89023a0..101180b 100644
--- a/Test/Unit/GetOption.php
+++ b/Test/Unit/GetOption.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,12 +47,11 @@ use Hoa\Test;
*
* Test suite of the option reader.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class GetOption extends Test\Unit\Suite
{
- public function case_empty()
+ public function case_empty(): void
{
$this
->given(
@@ -69,7 +70,7 @@ class GetOption extends Test\Unit\Suite
->isNull();
}
- public function case_one_entry()
+ public function case_one_entry(): void
{
$this
->given(
@@ -101,7 +102,7 @@ class GetOption extends Test\Unit\Suite
->isNull();
}
- public function case_more_entries()
+ public function case_more_entries(): void
{
$this
->given(
@@ -144,7 +145,7 @@ class GetOption extends Test\Unit\Suite
->isNull();
}
- public function case_ambiguous()
+ public function case_ambiguous(): void
{
$this
->given(
@@ -173,7 +174,7 @@ class GetOption extends Test\Unit\Suite
]);
}
- public function case_resolve_option_ambiguity_no_solution()
+ public function case_resolve_option_ambiguity_no_solution(): void
{
$this
->given(
@@ -188,13 +189,13 @@ class GetOption extends Test\Unit\Suite
'option' => 'baz'
]
)
- ->exception(function () use ($options, $solutions) {
+ ->exception(function () use ($options, $solutions): void {
$options->resolveOptionAmbiguity($solutions);
})
->isInstanceOf('Hoa\Console\Exception');
}
- public function case_resolve_option_ambiguity()
+ public function case_resolve_option_ambiguity(): void
{
$this
->given(
diff --git a/Test/Unit/Input.php b/Test/Unit/Input.php
index 7b723f1..485d8cb 100644
--- a/Test/Unit/Input.php
+++ b/Test/Unit/Input.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,12 +47,11 @@ use Hoa\Test;
*
* Test suite of the input object.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Input extends Test\Unit\Suite
{
- public function case_is_a_stream()
+ public function case_is_a_stream(): void
{
$this
->when($result = new SUT())
@@ -59,7 +60,7 @@ class Input extends Test\Unit\Suite
->isInstanceOf('Hoa\Stream\IStream\In');
}
- public function case_eof()
+ public function case_eof(): void
{
$this
->given(
@@ -72,7 +73,7 @@ class Input extends Test\Unit\Suite
->isEqualTo($file->eof());
}
- public function case_read()
+ public function case_read(): void
{
$this
->given(
@@ -87,7 +88,7 @@ class Input extends Test\Unit\Suite
->isEqualTo('foo');
}
- public function case_read_string()
+ public function case_read_string(): void
{
$this
->given(
@@ -102,7 +103,7 @@ class Input extends Test\Unit\Suite
->isEqualTo('foo');
}
- public function case_read_character()
+ public function case_read_character(): void
{
$this
->given(
@@ -117,7 +118,7 @@ class Input extends Test\Unit\Suite
->isEqualTo('f');
}
- public function case_read_boolean_true()
+ public function case_read_boolean_true(): void
{
$this
->given(
@@ -132,7 +133,7 @@ class Input extends Test\Unit\Suite
->isTrue();
}
- public function case_read_boolean_false()
+ public function case_read_boolean_false(): void
{
$this
->given(
@@ -147,7 +148,7 @@ class Input extends Test\Unit\Suite
->isFalse();
}
- public function case_read_integer()
+ public function case_read_integer(): void
{
$this
->given(
@@ -162,7 +163,7 @@ class Input extends Test\Unit\Suite
->isEqualTo(42);
}
- public function case_read_float()
+ public function case_read_float(): void
{
$this
->given(
@@ -177,7 +178,7 @@ class Input extends Test\Unit\Suite
->isEqualTo(4.2);
}
- public function case_read_array()
+ public function case_read_array(): void
{
$this
->given(
@@ -195,7 +196,7 @@ class Input extends Test\Unit\Suite
]);
}
- public function case_read_line()
+ public function case_read_line(): void
{
$this
->given(
@@ -210,7 +211,7 @@ class Input extends Test\Unit\Suite
->isEqualTo('foo' . "\n");
}
- public function case_read_all()
+ public function case_read_all(): void
{
$this
->given(
@@ -226,7 +227,7 @@ class Input extends Test\Unit\Suite
->isEqualTo($content);
}
- public function case_scanf()
+ public function case_scanf(): void
{
$this
->given(
diff --git a/Test/Unit/Mouse.php b/Test/Unit/Mouse.php
index 40aafda..ae27ae6 100644
--- a/Test/Unit/Mouse.php
+++ b/Test/Unit/Mouse.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -47,12 +49,11 @@ use Hoa\Test;
*
* Test suite of the mouse.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Mouse extends Test\Unit\Suite
{
- public function beforeTestMethod($methodName)
+ public function beforeTestMethod($methodName): void
{
parent::beforeTestMethod($methodName);
LUT::setTput(new LUT\Tput('hoa://Library/Console/Source/Terminfo/78/xterm-256color'));
@@ -60,7 +61,7 @@ class Mouse extends Test\Unit\Suite
return;
}
- public function case_get_instance()
+ public function case_get_instance(): void
{
$this
->when($result = SUT::getInstance())
@@ -177,7 +178,7 @@ class Mouse extends Test\Unit\Suite
);
}
- public function _case_track($x, $y, $pointerActionCode, $listenerName, array $listenerData)
+ public function _case_track($x, $y, $pointerActionCode, $listenerName, array $listenerData): void
{
$this
->given(
@@ -204,7 +205,7 @@ class Mouse extends Test\Unit\Suite
SUT::getInstance()->on(
$listenerName,
- function (Event\Bucket $bucket) use (&$_listenerData) {
+ function (Event\Bucket $bucket) use (&$_listenerData): void {
$_listenerData = $bucket->getData();
return;
@@ -228,7 +229,7 @@ class Mouse extends Test\Unit\Suite
->isEqualTo($listenerData);
}
- public function case_untrack_when_not_tracked()
+ public function case_untrack_when_not_tracked(): void
{
$this
->when($result = SUT::untrack())
diff --git a/Test/Unit/Output.php b/Test/Unit/Output.php
index 6cf1bd5..2d779ed 100644
--- a/Test/Unit/Output.php
+++ b/Test/Unit/Output.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the output object.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Output extends Test\Unit\Suite
{
- public function case_is_a_stream()
+ public function case_is_a_stream(): void
{
$this
->when($result = new SUT())
@@ -58,7 +59,7 @@ class Output extends Test\Unit\Suite
->isInstanceOf('Hoa\Stream\IStream\Out');
}
- public function case_write()
+ public function case_write(): void
{
$this
->given($output = new SUT())
@@ -68,7 +69,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('foo');
}
- public function case_write_string()
+ public function case_write_string(): void
{
$this
->given($output = new SUT())
@@ -78,7 +79,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('123');
}
- public function case_write_character()
+ public function case_write_character(): void
{
$this
->given($output = new SUT())
@@ -88,7 +89,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('f');
}
- public function case_write_boolean_true()
+ public function case_write_boolean_true(): void
{
$this
->given($output = new SUT())
@@ -98,7 +99,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('1');
}
- public function case_write_boolean_false()
+ public function case_write_boolean_false(): void
{
$this
->given($output = new SUT())
@@ -108,7 +109,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('0');
}
- public function case_write_integer()
+ public function case_write_integer(): void
{
$this
->given($output = new SUT())
@@ -118,7 +119,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('-42');
}
- public function case_write_float()
+ public function case_write_float(): void
{
$this
->given($output = new SUT())
@@ -128,7 +129,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('-4.2');
}
- public function case_write_array()
+ public function case_write_array(): void
{
$this
->given($output = new SUT())
@@ -142,7 +143,7 @@ class Output extends Test\Unit\Suite
);
}
- public function case_write_line_no_newline()
+ public function case_write_line_no_newline(): void
{
$this
->given($output = new SUT())
@@ -152,7 +153,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('foo' . "\n");
}
- public function case_write_line_with_newline()
+ public function case_write_line_with_newline(): void
{
$this
->given($output = new SUT())
@@ -162,7 +163,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('foo' . "\n");
}
- public function case_write_line_with_newlines()
+ public function case_write_line_with_newlines(): void
{
$this
->given($output = new SUT())
@@ -172,7 +173,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('foo' . "\n");
}
- public function case_write_all()
+ public function case_write_all(): void
{
$this
->given($output = new SUT())
@@ -182,7 +183,7 @@ class Output extends Test\Unit\Suite
->isIdenticalTo('foobar');
}
- public function case_truncate()
+ public function case_truncate(): void
{
$this
->given($output = new SUT())
@@ -192,7 +193,7 @@ class Output extends Test\Unit\Suite
->isFalse();
}
- public function case_default_multiplexer_consideration()
+ public function case_default_multiplexer_consideration(): void
{
$this
->given($output = new SUT())
@@ -202,7 +203,7 @@ class Output extends Test\Unit\Suite
->isFalse();
}
- public function case_consider_multiplexer()
+ public function case_consider_multiplexer(): void
{
$this
->given($output = new SUT())
diff --git a/Test/Unit/Parser.php b/Test/Unit/Parser.php
index 36c7822..3a20425 100644
--- a/Test/Unit/Parser.php
+++ b/Test/Unit/Parser.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,7 +46,6 @@ use Hoa\Test;
*
* Test suite of the parser.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Parser extends Test\Unit\Suite
@@ -205,7 +206,7 @@ class Parser extends Test\Unit\Suite
);
}
- protected function _case($command, array $switches, array $inputs = [])
+ protected function _case($command, array $switches, array $inputs = []): void
{
$this
->given($parser = new SUT())
@@ -219,7 +220,7 @@ class Parser extends Test\Unit\Suite
->isIdenticalTo($inputs);
}
- public function case_state_is_reset()
+ public function case_state_is_reset(): void
{
$this
->given($parser = new SUT())
@@ -241,7 +242,7 @@ class Parser extends Test\Unit\Suite
->isIdenticalTo(['qux']);
}
- public function case_parse_special_value_list()
+ public function case_parse_special_value_list(): void
{
$this
->given($parser = new SUT())
@@ -255,7 +256,7 @@ class Parser extends Test\Unit\Suite
]);
}
- public function case_parse_special_value_list_with_keywords()
+ public function case_parse_special_value_list_with_keywords(): void
{
$this
->given($parser = new SUT())
@@ -269,7 +270,7 @@ class Parser extends Test\Unit\Suite
]);
}
- public function case_parse_special_value_list_with_range()
+ public function case_parse_special_value_list_with_range(): void
{
$this
->given($parser = new SUT())
@@ -285,7 +286,7 @@ class Parser extends Test\Unit\Suite
]);
}
- public function case_set_long_only()
+ public function case_set_long_only(): void
{
$this
->given($parser = new SUT())
diff --git a/Test/Unit/Readline/Autocompleter/Aggregate.php b/Test/Unit/Readline/Autocompleter/Aggregate.php
index 6f3d51e..8edd46b 100644
--- a/Test/Unit/Readline/Autocompleter/Aggregate.php
+++ b/Test/Unit/Readline/Autocompleter/Aggregate.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the readline autocompleter aggregator.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Aggregate extends Test\Unit\Suite
{
- public function case_get_word_definition()
+ public function case_get_word_definition(): void
{
$this
->given($autocompleter = new SUT([]))
@@ -59,7 +60,7 @@ class Aggregate extends Test\Unit\Suite
->isEqualTo('.*');
}
- public function case_constructor()
+ public function case_constructor(): void
{
$this
->given(
@@ -81,7 +82,7 @@ class Aggregate extends Test\Unit\Suite
->isIdenticalTo($autocompleterB);
}
- public function case_complete_no_solution()
+ public function case_complete_no_solution(): void
{
$this
->given(
@@ -106,7 +107,7 @@ class Aggregate extends Test\Unit\Suite
->isEqualTo('ccc');
}
- public function case_complete_one_solution_first_autocompleter()
+ public function case_complete_one_solution_first_autocompleter(): void
{
$self = $this;
@@ -128,7 +129,7 @@ class Aggregate extends Test\Unit\Suite
$this->calling($autocompleterB)->getWordDefinition = function () {
return 'bbb';
},
- $this->calling($autocompleterB)->complete = function ($prefix) use ($self) {
+ $this->calling($autocompleterB)->complete = function ($prefix) use ($self): void {
$self->fail('Bad autocompleter called.');
},
@@ -143,7 +144,7 @@ class Aggregate extends Test\Unit\Suite
->isEqualTo('aaa');
}
- public function case_complete_one_solution_second_autocompleter()
+ public function case_complete_one_solution_second_autocompleter(): void
{
$self = $this;
@@ -153,7 +154,7 @@ class Aggregate extends Test\Unit\Suite
$this->calling($autocompleterA)->getWordDefinition = function () {
return 'aaa';
},
- $this->calling($autocompleterA)->complete = function ($prefix) use ($self) {
+ $this->calling($autocompleterA)->complete = function ($prefix) use ($self): void {
$self->fail('Bad autocompleter called.');
},
diff --git a/Test/Unit/Readline/Autocompleter/Path.php b/Test/Unit/Readline/Autocompleter/Path.php
index d02b652..27546f7 100644
--- a/Test/Unit/Readline/Autocompleter/Path.php
+++ b/Test/Unit/Readline/Autocompleter/Path.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the path autocompleter for the readline.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Path extends Test\Unit\Suite
{
- public function case_get_word_definition()
+ public function case_get_word_definition(): void
{
$this
->given($autocompleter = new SUT())
@@ -59,7 +60,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('/?[\w\d\\_\-\.]+(/[\w\d\\_\-\.]*)*');
}
- public function case_constructor()
+ public function case_constructor(): void
{
$this
->given(
@@ -78,7 +79,7 @@ class Path extends Test\Unit\Suite
->isIdenticalTo($iteratorFactory);
}
- public function case_complete_no_solution()
+ public function case_complete_no_solution(): void
{
$this
->given(
@@ -97,7 +98,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('Q');
}
- public function case_complete_one_solution()
+ public function case_complete_one_solution(): void
{
$this
->given(
@@ -116,7 +117,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('F');
}
- public function case_complete_with_smallest_prefix()
+ public function case_complete_with_smallest_prefix(): void
{
$this
->given(
@@ -137,7 +138,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('B');
}
- public function case_complete_with_longer_prefix()
+ public function case_complete_with_longer_prefix(): void
{
$this
->given(
@@ -157,7 +158,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('Bar');
}
- public function case_set_root()
+ public function case_set_root(): void
{
$this
->given($autocompleter = new SUT())
@@ -172,7 +173,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('foo');
}
- public function case_get_root()
+ public function case_get_root(): void
{
$this
->given(
@@ -185,7 +186,7 @@ class Path extends Test\Unit\Suite
->isEqualTo('foo');
}
- public function case_set_iterator_factory()
+ public function case_set_iterator_factory(): void
{
$this
->given($autocompleter = new SUT())
@@ -208,7 +209,7 @@ class Path extends Test\Unit\Suite
->isEqualTo(42);
}
- public function case_get_iterator_factory()
+ public function case_get_iterator_factory(): void
{
$this
->given(
@@ -217,7 +218,7 @@ class Path extends Test\Unit\Suite
return 42;
})
)
- ->when(function () use (&$result, $autocompleter) {
+ ->when(function () use (&$result, $autocompleter): void {
$result = $autocompleter->getIteratorFactory();
})
->then
@@ -225,10 +226,10 @@ class Path extends Test\Unit\Suite
->isEqualTo(42);
}
- public function case_get_default_iterator_factory()
+ public function case_get_default_iterator_factory(): void
{
$this
- ->when(function () use (&$result) {
+ ->when(function () use (&$result): void {
$result = SUT::getDefaultIteratorFactory();
})
->then
diff --git a/Test/Unit/Readline/Autocompleter/Word.php b/Test/Unit/Readline/Autocompleter/Word.php
index 80e7307..0b72655 100644
--- a/Test/Unit/Readline/Autocompleter/Word.php
+++ b/Test/Unit/Readline/Autocompleter/Word.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the word autocompleter for the readline.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Word extends Test\Unit\Suite
{
- public function case_constructor()
+ public function case_constructor(): void
{
$this
->given($words = ['foo', 'bar', 'baz', 'qux'])
@@ -61,7 +62,7 @@ class Word extends Test\Unit\Suite
->isEqualTo($words);
}
- public function case_complete_no_solution()
+ public function case_complete_no_solution(): void
{
$this
->given(
@@ -76,7 +77,7 @@ class Word extends Test\Unit\Suite
->isEqualTo('q');
}
- public function case_complete_one_solution()
+ public function case_complete_one_solution(): void
{
$this
->given(
@@ -91,7 +92,7 @@ class Word extends Test\Unit\Suite
->isEqualTo('f');
}
- public function case_complete_with_smallest_prefix()
+ public function case_complete_with_smallest_prefix(): void
{
$this
->given(
@@ -106,7 +107,7 @@ class Word extends Test\Unit\Suite
->isEqualTo('b');
}
- public function case_complete_with_longer_prefix()
+ public function case_complete_with_longer_prefix(): void
{
$this
->given(
@@ -121,7 +122,7 @@ class Word extends Test\Unit\Suite
->isEqualTo('bar');
}
- public function case_get_word_definition()
+ public function case_get_word_definition(): void
{
$this
->given($autocompleter = new SUT([]))
@@ -131,7 +132,7 @@ class Word extends Test\Unit\Suite
->isEqualTo('\b\w+');
}
- public function case_set_words()
+ public function case_set_words(): void
{
$this
->given(
@@ -144,7 +145,7 @@ class Word extends Test\Unit\Suite
->isEmpty();
}
- public function case_get_words()
+ public function case_get_words(): void
{
$this
->given(
diff --git a/Test/Unit/Readline/Password.php b/Test/Unit/Readline/Password.php
index dc96c52..5bc3420 100644
--- a/Test/Unit/Readline/Password.php
+++ b/Test/Unit/Readline/Password.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -45,12 +47,11 @@ use Hoa\Test;
*
* Test suite of the password readline.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Password extends Test\Unit\Suite
{
- public function case_ensure_hidden()
+ public function case_ensure_hidden(): void
{
$this
->when($result = SUT::STATE_CONTINUE)
diff --git a/Test/Unit/Tput.php b/Test/Unit/Tput.php
index 3759692..5d5e9a9 100644
--- a/Test/Unit/Tput.php
+++ b/Test/Unit/Tput.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the tput parser.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Tput extends Test\Unit\Suite
{
- public function case_get_term_from_environment()
+ public function case_get_term_from_environment(): void
{
$this
->given($_SERVER['TERM'] = 'foo')
@@ -59,7 +60,7 @@ class Tput extends Test\Unit\Suite
->isEqualTo('foo');
}
- public function case_get_unknown_term_on_windows()
+ public function case_get_unknown_term_on_windows(): void
{
unset($_SERVER['TERM']);
@@ -71,7 +72,7 @@ class Tput extends Test\Unit\Suite
->isEqualTo('windows-ansi');
}
- public function case_get_unknown_term()
+ public function case_get_unknown_term(): void
{
unset($_SERVER['TERM']);
@@ -83,16 +84,16 @@ class Tput extends Test\Unit\Suite
->isEqualTo('xterm');
}
- public function case_unknown_file_when_parsing()
+ public function case_unknown_file_when_parsing(): void
{
$this
- ->exception(function () {
+ ->exception(function (): void {
new SUT('/hoa/flatland');
})
->isInstanceOf('Hoa\Console\Exception');
}
- public function case_all_informations()
+ public function case_all_informations(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -344,7 +345,7 @@ class Tput extends Test\Unit\Suite
]);
}
- public function case_has()
+ public function case_has(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -359,7 +360,7 @@ class Tput extends Test\Unit\Suite
->isTrue();
}
- public function case_has_unknown_boolean()
+ public function case_has_unknown_boolean(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -369,7 +370,7 @@ class Tput extends Test\Unit\Suite
->isFalse();
}
- public function case_count()
+ public function case_count(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -379,7 +380,7 @@ class Tput extends Test\Unit\Suite
->isEqualTo(80);
}
- public function case_count_unknown_integer()
+ public function case_count_unknown_integer(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -389,7 +390,7 @@ class Tput extends Test\Unit\Suite
->isEqualTo(0);
}
- public function case_get()
+ public function case_get(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
@@ -399,7 +400,7 @@ class Tput extends Test\Unit\Suite
->isEqualTo("\n");
}
- public function case_get_unknown_string()
+ public function case_get_unknown_string(): void
{
$this
->given($tput = new SUT('hoa://Library/Console/Source/Terminfo/78/xterm'))
diff --git a/Test/Unit/Window.php b/Test/Unit/Window.php
index 590d88d..1652339 100644
--- a/Test/Unit/Window.php
+++ b/Test/Unit/Window.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -46,12 +48,11 @@ use Hoa\Test;
*
* Test suite of the window.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Window extends Test\Unit\Suite
{
- public function beforeTestMethod($methodName)
+ public function beforeTestMethod($methodName): void
{
parent::beforeTestMethod($methodName);
LUT::setTput(new LUT\Tput('hoa://Library/Console/Source/Terminfo/78/xterm-256color'));
@@ -59,7 +60,7 @@ class Window extends Test\Unit\Suite
return;
}
- public function case_get_instance()
+ public function case_get_instance(): void
{
$this
->when($result = SUT::getInstance())
@@ -68,7 +69,7 @@ class Window extends Test\Unit\Suite
->isIdenticalTo(SUT::getInstance());
}
- public function case_set_size()
+ public function case_set_size(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -78,7 +79,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[8;42;7t");
}
- public function case_set_size_on_windows()
+ public function case_set_size_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -88,7 +89,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_move_to()
+ public function case_move_to(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -98,7 +99,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[3;7;42t");
}
- public function case_move_to_on_windows()
+ public function case_move_to_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -108,7 +109,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_get_position()
+ public function case_get_position(): void
{
$this
->given(
@@ -130,7 +131,7 @@ class Window extends Test\Unit\Suite
]);
}
- public function case_get_position_on_windows()
+ public function case_get_position_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -142,7 +143,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_scroll_u()
+ public function case_scroll_u(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -152,7 +153,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[1S");
}
- public function case_scroll_up()
+ public function case_scroll_up(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -162,7 +163,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[1S");
}
- public function case_scroll_d()
+ public function case_scroll_d(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -172,7 +173,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[1T");
}
- public function case_scroll_down()
+ public function case_scroll_down(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -182,7 +183,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[1T");
}
- public function case_scroll_u_d_up_down()
+ public function case_scroll_u_d_up_down(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -192,7 +193,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[2S\033[2T");
}
- public function case_scroll_up_repeated()
+ public function case_scroll_up_repeated(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -202,7 +203,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[3S");
}
- public function case_scroll_on_windows()
+ public function case_scroll_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -212,7 +213,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_minimize()
+ public function case_minimize(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -222,7 +223,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[2t");
}
- public function case_minimize_on_windows()
+ public function case_minimize_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -232,7 +233,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_restore()
+ public function case_restore(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -242,7 +243,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[1t");
}
- public function case_restore_on_windows()
+ public function case_restore_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -252,7 +253,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_raise()
+ public function case_raise(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -262,7 +263,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[5t");
}
- public function case_raise_on_windows()
+ public function case_raise_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -272,7 +273,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_lower()
+ public function case_lower(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -282,7 +283,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[6t");
}
- public function case_lower_on_windows()
+ public function case_lower_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -292,7 +293,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_set_title()
+ public function case_set_title(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -302,7 +303,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033]0;foobar 😄\033\\");
}
- public function case_set_title_on_windows()
+ public function case_set_title_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -312,7 +313,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_get_title()
+ public function case_get_title(): void
{
$this
->given(
@@ -335,7 +336,7 @@ class Window extends Test\Unit\Suite
->isEqualTo($title);
}
- public function case_get_title_on_windows()
+ public function case_get_title_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -347,7 +348,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_get_title_timed_out()
+ public function case_get_title_timed_out(): void
{
$this
->given(
@@ -363,7 +364,7 @@ class Window extends Test\Unit\Suite
->isNull();
}
- public function case_get_label()
+ public function case_get_label(): void
{
$this
->given(
@@ -386,7 +387,7 @@ class Window extends Test\Unit\Suite
->isEqualTo($label);
}
- public function case_get_label_timed_out()
+ public function case_get_label_timed_out(): void
{
$this
->given(
@@ -402,7 +403,7 @@ class Window extends Test\Unit\Suite
->isNull();
}
- public function case_get_label_on_windows()
+ public function case_get_label_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -414,7 +415,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_refresh()
+ public function case_refresh(): void
{
$this
->given($this->constant->OS_WIN = false)
@@ -424,7 +425,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033[7t");
}
- public function case_refresh_on_windows()
+ public function case_refresh_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)
@@ -434,7 +435,7 @@ class Window extends Test\Unit\Suite
->isEmpty();
}
- public function case_copy()
+ public function case_copy(): void
{
unset($_SERVER['TMUX']);
@@ -446,7 +447,7 @@ class Window extends Test\Unit\Suite
->isEqualTo("\033]52;;" . base64_encode('bla') . "\033\\");
}
- public function case_copy_on_tmux()
+ public function case_copy_on_tmux(): void
{
$this
->given(
@@ -463,7 +464,7 @@ class Window extends Test\Unit\Suite
);
}
- public function case_copy_on_windows()
+ public function case_copy_on_windows(): void
{
$this
->given($this->constant->OS_WIN = true)