phpcs fix

This commit is contained in:
Dennis Eichhorn 2020-01-26 12:27:35 +01:00
parent 65d76e11ea
commit a49251c0bb
208 changed files with 775 additions and 784 deletions

View File

@ -61,7 +61,7 @@ final class Kmeans
* *
* @param PointInterface[] $points Points to cluster * @param PointInterface[] $points Points to cluster
* @param int $clusters Amount of clusters * @param int $clusters Amount of clusters
* @param null|\Closure $metric Metric to use for the distance between two points. * @param null|\Closure $metric metric to use for the distance between two points
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -63,7 +63,7 @@ final class Bounded
for ($j = 0; $j <= $maxCost; ++$j) { for ($j = 0; $j <= $maxCost; ++$j) {
$m[$i][$j] = $m[$i - 1][$j]; $m[$i][$j] = $m[$i - 1][$j];
for ($k = 1; $k <= $items[$i - 1]['quantity']; $k++) { for ($k = 1; $k <= $items[$i - 1]['quantity']; ++$k) {
if ($k * ((int) $items[$i - 1]['item']->getCost()) > $j) { if ($k * ((int) $items[$i - 1]['item']->getCost()) > $j) {
break; break;
} }
@ -85,7 +85,7 @@ final class Bounded
$value = (int) $items[$i - 1]['item']->getValue(); $value = (int) $items[$i - 1]['item']->getValue();
for ($k = 0; $v !== $m[$i - 1][$j] + $k * $value; ++$k) { for ($k = 0; $v !== $m[$i - 1][$j] + $k * $value; ++$k) {
$s++; ++$s;
$j -= (int) $items[$i - 1]['item']->getCost(); $j -= (int) $items[$i - 1]['item']->getCost();
} }

View File

@ -47,7 +47,7 @@ final class Continuous
*/ */
public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface
{ {
usort($items, function($a, $b) { \usort($items, function($a, $b) {
return $a['item']->getValue() / $a['item']->getCost() < $b['item']->getValue() / $b['item']->getCost(); return $a['item']->getValue() / $a['item']->getCost() < $b['item']->getValue() / $b['item']->getCost();
}); });

View File

@ -139,7 +139,7 @@ class Node
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setParent(?Node $node) : void public function setParent(?self $node) : void
{ {
$this->parent = $node; $this->parent = $node;
} }
@ -151,7 +151,7 @@ class Node
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function getParent() : ?Node public function getParent() : ?self
{ {
return $this->parent; return $this->parent;
} }
@ -165,7 +165,7 @@ class Node
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function isEqual(Node $node) : bool public function isEqual(self $node) : bool
{ {
return $this->x === $node->getX() && $this->y === $node->getY(); return $this->x === $node->getX() && $this->y === $node->getY();
} }

View File

@ -14,19 +14,19 @@ declare(strict_types=1);
namespace phpOMS; namespace phpOMS;
use phpOMS\Router\RouterInterface;
use phpOMS\Log\FileLogger;
use phpOMS\Event\EventManager;
use phpOMS\Module\ModuleManager;
use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Account\AccountManager; use phpOMS\Account\AccountManager;
use phpOMS\Localization\L11nManager; use phpOMS\Config\SettingsAbstract;
use phpOMS\Localization\Localization;
use phpOMS\DataStorage\Cache\CachePool; use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\DataStorage\Cookie\CookieJar; use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Session\SessionInterface; use phpOMS\DataStorage\Session\SessionInterface;
use phpOMS\Config\SettingsAbstract; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager;
use phpOMS\Localization\L11nManager;
use phpOMS\Localization\Localization;
use phpOMS\Log\FileLogger;
use phpOMS\Module\ModuleManager;
use phpOMS\Router\RouterInterface;
/** /**
* Application class. * Application class.

View File

@ -14,9 +14,9 @@ declare(strict_types=1);
namespace phpOMS\Config; namespace phpOMS\Config;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Cache\CachePool; use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
/** /**
* Settings class. * Settings class.

View File

@ -16,7 +16,6 @@ namespace phpOMS\DataStorage\Cache\Connection;
use phpOMS\DataStorage\Cache\CacheStatus; use phpOMS\DataStorage\Cache\CacheStatus;
use phpOMS\DataStorage\Cache\CacheType; use phpOMS\DataStorage\Cache\CacheType;
use phpOMS\DataStorage\Cache\Connection\CacheValueType;
/** /**
* Cache handler. * Cache handler.

View File

@ -18,7 +18,6 @@ use phpOMS\DataStorage\Cache\CacheStatus;
use phpOMS\DataStorage\Cache\CacheType; use phpOMS\DataStorage\Cache\CacheType;
use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException; use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException;
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue; use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
use phpOMS\DataStorage\Cache\Connection\CacheValueType;
/** /**
* RedisCache class. * RedisCache class.

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\DataStorage\Database; namespace phpOMS\DataStorage\Database;
use phpOMS\DataStorage\Database\Query\QueryType;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
use phpOMS\DataStorage\Database\Query\QueryType;
/** /**
* Database query builder. * Database query builder.

View File

@ -1030,8 +1030,8 @@ class DataMapperAbstract implements DataMapperInterface
try { try {
self::$db->con->prepare($relQuery->toSql())->execute(); self::$db->con->prepare($relQuery->toSql())->execute();
} catch (\Throwable $e) { } catch (\Throwable $e) {
var_dump($e->getMessage()); \var_dump($e->getMessage());
var_dump($relQuery->toSql()); \var_dump($relQuery->toSql());
} }
} }
} }

View File

@ -14,11 +14,11 @@ declare(strict_types=1);
namespace phpOMS\DataStorage\Database; namespace phpOMS\DataStorage\Database;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
use phpOMS\DataStorage\Database\Connection\ConnectionFactory; use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
use phpOMS\DataStorage\Database\Connection\NullConnection; use phpOMS\DataStorage\Database\Connection\NullConnection;
use phpOMS\DataStorage\DataStorageConnectionInterface; use phpOMS\DataStorage\DataStorageConnectionInterface;
use phpOMS\DataStorage\DataStoragePoolInterface; use phpOMS\DataStorage\DataStoragePoolInterface;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
/** /**
* Database pool handler. * Database pool handler.

View File

@ -136,7 +136,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
{ {
$file = $this->savePath . '/sess_' . $id; $file = $this->savePath . '/sess_' . $id;
if (\file_exists($file)) { if (\file_exists($file)) {
unlink($file); \unlink($file);
} }
return true; return true;
@ -153,7 +153,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
*/ */
public function gc($maxlifetime) public function gc($maxlifetime)
{ {
$files = \glob("$this->savePath/sess_*"); $files = \glob("{$this->savePath}/sess_*");
if ($files === false) { if ($files === false) {
return false; return false;
@ -161,7 +161,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
foreach ($files as $file) { foreach ($files as $file) {
if (\filemtime($file) + $maxlifetime < \time() && \file_exists($file)) { if (\filemtime($file) + $maxlifetime < \time() && \file_exists($file)) {
unlink($file); \unlink($file);
} }
} }

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\Math\Statistic\Forecast\Regression; namespace phpOMS\Math\Statistic\Forecast\Regression;
use phpOMS\Math\Statistic\Average;
use phpOMS\Math\Matrix\Exception\InvalidDimensionException; use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
use phpOMS\Math\Statistic\Average;
/** /**
* Regression class. * Regression class.

View File

@ -154,7 +154,7 @@ final class LogNormalDistribution
*/ */
public static function getEntrpoy(float $mu, float $sigma) : float public static function getEntrpoy(float $mu, float $sigma) : float
{ {
return \log($sigma * \exp($mu + 1 / 2) * \sqrt(2 * M_1_PI), 2); return \log($sigma * \exp($mu + 1 / 2) * \sqrt(2 * \M_1_PI), 2);
} }
/** /**

View File

@ -191,7 +191,7 @@ final class ParetoDistribution
{ {
return [ return [
[$alpha / $xm ** 2, -1 / $xm], [$alpha / $xm ** 2, -1 / $xm],
[-1 / $xm, 1 / ($alpha ** 2)] [-1 / $xm, 1 / ($alpha ** 2)],
]; ];
} }
} }

View File

@ -21,6 +21,8 @@ namespace phpOMS\Math\Stochastic\Distribution;
* @license OMS License 1.0 * @license OMS License 1.0
* @link https://orange-management.org * @link https://orange-management.org
* @since 1.0.0 * @since 1.0.0
*
* @internal
*/ */
final class ZTest final class ZTest
{ {

View File

@ -14,11 +14,8 @@ declare(strict_types=1);
namespace phpOMS\Message\Socket; namespace phpOMS\Message\Socket;
use phpOMS\Socket\Server\ClientManager;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Router\SocketRouter; use phpOMS\Router\SocketRouter;
use phpOMS\Message\Socket\Request;
use phpOMS\Message\Socket\Response;
/** /**
* Server class. * Server class.

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\Message\Socket; namespace phpOMS\Message\Socket;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Contract\RenderableInterface; use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\ResponseAbstract;
/** /**
* Response class. * Response class.

View File

@ -105,7 +105,7 @@ abstract class ModuleAbstract
*/ */
public function __construct(ApplicationAbstract $app = null) public function __construct(ApplicationAbstract $app = null)
{ {
$this->app = $app ?? new class extends ApplicationAbstract {}; $this->app = $app ?? new class() extends ApplicationAbstract {};
} }
/** /**

View File

@ -15,8 +15,8 @@ declare(strict_types=1);
namespace phpOMS\Module; namespace phpOMS\Module;
use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
/** /**
* Uninstaller abstract class. * Uninstaller abstract class.

View File

@ -14,10 +14,10 @@ declare(strict_types=1);
namespace phpOMS\Socket\Client; namespace phpOMS\Socket\Client;
use phpOMS\Socket\SocketAbstract;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
use phpOMS\Socket\Server\ClientManager;
use phpOMS\Message\Socket\PacketManager; use phpOMS\Message\Socket\PacketManager;
use phpOMS\Socket\Server\ClientManager;
use phpOMS\Socket\SocketAbstract;
/** /**
* Client socket class. * Client socket class.
@ -107,7 +107,7 @@ class Client extends SocketAbstract
if (\count($read) > 0) { if (\count($read) > 0) {
$data = \socket_read($this->sock, 1024); $data = \socket_read($this->sock, 1024);
var_dump($data); \var_dump($data);
/* Server no data */ /* Server no data */
if ($data === false) { if ($data === false) {

View File

@ -15,11 +15,10 @@ declare(strict_types=1);
namespace phpOMS\Socket\Server; namespace phpOMS\Socket\Server;
use phpOMS\Account\Account; use phpOMS\Account\Account;
use phpOMS\ApplicationAbstract;
use phpOMS\Message\Socket\PacketManager;
use phpOMS\Socket\Client\ClientConnection; use phpOMS\Socket\Client\ClientConnection;
use phpOMS\Socket\SocketAbstract; use phpOMS\Socket\SocketAbstract;
use phpOMS\Message\Socket\PacketManager;
use Socket\SocketApplication;
use phpOMS\ApplicationAbstract;
/** /**
* Server class. * Server class.

View File

@ -152,7 +152,7 @@ class Address implements \JsonSerializable
return [ return [
'recipient' => $this->recipient, 'recipient' => $this->recipient,
'fao' => $this->fao, 'fao' => $this->fao,
'location' => $this->location->toArray() 'location' => $this->location->toArray(),
]; ];
} }
} }

View File

@ -65,7 +65,7 @@ class Edge
* *
* @param Node $node1 Graph node (start node in case of directed edge) * @param Node $node1 Graph node (start node in case of directed edge)
* @param Node $node2 Graph node (end node in case of directed edge) * @param Node $node2 Graph node (end node in case of directed edge)
* @param float $weight Weight/cost of the edge. * @param float $weight weight/cost of the edge
* @param bool $isDirected Is directed edge * @param bool $isDirected Is directed edge
* *
* @since 1.0.0 * @since 1.0.0
@ -148,7 +148,7 @@ class Edge
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function compare(Edge $e1, Edge $e2) : int public static function compare(self $e1, self $e2) : int
{ {
return $e1->getWeight() <=> $e2->getWeight(); return $e1->getWeight() <=> $e2->getWeight();
} }

View File

@ -109,7 +109,7 @@ class Node
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function isEqual(Node $node) : bool public function isEqual(self $node) : bool
{ {
return $this->id === $node->getId() && $this->data === $node->getData(); return $this->id === $node->getId() && $this->data === $node->getData();
} }
@ -124,7 +124,7 @@ class Node
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setNodeRelative(Node $node, int $key = null) : Edge public function setNodeRelative(self $node, int $key = null) : Edge
{ {
$edge = new Edge($this, $node); $edge = new Edge($this, $node);
$this->setEdge($edge, $key); $this->setEdge($edge, $key);

View File

@ -59,7 +59,7 @@ final class Storage
{ {
if (isset(self::$registered[$env])) { if (isset(self::$registered[$env])) {
if (\is_string(self::$registered[$env])) { if (\is_string(self::$registered[$env])) {
$instance = new self::$registered[$env]; $instance = new self::$registered[$env]();
self::$registered[$env] = $instance; self::$registered[$env] = $instance;
} elseif (self::$registered[$env] instanceof StorageAbstract || self::$registered[$env] instanceof ContainerInterface) { } elseif (self::$registered[$env] instanceof StorageAbstract || self::$registered[$env] instanceof ContainerInterface) {
$instance = self::$registered[$env]; $instance = self::$registered[$env];

View File

@ -15,9 +15,9 @@ declare(strict_types=1);
namespace phpOMS\Utils\IO; namespace phpOMS\Utils\IO;
use phpOMS\Utils\IO\Csv\CsvInterface; use phpOMS\Utils\IO\Csv\CsvInterface;
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetInterface;
use phpOMS\Utils\IO\Json\JsonInterface; use phpOMS\Utils\IO\Json\JsonInterface;
use phpOMS\Utils\IO\Pdf\PdfInterface; use phpOMS\Utils\IO\Pdf\PdfInterface;
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetInterface;
/** /**
* Exchange interface. * Exchange interface.

View File

@ -534,7 +534,7 @@ class Interval implements \Serializable
'hour' => $this->hour, 'hour' => $this->hour,
'dayOfMonth' => $this->dayOfMonth, 'dayOfMonth' => $this->dayOfMonth,
'dayOfWeek' => $this->dayOfWeek, 'dayOfWeek' => $this->dayOfWeek,
'year' => $this->year 'year' => $this->year,
]); ]);
} }
@ -547,7 +547,7 @@ class Interval implements \Serializable
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function unserialize($serialized) public function unserialize($serialized): void
{ {
$data = \json_decode($serialized, true); $data = \json_decode($serialized, true);

View File

@ -34,7 +34,7 @@ class JobTest extends \PHPUnit\Framework\TestCase
self::assertEquals(3.0, $item->getValue()); self::assertEquals(3.0, $item->getValue());
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $item->getStart()->format('Y-m-d')); self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $item->getStart()->format('Y-m-d'));
self::assertEquals(null, $item->getEnd()); self::assertNull($item->getEnd());
self::assertEquals('abc', $item->getName()); self::assertEquals('abc', $item->getName());
} }
} }

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\JobScheduling; namespace phpOMS\tests\Algorithm\JobScheduling;
use phpOMS\Algorithm\JobScheduling\Weighted;
use phpOMS\Algorithm\JobScheduling\Job; use phpOMS\Algorithm\JobScheduling\Job;
use phpOMS\Algorithm\JobScheduling\Weighted;
/** /**
* @testdox phpOMS\tests\Algorithm\JobScheduling\WeightedTest: Job scheduling based on values/profit * @testdox phpOMS\tests\Algorithm\JobScheduling\WeightedTest: Job scheduling based on values/profit
@ -64,7 +64,7 @@ class WeightedTest extends \PHPUnit\Framework\TestCase
public function testSmallList() : void public function testSmallList() : void
{ {
$jobs = [ $jobs = [
new Job(20, new \DateTime('2003-01-01'), new \DateTime('2010-01-01'), 'A') new Job(20, new \DateTime('2003-01-01'), new \DateTime('2010-01-01'), 'A'),
]; ];
$filtered = WeighteD::solve($jobs); $filtered = WeighteD::solve($jobs);

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Knapsack; namespace phpOMS\tests\Algorithm\Knapsack;
use phpOMS\Algorithm\Knapsack\Bounded;
use phpOMS\Algorithm\Knapsack\Backpack; use phpOMS\Algorithm\Knapsack\Backpack;
use phpOMS\Algorithm\Knapsack\Bounded;
use phpOMS\Algorithm\Knapsack\Item; use phpOMS\Algorithm\Knapsack\Item;
/** /**

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Knapsack; namespace phpOMS\tests\Algorithm\Knapsack;
use phpOMS\Algorithm\Knapsack\Continuous;
use phpOMS\Algorithm\Knapsack\Backpack; use phpOMS\Algorithm\Knapsack\Backpack;
use phpOMS\Algorithm\Knapsack\Continuous;
use phpOMS\Algorithm\Knapsack\Item; use phpOMS\Algorithm\Knapsack\Item;
/** /**

View File

@ -42,7 +42,7 @@ class AStarNodeTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->node->isClosed()); self::assertFalse($this->node->isClosed());
self::assertFalse($this->node->isOpened()); self::assertFalse($this->node->isOpened());
self::assertEquals(0.0, $this->node->getG()); self::assertEquals(0.0, $this->node->getG());
self::assertEquals(null, $this->node->getH()); self::assertNull($this->node->getH());
self::assertEquals(0.0, $this->node->getF()); self::assertEquals(0.0, $this->node->getF());
} }

View File

@ -14,11 +14,11 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\PathFinding; namespace phpOMS\tests\Algorithm\PathFinding;
use phpOMS\Algorithm\PathFinding\Grid;
use phpOMS\Algorithm\PathFinding\MovementType;
use phpOMS\Algorithm\PathFinding\HeuristicType;
use phpOMS\Algorithm\PathFinding\AStarNode;
use phpOMS\Algorithm\PathFinding\AStar; use phpOMS\Algorithm\PathFinding\AStar;
use phpOMS\Algorithm\PathFinding\AStarNode;
use phpOMS\Algorithm\PathFinding\Grid;
use phpOMS\Algorithm\PathFinding\HeuristicType;
use phpOMS\Algorithm\PathFinding\MovementType;
require_once __DIR__ . '/../../Autoloader.php'; require_once __DIR__ . '/../../Autoloader.php';

View File

@ -35,7 +35,7 @@ class GridTest extends \PHPUnit\Framework\TestCase
public function testDefault() : void public function testDefault() : void
{ {
$grid = new Grid(); $grid = new Grid();
self::assertEquals(null, $grid->getNode(0, 0)); self::assertNull($grid->getNode(0, 0));
} }
/** /**
@ -95,10 +95,10 @@ class GridTest extends \PHPUnit\Framework\TestCase
[0, 9, 0], [0, 9, 0],
], Node::class); ], Node::class);
self::assertEquals(null, $grid->getNode(-1, 0)); self::assertNull($grid->getNode(-1, 0));
self::assertEquals(null, $grid->getNode(0, -1)); self::assertNull($grid->getNode(0, -1));
self::assertEquals(null, $grid->getNode(3, 0)); self::assertNull($grid->getNode(3, 0));
self::assertEquals(null, $grid->getNode(0, 3)); self::assertNull($grid->getNode(0, 3));
} }
/** /**

View File

@ -43,7 +43,7 @@ class JumpPointNodeTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->node->isOpened()); self::assertFalse($this->node->isOpened());
self::assertFalse($this->node->isTested()); self::assertFalse($this->node->isTested());
self::assertEquals(0.0, $this->node->getG()); self::assertEquals(0.0, $this->node->getG());
self::assertEquals(null, $this->node->getH()); self::assertNull($this->node->getH());
self::assertEquals(0.0, $this->node->getF()); self::assertEquals(0.0, $this->node->getF());
} }

View File

@ -15,10 +15,10 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\PathFinding; namespace phpOMS\tests\Algorithm\PathFinding;
use phpOMS\Algorithm\PathFinding\Grid; use phpOMS\Algorithm\PathFinding\Grid;
use phpOMS\Algorithm\PathFinding\MovementType;
use phpOMS\Algorithm\PathFinding\HeuristicType; use phpOMS\Algorithm\PathFinding\HeuristicType;
use phpOMS\Algorithm\PathFinding\JumpPointNode; use phpOMS\Algorithm\PathFinding\JumpPointNode;
use phpOMS\Algorithm\PathFinding\JumpPointSearch; use phpOMS\Algorithm\PathFinding\JumpPointSearch;
use phpOMS\Algorithm\PathFinding\MovementType;
require_once __DIR__ . '/../../Autoloader.php'; require_once __DIR__ . '/../../Autoloader.php';

View File

@ -38,7 +38,7 @@ class NodeTest extends \PHPUnit\Framework\TestCase
self::assertEquals(2, $node->getY()); self::assertEquals(2, $node->getY());
self::assertEquals(['x' => 1, 'y' => 2], $node->getCoordinates()); self::assertEquals(['x' => 1, 'y' => 2], $node->getCoordinates());
self::assertEquals(3.0, $node->getWeight()); self::assertEquals(3.0, $node->getWeight());
self::assertEquals(null, $node->getParent()); self::assertNull($node->getParent());
self::assertFalse($node->isWalkable()); self::assertFalse($node->isWalkable());
} }

View File

@ -81,7 +81,7 @@ class IntroSortTest extends \PHPUnit\Framework\TestCase
new NumericElement(35), new NumericElement(11), new NumericElement(35), new NumericElement(4), new NumericElement(25), new NumericElement(11), new NumericElement(80), new NumericElement(35), new NumericElement(11), new NumericElement(35), new NumericElement(4), new NumericElement(25), new NumericElement(11), new NumericElement(80),
new NumericElement(22), new NumericElement(94), new NumericElement(4), new NumericElement(30), new NumericElement(6), new NumericElement(66), new NumericElement(11), new NumericElement(22), new NumericElement(94), new NumericElement(4), new NumericElement(30), new NumericElement(6), new NumericElement(66), new NumericElement(11),
new NumericElement(4), new NumericElement(80), new NumericElement(2), new NumericElement(80), new NumericElement(25), new NumericElement(0), new NumericElement(45), new NumericElement(4), new NumericElement(80), new NumericElement(2), new NumericElement(80), new NumericElement(25), new NumericElement(0), new NumericElement(45),
new NumericElement(55), new NumericElement(25) new NumericElement(55), new NumericElement(25),
]; ];
$newList = IntroSort::sort($list); $newList = IntroSort::sort($list);

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\StoogeSort;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
use phpOMS\Algorithm\Sort\StoogeSort;
require_once __DIR__ . '/../../Autoloader.php'; require_once __DIR__ . '/../../Autoloader.php';

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\TimSort;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
use phpOMS\Algorithm\Sort\TimSort;
require_once __DIR__ . '/../../Autoloader.php'; require_once __DIR__ . '/../../Autoloader.php';
@ -81,7 +81,7 @@ class TimSortTest extends \PHPUnit\Framework\TestCase
new NumericElement(35), new NumericElement(11), new NumericElement(35), new NumericElement(4), new NumericElement(25), new NumericElement(11), new NumericElement(80), new NumericElement(35), new NumericElement(11), new NumericElement(35), new NumericElement(4), new NumericElement(25), new NumericElement(11), new NumericElement(80),
new NumericElement(22), new NumericElement(94), new NumericElement(4), new NumericElement(30), new NumericElement(6), new NumericElement(66), new NumericElement(11), new NumericElement(22), new NumericElement(94), new NumericElement(4), new NumericElement(30), new NumericElement(6), new NumericElement(66), new NumericElement(11),
new NumericElement(4), new NumericElement(80), new NumericElement(2), new NumericElement(80), new NumericElement(25), new NumericElement(0), new NumericElement(45), new NumericElement(4), new NumericElement(80), new NumericElement(2), new NumericElement(80), new NumericElement(25), new NumericElement(0), new NumericElement(45),
new NumericElement(55), new NumericElement(25) new NumericElement(55), new NumericElement(25),
]; ];
$newList = TimSort::sort($list); $newList = TimSort::sort($list);

View File

@ -26,4 +26,3 @@ class SelectTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new Select($GLOBALS['dbpool']->get())); self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new Select($GLOBALS['dbpool']->get()));
} }
} }

View File

@ -151,7 +151,7 @@ class PolygonTest extends \PHPUnit\Framework\TestCase
* @covers phpOMS\Math\Geometry\Shape\D2\Polygon * @covers phpOMS\Math\Geometry\Shape\D2\Polygon
* @group framework * @group framework
*/ */
public function testRegularAreaByLength() public function testRegularAreaByLength(): void
{ {
self::assertEqualsWithDelta(3 * 3, Polygon::getRegularAreaByLength(3.0, 4), 0.01); self::assertEqualsWithDelta(3 * 3, Polygon::getRegularAreaByLength(3.0, 4), 0.01);
} }
@ -161,7 +161,7 @@ class PolygonTest extends \PHPUnit\Framework\TestCase
* @covers phpOMS\Math\Geometry\Shape\D2\Polygon * @covers phpOMS\Math\Geometry\Shape\D2\Polygon
* @group framework * @group framework
*/ */
public function testRegularAreaByRadius() public function testRegularAreaByRadius(): void
{ {
self::assertEqualsWithDelta(3 * 3 , Polygon::getRegularAreaByRadius(1.5, 4), 0.01); self::assertEqualsWithDelta(3 * 3 , Polygon::getRegularAreaByRadius(1.5, 4), 0.01);
} }

View File

@ -48,7 +48,7 @@ class PrismTest extends \PHPUnit\Framework\TestCase
* @covers phpOMS\Math\Geometry\Shape\D3\Prism * @covers phpOMS\Math\Geometry\Shape\D3\Prism
* @group framework * @group framework
*/ */
public function testSurface() public function testSurface(): void
{ {
self::assertEqualsWithDelta(3 * 3 * 2 + 3 * 12 * 4, Prism::getSurfaceRegularLength(3, 4, 12), 0.01); self::assertEqualsWithDelta(3 * 3 * 2 + 3 * 12 * 4, Prism::getSurfaceRegularLength(3, 4, 12), 0.01);
} }

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace phpOMS\tests\Math\Statistic\Forecast; namespace phpOMS\tests\Math\Statistic\Forecast;
use phpOMS\Math\Statistic\Correlation;
use phpOMS\Math\Statistic\Forecast\Error; use phpOMS\Math\Statistic\Forecast\Error;
use phpOMS\Math\Statistic\MeasureOfDispersion; use phpOMS\Math\Statistic\MeasureOfDispersion;

View File

@ -14,8 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\Math\Statistic\Forecast\Regression; namespace phpOMS\tests\Math\Statistic\Forecast\Regression;
use phpOMS\Math\Statistic\Forecast\Regression\LevelLevelRegression;
use phpOMS\Math\Statistic\Forecast\Error; use phpOMS\Math\Statistic\Forecast\Error;
use phpOMS\Math\Statistic\Forecast\Regression\LevelLevelRegression;
use phpOMS\Math\Stochastic\Distribution\TDistribution; use phpOMS\Math\Stochastic\Distribution\TDistribution;
/** /**

View File

@ -16,9 +16,9 @@ namespace phpOMS\tests\Module;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Message\Http\Request;
use phpOMS\Module\ModuleManager; use phpOMS\Module\ModuleManager;
use phpOMS\Router\WebRouter; use phpOMS\Router\WebRouter;
use phpOMS\Message\Http\Request;
use phpOMS\Uri\Http; use phpOMS\Uri\Http;
require_once __DIR__ . '/../Autoloader.php'; require_once __DIR__ . '/../Autoloader.php';
@ -145,9 +145,9 @@ class ModuleManagerTest extends \PHPUnit\Framework\TestCase
/** /**
* @testdox A module can be installed and its status can be changed * @testdox A module can be installed and its status can be changed
* @covers phpOMS\Module\InstallerAbstract
* @covers phpOMS\Module\ModuleManager * @covers phpOMS\Module\ModuleManager
* @covers phpOMS\Module\StatusAbstract * @covers phpOMS\Module\StatusAbstract
* @covers phpOMS\Module\InstallerAbstract
* @group framework * @group framework
*/ */
public function testStatus() : void public function testStatus() : void

View File

@ -19,11 +19,11 @@ use Modules\Admin\Models\PermissionState;
use phpOMS\Account\Account; use phpOMS\Account\Account;
use phpOMS\Account\PermissionAbstract; use phpOMS\Account\PermissionAbstract;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
use phpOMS\Message\Http\Request;
use phpOMS\Router\WebRouter;
use phpOMS\Router\RouteVerb;
use phpOMS\Uri\Http;
use phpOMS\Autoloader; use phpOMS\Autoloader;
use phpOMS\Message\Http\Request;
use phpOMS\Router\RouteVerb;
use phpOMS\Router\WebRouter;
use phpOMS\Uri\Http;
require_once __DIR__ . '/../Autoloader.php'; require_once __DIR__ . '/../Autoloader.php';

View File

@ -17,6 +17,7 @@ namespace phpOMS\tests\Socket\Client;
use Model\CoreSettings; use Model\CoreSettings;
use phpOMS\Account\AccountManager; use phpOMS\Account\AccountManager;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
use phpOMS\Autoloader;
use phpOMS\DataStorage\Cache\CachePool; use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager; use phpOMS\Event\EventManager;
@ -25,7 +26,6 @@ use phpOMS\Log\FileLogger;
use phpOMS\Module\ModuleManager; use phpOMS\Module\ModuleManager;
use phpOMS\Router\SocketRouter; use phpOMS\Router\SocketRouter;
use phpOMS\Socket\Client\Client; use phpOMS\Socket\Client\Client;
use phpOMS\Autoloader;
/** /**
* @internal * @internal
@ -92,7 +92,7 @@ class ClientTest extends \PHPUnit\Framework\TestCase
$socket->addPacket('help' . "\r"); $socket->addPacket('help' . "\r");
$socket->addPacket('shutdown' . "\r"); $socket->addPacket('shutdown' . "\r");
$this->app->router->add('^shutdown$', function() use ($socket) { $socket->shutdown(); }); $this->app->router->add('^shutdown$', function() use ($socket): void { $socket->shutdown(); });
$socket->run(); $socket->run();

View File

@ -14,20 +14,20 @@ declare(strict_types=1);
namespace phpOMS\tests\Socket\Client; namespace phpOMS\tests\Socket\Client;
use phpOMS\Socket\Server\Server;
use Model\CoreSettings; use Model\CoreSettings;
use phpOMS\Account\AccountManager; use phpOMS\Account\AccountManager;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
use phpOMS\DataStorage\Cache\CachePool; use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Session\HttpSession;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager; use phpOMS\Event\EventManager;
use phpOMS\Localization\L11nManager; use phpOMS\Localization\L11nManager;
use phpOMS\Log\FileLogger; use phpOMS\Log\FileLogger;
use phpOMS\Module\ModuleManager; use phpOMS\Module\ModuleManager;
use phpOMS\Router\SocketRouter; use phpOMS\Router\SocketRouter;
use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\Socket\Server\Server;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Session\HttpSession;
require_once __DIR__ . '/../../../Autoloader.php'; require_once __DIR__ . '/../../../Autoloader.php';
$config = require_once __DIR__ . '/../../../../config.php'; $config = require_once __DIR__ . '/../../../../config.php';
@ -66,6 +66,6 @@ $socket = new Server($app);
$socket->create('127.0.0.1', $config['socket']['master']['port']); $socket->create('127.0.0.1', $config['socket']['master']['port']);
$socket->setLimit(1); $socket->setLimit(1);
$app->router->add('^shutdown$', function($app, $request) use ($socket) { $socket->shutdown($request); }); $app->router->add('^shutdown$', function($app, $request) use ($socket): void { $socket->shutdown($request); });
$socket->run(); $socket->run();

View File

@ -17,15 +17,15 @@ namespace phpOMS\tests\Socket\Server;
use Model\CoreSettings; use Model\CoreSettings;
use phpOMS\Account\AccountManager; use phpOMS\Account\AccountManager;
use phpOMS\ApplicationAbstract; use phpOMS\ApplicationAbstract;
use phpOMS\Autoloader;
use phpOMS\DataStorage\Cache\CachePool; use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\Dispatcher\Dispatcher; use phpOMS\Dispatcher\Dispatcher;
use phpOMS\Event\EventManager; use phpOMS\Event\EventManager;
use phpOMS\Localization\L11nManager; use phpOMS\Localization\L11nManager;
use phpOMS\Log\FileLogger; use phpOMS\Log\FileLogger;
use phpOMS\Module\ModuleManager; use phpOMS\Module\ModuleManager;
use phpOMS\Socket\Server\Server;
use phpOMS\Router\SocketRouter; use phpOMS\Router\SocketRouter;
use phpOMS\Autoloader; use phpOMS\Socket\Server\Server;
/** /**
* @internal * @internal
@ -85,7 +85,7 @@ class ServerTest extends \PHPUnit\Framework\TestCase
$socket->create('127.0.0.1', $GLOBALS['CONFIG']['socket']['master']['port']); $socket->create('127.0.0.1', $GLOBALS['CONFIG']['socket']['master']['port']);
$socket->setLimit(1); $socket->setLimit(1);
$this->app->router->add('^shutdown$', function($app, $request) use ($socket) { $socket->shutdown($request); }); $this->app->router->add('^shutdown$', function($app, $request) use ($socket): void { $socket->shutdown($request); });
$socket->run(); $socket->run();

View File

@ -14,8 +14,6 @@ declare(strict_types=1);
namespace phpOMS\tests\Socket\Server; namespace phpOMS\tests\Socket\Server;
use phpOMS\Socket\Client\Client;
require_once __DIR__ . '/../../../Autoloader.php'; require_once __DIR__ . '/../../../Autoloader.php';
$config = require_once __DIR__ . '/../../../../config.php'; $config = require_once __DIR__ . '/../../../../config.php';

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace phpOMS\tests\Utils\Encoding; namespace phpOMS\tests\Utils\Encoding;
use phpOMS\Utils\Encoding\XorEncoding; use phpOMS\Utils\Encoding\XorEncoding;
use phpOMS\Utils\RnG\StringUtils;
/** /**
* @testdox phpOMS\tests\Utils\Encoding\XorEncodingTest: XOR text encoding/decoding * @testdox phpOMS\tests\Utils\Encoding\XorEncodingTest: XOR text encoding/decoding

View File

@ -14,11 +14,11 @@ declare(strict_types=1);
namespace phpOMS\tests\Utils\IO\Spreadsheet; namespace phpOMS\tests\Utils\IO\Spreadsheet;
use phpOMS\Autoloader;
use phpOMS\DataStorage\Database\Connection\SQLiteConnection; use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapper; use phpOMS\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapper;
use phpOMS\Utils\StringUtils; use phpOMS\Utils\StringUtils;
use phpOMS\Autoloader;
/** /**
* @testdox phpOMS\tests\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapperTest: Spreadsheet database mapper * @testdox phpOMS\tests\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapperTest: Spreadsheet database mapper

View File

@ -34,7 +34,7 @@ class IntervalTest extends \PHPUnit\Framework\TestCase
$interval = new Interval($dt); $interval = new Interval($dt);
self::assertEquals($dt->format('Y-m-d'), $interval->getStart()->format('Y-m-d')); self::assertEquals($dt->format('Y-m-d'), $interval->getStart()->format('Y-m-d'));
self::assertEquals(null, $interval->getEnd()); self::assertNull($interval->getEnd());
self::assertEquals(0, $interval->getMaxDuration()); self::assertEquals(0, $interval->getMaxDuration());
self::assertEquals([], $interval->getMinute()); self::assertEquals([], $interval->getMinute());
self::assertEquals([], $interval->getHour()); self::assertEquals([], $interval->getHour());

View File

@ -246,7 +246,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
{ {
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response()); $view = new View($this->app, $request = new Request(new Http('')), $response = new Response());
self::assertEquals(false, $view->getView('test')); self::assertFalse($view->getView('test'));
} }
/** /**