mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-18 01:18:40 +00:00
phpcs fix
This commit is contained in:
parent
65d76e11ea
commit
a49251c0bb
|
|
@ -61,7 +61,7 @@ final class Kmeans
|
|||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ final class Bounded
|
|||
for ($j = 0; $j <= $maxCost; ++$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) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ final class Bounded
|
|||
$value = (int) $items[$i - 1]['item']->getValue();
|
||||
|
||||
for ($k = 0; $v !== $m[$i - 1][$j] + $k * $value; ++$k) {
|
||||
$s++;
|
||||
++$s;
|
||||
$j -= (int) $items[$i - 1]['item']->getCost();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ final class Continuous
|
|||
*/
|
||||
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();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class Node
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setParent(?Node $node) : void
|
||||
public function setParent(?self $node) : void
|
||||
{
|
||||
$this->parent = $node;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ class Node
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getParent() : ?Node
|
||||
public function getParent() : ?self
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ class Node
|
|||
*
|
||||
* @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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ declare(strict_types=1);
|
|||
|
||||
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\Localization\L11nManager;
|
||||
use phpOMS\Localization\Localization;
|
||||
use phpOMS\Config\SettingsAbstract;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Config;
|
||||
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
|
||||
/**
|
||||
* Settings class.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace phpOMS\DataStorage\Cache\Connection;
|
|||
|
||||
use phpOMS\DataStorage\Cache\CacheStatus;
|
||||
use phpOMS\DataStorage\Cache\CacheType;
|
||||
use phpOMS\DataStorage\Cache\Connection\CacheValueType;
|
||||
|
||||
/**
|
||||
* Cache handler.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use phpOMS\DataStorage\Cache\CacheStatus;
|
|||
use phpOMS\DataStorage\Cache\CacheType;
|
||||
use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException;
|
||||
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||
use phpOMS\DataStorage\Cache\Connection\CacheValueType;
|
||||
|
||||
/**
|
||||
* RedisCache class.
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\DataStorage\Database;
|
||||
|
||||
use phpOMS\DataStorage\Database\Query\QueryType;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Query\QueryType;
|
||||
|
||||
/**
|
||||
* Database query builder.
|
||||
|
|
|
|||
|
|
@ -1030,8 +1030,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
try {
|
||||
self::$db->con->prepare($relQuery->toSql())->execute();
|
||||
} catch (\Throwable $e) {
|
||||
var_dump($e->getMessage());
|
||||
var_dump($relQuery->toSql());
|
||||
\var_dump($e->getMessage());
|
||||
\var_dump($relQuery->toSql());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\DataStorage\Database;
|
||||
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
|
||||
use phpOMS\DataStorage\Database\Connection\NullConnection;
|
||||
use phpOMS\DataStorage\DataStorageConnectionInterface;
|
||||
use phpOMS\DataStorage\DataStoragePoolInterface;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
|
||||
/**
|
||||
* Database pool handler.
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
|
|||
{
|
||||
$file = $this->savePath . '/sess_' . $id;
|
||||
if (\file_exists($file)) {
|
||||
unlink($file);
|
||||
\unlink($file);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -153,7 +153,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
|
|||
*/
|
||||
public function gc($maxlifetime)
|
||||
{
|
||||
$files = \glob("$this->savePath/sess_*");
|
||||
$files = \glob("{$this->savePath}/sess_*");
|
||||
|
||||
if ($files === false) {
|
||||
return false;
|
||||
|
|
@ -161,7 +161,7 @@ final class ConsoleSessionHandler implements \SessionHandlerInterface, \SessionI
|
|||
|
||||
foreach ($files as $file) {
|
||||
if (\filemtime($file) + $maxlifetime < \time() && \file_exists($file)) {
|
||||
unlink($file);
|
||||
\unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Math\Statistic\Forecast\Regression;
|
||||
|
||||
use phpOMS\Math\Statistic\Average;
|
||||
use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
|
||||
use phpOMS\Math\Statistic\Average;
|
||||
|
||||
/**
|
||||
* Regression class.
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ final class LogNormalDistribution
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ final class ParetoDistribution
|
|||
{
|
||||
return [
|
||||
[$alpha / $xm ** 2, -1 / $xm],
|
||||
[-1 / $xm, 1 / ($alpha ** 2)]
|
||||
[-1 / $xm, 1 / ($alpha ** 2)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ namespace phpOMS\Math\Stochastic\Distribution;
|
|||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class ZTest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ final class NaiveBayesClassifier
|
|||
* \exp(-($toMatch[$attr] - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
|
||||
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count']);
|
||||
} else {
|
||||
if (!isset( $this->probabilities['attr'][$attr])) {
|
||||
if (!isset($this->probabilities['attr'][$attr])) {
|
||||
$this->probabilities['attr'][$attr] = ['data' => []];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Message\Socket;
|
||||
|
||||
use phpOMS\Socket\Server\ClientManager;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Router\SocketRouter;
|
||||
use phpOMS\Message\Socket\Request;
|
||||
use phpOMS\Message\Socket\Response;
|
||||
|
||||
/**
|
||||
* Server class.
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Message\Socket;
|
||||
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
/**
|
||||
* Response class.
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ abstract class ModuleAbstract
|
|||
*/
|
||||
public function __construct(ApplicationAbstract $app = null)
|
||||
{
|
||||
$this->app = $app ?? new class extends ApplicationAbstract {};
|
||||
$this->app = $app ?? new class() extends ApplicationAbstract {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ declare(strict_types=1);
|
|||
namespace phpOMS\Module;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
|
||||
|
||||
/**
|
||||
* Uninstaller abstract class.
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Socket\Client;
|
||||
|
||||
use phpOMS\Socket\SocketAbstract;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Socket\Server\ClientManager;
|
||||
use phpOMS\Message\Socket\PacketManager;
|
||||
use phpOMS\Socket\Server\ClientManager;
|
||||
use phpOMS\Socket\SocketAbstract;
|
||||
|
||||
/**
|
||||
* Client socket class.
|
||||
|
|
@ -107,7 +107,7 @@ class Client extends SocketAbstract
|
|||
if (\count($read) > 0) {
|
||||
$data = \socket_read($this->sock, 1024);
|
||||
|
||||
var_dump($data);
|
||||
\var_dump($data);
|
||||
|
||||
/* Server no data */
|
||||
if ($data === false) {
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@ declare(strict_types=1);
|
|||
namespace phpOMS\Socket\Server;
|
||||
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Message\Socket\PacketManager;
|
||||
use phpOMS\Socket\Client\ClientConnection;
|
||||
use phpOMS\Socket\SocketAbstract;
|
||||
use phpOMS\Message\Socket\PacketManager;
|
||||
use Socket\SocketApplication;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* Server class.
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class Address implements \JsonSerializable
|
|||
return [
|
||||
'recipient' => $this->recipient,
|
||||
'fao' => $this->fao,
|
||||
'location' => $this->location->toArray()
|
||||
'location' => $this->location->toArray(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class 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 float $weight Weight/cost of the edge.
|
||||
* @param float $weight weight/cost of the edge
|
||||
* @param bool $isDirected Is directed edge
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -148,7 +148,7 @@ class Edge
|
|||
*
|
||||
* @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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class Node
|
|||
*
|
||||
* @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();
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ class Node
|
|||
*
|
||||
* @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);
|
||||
$this->setEdge($edge, $key);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ final class Storage
|
|||
{
|
||||
if (isset(self::$registered[$env])) {
|
||||
if (\is_string(self::$registered[$env])) {
|
||||
$instance = new self::$registered[$env];
|
||||
$instance = new self::$registered[$env]();
|
||||
self::$registered[$env] = $instance;
|
||||
} elseif (self::$registered[$env] instanceof StorageAbstract || self::$registered[$env] instanceof ContainerInterface) {
|
||||
$instance = self::$registered[$env];
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ declare(strict_types=1);
|
|||
namespace phpOMS\Utils\IO;
|
||||
|
||||
use phpOMS\Utils\IO\Csv\CsvInterface;
|
||||
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetInterface;
|
||||
use phpOMS\Utils\IO\Json\JsonInterface;
|
||||
use phpOMS\Utils\IO\Pdf\PdfInterface;
|
||||
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetInterface;
|
||||
|
||||
/**
|
||||
* Exchange interface.
|
||||
|
|
|
|||
|
|
@ -534,7 +534,7 @@ class Interval implements \Serializable
|
|||
'hour' => $this->hour,
|
||||
'dayOfMonth' => $this->dayOfMonth,
|
||||
'dayOfWeek' => $this->dayOfWeek,
|
||||
'year' => $this->year
|
||||
'year' => $this->year,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -547,7 +547,7 @@ class Interval implements \Serializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
public function unserialize($serialized): void
|
||||
{
|
||||
$data = \json_decode($serialized, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class JobTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(3.0, $item->getValue());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Algorithm\JobScheduling;
|
||||
|
||||
use phpOMS\Algorithm\JobScheduling\Weighted;
|
||||
use phpOMS\Algorithm\JobScheduling\Job;
|
||||
use phpOMS\Algorithm\JobScheduling\Weighted;
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$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);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Bounded;
|
||||
use phpOMS\Algorithm\Knapsack\Backpack;
|
||||
use phpOMS\Algorithm\Knapsack\Bounded;
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Continuous;
|
||||
use phpOMS\Algorithm\Knapsack\Backpack;
|
||||
use phpOMS\Algorithm\Knapsack\Continuous;
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class AStarNodeTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($this->node->isClosed());
|
||||
self::assertFalse($this->node->isOpened());
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ declare(strict_types=1);
|
|||
|
||||
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\AStarNode;
|
||||
use phpOMS\Algorithm\PathFinding\Grid;
|
||||
use phpOMS\Algorithm\PathFinding\HeuristicType;
|
||||
use phpOMS\Algorithm\PathFinding\MovementType;
|
||||
|
||||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class GridTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDefault() : void
|
||||
{
|
||||
$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],
|
||||
], Node::class);
|
||||
|
||||
self::assertEquals(null, $grid->getNode(-1, 0));
|
||||
self::assertEquals(null, $grid->getNode(0, -1));
|
||||
self::assertEquals(null, $grid->getNode(3, 0));
|
||||
self::assertEquals(null, $grid->getNode(0, 3));
|
||||
self::assertNull($grid->getNode(-1, 0));
|
||||
self::assertNull($grid->getNode(0, -1));
|
||||
self::assertNull($grid->getNode(3, 0));
|
||||
self::assertNull($grid->getNode(0, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class JumpPointNodeTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($this->node->isOpened());
|
||||
self::assertFalse($this->node->isTested());
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ declare(strict_types=1);
|
|||
namespace phpOMS\tests\Algorithm\PathFinding;
|
||||
|
||||
use phpOMS\Algorithm\PathFinding\Grid;
|
||||
use phpOMS\Algorithm\PathFinding\MovementType;
|
||||
use phpOMS\Algorithm\PathFinding\HeuristicType;
|
||||
use phpOMS\Algorithm\PathFinding\JumpPointNode;
|
||||
use phpOMS\Algorithm\PathFinding\JumpPointSearch;
|
||||
use phpOMS\Algorithm\PathFinding\MovementType;
|
||||
|
||||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class NodeTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(2, $node->getY());
|
||||
self::assertEquals(['x' => 1, 'y' => 2], $node->getCoordinates());
|
||||
self::assertEquals(3.0, $node->getWeight());
|
||||
self::assertEquals(null, $node->getParent());
|
||||
self::assertNull($node->getParent());
|
||||
self::assertFalse($node->isWalkable());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(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(55), new NumericElement(25)
|
||||
new NumericElement(55), new NumericElement(25),
|
||||
];
|
||||
|
||||
$newList = IntroSort::sort($list);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Algorithm\Sort;
|
||||
|
||||
use phpOMS\Algorithm\Sort\StoogeSort;
|
||||
use phpOMS\Algorithm\Sort\SortOrder;
|
||||
use phpOMS\Algorithm\Sort\StoogeSort;
|
||||
|
||||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Algorithm\Sort;
|
||||
|
||||
use phpOMS\Algorithm\Sort\TimSort;
|
||||
use phpOMS\Algorithm\Sort\SortOrder;
|
||||
use phpOMS\Algorithm\Sort\TimSort;
|
||||
|
||||
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(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(55), new NumericElement(25)
|
||||
new NumericElement(55), new NumericElement(25),
|
||||
];
|
||||
|
||||
$newList = TimSort::sort($list);
|
||||
|
|
|
|||
|
|
@ -26,4 +26,3 @@ class SelectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Builder', new Select($GLOBALS['dbpool']->get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class PolygonTest extends \PHPUnit\Framework\TestCase
|
|||
* @covers phpOMS\Math\Geometry\Shape\D2\Polygon
|
||||
* @group framework
|
||||
*/
|
||||
public function testRegularAreaByLength()
|
||||
public function testRegularAreaByLength(): void
|
||||
{
|
||||
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
|
||||
* @group framework
|
||||
*/
|
||||
public function testRegularAreaByRadius()
|
||||
public function testRegularAreaByRadius(): void
|
||||
{
|
||||
self::assertEqualsWithDelta(3 * 3 , Polygon::getRegularAreaByRadius(1.5, 4), 0.01);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class PrismTest extends \PHPUnit\Framework\TestCase
|
|||
* @covers phpOMS\Math\Geometry\Shape\D3\Prism
|
||||
* @group framework
|
||||
*/
|
||||
public function testSurface()
|
||||
public function testSurface(): void
|
||||
{
|
||||
self::assertEqualsWithDelta(3 * 3 * 2 + 3 * 12 * 4, Prism::getSurfaceRegularLength(3, 4, 12), 0.01);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Math\Statistic\Forecast;
|
||||
|
||||
use phpOMS\Math\Statistic\Correlation;
|
||||
use phpOMS\Math\Statistic\Forecast\Error;
|
||||
use phpOMS\Math\Statistic\MeasureOfDispersion;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
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\Regression\LevelLevelRegression;
|
||||
use phpOMS\Math\Stochastic\Distribution\TDistribution;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ namespace phpOMS\tests\Module;
|
|||
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Message\Http\Request;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Message\Http\Request;
|
||||
use phpOMS\Uri\Http;
|
||||
|
||||
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
|
||||
* @covers phpOMS\Module\InstallerAbstract
|
||||
* @covers phpOMS\Module\ModuleManager
|
||||
* @covers phpOMS\Module\StatusAbstract
|
||||
* @covers phpOMS\Module\InstallerAbstract
|
||||
* @group framework
|
||||
*/
|
||||
public function testStatus() : void
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ use Modules\Admin\Models\PermissionState;
|
|||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\PermissionAbstract;
|
||||
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\Message\Http\Request;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Uri\Http;
|
||||
|
||||
require_once __DIR__ . '/../Autoloader.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace phpOMS\tests\Socket\Client;
|
|||
use Model\CoreSettings;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
|
|
@ -25,7 +26,6 @@ use phpOMS\Log\FileLogger;
|
|||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\SocketRouter;
|
||||
use phpOMS\Socket\Client\Client;
|
||||
use phpOMS\Autoloader;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -92,7 +92,7 @@ class ClientTest extends \PHPUnit\Framework\TestCase
|
|||
$socket->addPacket('help' . "\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();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Socket\Client;
|
||||
|
||||
use phpOMS\Socket\Server\Server;
|
||||
use Model\CoreSettings;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
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\Event\EventManager;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Log\FileLogger;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\SocketRouter;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Socket\Server\Server;
|
||||
|
||||
require_once __DIR__ . '/../../../Autoloader.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->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();
|
||||
|
|
@ -17,15 +17,15 @@ namespace phpOMS\tests\Socket\Server;
|
|||
use Model\CoreSettings;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\DataStorage\Cache\CachePool;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Localization\L11nManager;
|
||||
use phpOMS\Log\FileLogger;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Socket\Server\Server;
|
||||
use phpOMS\Router\SocketRouter;
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\Socket\Server\Server;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -85,7 +85,7 @@ class ServerTest extends \PHPUnit\Framework\TestCase
|
|||
$socket->create('127.0.0.1', $GLOBALS['CONFIG']['socket']['master']['port']);
|
||||
$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();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Socket\Server;
|
||||
|
||||
use phpOMS\Socket\Client\Client;
|
||||
|
||||
require_once __DIR__ . '/../../../Autoloader.php';
|
||||
$config = require_once __DIR__ . '/../../../../config.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
|||
namespace phpOMS\tests\Utils\Encoding;
|
||||
|
||||
use phpOMS\Utils\Encoding\XorEncoding;
|
||||
use phpOMS\Utils\RnG\StringUtils;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Utils\Encoding\XorEncodingTest: XOR text encoding/decoding
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\tests\Utils\IO\Spreadsheet;
|
||||
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapper;
|
||||
use phpOMS\Utils\StringUtils;
|
||||
use phpOMS\Autoloader;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Utils\IO\Spreadsheet\SpreadsheetDatabaseMapperTest: Spreadsheet database mapper
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class IntervalTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$interval = new Interval($dt);
|
||||
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([], $interval->getMinute());
|
||||
self::assertEquals([], $interval->getHour());
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response());
|
||||
|
||||
self::assertEquals(false, $view->getView('test'));
|
||||
self::assertFalse($view->getView('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user