Skip to content

Commit

Permalink
1. update syntax
Browse files Browse the repository at this point in the history
2. remive travis.yml
  • Loading branch information
scarwu committed Feb 11, 2022
1 parent d1e1b71 commit 5f1f15a
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 127 deletions.
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A Lightweight PHP Framework for Web & CLI

### Requirement

* PHP 7.1+
* PHP 7.4+

## Installation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"homepage": "https://github.com/scarwu/Oni",
"description": "A Lightweight PHP Framework for Web & CLI",
"require": {
"php": ">=7.1.0"
"php": ">=7.3.0"
},
"require-dev": {
"phpunit/phpunit": "^7",
Expand Down
4 changes: 2 additions & 2 deletions src/Oni/CLI/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct()
/**
* Run
*/
public function run()
public function run(): bool
{
// Register Task Classes & Load
$namespace = $this->getAttr('task/namespace');
Expand All @@ -64,7 +64,7 @@ public function run()
*
* @return bool
*/
private function loadTask()
private function loadTask(): bool
{
$namespace = $this->getAttr('task/namespace');
$path = $this->getAttr('task/path');
Expand Down
50 changes: 25 additions & 25 deletions src/Oni/CLI/Helper/ANSIEscapeCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function __construct() {}
*
* @return string
*/
public static function SGR($param)
public static function SGR($param): string
{
if (true === is_array($param)) {
$param = implode(self::SEP, $param);
Expand All @@ -70,25 +70,25 @@ public static function SGR($param)
/**
* Cursor Position
*
* @param integer $x
* @param integer $y
* @param int $x
* @param int $y
*
* @return string
*/
public static function CUP($x = 0, $y = 0)
public static function CUP(int $x = 0, int $y = 0): string
{
return self::CSI . ($y + 1) . self::SEP . ($x + 1) . 'H';
}

/**
* CUP: Move To
*
* @param integer $x
* @param integer $y
* @param int $x
* @param int $y
*
* @return string
*/
public static function moveTo($x = 0, $y = 0)
public static function moveTo(int $x = 0, int $y = 0)
{
return self::CUP($x, $y);
}
Expand All @@ -98,7 +98,7 @@ public static function moveTo($x = 0, $y = 0)
*
* @return string
*/
public static function reset()
public static function reset(): string
{
return self::SGR(0);
}
Expand All @@ -112,7 +112,7 @@ public static function reset()
*
* @return string
*/
public static function color($text, $fgColor = null, $bgColor = null)
public static function color(string $text, ?string $fgColor = null, ?string $bgColor = null): string
{
$startCodes = [];
$endCodes = [];
Expand All @@ -138,7 +138,7 @@ public static function color($text, $fgColor = null, $bgColor = null)
*
* @return string
*/
public static function cursorShow()
public static function cursorShow(): string
{
return self::CSI . '?25h';
}
Expand All @@ -148,79 +148,79 @@ public static function cursorShow()
*
* @return string
*/
public static function cursorHide()
public static function cursorHide(): string
{
return self::CSI . '?25l';
}

/**
* Cursor Up
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorUp($n = 1)
public static function cursorUp(int $n = 1): string
{
return self::CSI . "{$n}A";
}

/**
* Cursor Down
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorDown($n = 1)
public static function cursorDown(int $n = 1): string
{
return self::CSI . "{$n}B";
}

/**
* Cursor Left
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorLeft($n = 1)
public static function cursorLeft(int $n = 1): string
{
return self::CSI . "{$n}C";
}

/**
* Cursor Right
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorRight($n = 1)
public static function cursorRight(int $n = 1): string
{
return self::CSI . "{$n}D";
}

/**
* Cursor Next
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorNext($n = 1)
public static function cursorNext(int $n = 1): string
{
return self::CSI . "{$n}E";
}

/**
* Cursor Prev
*
* @param integer $n
* @param int $n
*
* @return string
*/
public static function cursorPrev($n = 1)
public static function cursorPrev(int $n = 1): string
{
return self::CSI . "{$n}F";
}
Expand All @@ -230,7 +230,7 @@ public static function cursorPrev($n = 1)
*
* @return string
*/
public static function cursorSave()
public static function cursorSave(): string
{
return self::CSI . (('Apple_Terminal' === getenv('TERM_PROGRAM')) ? '7' : 's');
}
Expand All @@ -240,7 +240,7 @@ public static function cursorSave()
*
* @return string
*/
public static function cursorLoad()
public static function cursorLoad(): string
{
return self::CSI . (('Apple_Terminal' === getenv('TERM_PROGRAM')) ? '8' : 'u');
}
Expand Down
Loading

0 comments on commit 5f1f15a

Please sign in to comment.