diff --git a/Autoloader.php b/Autoloader.php index 5271dfb9d..af7461705 100644 --- a/Autoloader.php +++ b/Autoloader.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace phpOMS; -spl_autoload_register('\phpOMS\Autoloader::defaultAutoloader'); +\spl_autoload_register('\phpOMS\Autoloader::defaultAutoloader'); /** * Autoloader class. diff --git a/Business/Finance/FinanceFormulas.php b/Business/Finance/FinanceFormulas.php index 18f140c19..7ad488835 100644 --- a/Business/Finance/FinanceFormulas.php +++ b/Business/Finance/FinanceFormulas.php @@ -192,7 +192,7 @@ final class FinanceFormulas */ public static function getNumberOfAPPV(float $p, float $pv, float $r) : int { - return (int) \round(-log(-($r * $pv / $p - 1)) / \log(1 + $r)); + return (int) \round(-\log(-($r * $pv / $p - 1)) / \log(1 + $r)); } /** @@ -286,7 +286,7 @@ final class FinanceFormulas */ public static function getNumberOfAPFPV(float $p, float $r) : int { - return (int) \round(-log(-($r / $p - 1)) / \log(1 + $r)); + return (int) \round(-\log(-($r / $p - 1)) / \log(1 + $r)); } /** @@ -318,7 +318,7 @@ final class FinanceFormulas */ public static function getNumberOfPeriodsOfPVA(float $pva, float $P, float $r) : int { - return (int) \round(-log(-($pva / $P * $r - 1)) / \log(1 + $r)); + return (int) \round(-\log(-($pva / $P * $r - 1)) / \log(1 + $r)); } /** @@ -364,7 +364,7 @@ final class FinanceFormulas */ public static function getPeriodsOfPVAF(float $p, float $r) : int { - return (int) \round(-log(-($p * $r - 1)) / \log(1 + $r)); + return (int) \round(-\log(-($p * $r - 1)) / \log(1 + $r)); } /** @@ -813,7 +813,7 @@ final class FinanceFormulas */ public static function getPeriodsOfEAA(float $C, float $NPV, float $r) : int { - return (int) \round(-log(1 - $r * $NPV / $C) / \log(1 + $r)); + return (int) \round(-\log(1 - $r * $NPV / $C) / \log(1 + $r)); } /** diff --git a/DataStorage/Cookie/CookieJar.php b/DataStorage/Cookie/CookieJar.php index 1404f4319..c196fe87c 100644 --- a/DataStorage/Cookie/CookieJar.php +++ b/DataStorage/Cookie/CookieJar.php @@ -144,7 +144,7 @@ final class CookieJar } if (!\headers_sent()) { - \setcookie($id, '', time() - 3600); + \setcookie($id, '', \time() - 3600); return true; } diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index b84388c40..ce5afbd5a 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -256,7 +256,7 @@ class DataMapperAbstract implements DataMapperInterface self::$collection['ownsOne'][] = $class::$ownsOne; self::$collection['table'][] = $class::$table; - if (($parent = get_parent_class($class)) !== false && !$class::$overwrite) { + if (($parent = \get_parent_class($class)) !== false && !$class::$overwrite) { self::extend($parent); } } diff --git a/Localization/Money.php b/Localization/Money.php index 4d0255667..7eacb2030 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -203,7 +203,7 @@ final class Money implements \Serializable throw new \Exception(); } - return ($decimals > 0) ? number_format((float) $left, 0, $this->decimal, $this->thousands) . $this->decimal . \substr($right, 0, $decimals) : $left; + return ($decimals > 0) ? \number_format((float) $left, 0, $this->decimal, $this->thousands) . $this->decimal . \substr($right, 0, $decimals) : $left; } /** diff --git a/Log/FileLogger.php b/Log/FileLogger.php index ecb31c75e..0964b631b 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -502,7 +502,7 @@ final class FileLogger implements LoggerInterface if ($limit <= 0) { \reset($logs); - unset($logs[key($logs)]); + unset($logs[\key($logs)]); } foreach ($line as &$value) { diff --git a/Math/Functions/Functions.php b/Math/Functions/Functions.php index 23c60155f..8a1ee0216 100644 --- a/Math/Functions/Functions.php +++ b/Math/Functions/Functions.php @@ -78,7 +78,7 @@ final class Functions $min = \min([$k, $n - $k]); $fact = 1; - $range = array_reverse(\range(1, $min)); + $range = \array_reverse(\range(1, $min)); for ($i = $max + 1; $i < $n + 1; ++$i) { $div = 1; diff --git a/Math/Functions/Gamma.php b/Math/Functions/Gamma.php index 35669ffc4..10903f1ba 100644 --- a/Math/Functions/Gamma.php +++ b/Math/Functions/Gamma.php @@ -98,7 +98,7 @@ final class Gamma public static function spougeApproximation($z) : float { $k1_fact = 1.0; - $c = [sqrt(2.0 * M_PI)]; + $c = [\sqrt(2.0 * M_PI)]; for ($k = 1; $k < 12; ++$k) { $c[$k] = \exp(12 - $k) * \pow(12 - $k, $k - 0.5) / $k1_fact; diff --git a/Math/Geometry/Shape/D2/Circle.php b/Math/Geometry/Shape/D2/Circle.php index 2965f0f2e..6cb4b0e83 100644 --- a/Math/Geometry/Shape/D2/Circle.php +++ b/Math/Geometry/Shape/D2/Circle.php @@ -36,7 +36,7 @@ final class Circle implements D2ShapeInterface */ public static function getSurface(float $r) : float { - return pi() * $r ** 2; + return \pi() * $r ** 2; } /** @@ -50,7 +50,7 @@ final class Circle implements D2ShapeInterface */ public static function getPerimeter(float $r) : float { - return 2 * pi() * $r; + return 2 * \pi() * $r; } /** @@ -64,7 +64,7 @@ final class Circle implements D2ShapeInterface */ public static function getRadiusBySurface(float $surface) : float { - return \sqrt($surface / pi()); + return \sqrt($surface / \pi()); } /** @@ -81,6 +81,6 @@ final class Circle implements D2ShapeInterface */ public static function getRadiusByPerimeter(float $C) : float { - return $C / (2 * pi()); + return $C / (2 * \pi()); } } diff --git a/Math/Geometry/Shape/D2/Ellipse.php b/Math/Geometry/Shape/D2/Ellipse.php index 4dea9cd98..0241f2cc7 100644 --- a/Math/Geometry/Shape/D2/Ellipse.php +++ b/Math/Geometry/Shape/D2/Ellipse.php @@ -42,7 +42,7 @@ final class Ellipse implements D2ShapeInterface */ public static function getSurface(float $a, float $b) : float { - return pi() * $a * $b; + return \pi() * $a * $b; } /** @@ -62,6 +62,6 @@ final class Ellipse implements D2ShapeInterface */ public static function getPerimeter(float $a, float $b) : float { - return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (\sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1); + return \pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (\sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1); } } diff --git a/Math/Geometry/Shape/D3/Cone.php b/Math/Geometry/Shape/D3/Cone.php index d19eed26b..23856d4c8 100644 --- a/Math/Geometry/Shape/D3/Cone.php +++ b/Math/Geometry/Shape/D3/Cone.php @@ -37,7 +37,7 @@ final class Cone implements D3ShapeInterface */ public static function getVolume(float $r, float $h) : float { - return pi() * $r ** 2 * $h / 3; + return \pi() * $r ** 2 * $h / 3; } /** @@ -52,7 +52,7 @@ final class Cone implements D3ShapeInterface */ public static function getSurface(float $r, float $h) : float { - return pi() * $r * ($r + \sqrt($h ** 2 + $r ** 2)); + return \pi() * $r * ($r + \sqrt($h ** 2 + $r ** 2)); } /** @@ -85,6 +85,6 @@ final class Cone implements D3ShapeInterface */ public static function getHeightFromVolume(float $V, float $r) : float { - return 3 * $V / (pi() * $r ** 2); + return 3 * $V / (\pi() * $r ** 2); } } diff --git a/Math/Geometry/Shape/D3/Cylinder.php b/Math/Geometry/Shape/D3/Cylinder.php index 47951e9cc..e7e2b0e37 100644 --- a/Math/Geometry/Shape/D3/Cylinder.php +++ b/Math/Geometry/Shape/D3/Cylinder.php @@ -37,7 +37,7 @@ final class Cylinder implements D3ShapeInterface */ public static function getVolume(float $r, float $h) : float { - return pi() * $r ** 2 * $h; + return \pi() * $r ** 2 * $h; } /** @@ -52,7 +52,7 @@ final class Cylinder implements D3ShapeInterface */ public static function getSurface(float $r, float $h) : float { - return 2 * pi() * ($r * $h + $r ** 2); + return 2 * \pi() * ($r * $h + $r ** 2); } /** @@ -67,6 +67,6 @@ final class Cylinder implements D3ShapeInterface */ public static function getLateralSurface(float $r, float $h) : float { - return 2 * pi() * $r * $h; + return 2 * \pi() * $r * $h; } } diff --git a/Math/Geometry/Shape/D3/Sphere.php b/Math/Geometry/Shape/D3/Sphere.php index 42f87e796..4e79b7f0f 100644 --- a/Math/Geometry/Shape/D3/Sphere.php +++ b/Math/Geometry/Shape/D3/Sphere.php @@ -59,10 +59,10 @@ final class Sphere implements D3ShapeInterface */ public static function distance2PointsOnSphere(float $latStart, float $longStart, float $latEnd, float $longEnd, float $radius = 6371000.0) : float { - $latFrom = deg2rad($latStart); - $lonFrom = deg2rad($longStart); - $latTo = deg2rad($latEnd); - $lonTo = deg2rad($longEnd); + $latFrom = \deg2rad($latStart); + $lonFrom = \deg2rad($longStart); + $latTo = \deg2rad($latEnd); + $lonTo = \deg2rad($longEnd); //$latDelta = $latTo - $latFrom; $lonDelta = $lonTo - $lonFrom; @@ -70,7 +70,7 @@ final class Sphere implements D3ShapeInterface $a = \pow(\cos($latTo) * \sin($lonDelta), 2) + \pow(\cos($latFrom) * \sin($latTo) - \sin($latFrom) * \cos($latTo) * \cos($lonDelta), 2); $b = \sin($latFrom) * \sin($latTo) + \cos($latFrom) * \cos($latTo) * \cos($lonDelta); - $angle = atan2(\sqrt($a), $b); + $angle = \atan2(\sqrt($a), $b); // Approximation (very good for short distances) // $angle = 2 * asin(\sqrt(\pow(\sin($latDelta / 2), 2) + \cos($latFrom) * \cos($latTo) * \pow(\sin($lonDelta / 2), 2))); @@ -116,7 +116,7 @@ final class Sphere implements D3ShapeInterface */ public static function getRadiusByVolume(float $v) : float { - return \pow($v * 3 / (4 * pi()), 1 / 3); + return \pow($v * 3 / (4 * \pi()), 1 / 3); } /** @@ -147,7 +147,7 @@ final class Sphere implements D3ShapeInterface */ public static function getRadiusBySurface(float $S) : float { - return \sqrt($S / (4 * pi())); + return \sqrt($S / (4 * \pi())); } /** @@ -173,7 +173,7 @@ final class Sphere implements D3ShapeInterface */ public static function getVolumeByRadius(float $r) : float { - return 4 / 3 * pi() * $r ** 3; + return 4 / 3 * \pi() * $r ** 3; } /** @@ -211,6 +211,6 @@ final class Sphere implements D3ShapeInterface */ public static function getSurfaceByRadius(float $r) : float { - return 4 * pi() * $r ** 2; + return 4 * \pi() * $r ** 2; } } diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 126c8b52f..ff0e8397d 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -402,7 +402,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->add($value->mult(-1)); - } elseif (!\is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && \is_numeric($value)) { return $this->add(-$value); } @@ -424,7 +424,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->addMatrix($value); - } elseif (!\is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && \is_numeric($value)) { return $this->addScalar($value); } @@ -529,7 +529,7 @@ class Matrix implements \ArrayAccess, \Iterator { if ($value instanceof self) { return $this->multMatrix($value); - } elseif (!\is_string($value) && is_numeric($value)) { + } elseif (!\is_string($value) && \is_numeric($value)) { return $this->multScalar($value); } diff --git a/Math/Matrix/SingularValueDecomposition.php b/Math/Matrix/SingularValueDecomposition.php index 14fcd3937..885ee259c 100644 --- a/Math/Matrix/SingularValueDecomposition.php +++ b/Math/Matrix/SingularValueDecomposition.php @@ -359,7 +359,7 @@ final class SingularValueDecomposition $shift = 0.0; if ($b != 0 || $c != 0) { - $shift = sqrt($b * $b + $c); + $shift = \sqrt($b * $b + $c); if ($b < 0.0) { $shift = -$shift; } diff --git a/Math/Number/Complex.php b/Math/Number/Complex.php index d519a25d8..30d4672d6 100644 --- a/Math/Number/Complex.php +++ b/Math/Number/Complex.php @@ -406,11 +406,11 @@ final class Complex */ public function render(int $precision = 2) : string { - return ($this->re !== 0 ? number_format($this->re, $precision) : '') + return ($this->re !== 0 ? \number_format($this->re, $precision) : '') . ($this->im > 0 && $this->re !== 0 ? ' +' : '') . ($this->im < 0 && $this->re !== 0 ? ' -' : '') . ($this->im !== 0 ? ( - ($this->re !== 0 ? ' ' : '') . number_format( + ($this->re !== 0 ? ' ' : '') . \number_format( ($this->im < 0 && $this->re === 0 ? $this->im : \abs($this->im)), $precision ) . 'i' ) : ''); diff --git a/Math/Number/Integer.php b/Math/Number/Integer.php index 72c99e5d7..8e86328da 100644 --- a/Math/Number/Integer.php +++ b/Math/Number/Integer.php @@ -46,7 +46,7 @@ final class Integer */ public static function isInteger($value) : bool { - return is_int($value); + return \is_int($value); } /** @@ -159,7 +159,7 @@ final class Integer throw new \Exception('Only odd integers are allowed'); } - $a = (int) ceil(\sqrt($value)); + $a = (int) \ceil(\sqrt($value)); $b2 = ($a * $a - $value); $i = 1; diff --git a/Math/Number/Natural.php b/Math/Number/Natural.php index 524f32de6..23db1cc9c 100644 --- a/Math/Number/Natural.php +++ b/Math/Number/Natural.php @@ -46,6 +46,6 @@ final class Natural */ public static function isNatural($value) : bool { - return is_int($value) && $value >= 0; + return \is_int($value) && $value >= 0; } } diff --git a/Math/Number/Prime.php b/Math/Number/Prime.php index d03215ca4..66c8be77e 100644 --- a/Math/Number/Prime.php +++ b/Math/Number/Prime.php @@ -94,7 +94,7 @@ final class Prime } for ($i = 0; $i < $k; ++$i) { - $a = mt_rand(2, $n - 1); + $a = \mt_rand(2, $n - 1); $x = \bcpowmod((string) $a, (string) $d, (string) $n); @@ -133,7 +133,7 @@ final class Prime { $number = 2; $range = \range(2, $n); - $primes = array_combine($range, $range); + $primes = \array_combine($range, $range); while ($number * $number < $n) { for ($i = $number; $i <= $n; $i += $number) { @@ -147,7 +147,7 @@ final class Prime $number = \next($primes); } - return array_values($primes); + return \array_values($primes); } /** diff --git a/Math/Stochastic/Distribution/BinomialDistribution.php b/Math/Stochastic/Distribution/BinomialDistribution.php index f315c73a9..b5bd14dd2 100644 --- a/Math/Stochastic/Distribution/BinomialDistribution.php +++ b/Math/Stochastic/Distribution/BinomialDistribution.php @@ -41,7 +41,7 @@ class BinomialDistribution */ public static function getMode(int $n, float $p) : float { - return floor(($n + 1) * $p); + return \floor(($n + 1) * $p); } /** @@ -157,7 +157,7 @@ class BinomialDistribution */ public static function getMedian(int $n, float $p) : float { - return floor($n * $p); + return \floor($n * $p); } /** diff --git a/Math/Stochastic/Distribution/CauchyDistribution.php b/Math/Stochastic/Distribution/CauchyDistribution.php index 8b7e7837f..009f2feac 100644 --- a/Math/Stochastic/Distribution/CauchyDistribution.php +++ b/Math/Stochastic/Distribution/CauchyDistribution.php @@ -37,7 +37,7 @@ class CauchyDistribution */ public static function getPdf(float $x, float $x0, float $gamma) : float { - return 1 / (pi() * $gamma * (1 + (($x - $x0) / $gamma) ** 2)); + return 1 / (\pi() * $gamma * (1 + (($x - $x0) / $gamma) ** 2)); } /** @@ -53,7 +53,7 @@ class CauchyDistribution */ public static function getCdf(float $x, float $x0, float $gamma) : float { - return 1 / pi() * atan(($x - $x0) / $gamma) + 0.5; + return 1 / \pi() * \atan(($x - $x0) / $gamma) + 0.5; } /** diff --git a/Math/Stochastic/Distribution/ChiSquaredDistribution.php b/Math/Stochastic/Distribution/ChiSquaredDistribution.php index 5033d9338..4e0c223e9 100644 --- a/Math/Stochastic/Distribution/ChiSquaredDistribution.php +++ b/Math/Stochastic/Distribution/ChiSquaredDistribution.php @@ -103,7 +103,7 @@ class ChiSquaredDistribution $df = self::getDegreesOfFreedom($dataset); } - if (!defined('self::TABLE') || !\array_key_exists($df, self::TABLE)) { + if (!\defined('self::TABLE') || !\array_key_exists($df, self::TABLE)) { throw new \Exception('Degrees of freedom not supported'); } diff --git a/Math/Stochastic/Distribution/GeometricDistribution.php b/Math/Stochastic/Distribution/GeometricDistribution.php index 5ca16e46d..3d0cefdaa 100644 --- a/Math/Stochastic/Distribution/GeometricDistribution.php +++ b/Math/Stochastic/Distribution/GeometricDistribution.php @@ -91,7 +91,7 @@ class GeometricDistribution */ public static function getMedian(float $p) : float { - return ceil(-1 / (\log(1 - $p, 2))); + return \ceil(-1 / (\log(1 - $p, 2))); } /** diff --git a/Math/Stochastic/Distribution/LaplaceDistribution.php b/Math/Stochastic/Distribution/LaplaceDistribution.php index e526f7eb4..a349621ed 100644 --- a/Math/Stochastic/Distribution/LaplaceDistribution.php +++ b/Math/Stochastic/Distribution/LaplaceDistribution.php @@ -37,7 +37,7 @@ class LaplaceDistribution */ public static function getPdf(float $x, float $mu, float $b) : float { - return 1 / (2 * $b) * \exp(-abs($x - $mu) / $b); + return 1 / (2 * $b) * \exp(-\abs($x - $mu) / $b); } /** diff --git a/Math/Stochastic/Distribution/NormalDistribution.php b/Math/Stochastic/Distribution/NormalDistribution.php index 62e5d9cae..6876aa9ec 100644 --- a/Math/Stochastic/Distribution/NormalDistribution.php +++ b/Math/Stochastic/Distribution/NormalDistribution.php @@ -38,7 +38,7 @@ class NormalDistribution */ public static function getPdf(float $x, float $mu, float $sig) : float { - return 1 / ($sig * \sqrt(2 * pi())) * \exp(-($x - $mu) ** 2 / (2 * $sig ** 2)); + return 1 / ($sig * \sqrt(2 * \pi())) * \exp(-($x - $mu) ** 2 / (2 * $sig ** 2)); } /** @@ -72,9 +72,9 @@ class NormalDistribution return -self::erf(-$x); } - $a = 8 * (pi() - 3) / (3 * pi() * (4 - pi())); + $a = 8 * (\pi() - 3) / (3 * \pi() * (4 - \pi())); - return \sqrt(1 - \exp(-($x ** 2) * (4 / pi() + $a * $x ** 2) / (1 + $a * $x ** 2))); + return \sqrt(1 - \exp(-($x ** 2) * (4 / \pi() + $a * $x ** 2) / (1 + $a * $x ** 2))); } /** diff --git a/Message/Console/Header.php b/Message/Console/Header.php index a01363726..141b0c157 100644 --- a/Message/Console/Header.php +++ b/Message/Console/Header.php @@ -142,7 +142,7 @@ final class Header extends HeaderAbstract */ public function get(string $key) : array { - return $this->header[strtolower($key)] ?? []; + return $this->header[\strtolower($key)] ?? []; } /** diff --git a/Message/Console/Request.php b/Message/Console/Request.php index 80a143800..ee324745f 100644 --- a/Message/Console/Request.php +++ b/Message/Console/Request.php @@ -95,7 +95,7 @@ final class Request extends RequestAbstract $paths[] = $pathArray[$i]; } - $this->hash[] = sha1(\implode('', $paths)); + $this->hash[] = \sha1(\implode('', $paths)); } } diff --git a/Module/InstallerAbstract.php b/Module/InstallerAbstract.php index a2c805242..90bf655bc 100644 --- a/Module/InstallerAbstract.php +++ b/Module/InstallerAbstract.php @@ -61,7 +61,7 @@ abstract class InstallerAbstract foreach ($load as $val) { foreach ($val['pid'] as $pid) { $queryLoad->values( - sha1(\str_replace('/', '', $pid)), + \sha1(\str_replace('/', '', $pid)), (int) $val['type'], $val['from'], $val['for'], diff --git a/Socket/Client/Client.php b/Socket/Client/Client.php index 8e3c951bd..1b2661a42 100644 --- a/Socket/Client/Client.php +++ b/Socket/Client/Client.php @@ -69,14 +69,14 @@ class Client extends SocketAbstract */ public function run() : void { - socket_connect($this->sock, $this->ip, $this->port); + \socket_connect($this->sock, $this->ip, $this->port); $i = 0; while ($this->run) { try { $i++; $msg = 'disconnect'; - socket_write($this->sock, $msg, \strlen($msg)); + \socket_write($this->sock, $msg, \strlen($msg)); $read = [$this->sock]; @@ -87,7 +87,7 @@ class Client extends SocketAbstract //} if (\count($read) > 0) { - $data = socket_read($this->sock, 1024); + $data = \socket_read($this->sock, 1024); /* Server no data */ if ($data === false) { diff --git a/Socket/Server/Server.php b/Socket/Server/Server.php index 9c4b2759f..5afa49a40 100644 --- a/Socket/Server/Server.php +++ b/Socket/Server/Server.php @@ -89,7 +89,7 @@ class Server extends SocketAbstract */ public static function hasInternet() : bool { - $connected = @fsockopen("www.google.com", 80); + $connected = @\fsockopen("www.google.com", 80); if ($connected) { \fclose($connected); @@ -108,7 +108,7 @@ class Server extends SocketAbstract $this->app->logger->info('Creating socket...'); parent::create($ip, $port); $this->app->logger->info('Binding socket...'); - socket_bind($this->sock, $this->ip, $this->port); + \socket_bind($this->sock, $this->ip, $this->port); } /** @@ -155,13 +155,13 @@ class Server extends SocketAbstract } $acceptKey = $key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; - $acceptKey = base64_encode(sha1($acceptKey, true)); + $acceptKey = \base64_encode(\sha1($acceptKey, true)); $upgrade = "HTTP/1.1 101 Switching Protocols\r\n" . "Upgrade: websocket\r\n" . "Connection: Upgrade\r\n" . "Sec-WebSocket-Accept: $acceptKey" . "\r\n\r\n"; - socket_write($client->getSocket(), $upgrade); + \socket_write($client->getSocket(), $upgrade); $client->setHandshake(true); return true; @@ -176,8 +176,8 @@ class Server extends SocketAbstract public function run() : void { $this->app->logger->info('Start listening...'); - socket_listen($this->sock); - socket_set_nonblock($this->sock); + \socket_listen($this->sock); + \socket_set_nonblock($this->sock); $this->conn[] = $this->sock; $this->app->logger->info('Start running...'); @@ -187,7 +187,7 @@ class Server extends SocketAbstract $write = null; $except = null; - if (socket_select($read, $write, $except, 0) < 1) { + if (\socket_select($read, $write, $except, 0) < 1) { // error // socket_last_error(); // socket_strerror(socket_last_error()); @@ -196,11 +196,11 @@ class Server extends SocketAbstract foreach ($read as $key => $socket) { if ($this->sock === $socket) { - $newc = socket_accept($this->sock); + $newc = \socket_accept($this->sock); $this->connectClient($newc); } else { $client = $this->clientManager->getBySocket($socket); - $data = socket_read($socket, 1024); + $data = \socket_read($socket, 1024); if (!$client->getHandshake()) { $this->app->logger->debug('Doing handshake...'); @@ -233,8 +233,8 @@ class Server extends SocketAbstract $this->app->logger->debug('Disconnecting client...'); $client->setConnected(false); $client->setHandshake(false); - socket_shutdown($client->getSocket(), 2); - socket_close($client->getSocket()); + \socket_shutdown($client->getSocket(), 2); + \socket_close($client->getSocket()); if (isset($this->conn[$client->getId()])) { unset($this->conn[$client->getId()]); diff --git a/Socket/SocketAbstract.php b/Socket/SocketAbstract.php index 9f0ea5c1f..9249e505b 100644 --- a/Socket/SocketAbstract.php +++ b/Socket/SocketAbstract.php @@ -85,8 +85,8 @@ abstract class SocketAbstract implements SocketInterface public function close() : void { if ($this->sock !== null) { - socket_shutdown($this->sock, 2); - socket_close($this->sock); + \socket_shutdown($this->sock, 2); + \socket_close($this->sock); $this->sock = null; } } diff --git a/Stdlib/Base/Enum.php b/Stdlib/Base/Enum.php index 44d8ee3cc..1766eb355 100644 --- a/Stdlib/Base/Enum.php +++ b/Stdlib/Base/Enum.php @@ -54,7 +54,7 @@ abstract class Enum */ public static function getConstants() : array { - $reflect = new \ReflectionClass(get_called_class()); + $reflect = new \ReflectionClass(\get_called_class()); return $reflect->getConstants(); } @@ -69,9 +69,9 @@ abstract class Enum public static function getRandom() { $constants = self::getConstants(); - $keys = array_keys($constants); + $keys = \array_keys($constants); - return $constants[$keys[mt_rand(0, \count($constants) - 1)]]; + return $constants[$keys[\mt_rand(0, \count($constants) - 1)]]; } /** @@ -91,7 +91,7 @@ abstract class Enum throw new \UnexpectedValueException($name); } - return constant('static::' . $name); + return \constant('static::' . $name); } /** @@ -107,7 +107,7 @@ abstract class Enum { $arr = self::getConstants(); - return array_search($value, $arr); + return \array_search($value, $arr); } /** @@ -123,7 +123,7 @@ abstract class Enum */ public static function isValidName(string $name) : bool { - return defined('static::' . $name); + return \defined('static::' . $name); } /** diff --git a/Stdlib/Base/Iban.php b/Stdlib/Base/Iban.php index 12049ea12..dc3ceddbf 100644 --- a/Stdlib/Base/Iban.php +++ b/Stdlib/Base/Iban.php @@ -268,7 +268,7 @@ class Iban implements \Serializable */ public function prettyPrint() : string { - return wordwrap($this->iban, 4, ' ', true); + return \wordwrap($this->iban, 4, ' ', true); } /** diff --git a/Stdlib/Base/SmartDateTime.php b/Stdlib/Base/SmartDateTime.php index 95d87e2e6..94d7046b4 100644 --- a/Stdlib/Base/SmartDateTime.php +++ b/Stdlib/Base/SmartDateTime.php @@ -92,7 +92,7 @@ class SmartDateTime extends \DateTime */ public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : self { - $yearChange = (int) floor(((int) $this->format('m') - 1 + $m) / 12); + $yearChange = (int) \floor(((int) $this->format('m') - 1 + $m) / 12); $yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange; $yearNew = (int) $this->format('Y') + $y + $yearChange; $monthNew = ((int) $this->format('m') + $m) % 12; @@ -163,7 +163,7 @@ class SmartDateTime extends \DateTime */ public function getFirstDayOfMonth() : int { - return getdate(\mktime(0, 0, 0, (int) $this->format('m'), 1, (int) $this->format('Y')))['wday']; + return \getdate(\mktime(0, 0, 0, (int) $this->format('m'), 1, (int) $this->format('Y')))['wday']; } /** @@ -225,7 +225,7 @@ class SmartDateTime extends \DateTime return -1; } - return (int) date('w', $time); + return (int) \date('w', $time); } /** diff --git a/Stdlib/Graph/Tree.php b/Stdlib/Graph/Tree.php index 26a9ce81a..2ed22668b 100644 --- a/Stdlib/Graph/Tree.php +++ b/Stdlib/Graph/Tree.php @@ -172,7 +172,7 @@ class Tree extends Graph } foreach ($neighbors as $neighbor) { - array_merge($nodes, $this->getLevelNodes($level, $neighbor)); + \array_merge($nodes, $this->getLevelNodes($level, $neighbor)); } return $nodes; diff --git a/Uri/Http.php b/Uri/Http.php index bfedc92d6..041e28300 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -282,7 +282,7 @@ final class Http implements UriInterface */ public function getSubdomain() : string { - $host = explode('.', $this->host); + $host = \explode('.', $this->host); $length = \count($host) - 2; if ($length < 1) { diff --git a/Utils/Barcode/C128c.php b/Utils/Barcode/C128c.php index a654ed3d5..c9e17b0f6 100644 --- a/Utils/Barcode/C128c.php +++ b/Utils/Barcode/C128c.php @@ -84,8 +84,8 @@ class C128c extends C128Abstract */ protected function generateCodeString() : string { - $keys = array_keys(self::$CODEARRAY); - $values = array_flip($keys); + $keys = \array_keys(self::$CODEARRAY); + $values = \array_flip($keys); $codeString = ''; $length = \strlen($this->content); $checksum = self::$CHECKSUM; diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php index 040af6645..bb52a3471 100644 --- a/Utils/Barcode/C39.php +++ b/Utils/Barcode/C39.php @@ -78,7 +78,7 @@ class C39 extends C128Abstract $length = \strlen($this->content); for ($X = 1; $X <= $length; ++$X) { - $codeString .= self::$CODEARRAY[substr($this->content, ($X - 1), 1)] . '1'; + $codeString .= self::$CODEARRAY[\substr($this->content, ($X - 1), 1)] . '1'; } return $codeString; diff --git a/Utils/Compression/LZW.php b/Utils/Compression/LZW.php index 33f3802a1..176ca4446 100644 --- a/Utils/Compression/LZW.php +++ b/Utils/Compression/LZW.php @@ -36,7 +36,7 @@ class LZW implements CompressionInterface $dictSize = 256; for ($i = 0; $i < 256; $i += 1) { - $dictionary[chr($i)] = $i; + $dictionary[\chr($i)] = $i; } $length = \strlen($source); diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index 3dcb3a90d..c6e2f4aef 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -443,7 +443,7 @@ class Repository $path = $this->getDirectoryPath(); $path = \str_replace('\\', '/', $path); $path = \explode('/', $path); - $this->name = $path[count($path) - ($this->bare ? 1 : 2)]; + $this->name = $path[\count($path) - ($this->bare ? 1 : 2)]; } return $this->name; @@ -670,7 +670,7 @@ class Repository return 0; } - while (!feof($fh)) { + while (!\feof($fh)) { \fgets($fh); $loc++; } diff --git a/Utils/ImageUtils.php b/Utils/ImageUtils.php index 914a61690..d41b0ffc5 100644 --- a/Utils/ImageUtils.php +++ b/Utils/ImageUtils.php @@ -51,6 +51,6 @@ final class ImageUtils $img = \str_replace('data:image/png;base64,', '', $img); $img = \str_replace(' ', '+', $img); - return (string) base64_decode($img); + return (string) \base64_decode($img); } } diff --git a/Utils/Parser/Markdown/Markdown.php b/Utils/Parser/Markdown/Markdown.php index b42fe89ad..2c42a1e33 100644 --- a/Utils/Parser/Markdown/Markdown.php +++ b/Utils/Parser/Markdown/Markdown.php @@ -253,7 +253,7 @@ class Markdown $currentBlock = null; foreach ($lines as $line) { - if (chop($line) === '') { + if (\chop($line) === '') { if (isset($currentBlock)) { $currentBlock['interrupted'] = true; } @@ -268,9 +268,9 @@ class Markdown unset($parts[0]); foreach ($parts as $part) { - $shortage = 4 - mb_strlen($line, 'utf-8') % 4; + $shortage = 4 - \mb_strlen($line, 'utf-8') % 4; - $line .= str_repeat(' ', $shortage); + $line .= \str_repeat(' ', $shortage); $line .= $part; } } @@ -746,7 +746,7 @@ class Markdown return null; } - if (chop($lineArray['text'], $lineArray['text'][0]) !== '') { + if (\chop($lineArray['text'], $lineArray['text'][0]) !== '') { return null; } @@ -796,7 +796,7 @@ class Markdown return null; } - if (\strpos($block['element']['text'], '|') !== false && chop($lineArray['text'], ' -:|') === '') { + if (\strpos($block['element']['text'], '|') !== false && \chop($lineArray['text'], ' -:|') === '') { $alignments = []; $divider = $lineArray['text']; $divider = \trim($divider); @@ -899,7 +899,7 @@ class Markdown $row = \trim($row); $row = \trim($row, '|'); - preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches); + \preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches); foreach ($matches[0] as $index => $cell) { $element = [ diff --git a/Utils/RnG/DateTime.php b/Utils/RnG/DateTime.php index ff6e9c57b..0c2af5b18 100644 --- a/Utils/RnG/DateTime.php +++ b/Utils/RnG/DateTime.php @@ -39,6 +39,6 @@ class DateTime { $rng = new \DateTime(); - return $rng->setTimestamp(mt_rand($start->getTimestamp(), $end->getTimestamp())); + return $rng->setTimestamp(\mt_rand($start->getTimestamp(), $end->getTimestamp())); } } diff --git a/Utils/RnG/Name.php b/Utils/RnG/Name.php index e84e43167..77290a825 100644 --- a/Utils/RnG/Name.php +++ b/Utils/RnG/Name.php @@ -493,8 +493,8 @@ class Name */ public static function generateName(array $type, string $origin = 'western') : string { - $rndType = mt_rand(0, \count($type) - 1); + $rndType = \mt_rand(0, \count($type) - 1); - return self::$names[$origin][$type[$rndType]][mt_rand(0, \count(self::$names[$origin][$type[$rndType]]) - 1)]; + return self::$names[$origin][$type[$rndType]][\mt_rand(0, \count(self::$names[$origin][$type[$rndType]]) - 1)]; } } diff --git a/Utils/RnG/StringUtils.php b/Utils/RnG/StringUtils.php index b8e7a3b6d..f54faa5d7 100644 --- a/Utils/RnG/StringUtils.php +++ b/Utils/RnG/StringUtils.php @@ -40,12 +40,12 @@ class StringUtils string $charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) : string { - $length = mt_rand($min, $max); + $length = \mt_rand($min, $max); $charactersLength = \strlen($charset); $randomString = ''; for ($i = 0; $i < $length; ++$i) { - $randomString .= $charset[mt_rand(0, $charactersLength - 1)]; + $randomString .= $charset[\mt_rand(0, $charactersLength - 1)]; } return $randomString; diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index f7a5a36b9..020ef66cd 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -147,7 +147,7 @@ final class StringUtils } foreach ($needles as $needle) { - if ($needle === '' || strrpos($haystack, $needle, -strlen($haystack)) !== false) { + if ($needle === '' || \strrpos($haystack, $needle, -\strlen($haystack)) !== false) { return true; } } @@ -207,7 +207,7 @@ final class StringUtils } foreach ($needles as $needle) { - if ($needle === '' || (($temp = \mb_strlen($haystack) - \mb_strlen($needle)) >= 0 && mb_strpos($haystack, $needle, $temp) !== false)) { + if ($needle === '' || (($temp = \mb_strlen($haystack) - \mb_strlen($needle)) >= 0 && \mb_strpos($haystack, $needle, $temp) !== false)) { return true; } } @@ -230,7 +230,7 @@ final class StringUtils $firstChar = \mb_substr($string, 0, 1); $then = \mb_substr($string, 1, $strlen - 1); - return mb_strtoupper($firstChar) . $then; + return \mb_strtoupper($firstChar) . $then; } /** @@ -248,7 +248,7 @@ final class StringUtils $firstChar = \mb_substr($string, 0, 1); $then = \mb_substr($string, 1, $strlen - 1); - return mb_strtolower($firstChar) . $then; + return \mb_strtolower($firstChar) . $then; } /** diff --git a/tests/Account/PermissionTypeTest.php b/tests/Account/PermissionTypeTest.php index fd80b72f0..0b10cfa39 100644 --- a/tests/Account/PermissionTypeTest.php +++ b/tests/Account/PermissionTypeTest.php @@ -22,7 +22,7 @@ class PermissionTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(6, \count(PermissionType::getConstants())); - self::assertEquals(PermissionType::getConstants(), array_unique(PermissionType::getConstants())); + self::assertEquals(PermissionType::getConstants(), \array_unique(PermissionType::getConstants())); self::assertEquals(1, PermissionType::NONE); self::assertEquals(2, PermissionType::READ); diff --git a/tests/Autoloader.php b/tests/Autoloader.php index 4e94912be..07c894625 100644 --- a/tests/Autoloader.php +++ b/tests/Autoloader.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace Tests\PHPUnit; -spl_autoload_register('\Tests\PHPUnit\Autoloader::defaultAutoloader'); +\spl_autoload_register('\Tests\PHPUnit\Autoloader::defaultAutoloader'); /** * Autoloader class. diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 6a5701930..651af3ae3 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,9 +1,9 @@ add(mt_rand(0, 6)); + $nps->add(\mt_rand(0, 6)); } for ($i = 0; $i < 30; ++$i) { - $nps->add(mt_rand(7, 8)); + $nps->add(\mt_rand(7, 8)); } for ($i = 0; $i < 60; ++$i) { - $nps->add(mt_rand(9, 10)); + $nps->add(\mt_rand(9, 10)); } self::assertEquals(50, $nps->getScore()); diff --git a/tests/DataStorage/Cache/Connection/ConnectionFactoryTest.php b/tests/DataStorage/Cache/Connection/ConnectionFactoryTest.php index fd2853fab..de265caf7 100644 --- a/tests/DataStorage/Cache/Connection/ConnectionFactoryTest.php +++ b/tests/DataStorage/Cache/Connection/ConnectionFactoryTest.php @@ -28,7 +28,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase public function testCreateMemCached() : void { - if (!extension_loaded('memcached')) { + if (!\extension_loaded('memcached')) { $this->markTestSkipped( 'The Memcached extension is not available.' ); @@ -42,7 +42,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase public function testCreateRedisCache() : void { - if (!extension_loaded('redis')) { + if (!\extension_loaded('redis')) { $this->markTestSkipped( 'The Redis extension is not available.' ); diff --git a/tests/DataStorage/Cache/Connection/FileCacheTest.php b/tests/DataStorage/Cache/Connection/FileCacheTest.php index 983ad6bb7..2dae1eca5 100644 --- a/tests/DataStorage/Cache/Connection/FileCacheTest.php +++ b/tests/DataStorage/Cache/Connection/FileCacheTest.php @@ -142,26 +142,26 @@ class FileCacheTest extends \PHPUnit\Framework\TestCase $cache->set('key2', 'testVal2', 1); self::assertEquals('testVal2', $cache->get('key2', 1)); - sleep(3); + \sleep(3); self::assertEquals(null, $cache->get('key2', 1)); $cache->set('key3', 'testVal3', 1); self::assertEquals('testVal3', $cache->get('key3', 1)); - sleep(3); + \sleep(3); self::assertEquals(null, $cache->get('key3', 1)); $cache->set('key4', 'testVal4', 1); self::assertFalse($cache->delete('key4', 0)); - sleep(3); + \sleep(3); self::assertTrue($cache->delete('key4', 1)); $cache->set('key5', 'testVal5', 10000); - sleep(3); + \sleep(3); self::assertFalse($cache->delete('key5', 1000000)); self::assertTrue($cache->delete('key5', 1)); $cache->set('key6', 'testVal6', 1); - sleep(2); + \sleep(2); $cache->flush(0); diff --git a/tests/DataStorage/Cache/Connection/MemCachedTest.php b/tests/DataStorage/Cache/Connection/MemCachedTest.php index 635381eaa..db25fc761 100644 --- a/tests/DataStorage/Cache/Connection/MemCachedTest.php +++ b/tests/DataStorage/Cache/Connection/MemCachedTest.php @@ -22,7 +22,7 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('memcached')) { + if (!\extension_loaded('memcached')) { $this->markTestSkipped( 'The Memcached extension is not available.' ); @@ -75,7 +75,7 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase self::assertEquals(5.12, $cache->get('key5')); $cache->set('key6', ['asdf', 1, true, 2.3]); // 7 - self::assertEquals(json_encode(['asdf', 1, true, 2.3]), $cache->get('key6')); + self::assertEquals(\json_encode(['asdf', 1, true, 2.3]), $cache->get('key6')); self::assertTrue($cache->replace('key4', 5)); self::assertFalse($cache->replace('keyInvalid', 5)); diff --git a/tests/DataStorage/Cache/Connection/RedisCacheTest.php b/tests/DataStorage/Cache/Connection/RedisCacheTest.php index 1857213f4..4f5599543 100644 --- a/tests/DataStorage/Cache/Connection/RedisCacheTest.php +++ b/tests/DataStorage/Cache/Connection/RedisCacheTest.php @@ -22,7 +22,7 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('redis')) { + if (!\extension_loaded('redis')) { $this->markTestSkipped( 'The Redis extension is not available.' ); @@ -77,7 +77,7 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase self::assertEquals(5.12, $cache->get('key5')); $cache->set('key6', ['asdf', 1, true, 2.3]); // 7 - self::assertEquals(json_encode(['asdf', 1, true, 2.3]), $cache->get('key6')); + self::assertEquals(\json_encode(['asdf', 1, true, 2.3]), $cache->get('key6')); self::assertTrue($cache->replace('key4', 5)); self::assertFalse($cache->replace('keyInvalid', 5)); diff --git a/tests/DataStorage/Database/Connection/ConnectionFactoryTest.php b/tests/DataStorage/Database/Connection/ConnectionFactoryTest.php index 1e6bd6d69..8488ccd7f 100644 --- a/tests/DataStorage/Database/Connection/ConnectionFactoryTest.php +++ b/tests/DataStorage/Database/Connection/ConnectionFactoryTest.php @@ -23,7 +23,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase { public function testCreateMysql() : void { - if (!extension_loaded('pdo_mysql')) { + if (!\extension_loaded('pdo_mysql')) { $this->markTestSkipped( 'The Mysql extension is not available.' ); @@ -39,7 +39,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase public function testCreatePostgres() : void { - if (!extension_loaded('pdo_pgsql')) { + if (!\extension_loaded('pdo_pgsql')) { $this->markTestSkipped( 'The Postresql extension is not available.' ); @@ -55,7 +55,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase public function testCreateSqlsrv() : void { - if (!extension_loaded('pdo_sqlsrv')) { + if (!\extension_loaded('pdo_sqlsrv')) { $this->markTestSkipped( 'The Sqlsrv extension is not available.' ); @@ -71,7 +71,7 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase public function testCreateSqlite() : void { - if (!extension_loaded('pdo_sqlite')) { + if (!\extension_loaded('pdo_sqlite')) { $this->markTestSkipped( 'The SQLite extension is not available.' ); diff --git a/tests/DataStorage/Database/Connection/MysqlConnectionTest.php b/tests/DataStorage/Database/Connection/MysqlConnectionTest.php index 5e6af4993..a21a27867 100644 --- a/tests/DataStorage/Database/Connection/MysqlConnectionTest.php +++ b/tests/DataStorage/Database/Connection/MysqlConnectionTest.php @@ -20,7 +20,7 @@ class MysqlConnectionTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('pdo_mysql')) { + if (!\extension_loaded('pdo_mysql')) { $this->markTestSkipped( 'The Mysql extension is not available.' ); diff --git a/tests/DataStorage/Database/Connection/PostgresConnectionTest.php b/tests/DataStorage/Database/Connection/PostgresConnectionTest.php index f4aec2d1f..d13d3b82f 100644 --- a/tests/DataStorage/Database/Connection/PostgresConnectionTest.php +++ b/tests/DataStorage/Database/Connection/PostgresConnectionTest.php @@ -19,7 +19,7 @@ class PostgresConnectionTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('pdo_pgsql')) { + if (!\extension_loaded('pdo_pgsql')) { $this->markTestSkipped( 'The Postresql extension is not available.' ); diff --git a/tests/DataStorage/Database/Connection/SQLiteConnectionTest.php b/tests/DataStorage/Database/Connection/SQLiteConnectionTest.php index 41704d8e9..fab72f907 100644 --- a/tests/DataStorage/Database/Connection/SQLiteConnectionTest.php +++ b/tests/DataStorage/Database/Connection/SQLiteConnectionTest.php @@ -19,7 +19,7 @@ class SQLiteConnectionTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('pdo_sqlite')) { + if (!\extension_loaded('pdo_sqlite')) { $this->markTestSkipped( 'The SQLite extension is not available.' ); diff --git a/tests/DataStorage/Database/Connection/SqlServerConnectionTest.php b/tests/DataStorage/Database/Connection/SqlServerConnectionTest.php index 021f2f1e9..389f9e8b6 100644 --- a/tests/DataStorage/Database/Connection/SqlServerConnectionTest.php +++ b/tests/DataStorage/Database/Connection/SqlServerConnectionTest.php @@ -20,7 +20,7 @@ class SqlServerConnectionTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('pdo_sqlsrv')) { + if (!\extension_loaded('pdo_sqlsrv')) { $this->markTestSkipped( 'The Sqlsrv extension is not available.' ); diff --git a/tests/DataStorage/Database/Query/JoinTypeTest.php b/tests/DataStorage/Database/Query/JoinTypeTest.php index ba3e0b0a2..e1762dde6 100644 --- a/tests/DataStorage/Database/Query/JoinTypeTest.php +++ b/tests/DataStorage/Database/Query/JoinTypeTest.php @@ -20,7 +20,7 @@ class JoinTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(12, \count(JoinType::getConstants())); - self::assertEquals(JoinType::getConstants(), array_unique(JoinType::getConstants())); + self::assertEquals(JoinType::getConstants(), \array_unique(JoinType::getConstants())); self::assertEquals('JOIN', JoinType::JOIN); self::assertEquals('LEFT JOIN', JoinType::LEFT_JOIN); diff --git a/tests/DataStorage/Database/Query/QueryTypeTest.php b/tests/DataStorage/Database/Query/QueryTypeTest.php index d8473e303..4d148ac4d 100644 --- a/tests/DataStorage/Database/Query/QueryTypeTest.php +++ b/tests/DataStorage/Database/Query/QueryTypeTest.php @@ -20,7 +20,7 @@ class QueryTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(7, \count(QueryType::getConstants())); - self::assertEquals(QueryType::getConstants(), array_unique(QueryType::getConstants())); + self::assertEquals(QueryType::getConstants(), \array_unique(QueryType::getConstants())); self::assertEquals(0, QueryType::SELECT); self::assertEquals(1, QueryType::INSERT); diff --git a/tests/DataStorage/Database/Schema/QueryTypeTest.php b/tests/DataStorage/Database/Schema/QueryTypeTest.php index 0876a46ad..388f1f606 100644 --- a/tests/DataStorage/Database/Schema/QueryTypeTest.php +++ b/tests/DataStorage/Database/Schema/QueryTypeTest.php @@ -20,7 +20,7 @@ class QueryTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(13, \count(QueryType::getConstants())); - self::assertEquals(QueryType::getConstants(), array_unique(QueryType::getConstants())); + self::assertEquals(QueryType::getConstants(), \array_unique(QueryType::getConstants())); self::assertEquals(128, QueryType::DROP_DATABASE); self::assertEquals(129, QueryType::ALTER); diff --git a/tests/ExtensionTest.php b/tests/ExtensionTest.php index d6121402f..65e09604d 100644 --- a/tests/ExtensionTest.php +++ b/tests/ExtensionTest.php @@ -17,26 +17,26 @@ class ExtensionTest extends \PHPUnit\Framework\TestCase { public function testExtensionMbstring() : void { - self::assertTrue(extension_loaded('mbstring')); + self::assertTrue(\extension_loaded('mbstring')); } public function testExtensionCurl() : void { - self::assertTrue(extension_loaded('curl')); + self::assertTrue(\extension_loaded('curl')); } public function testExtensionImap() : void { - self::assertTrue(extension_loaded('imap')); + self::assertTrue(\extension_loaded('imap')); } public function testExtensionPdo() : void { - self::assertTrue(extension_loaded('pdo')); + self::assertTrue(\extension_loaded('pdo')); } public function testExtensionGD() : void { - self::assertTrue(extension_loaded('gd') || extension_loaded('gd2')); + self::assertTrue(\extension_loaded('gd') || \extension_loaded('gd2')); } } diff --git a/tests/Localization/ISO3166CharEnumTest.php b/tests/Localization/ISO3166CharEnumTest.php index 07c9c89f1..df7e30c10 100644 --- a/tests/Localization/ISO3166CharEnumTest.php +++ b/tests/Localization/ISO3166CharEnumTest.php @@ -33,6 +33,6 @@ class ISO3166CharEnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO3166NameEnumTest.php b/tests/Localization/ISO3166NameEnumTest.php index da220245e..96772c246 100644 --- a/tests/Localization/ISO3166NameEnumTest.php +++ b/tests/Localization/ISO3166NameEnumTest.php @@ -22,6 +22,6 @@ class ISO3166NameEnumTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { $enum = ISO3166NameEnum::getConstants(); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO3166NumEnumTest.php b/tests/Localization/ISO3166NumEnumTest.php index b0a610532..3b27bcdbf 100644 --- a/tests/Localization/ISO3166NumEnumTest.php +++ b/tests/Localization/ISO3166NumEnumTest.php @@ -33,6 +33,6 @@ class ISO3166NumEnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO3166TwoEnumTest.php b/tests/Localization/ISO3166TwoEnumTest.php index 4ed5f2f53..d6e81d825 100644 --- a/tests/Localization/ISO3166TwoEnumTest.php +++ b/tests/Localization/ISO3166TwoEnumTest.php @@ -33,6 +33,6 @@ class ISO3166TwoEnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($countryCodes), \count(array_unique($countryCodes))); + self::assertEquals(\count($countryCodes), \count(\array_unique($countryCodes))); } } diff --git a/tests/Localization/ISO4217CharEnumTest.php b/tests/Localization/ISO4217CharEnumTest.php index 103ac8b5c..cb6dae589 100644 --- a/tests/Localization/ISO4217CharEnumTest.php +++ b/tests/Localization/ISO4217CharEnumTest.php @@ -33,6 +33,6 @@ class ISO4217CharEnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO4217EnumTest.php b/tests/Localization/ISO4217EnumTest.php index bc4573888..2a5e1efe3 100644 --- a/tests/Localization/ISO4217EnumTest.php +++ b/tests/Localization/ISO4217EnumTest.php @@ -22,6 +22,6 @@ class ISO4217EnumTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { $enum = ISO4217Enum::getConstants(); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO4217NumEnumTest.php b/tests/Localization/ISO4217NumEnumTest.php index 5d502b681..f24068133 100644 --- a/tests/Localization/ISO4217NumEnumTest.php +++ b/tests/Localization/ISO4217NumEnumTest.php @@ -33,6 +33,6 @@ class ISO4217NumEnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO639EnumTest.php b/tests/Localization/ISO639EnumTest.php index e441cd49b..b395ad4cc 100644 --- a/tests/Localization/ISO639EnumTest.php +++ b/tests/Localization/ISO639EnumTest.php @@ -22,6 +22,6 @@ class ISO639EnumTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { $enum = ISO639Enum::getConstants(); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO639x1EnumTest.php b/tests/Localization/ISO639x1EnumTest.php index 36775fbd6..f9ee06478 100644 --- a/tests/Localization/ISO639x1EnumTest.php +++ b/tests/Localization/ISO639x1EnumTest.php @@ -33,6 +33,6 @@ class ISO639x1EnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/ISO639x2EnumTest.php b/tests/Localization/ISO639x2EnumTest.php index e83fbacbf..5226665ee 100644 --- a/tests/Localization/ISO639x2EnumTest.php +++ b/tests/Localization/ISO639x2EnumTest.php @@ -33,6 +33,6 @@ class ISO639x2EnumTest extends \PHPUnit\Framework\TestCase } self::assertTrue($ok); - self::assertEquals(\count($enum), \count(array_unique($enum))); + self::assertEquals(\count($enum), \count(\array_unique($enum))); } } diff --git a/tests/Localization/TimeZoneEnumArrayTest.php b/tests/Localization/TimeZoneEnumArrayTest.php index b36c842dc..c63072545 100644 --- a/tests/Localization/TimeZoneEnumArrayTest.php +++ b/tests/Localization/TimeZoneEnumArrayTest.php @@ -21,6 +21,6 @@ class TimeZoneEnumArrayTest extends \PHPUnit\Framework\TestCase { public function testEnums() : void { - self::assertEquals(\count(TimeZoneEnumArray::getConstants()), \count(array_unique(TimeZoneEnumArray::getConstants()))); + self::assertEquals(\count(TimeZoneEnumArray::getConstants()), \count(\array_unique(TimeZoneEnumArray::getConstants()))); } } diff --git a/tests/Log/FileLoggerTest.php b/tests/Log/FileLoggerTest.php index 1980dbb79..efc936ec0 100644 --- a/tests/Log/FileLoggerTest.php +++ b/tests/Log/FileLoggerTest.php @@ -26,15 +26,15 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase self::assertObjectHasAttribute('fp', $log); self::assertObjectHasAttribute('path', $log); - if (\file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) { - \unlink(__DIR__ . '/' . date('Y-m-d') . '.log'); + if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { + \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); } } public function testDefault() : void { - if (\file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) { - \unlink(__DIR__ . '/' . date('Y-m-d') . '.log'); + if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { + \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); } $log = FileLogger::getInstance(__DIR__); @@ -43,8 +43,8 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase self::assertEquals([], $log->get()); self::assertEquals([], $log->getByLine()); - if (\file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) { - \unlink(__DIR__ . '/' . date('Y-m-d') . '.log'); + if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { + \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); } } @@ -120,7 +120,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase self::assertEquals(2, $log->countLogs()['debug'] ?? 0); self::assertEquals(['0.0.0.0' => 9], $log->getHighestPerpetrator()); - self::assertEquals([6, 7, 8, 9, 10], array_keys($log->get(5, 1))); + self::assertEquals([6, 7, 8, 9, 10], \array_keys($log->get(5, 1))); self::assertEquals('alert', $log->getByLine(2)['level']); \ob_start(); @@ -129,7 +129,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase 'line' => 11, 'file' => self::class, ]); - $ob = ob_get_clean(); + $ob = \ob_get_clean(); // test without output $log->console(FileLogger::MSG_FULL, false, [ @@ -142,13 +142,13 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase \ob_start(); $log->console('test', true); - $ob = ob_get_clean(); + $ob = \ob_get_clean(); self::assertEquals(\date('[Y-m-d H:i:s] ') . "test\r\n", $ob); \unlink(__DIR__ . '/test.log'); - if (\file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) { - \unlink(__DIR__ . '/' . date('Y-m-d') . '.log'); + if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { + \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); } \ob_clean(); @@ -179,8 +179,8 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase \unlink(__DIR__ . '/test.log'); } - if (\file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) { - \unlink(__DIR__ . '/' . date('Y-m-d') . '.log'); + if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { + \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); } } } diff --git a/tests/Math/Matrix/EigenvalueDecompositionTest.php b/tests/Math/Matrix/EigenvalueDecompositionTest.php index 469349a23..4b698e9e0 100644 --- a/tests/Math/Matrix/EigenvalueDecompositionTest.php +++ b/tests/Math/Matrix/EigenvalueDecompositionTest.php @@ -33,9 +33,9 @@ class EigenvalueDecompositionTest extends \PHPUnit\Framework\TestCase self::assertEqualsWithDelta([0, 2, 5], $eig->getRealEigenvalues()->toArray(), 0.2); self::assertEqualsWithDelta([ - [0, 2/sqrt(6), 1/sqrt(3)], - [1/sqrt(2), -1/sqrt(6), 1/sqrt(3)], - [-1/sqrt(2), -1/sqrt(6), 1/sqrt(3)], + [0, 2/\sqrt(6), 1/\sqrt(3)], + [1/\sqrt(2), -1/\sqrt(6), 1/\sqrt(3)], + [-1/\sqrt(2), -1/\sqrt(6), 1/\sqrt(3)], ], $eig->getV()->toArray(), 0.2); self::assertEqualsWithDelta([ @@ -60,9 +60,9 @@ class EigenvalueDecompositionTest extends \PHPUnit\Framework\TestCase self::assertEqualsWithDelta([-5, 3, 6], $eig->getRealEigenvalues()->toArray(), 0.2); self::assertEqualsWithDelta([ - [-sqrt(2/3), sqrt(2/7), -1/sqrt(293)], - [-1/sqrt(6), -3/sqrt(14), -6/sqrt(293)], - [1/sqrt(6), -1/sqrt(14), -16/sqrt(293)], + [-\sqrt(2/3), \sqrt(2/7), -1/\sqrt(293)], + [-1/\sqrt(6), -3/\sqrt(14), -6/\sqrt(293)], + [1/\sqrt(6), -1/\sqrt(14), -16/\sqrt(293)], ], $eig->getV()->toArray(), 0.2); self::assertEqualsWithDelta([ diff --git a/tests/Math/Number/NumberTypeTest.php b/tests/Math/Number/NumberTypeTest.php index d7b857ddf..da7e2b9b6 100644 --- a/tests/Math/Number/NumberTypeTest.php +++ b/tests/Math/Number/NumberTypeTest.php @@ -20,7 +20,7 @@ class NumberTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(9, \count(NumberType::getConstants())); - self::assertEquals(NumberType::getConstants(), array_unique(NumberType::getConstants())); + self::assertEquals(NumberType::getConstants(), \array_unique(NumberType::getConstants())); self::assertEquals(0, NumberType::N_INTEGER); self::assertEquals(1, NumberType::N_NATURAL); diff --git a/tests/Math/Stochastic/Distribution/ChiSquaredDistributionTest.php b/tests/Math/Stochastic/Distribution/ChiSquaredDistributionTest.php index c9dcb7dcf..965e74b2e 100644 --- a/tests/Math/Stochastic/Distribution/ChiSquaredDistributionTest.php +++ b/tests/Math/Stochastic/Distribution/ChiSquaredDistributionTest.php @@ -46,7 +46,7 @@ class ChiSquaredDistributionTest extends \PHPUnit\Framework\TestCase public function testMode() : void { - self::assertEquals(max(5 - 2, 0), ChiSquaredDistribution::getMode(5)); + self::assertEquals(\max(5 - 2, 0), ChiSquaredDistribution::getMode(5)); } public function testMean() : void @@ -74,7 +74,7 @@ class ChiSquaredDistributionTest extends \PHPUnit\Framework\TestCase { $df = 5; - self::assertEquals(sqrt(8 / $df), ChiSquaredDistribution::getSkewness($df)); + self::assertEquals(\sqrt(8 / $df), ChiSquaredDistribution::getSkewness($df)); } public function testExKurtosis() : void diff --git a/tests/Math/Stochastic/Distribution/ExponentialDistributionTest.php b/tests/Math/Stochastic/Distribution/ExponentialDistributionTest.php index fad7ecdaf..7533da21a 100644 --- a/tests/Math/Stochastic/Distribution/ExponentialDistributionTest.php +++ b/tests/Math/Stochastic/Distribution/ExponentialDistributionTest.php @@ -45,7 +45,7 @@ class ExponentialDistributionTest extends \PHPUnit\Framework\TestCase public function testMedian() : void { - self::assertEquals(1/3 * log(2), ExponentialDistribution::getMedian(3)); + self::assertEquals(1/3 * \log(2), ExponentialDistribution::getMedian(3)); } public function testMgf() : void diff --git a/tests/Math/Stochastic/Distribution/GeometricDistributionTest.php b/tests/Math/Stochastic/Distribution/GeometricDistributionTest.php index 91a18b113..e6997ffcd 100644 --- a/tests/Math/Stochastic/Distribution/GeometricDistributionTest.php +++ b/tests/Math/Stochastic/Distribution/GeometricDistributionTest.php @@ -56,7 +56,7 @@ class GeometricDistributionTest extends \PHPUnit\Framework\TestCase { $p = 0.3; - self::assertEquals((2 - $p) / sqrt(1 - $p), GeometricDistribution::getSkewness($p)); + self::assertEquals((2 - $p) / \sqrt(1 - $p), GeometricDistribution::getSkewness($p)); } public function testExKurtosis() : void @@ -70,6 +70,6 @@ class GeometricDistributionTest extends \PHPUnit\Framework\TestCase { $p = 0.3; - self::assertEquals(ceil(-1 / log(1 - $p, 2)), GeometricDistribution::getMedian($p)); + self::assertEquals(\ceil(-1 / \log(1 - $p, 2)), GeometricDistribution::getMedian($p)); } } diff --git a/tests/Math/Stochastic/Distribution/PoissonDistributionTest.php b/tests/Math/Stochastic/Distribution/PoissonDistributionTest.php index abf63fb4f..7729c8d60 100644 --- a/tests/Math/Stochastic/Distribution/PoissonDistributionTest.php +++ b/tests/Math/Stochastic/Distribution/PoissonDistributionTest.php @@ -58,7 +58,7 @@ class PoissonDistributionTest extends \PHPUnit\Framework\TestCase { $l = 4.6; - self::assertEquals(1 / sqrt($l), PoissonDistribution::getSkewness($l)); + self::assertEquals(1 / \sqrt($l), PoissonDistribution::getSkewness($l)); } public function testExKurtosis() : void @@ -87,6 +87,6 @@ class PoissonDistributionTest extends \PHPUnit\Framework\TestCase $l = 4.6; $t = 3; - self::assertEquals(exp($l * (\exp($t) - 1)), PoissonDistribution::getMgf($l, $t)); + self::assertEquals(\exp($l * (\exp($t) - 1)), PoissonDistribution::getMgf($l, $t)); } } diff --git a/tests/Message/Http/BrowserTypeTest.php b/tests/Message/Http/BrowserTypeTest.php index 6f11e71c3..2d113d196 100644 --- a/tests/Message/Http/BrowserTypeTest.php +++ b/tests/Message/Http/BrowserTypeTest.php @@ -20,7 +20,7 @@ class BrowserTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(12, BrowserType::count()); - self::assertEquals(BrowserType::getConstants(), array_unique(BrowserType::getConstants())); + self::assertEquals(BrowserType::getConstants(), \array_unique(BrowserType::getConstants())); self::assertEquals('msie', BrowserType::IE); self::assertEquals('edge', BrowserType::EDGE); diff --git a/tests/Message/Http/OSTypeTest.php b/tests/Message/Http/OSTypeTest.php index 28b6d7314..2acf5c20a 100644 --- a/tests/Message/Http/OSTypeTest.php +++ b/tests/Message/Http/OSTypeTest.php @@ -20,6 +20,6 @@ class OSTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(24, \count(OSType::getConstants())); - self::assertEquals(OSType::getConstants(), array_unique(OSType::getConstants())); + self::assertEquals(OSType::getConstants(), \array_unique(OSType::getConstants())); } } diff --git a/tests/Message/Http/RequestMethodTest.php b/tests/Message/Http/RequestMethodTest.php index f7fc383bb..2d648ca91 100644 --- a/tests/Message/Http/RequestMethodTest.php +++ b/tests/Message/Http/RequestMethodTest.php @@ -20,7 +20,7 @@ class RequestMethodTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(6, \count(RequestMethod::getConstants())); - self::assertEquals(RequestMethod::getConstants(), array_unique(RequestMethod::getConstants())); + self::assertEquals(RequestMethod::getConstants(), \array_unique(RequestMethod::getConstants())); self::assertEquals('GET', RequestMethod::GET); self::assertEquals('POST', RequestMethod::POST); diff --git a/tests/Message/Http/RequestStatusCodeTest.php b/tests/Message/Http/RequestStatusCodeTest.php index e5823fbd2..ae50e2481 100644 --- a/tests/Message/Http/RequestStatusCodeTest.php +++ b/tests/Message/Http/RequestStatusCodeTest.php @@ -20,7 +20,7 @@ class RequestStatusCodeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(55, \count(RequestStatusCode::getConstants())); - self::assertEquals(RequestStatusCode::getConstants(), array_unique(RequestStatusCode::getConstants())); + self::assertEquals(RequestStatusCode::getConstants(), \array_unique(RequestStatusCode::getConstants())); self::assertEquals(100, RequestStatusCode::R_100); self::assertEquals(101, RequestStatusCode::R_101); diff --git a/tests/Message/Http/RequestStatusTest.php b/tests/Message/Http/RequestStatusTest.php index 6d848dbff..8ada35285 100644 --- a/tests/Message/Http/RequestStatusTest.php +++ b/tests/Message/Http/RequestStatusTest.php @@ -20,7 +20,7 @@ class RequestStatusTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(55, \count(RequestStatus::getConstants())); - self::assertEquals(RequestStatus::getConstants(), array_unique(RequestStatus::getConstants())); + self::assertEquals(RequestStatus::getConstants(), \array_unique(RequestStatus::getConstants())); self::assertEquals('Continue', RequestStatus::R_100); self::assertEquals('Switching Protocols', RequestStatus::R_101); diff --git a/tests/Model/Message/DomActionTest.php b/tests/Model/Message/DomActionTest.php index 02af27fe9..a4c4a31b3 100644 --- a/tests/Model/Message/DomActionTest.php +++ b/tests/Model/Message/DomActionTest.php @@ -20,7 +20,7 @@ class DomActionTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(9, \count(DomAction::getConstants())); - self::assertEquals(DomAction::getConstants(), array_unique(DomAction::getConstants())); + self::assertEquals(DomAction::getConstants(), \array_unique(DomAction::getConstants())); self::assertEquals(0, DomAction::CREATE_BEFORE); self::assertEquals(1, DomAction::CREATE_AFTER); diff --git a/tests/Model/Message/NotifyTypeTest.php b/tests/Model/Message/NotifyTypeTest.php index 6fc6d2b70..2e14d87ae 100644 --- a/tests/Model/Message/NotifyTypeTest.php +++ b/tests/Model/Message/NotifyTypeTest.php @@ -20,7 +20,7 @@ class NotifyTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(5, \count(NotifyType::getConstants())); - self::assertEquals(NotifyType::getConstants(), array_unique(NotifyType::getConstants())); + self::assertEquals(NotifyType::getConstants(), \array_unique(NotifyType::getConstants())); self::assertEquals(0, NotifyType::BINARY); self::assertEquals(1, NotifyType::INFO); diff --git a/tests/Module/PackageManagerTest.php b/tests/Module/PackageManagerTest.php index 09ce29bdc..1ee4087f2 100644 --- a/tests/Module/PackageManagerTest.php +++ b/tests/Module/PackageManagerTest.php @@ -24,7 +24,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase public static function setUpBeforeClass() : void { if (\file_exists(__DIR__ . '/testPackage.zip')) { - unlink(__DIR__ . '/testPackage.zip'); + \unlink(__DIR__ . '/testPackage.zip'); } if (\file_exists(__DIR__ . '/testPackageExtracted')) { @@ -34,7 +34,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase } if (\file_exists(__DIR__ . '/public.key')) { - unlink(__DIR__ . '/public.key'); + \unlink(__DIR__ . '/public.key'); } // create keys @@ -61,7 +61,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase } $hash = \sodium_crypto_generichash_final($state); - $signature = sodium_crypto_sign_detached($hash, $alice_sign_secretkey); + $signature = \sodium_crypto_sign_detached($hash, $alice_sign_secretkey); \file_put_contents(__DIR__ . '/testPackage/package.cert', $signature); \file_put_contents(__DIR__ . '/public.key', $alice_sign_publickey); @@ -133,7 +133,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase public static function tearDownAfterClass() : void { if (\file_exists(__DIR__ . '/testPackage.zip')) { - unlink(__DIR__ . '/testPackage.zip'); + \unlink(__DIR__ . '/testPackage.zip'); } if (\file_exists(__DIR__ . '/testPackageExtracted')) { @@ -144,9 +144,9 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase } if (\file_exists(__DIR__ . '/public.key')) { - unlink(__DIR__ . '/public.key'); + \unlink(__DIR__ . '/public.key'); } - file_put_contents(__DIR__ . '/testPackage/package.cert', ''); + \file_put_contents(__DIR__ . '/testPackage/package.cert', ''); } } diff --git a/tests/Router/RouteVerbTest.php b/tests/Router/RouteVerbTest.php index 4f344c4ea..8273eb51f 100644 --- a/tests/Router/RouteVerbTest.php +++ b/tests/Router/RouteVerbTest.php @@ -31,6 +31,6 @@ class RouteVerbTest extends \PHPUnit\Framework\TestCase public function testEnumUnique() : void { $values = RouteVerb::getConstants(); - self::assertEquals(\count($values), array_sum(array_count_values($values))); + self::assertEquals(\count($values), \array_sum(\array_count_values($values))); } } diff --git a/tests/Security/Sample/noDeprecated.php b/tests/Security/Sample/noDeprecated.php index 74ac13c5a..efe17285e 100644 --- a/tests/Security/Sample/noDeprecated.php +++ b/tests/Security/Sample/noDeprecated.php @@ -2,5 +2,5 @@ function noDeprecated() { - return is_string(''); + return \is_string(''); } diff --git a/tests/Stdlib/Base/SmartDateTimeTest.php b/tests/Stdlib/Base/SmartDateTimeTest.php index 20ec00d0d..7864d606a 100644 --- a/tests/Stdlib/Base/SmartDateTimeTest.php +++ b/tests/Stdlib/Base/SmartDateTimeTest.php @@ -46,8 +46,8 @@ class SmartDateTimeTest extends \PHPUnit\Framework\TestCase $expected = new \DateTime('now'); $obj = SmartDateTime::createFromDateTime($expected); self::assertEquals($expected->format('Y-m-d H:i:s'), $obj->format('Y-m-d H:i:s')); - self::assertEquals(\date("Y-m-t", strtotime($expected->format('Y-m-d'))), $obj->getEndOfMonth()->format('Y-m-d')); - self::assertEquals(\date("Y-m-01", strtotime($expected->format('Y-m-d'))), $obj->getStartOfMonth()->format('Y-m-d')); + self::assertEquals(\date("Y-m-t", \strtotime($expected->format('Y-m-d'))), $obj->getEndOfMonth()->format('Y-m-d')); + self::assertEquals(\date("Y-m-01", \strtotime($expected->format('Y-m-d'))), $obj->getStartOfMonth()->format('Y-m-d')); self::assertFalse((new SmartDateTime('2103-07-20'))->isLeapYear()); self::assertTrue((new SmartDateTime('2104-07-20'))->isLeapYear()); diff --git a/tests/System/File/ContentPutModeTest.php b/tests/System/File/ContentPutModeTest.php index 1f888b6bc..12c2ee95d 100644 --- a/tests/System/File/ContentPutModeTest.php +++ b/tests/System/File/ContentPutModeTest.php @@ -20,7 +20,7 @@ class ContentPutModeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(4, \count(ContentPutMode::getConstants())); - self::assertEquals(ContentPutMode::getConstants(), array_unique(ContentPutMode::getConstants())); + self::assertEquals(ContentPutMode::getConstants(), \array_unique(ContentPutMode::getConstants())); self::assertEquals(1, ContentPutMode::APPEND); self::assertEquals(2, ContentPutMode::PREPEND); diff --git a/tests/System/File/ExtensionTypeTest.php b/tests/System/File/ExtensionTypeTest.php index c095ee3d6..f945877a6 100644 --- a/tests/System/File/ExtensionTypeTest.php +++ b/tests/System/File/ExtensionTypeTest.php @@ -20,7 +20,7 @@ class ExtensionTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(11, \count(ExtensionType::getConstants())); - self::assertEquals(ExtensionType::getConstants(), array_unique(ExtensionType::getConstants())); + self::assertEquals(ExtensionType::getConstants(), \array_unique(ExtensionType::getConstants())); self::assertEquals(1, ExtensionType::UNKNOWN); self::assertEquals(2, ExtensionType::CODE); diff --git a/tests/System/File/Ftp/test.txt b/tests/System/File/Ftp/test.txt new file mode 100644 index 000000000..4aa80c5f0 --- /dev/null +++ b/tests/System/File/Ftp/test.txt @@ -0,0 +1 @@ +test5test3test4 \ No newline at end of file diff --git a/tests/System/SystemUtilsTest.php b/tests/System/SystemUtilsTest.php index 2d4428b14..3b478bd2d 100644 --- a/tests/System/SystemUtilsTest.php +++ b/tests/System/SystemUtilsTest.php @@ -33,7 +33,7 @@ class SystemUtilsTest extends \PHPUnit\Framework\TestCase self::assertEquals(0, SystemUtils::getRAMUsage()); } - if (!stristr(PHP_OS, 'WIN')) { + if (!\stristr(PHP_OS, 'WIN')) { self::assertGreaterThan(0, SystemUtils::getRAMUsage()); } } diff --git a/tests/Uri/UriSchemeTest.php b/tests/Uri/UriSchemeTest.php index 1bc1ad125..e5627eabf 100644 --- a/tests/Uri/UriSchemeTest.php +++ b/tests/Uri/UriSchemeTest.php @@ -41,6 +41,6 @@ class UriSchemeTest extends \PHPUnit\Framework\TestCase public function testEnumUnique() : void { $values = UriScheme::getConstants(); - self::assertEquals(\count($values), array_sum(array_count_values($values))); + self::assertEquals(\count($values), \array_sum(\array_count_values($values))); } } diff --git a/tests/Utils/Barcode/C128aTest.php b/tests/Utils/Barcode/C128aTest.php index 5b7f23fec..0b8c15c67 100644 --- a/tests/Utils/Barcode/C128aTest.php +++ b/tests/Utils/Barcode/C128aTest.php @@ -20,7 +20,7 @@ class C128aTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/C128bTest.php b/tests/Utils/Barcode/C128bTest.php index 9dd0b3c22..33c332c88 100644 --- a/tests/Utils/Barcode/C128bTest.php +++ b/tests/Utils/Barcode/C128bTest.php @@ -20,7 +20,7 @@ class C128bTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/C128cTest.php b/tests/Utils/Barcode/C128cTest.php index 07917084c..8f4989cf6 100644 --- a/tests/Utils/Barcode/C128cTest.php +++ b/tests/Utils/Barcode/C128cTest.php @@ -20,7 +20,7 @@ class C128cTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/C25Test.php b/tests/Utils/Barcode/C25Test.php index e0f87686b..bd9121cf1 100644 --- a/tests/Utils/Barcode/C25Test.php +++ b/tests/Utils/Barcode/C25Test.php @@ -20,7 +20,7 @@ class C25Test extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/C39Test.php b/tests/Utils/Barcode/C39Test.php index 523c2057c..460e80c94 100644 --- a/tests/Utils/Barcode/C39Test.php +++ b/tests/Utils/Barcode/C39Test.php @@ -20,7 +20,7 @@ class C39Test extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/CodebarTest.php b/tests/Utils/Barcode/CodebarTest.php index 5c642aa8b..28e0ce346 100644 --- a/tests/Utils/Barcode/CodebarTest.php +++ b/tests/Utils/Barcode/CodebarTest.php @@ -20,7 +20,7 @@ class CodebarTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('gd')) { + if (!\extension_loaded('gd')) { $this->markTestSkipped( 'The GD extension is not available.' ); diff --git a/tests/Utils/Barcode/OrientationTypeTest.php b/tests/Utils/Barcode/OrientationTypeTest.php index aa1f55c82..e52c4a68c 100644 --- a/tests/Utils/Barcode/OrientationTypeTest.php +++ b/tests/Utils/Barcode/OrientationTypeTest.php @@ -20,7 +20,7 @@ class OrientationTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(2, \count(OrientationType::getConstants())); - self::assertEquals(OrientationType::getConstants(), array_unique(OrientationType::getConstants())); + self::assertEquals(OrientationType::getConstants(), \array_unique(OrientationType::getConstants())); self::assertEquals(0, OrientationType::HORIZONTAL); self::assertEquals(1, OrientationType::VERTICAL); diff --git a/tests/Utils/Converter/AngleTypeTest.php b/tests/Utils/Converter/AngleTypeTest.php index fc66c13ba..18477216b 100644 --- a/tests/Utils/Converter/AngleTypeTest.php +++ b/tests/Utils/Converter/AngleTypeTest.php @@ -20,7 +20,7 @@ class AngleTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(10, \count(AngleType::getConstants())); - self::assertEquals(AngleType::getConstants(), array_unique(AngleType::getConstants())); + self::assertEquals(AngleType::getConstants(), \array_unique(AngleType::getConstants())); self::assertEquals('deg', AngleType::DEGREE); self::assertEquals('rad', AngleType::RADIAN); diff --git a/tests/Utils/Converter/AreaTypeTest.php b/tests/Utils/Converter/AreaTypeTest.php index f2c7a50d9..7e60caad9 100644 --- a/tests/Utils/Converter/AreaTypeTest.php +++ b/tests/Utils/Converter/AreaTypeTest.php @@ -20,7 +20,7 @@ class AreaTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(13, \count(AreaType::getConstants())); - self::assertEquals(AreaType::getConstants(), array_unique(AreaType::getConstants())); + self::assertEquals(AreaType::getConstants(), \array_unique(AreaType::getConstants())); self::assertEquals('ft', AreaType::SQUARE_FEET); self::assertEquals('m', AreaType::SQUARE_METERS); diff --git a/tests/Utils/Converter/EnergyPowerTypeTest.php b/tests/Utils/Converter/EnergyPowerTypeTest.php index 427ba6464..6dbf54753 100644 --- a/tests/Utils/Converter/EnergyPowerTypeTest.php +++ b/tests/Utils/Converter/EnergyPowerTypeTest.php @@ -20,7 +20,7 @@ class EnergyPowerTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(9, \count(EnergyPowerType::getConstants())); - self::assertEquals(EnergyPowerType::getConstants(), array_unique(EnergyPowerType::getConstants())); + self::assertEquals(EnergyPowerType::getConstants(), \array_unique(EnergyPowerType::getConstants())); self::assertEquals('kWh', EnergyPowerType::KILOWATT_HOUERS); self::assertEquals('MWh', EnergyPowerType::MEGAWATT_HOUERS); diff --git a/tests/Utils/Converter/LengthTypeTest.php b/tests/Utils/Converter/LengthTypeTest.php index 660459eb7..9e7a9dbfb 100644 --- a/tests/Utils/Converter/LengthTypeTest.php +++ b/tests/Utils/Converter/LengthTypeTest.php @@ -20,7 +20,7 @@ class LengthTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(21, \count(LengthType::getConstants())); - self::assertEquals(LengthType::getConstants(), array_unique(LengthType::getConstants())); + self::assertEquals(LengthType::getConstants(), \array_unique(LengthType::getConstants())); self::assertEquals('mi', LengthType::MILES); self::assertEquals('m', LengthType::METERS); diff --git a/tests/Utils/Converter/MeasurementTest.php b/tests/Utils/Converter/MeasurementTest.php index 47684b372..e19516f76 100644 --- a/tests/Utils/Converter/MeasurementTest.php +++ b/tests/Utils/Converter/MeasurementTest.php @@ -34,7 +34,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($temps as $from) { foreach ($temps as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertTemperature(Measurement::convertTemperature($rand, $from, $to), $to, $from)) < 1); } } @@ -46,7 +46,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($weights as $from) { foreach ($weights as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertWeight(Measurement::convertWeight($rand, $from, $to), $to, $from)) < 1); } } @@ -58,7 +58,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($lengths as $from) { foreach ($lengths as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertLength(Measurement::convertLength($rand, $from, $to), $to, $from)) < 1); } } @@ -70,7 +70,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($areas as $from) { foreach ($areas as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertArea(Measurement::convertArea($rand, $from, $to), $to, $from)) < 1); } } @@ -82,7 +82,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($volumes as $from) { foreach ($volumes as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertVolume(Measurement::convertVolume($rand, $from, $to), $to, $from)) < 1); } } @@ -94,7 +94,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($speeds as $from) { foreach ($speeds as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertSpeed(Measurement::convertSpeed($rand, $from, $to), $to, $from)) < 1); } } @@ -106,7 +106,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($times as $from) { foreach ($times as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertTime(Measurement::convertTime($rand, $from, $to), $to, $from)) < 1); } } @@ -118,7 +118,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($angles as $from) { foreach ($angles as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertAngle(Measurement::convertAngle($rand, $from, $to), $to, $from)) < 1); } } @@ -130,7 +130,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($pressures as $from) { foreach ($pressures as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertPressure(Measurement::convertPressure($rand, $from, $to), $to, $from)) < 1); } } @@ -142,7 +142,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($energies as $from) { foreach ($energies as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertEnergy(Measurement::convertEnergy($rand, $from, $to), $to, $from)) < 1); } } @@ -154,7 +154,7 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase foreach ($fileSizes as $from) { foreach ($fileSizes as $to) { - $rand = mt_rand(0, 100); + $rand = \mt_rand(0, 100); self::assertTrue(($rand - Measurement::convertFileSize(Measurement::convertFileSize($rand, $from, $to), $to, $from)) < 1); } } diff --git a/tests/Utils/Converter/NumericTest.php b/tests/Utils/Converter/NumericTest.php index 53868f214..508966a63 100644 --- a/tests/Utils/Converter/NumericTest.php +++ b/tests/Utils/Converter/NumericTest.php @@ -19,7 +19,7 @@ class NumericTest extends \PHPUnit\Framework\TestCase { public function testArabicRoman() : void { - $rand = mt_rand(1, 9999); + $rand = \mt_rand(1, 9999); self::assertEquals($rand, Numeric::romanToArabic(Numeric::arabicToRoman($rand))); self::assertEquals('VIII', Numeric::arabicToRoman(8)); diff --git a/tests/Utils/Converter/PressureTypeTest.php b/tests/Utils/Converter/PressureTypeTest.php index f8e8df60e..cc7234bd2 100644 --- a/tests/Utils/Converter/PressureTypeTest.php +++ b/tests/Utils/Converter/PressureTypeTest.php @@ -20,7 +20,7 @@ class PressureTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(13, \count(PressureType::getConstants())); - self::assertEquals(PressureType::getConstants(), array_unique(PressureType::getConstants())); + self::assertEquals(PressureType::getConstants(), \array_unique(PressureType::getConstants())); self::assertEquals('Pa', PressureType::PASCALS); self::assertEquals('bar', PressureType::BAR); diff --git a/tests/Utils/Converter/SpeedTypeTest.php b/tests/Utils/Converter/SpeedTypeTest.php index de6a97c79..44d28a251 100644 --- a/tests/Utils/Converter/SpeedTypeTest.php +++ b/tests/Utils/Converter/SpeedTypeTest.php @@ -20,7 +20,7 @@ class SpeedTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(34, \count(SpeedType::getConstants())); - self::assertEquals(SpeedType::getConstants(), array_unique(SpeedType::getConstants())); + self::assertEquals(SpeedType::getConstants(), \array_unique(SpeedType::getConstants())); self::assertEquals('mpd', SpeedType::MILES_PER_DAY); self::assertEquals('mph', SpeedType::MILES_PER_HOUR); diff --git a/tests/Utils/Converter/TemperatureTypeTest.php b/tests/Utils/Converter/TemperatureTypeTest.php index 6eba62e42..b094420b5 100644 --- a/tests/Utils/Converter/TemperatureTypeTest.php +++ b/tests/Utils/Converter/TemperatureTypeTest.php @@ -20,7 +20,7 @@ class TemperatureTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(8, \count(TemperatureType::getConstants())); - self::assertEquals(TemperatureType::getConstants(), array_unique(TemperatureType::getConstants())); + self::assertEquals(TemperatureType::getConstants(), \array_unique(TemperatureType::getConstants())); self::assertEquals('celsius', TemperatureType::CELSIUS); self::assertEquals('fahrenheit', TemperatureType::FAHRENHEIT); diff --git a/tests/Utils/Converter/TimeTypeTest.php b/tests/Utils/Converter/TimeTypeTest.php index 62b177f8c..ef799b171 100644 --- a/tests/Utils/Converter/TimeTypeTest.php +++ b/tests/Utils/Converter/TimeTypeTest.php @@ -20,7 +20,7 @@ class TimeTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(9, \count(TimeType::getConstants())); - self::assertEquals(TimeType::getConstants(), array_unique(TimeType::getConstants())); + self::assertEquals(TimeType::getConstants(), \array_unique(TimeType::getConstants())); self::assertEquals('ms', TimeType::MILLISECONDS); self::assertEquals('s', TimeType::SECONDS); diff --git a/tests/Utils/Converter/VolumeTypeTest.php b/tests/Utils/Converter/VolumeTypeTest.php index a09819015..ab645c4d7 100644 --- a/tests/Utils/Converter/VolumeTypeTest.php +++ b/tests/Utils/Converter/VolumeTypeTest.php @@ -20,7 +20,7 @@ class VolumeTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(38, \count(VolumeType::getConstants())); - self::assertEquals(VolumeType::getConstants(), array_unique(VolumeType::getConstants())); + self::assertEquals(VolumeType::getConstants(), \array_unique(VolumeType::getConstants())); self::assertEquals('UK gal', VolumeType::UK_GALLON); self::assertEquals('US gal lqd', VolumeType::US_GALLON_LIQUID); diff --git a/tests/Utils/Converter/WeightTypeTest.php b/tests/Utils/Converter/WeightTypeTest.php index 7d541956e..cc396e198 100644 --- a/tests/Utils/Converter/WeightTypeTest.php +++ b/tests/Utils/Converter/WeightTypeTest.php @@ -20,7 +20,7 @@ class WeightTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(14, \count(WeightType::getConstants())); - self::assertEquals(WeightType::getConstants(), array_unique(WeightType::getConstants())); + self::assertEquals(WeightType::getConstants(), \array_unique(WeightType::getConstants())); self::assertEquals('mg', WeightType::MICROGRAM); self::assertEquals('mug', WeightType::MILLIGRAM); diff --git a/tests/Utils/Encoding/GrayTest.php b/tests/Utils/Encoding/GrayTest.php index 597a570eb..b4f7aa6ee 100644 --- a/tests/Utils/Encoding/GrayTest.php +++ b/tests/Utils/Encoding/GrayTest.php @@ -26,7 +26,7 @@ class GrayTest extends \PHPUnit\Framework\TestCase public function testVolume() : void { for ($i = 0; $i < 100; ++$i) { - $raw = mt_rand(0, 2040140512); + $raw = \mt_rand(0, 2040140512); self::assertEquals($raw, Gray::decode(Gray::encode($raw))); } diff --git a/tests/Utils/Encoding/XorEncodingTest.php b/tests/Utils/Encoding/XorEncodingTest.php index 1fa9cffb6..7dac05411 100644 --- a/tests/Utils/Encoding/XorEncodingTest.php +++ b/tests/Utils/Encoding/XorEncodingTest.php @@ -21,8 +21,8 @@ class XorEncodingTest extends \PHPUnit\Framework\TestCase public function testEncoding() : void { $test = XorEncoding::encode('This is a test.', 'abcd'); - self::assertEquals(hex2bin('350a0a17410b10440042170112164d'), XorEncoding::encode('This is a test.', 'abcd')); - self::assertEquals('This is a test.', XorEncoding::decode(hex2bin('350a0a17410b10440042170112164d'), 'abcd')); + self::assertEquals(\hex2bin('350a0a17410b10440042170112164d'), XorEncoding::encode('This is a test.', 'abcd')); + self::assertEquals('This is a test.', XorEncoding::decode(\hex2bin('350a0a17410b10440042170112164d'), 'abcd')); } public function testVolume() : void diff --git a/tests/Utils/IO/Zip/TarGzTest.php b/tests/Utils/IO/Zip/TarGzTest.php index 682ff7879..13ede538c 100644 --- a/tests/Utils/IO/Zip/TarGzTest.php +++ b/tests/Utils/IO/Zip/TarGzTest.php @@ -19,7 +19,7 @@ class TarGzTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('phar')) { + if (!\extension_loaded('phar')) { $this->markTestSkipped( 'The Phar extension is not available.' ); diff --git a/tests/Utils/IO/Zip/TarTest.php b/tests/Utils/IO/Zip/TarTest.php index cc1323b1b..15acbbc86 100644 --- a/tests/Utils/IO/Zip/TarTest.php +++ b/tests/Utils/IO/Zip/TarTest.php @@ -19,7 +19,7 @@ class TarTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('phar')) { + if (!\extension_loaded('phar')) { $this->markTestSkipped( 'The Phar extension is not available.' ); diff --git a/tests/Utils/IO/Zip/ZipTest.php b/tests/Utils/IO/Zip/ZipTest.php index d4798d98f..877616022 100644 --- a/tests/Utils/IO/Zip/ZipTest.php +++ b/tests/Utils/IO/Zip/ZipTest.php @@ -19,7 +19,7 @@ class ZipTest extends \PHPUnit\Framework\TestCase { protected function setUp() : void { - if (!extension_loaded('zip')) { + if (!\extension_loaded('zip')) { $this->markTestSkipped( 'The ZIP extension is not available.' ); diff --git a/tests/Utils/RnG/DateTimeTest.php b/tests/Utils/RnG/DateTimeTest.php index 8a0e235fe..ae4d7356b 100644 --- a/tests/Utils/RnG/DateTimeTest.php +++ b/tests/Utils/RnG/DateTimeTest.php @@ -23,8 +23,8 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase $dateMin = new \DateTime(); $dateMax = new \DateTime(); - $min = mt_rand(0, PHP_INT_MAX - 2); - $max = mt_rand($min + 1, PHP_INT_MAX); + $min = \mt_rand(0, PHP_INT_MAX - 2); + $max = \mt_rand($min + 1, PHP_INT_MAX); $dateMin->setTimestamp($min); $dateMax->setTimestamp($max); diff --git a/tests/Utils/RnG/DistributionTypeTest.php b/tests/Utils/RnG/DistributionTypeTest.php index df57d8a2e..f0a5d354d 100644 --- a/tests/Utils/RnG/DistributionTypeTest.php +++ b/tests/Utils/RnG/DistributionTypeTest.php @@ -20,7 +20,7 @@ class DistributionTypeTest extends \PHPUnit\Framework\TestCase public function testEnums() : void { self::assertEquals(2, \count(DistributionType::getConstants())); - self::assertEquals(DistributionType::getConstants(), array_unique(DistributionType::getConstants())); + self::assertEquals(DistributionType::getConstants(), \array_unique(DistributionType::getConstants())); self::assertEquals(0, DistributionType::UNIFORM); self::assertEquals(1, DistributionType::NORMAL);