Solving critical bugs

This commit is contained in:
Dennis Eichhorn 2016-03-27 21:44:01 +02:00
parent 184e839899
commit fd9480a34c
16 changed files with 22 additions and 20 deletions

View File

@ -126,7 +126,7 @@ class Account
/** /**
* Account type. * Account type.
* *
* @var AccountType * @var AccountType|int
* @since 1.0.0 * @since 1.0.0
*/ */
protected $type = AccountType::USER; protected $type = AccountType::USER;
@ -134,7 +134,7 @@ class Account
/** /**
* Account status. * Account status.
* *
* @var AccountStatus * @var AccountStatus|int
* @since 1.0.0 * @since 1.0.0
*/ */
protected $status = AccountStatus::INACTIVE; protected $status = AccountStatus::INACTIVE;

View File

@ -78,7 +78,7 @@ class Pool
* *
* @param mixed $key Database key * @param mixed $key Database key
* *
* @return ConnectionAbstract * @return ConnectionAbstract|false
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -4,7 +4,7 @@ namespace phpOMS\Localization;
class Money implements Serialize { class Money implements Serialize {
private const MAX_DECIMALS = 5; const MAX_DECIMALS = 5;
private $currency = ISO4217CharEnum::C_USD; private $currency = ISO4217CharEnum::C_USD;
private $thousands = ','; private $thousands = ',';

View File

@ -52,7 +52,7 @@ class FileLogger implements LoggerInterface
/** /**
* Instance. * Instance.
* *
* @var \phpOMS\DataStorage\Cache\Pool * @var FileLogger
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $instance = null; protected static $instance = null;
@ -127,7 +127,7 @@ class FileLogger implements LoggerInterface
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public static function getInstance(string $path = '') public static function getInstance(string $path = '') : FileLogger
{ {
if (self::$instance === null) { if (self::$instance === null) {
self::$instance = new self($path); self::$instance = new self($path);

View File

@ -47,7 +47,7 @@ class Fibunacci
$fib = 0; $fib = 0;
for($i = 4; $i < $n; $i++) { for($i = 4; $i < $n; $i++) {
$fib = $old_1 + $old_2 $fib = $old_1 + $old_2;
$old_1 = $old_2; $old_1 = $old_2;
$old_2 = $fib; $old_2 = $fib;
} }

View File

@ -213,7 +213,7 @@ class Matrix implements ArrayAccess, Iterator
} }
$mDim = count($newMatrixArr); $mDim = count($newMatrixArr);
$nDim = count($newMatrixArr[0]) $nDim = count($newMatrixArr[0]);
// pivoting // pivoting
$newMatrixArr = $this->diag($newMatrixArr); $newMatrixArr = $this->diag($newMatrixArr);

View File

@ -88,7 +88,7 @@ class Numbers
$goodMask; // 0xC840C04048404040 computed below $goodMask; // 0xC840C04048404040 computed below
for ($i = 0; $i < 64; ++$i) { 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. // This tests if the 6 least significant bits are right.

View File

@ -43,7 +43,7 @@ class Prime
{ {
$mersenne = log($n+1, 2); $mersenne = log($n+1, 2);
return $mersenne - (int) $mersenne < 0.00001 return $mersenne - (int) $mersenne < 0.00001;
} }
/** /**

View File

@ -46,7 +46,7 @@ interface VerticeInterface
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public function getEdges() array; public function getEdges() : array;
/** /**
* Add edge. * Add edge.

View File

@ -118,7 +118,7 @@ abstract class C128Abstract
* @var int[] * @var int[]
* @since 1.0.0 * @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. * Front color.

View File

@ -44,7 +44,8 @@ class LZW implements CompressionInterface
$dictionary[chr($i)] = $i; $dictionary[chr($i)] = $i;
} }
for ($i = 0; $i < strlen($source); $i++) { $length = strlen($source);
for ($i = 0; $i < $length; $i++) {
$c = $source[$i]; $c = $source[$i];
$wc = $w.$c; $wc = $w.$c;
@ -81,7 +82,8 @@ class LZW implements CompressionInterface
$w = chr($compressed[0]); $w = chr($compressed[0]);
$result = $w; $result = $w;
for ($i = 1; $i < count($compressed);$i++) { $count = count($compressed);
for ($i = 1; $i < $count;$i++) {
$k = $compressed[$i]; $k = $compressed[$i];
if ($dictionary[$k]) { if ($dictionary[$k]) {

View File

@ -144,7 +144,7 @@ class Commit
} }
if(!isset($this->files[$path][$line])) { if(!isset($this->files[$path][$line])) {
$this->files[$path][$line] => ['old' => $old, 'new' => $new]; $this->files[$path][$line] = ['old' => $old, 'new' => $new];
} else { } else {
throw new \Exception(); throw new \Exception();
} }

View File

@ -46,7 +46,7 @@ class Git {
public static function setBin(string $path) public static function setBin(string $path)
{ {
if(realpath($path) === false) { if(realpath($path) === false) {
throw new \PathException($path) throw new \PathException($path);
} }
self::$bin = realpath($path); self::$bin = realpath($path);

View File

@ -41,7 +41,7 @@ class ArrayRandomize
{ {
$shuffled = []; $shuffled = [];
while($arr){ while(!empty($arr)) {
$rnd = array_rand($arr); $rnd = array_rand($arr);
$shuffled[] = $arr[$rnd]; $shuffled[] = $arr[$rnd];
array_splice($arr, $rnd, 1); array_splice($arr, $rnd, 1);

View File

@ -41,7 +41,7 @@ class LinearCongruentialGenerator
{ {
return function() use(&$seed) { return function() use(&$seed) {
return $seed = (1103515245 * $seed + 12345) % (1 << 31); return $seed = (1103515245 * $seed + 12345) % (1 << 31);
} };
} }
/** /**

View File

@ -24,8 +24,8 @@ class BitcoinValidator
$d1 = hash("sha256", substr($decoded,0,21), true); $d1 = hash("sha256", substr($decoded,0,21), true);
$d2 = hash("sha256", $d1, true); $d2 = hash("sha256", $d1, true);
if(substr_compare($decoded, $d2, 21, 4)){ if(substr_compare($decoded, $d2, 21, 4)) {
return false return false;
} }
return true; return true;