diff --git a/Account/Account.php b/Account/Account.php index ef3431b72..3ffa94b17 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -126,7 +126,7 @@ class Account /** * Account type. * - * @var AccountType + * @var AccountType|int * @since 1.0.0 */ protected $type = AccountType::USER; @@ -134,7 +134,7 @@ class Account /** * Account status. * - * @var AccountStatus + * @var AccountStatus|int * @since 1.0.0 */ protected $status = AccountStatus::INACTIVE; diff --git a/DataStorage/Database/Pool.php b/DataStorage/Database/Pool.php index 960ee0a73..f4f16400b 100644 --- a/DataStorage/Database/Pool.php +++ b/DataStorage/Database/Pool.php @@ -78,7 +78,7 @@ class Pool * * @param mixed $key Database key * - * @return ConnectionAbstract + * @return ConnectionAbstract|false * * @since 1.0.0 * @author Dennis Eichhorn diff --git a/Localization/Money.php b/Localization/Money.php index 5de909096..b7ff478b3 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -4,7 +4,7 @@ namespace phpOMS\Localization; class Money implements Serialize { - private const MAX_DECIMALS = 5; + const MAX_DECIMALS = 5; private $currency = ISO4217CharEnum::C_USD; private $thousands = ','; diff --git a/Log/FileLogger.php b/Log/FileLogger.php index 3b741e9fc..904d8b9b2 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -52,7 +52,7 @@ class FileLogger implements LoggerInterface /** * Instance. * - * @var \phpOMS\DataStorage\Cache\Pool + * @var FileLogger * @since 1.0.0 */ protected static $instance = null; @@ -127,7 +127,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getInstance(string $path = '') + public static function getInstance(string $path = '') : FileLogger { if (self::$instance === null) { self::$instance = new self($path); diff --git a/Math/Function/Fibunacci.php b/Math/Function/Fibunacci.php index 3b1664d7f..7dad9d8bb 100644 --- a/Math/Function/Fibunacci.php +++ b/Math/Function/Fibunacci.php @@ -47,7 +47,7 @@ class Fibunacci $fib = 0; for($i = 4; $i < $n; $i++) { - $fib = $old_1 + $old_2 + $fib = $old_1 + $old_2; $old_1 = $old_2; $old_2 = $fib; } diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index e8fda0bde..b639f6e6b 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -213,7 +213,7 @@ class Matrix implements ArrayAccess, Iterator } $mDim = count($newMatrixArr); - $nDim = count($newMatrixArr[0]) + $nDim = count($newMatrixArr[0]); // pivoting $newMatrixArr = $this->diag($newMatrixArr); diff --git a/Math/Number/Numbers.php b/Math/Number/Numbers.php index 4b29ff139..153445f12 100644 --- a/Math/Number/Numbers.php +++ b/Math/Number/Numbers.php @@ -88,7 +88,7 @@ class Numbers $goodMask; // 0xC840C04048404040 computed below for ($i = 0; $i < 64; ++$i) { - $goodMask |= PHP_INT_MIN >>> ($i*$i); + $goodMask |= PHP_INT_MIN >> ($i*$i); } // This tests if the 6 least significant bits are right. diff --git a/Math/Number/Prime.php b/Math/Number/Prime.php index 1a355f221..30c484dc8 100644 --- a/Math/Number/Prime.php +++ b/Math/Number/Prime.php @@ -43,7 +43,7 @@ class Prime { $mersenne = log($n+1, 2); - return $mersenne - (int) $mersenne < 0.00001 + return $mersenne - (int) $mersenne < 0.00001; } /** diff --git a/Math/Optimization/Graph/VerticeInterface.php b/Math/Optimization/Graph/VerticeInterface.php index 4f73a55dd..fd4471862 100644 --- a/Math/Optimization/Graph/VerticeInterface.php +++ b/Math/Optimization/Graph/VerticeInterface.php @@ -46,7 +46,7 @@ interface VerticeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function getEdges() array; + public function getEdges() : array; /** * Add edge. diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index 2de5c1c8c..12d044e8d 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -118,7 +118,7 @@ abstract class C128Abstract * @var int[] * @since 1.0.0 */ - protected $background = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0 + protected $background = ['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]; /** * Front color. diff --git a/Utils/Compression/LZW.php b/Utils/Compression/LZW.php index 1cf0dfca8..3c221c62c 100644 --- a/Utils/Compression/LZW.php +++ b/Utils/Compression/LZW.php @@ -44,7 +44,8 @@ class LZW implements CompressionInterface $dictionary[chr($i)] = $i; } - for ($i = 0; $i < strlen($source); $i++) { + $length = strlen($source); + for ($i = 0; $i < $length; $i++) { $c = $source[$i]; $wc = $w.$c; @@ -81,7 +82,8 @@ class LZW implements CompressionInterface $w = chr($compressed[0]); $result = $w; - for ($i = 1; $i < count($compressed);$i++) { + $count = count($compressed); + for ($i = 1; $i < $count;$i++) { $k = $compressed[$i]; if ($dictionary[$k]) { diff --git a/Utils/Git/Commit.php b/Utils/Git/Commit.php index 031f146cf..d0fcc4e53 100644 --- a/Utils/Git/Commit.php +++ b/Utils/Git/Commit.php @@ -144,7 +144,7 @@ class Commit } if(!isset($this->files[$path][$line])) { - $this->files[$path][$line] => ['old' => $old, 'new' => $new]; + $this->files[$path][$line] = ['old' => $old, 'new' => $new]; } else { throw new \Exception(); } diff --git a/Utils/Git/Git.php b/Utils/Git/Git.php index 5bed695e2..7ae887ba8 100644 --- a/Utils/Git/Git.php +++ b/Utils/Git/Git.php @@ -46,7 +46,7 @@ class Git { public static function setBin(string $path) { if(realpath($path) === false) { - throw new \PathException($path) + throw new \PathException($path); } self::$bin = realpath($path); diff --git a/Utils/RnG/ArrayRandomize.php b/Utils/RnG/ArrayRandomize.php index 90dcb372a..d8bcabbfb 100644 --- a/Utils/RnG/ArrayRandomize.php +++ b/Utils/RnG/ArrayRandomize.php @@ -41,7 +41,7 @@ class ArrayRandomize { $shuffled = []; - while($arr){ + while(!empty($arr)) { $rnd = array_rand($arr); $shuffled[] = $arr[$rnd]; array_splice($arr, $rnd, 1); diff --git a/Utils/RnG/LinearCongruentialGenerator.php b/Utils/RnG/LinearCongruentialGenerator.php index e43a1157b..944280743 100644 --- a/Utils/RnG/LinearCongruentialGenerator.php +++ b/Utils/RnG/LinearCongruentialGenerator.php @@ -41,7 +41,7 @@ class LinearCongruentialGenerator { return function() use(&$seed) { return $seed = (1103515245 * $seed + 12345) % (1 << 31); - } + }; } /** diff --git a/Validation/BitcoinValidator.php b/Validation/BitcoinValidator.php index cb89631b9..768b45175 100644 --- a/Validation/BitcoinValidator.php +++ b/Validation/BitcoinValidator.php @@ -24,8 +24,8 @@ class BitcoinValidator $d1 = hash("sha256", substr($decoded,0,21), true); $d2 = hash("sha256", $d1, true); - if(substr_compare($decoded, $d2, 21, 4)){ - return false + if(substr_compare($decoded, $d2, 21, 4)) { + return false; } return true;