mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
phpstan fixes
This commit is contained in:
parent
e7385fdf9d
commit
e4531d3726
|
|
@ -23,7 +23,7 @@ namespace phpOMS;
|
|||
*
|
||||
* @property string $appName
|
||||
* @property \phpOMS\DataStorage\Database\DatabasePool $dbPool
|
||||
* @property \phpOMS\Localization\L11nManager 4l11nManager
|
||||
* @property \phpOMS\Localization\L11nManager $l11nManager
|
||||
* @property \phpOMS\Router\Router $router
|
||||
* @property \phpOMS\DataStorage\Session\SessionInterface $sessionManager
|
||||
* @property \phpOMS\Module\ModuleManager $moduleManager
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace phpOMS\DataStorage\Cache;
|
|||
use phpOMS\DataStorage\DataStoragePoolInterface;
|
||||
use phpOMS\DataStorage\DataStorageConnectionInterface;
|
||||
use phpOMS\DataStorage\Cache\Connection\ConnectionFactory;
|
||||
use phpOMS\DataStorage\Cache\Connection\NullCache;
|
||||
|
||||
/**
|
||||
* Cache class.
|
||||
|
|
@ -51,7 +52,7 @@ class CachePool implements DataStoragePoolInterface
|
|||
/**
|
||||
* Add database.
|
||||
*
|
||||
* @param mixed $key Database key
|
||||
* @param string $key Database key
|
||||
* @param DataStorageConnectionInterface $cache Cache
|
||||
*
|
||||
* @return bool
|
||||
|
|
@ -72,7 +73,7 @@ class CachePool implements DataStoragePoolInterface
|
|||
/**
|
||||
* Remove database.
|
||||
*
|
||||
* @param mixed $key Database key
|
||||
* @param string $key Database key
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
|
|
@ -94,14 +95,14 @@ class CachePool implements DataStoragePoolInterface
|
|||
*
|
||||
* @param string $key Cache to request
|
||||
*
|
||||
* @return \phpOMS\DataStorage\Cache\CacheInterface
|
||||
* @return DataStorageConnectionInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get(string $key = '') /* : ?CacheInterface */
|
||||
public function get(string $key = '') : DataStorageConnectionInterface
|
||||
{
|
||||
if ((!empty($key) && !isset($this->pool[$key])) || empty($this->pool)) {
|
||||
return null;
|
||||
return new NullCache();
|
||||
}
|
||||
|
||||
if (empty($key)) {
|
||||
|
|
@ -114,8 +115,8 @@ class CachePool implements DataStoragePoolInterface
|
|||
/**
|
||||
* Create Cache.
|
||||
*
|
||||
* @param mixed $key Database key
|
||||
* @param array $config Database config data
|
||||
* @param string $key Database key
|
||||
* @param array $config Database config data
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ interface DataStoragePoolInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get(string $key = '');
|
||||
public function get(string $key = '') : DataStorageConnectionInterface;
|
||||
|
||||
/**
|
||||
* Remove connection.
|
||||
|
|
|
|||
|
|
@ -119,4 +119,13 @@ abstract class BuilderAbstract
|
|||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsing to sql string.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract public function toSql() : string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -682,6 +682,17 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create has one
|
||||
*
|
||||
* @param string $propertyName Property name to initialize
|
||||
* @param Object $obj Object to create
|
||||
*
|
||||
* @return mixed
|
||||
* @todo implement???
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createHasOne(\ReflectionClass $reflectionClass, $obj)
|
||||
{
|
||||
throw new \Exception();
|
||||
|
|
@ -2431,16 +2442,13 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
$query->select($value['table'] . '.' . $src)
|
||||
->from($value['table'])
|
||||
->where($value['table'] . '.' . $value['dst'], '=', $primaryKey);
|
||||
} elseif ($relations === RelationType::NEWEST) {
|
||||
/*
|
||||
} /*elseif ($relations === RelationType::NEWEST) {
|
||||
SELECT c.*, p1.*
|
||||
FROM customer c
|
||||
JOIN purchase p1 ON (c.id = p1.customer_id)
|
||||
LEFT OUTER JOIN purchase p2 ON (c.id = p2.customer_id AND
|
||||
(p1.date < p2.date OR p1.date = p2.date AND p1.id < p2.id))
|
||||
WHERE p2.id IS NULL;
|
||||
*/
|
||||
/*
|
||||
$query->select(static::$table . '.' . static::$primaryField, $value['table'] . '.' . $value['src'])
|
||||
->from(static::$table)
|
||||
->join($value['table'])
|
||||
|
|
@ -2448,8 +2456,8 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
->leftOuterJoin($value['table'])
|
||||
->on(new And('1', new And(new Or('d1', 'd2'), 'id')))
|
||||
->where($value['table'] . '.' . $value['dst'], '=', 'NULL');
|
||||
*/
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
$sth = self::$db->con->prepare($query->toSql());
|
||||
$sth->execute();
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ class DatabasePool implements DataStoragePoolInterface
|
|||
*
|
||||
* @param string $key Database key
|
||||
*
|
||||
* @return ConnectionAbstract
|
||||
* @return DataStorageConnectionInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function get(string $key = '') : ConnectionAbstract
|
||||
public function get(string $key = '') : DataStorageConnectionInterface
|
||||
{
|
||||
if ((!empty($key) && !isset($this->pool[$key])) || empty($this->pool)) {
|
||||
return new NullConnection();
|
||||
|
|
|
|||
|
|
@ -404,7 +404,11 @@ class MultiMap implements \Countable
|
|||
$removed = false;
|
||||
|
||||
foreach ($keys as $key => $value) {
|
||||
$removed |= $this->removeKey(implode(':', $value));
|
||||
$removed = $this->removeKey(implode(':', $value));
|
||||
|
||||
if (!$removed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $removed;
|
||||
|
|
|
|||
|
|
@ -92,15 +92,15 @@ abstract class C128Abstract
|
|||
/**
|
||||
* Content to encrypt.
|
||||
*
|
||||
* @var string|int
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $content = 0;
|
||||
protected $content = '';
|
||||
|
||||
/**
|
||||
* Show text below barcode.
|
||||
*
|
||||
* @var string
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $showText = true;
|
||||
|
|
|
|||
|
|
@ -32,18 +32,6 @@ final class Huffman
|
|||
*/
|
||||
private $dictionary = null;
|
||||
|
||||
/**
|
||||
* Remove dictionary
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function removeDictionary() : void
|
||||
{
|
||||
$this->dictionary = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dictionary
|
||||
*
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class Commit
|
|||
/**
|
||||
* Files.
|
||||
*
|
||||
* @var string[]
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $files = [];
|
||||
|
|
|
|||
|
|
@ -234,23 +234,27 @@ class Repository
|
|||
*
|
||||
* @param string $source Create repository from source (optional, can be remote)
|
||||
*
|
||||
* @return string
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function create(string $source = null)
|
||||
public function create(string $source = null) : void
|
||||
{
|
||||
if (!is_dir($this->path) || file_exists($this->path . '/.git')) {
|
||||
throw new \Exception('Already repository');
|
||||
}
|
||||
|
||||
if ($source !== null) {
|
||||
return stripos($source, '//') !== false ? $this->cloneRemote($source) : $this->cloneFrom($source);
|
||||
stripos($source, '//') !== false ? $this->cloneRemote($source) : $this->cloneFrom($source);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->run('init');
|
||||
$this->run('init');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -491,7 +495,7 @@ class Repository
|
|||
public function checkout(Branch $branch) : string
|
||||
{
|
||||
$result = implode("\n", $this->run('checkout ' . $branch->getName()));
|
||||
$this->branch = null;
|
||||
$this->branch = $branch;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface ArchiveInterface
|
|||
/**
|
||||
* Create archive.
|
||||
*
|
||||
* @param string $sources Files and directories to compress
|
||||
* @param mixed $sources Files and directories to compress
|
||||
* @param string $destination Output destination
|
||||
* @param bool $overwrite Overwrite if destination is existing
|
||||
*
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ class LinearCongruentialGenerator
|
|||
*
|
||||
* @param int $seed Starting seed
|
||||
*
|
||||
* @return \Closure
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function bsd(int $seed = 0)
|
||||
public static function bsd(int $seed = 0) : int
|
||||
{
|
||||
if ($seed !== 0) {
|
||||
self::$bsdSeed = $seed;
|
||||
|
|
@ -63,11 +63,11 @@ class LinearCongruentialGenerator
|
|||
*
|
||||
* @param int $seed Starting seed
|
||||
*
|
||||
* @return \Closure
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function msvcrt(int $seed = 0)
|
||||
public static function msvcrt(int $seed = 0) : int
|
||||
{
|
||||
if ($seed !== 0) {
|
||||
self::$msvcrtSeed = $seed;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final class TaskFactory
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function create(string $id = null, string $cmd = '') : TaskAbstract
|
||||
public static function create(string $id = '', string $cmd = '') : TaskAbstract
|
||||
{
|
||||
switch (OperatingSystem::getSystem()) {
|
||||
case SystemType::WIN:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Account;
|
||||
namespace phpOMS\tests\Asset;
|
||||
|
||||
use phpOMS\Asset\AssetManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Account;
|
||||
namespace phpOMS\tests\Auth;
|
||||
|
||||
use phpOMS\Auth\Auth;
|
||||
use phpOMS\Auth\LoginReturnType;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class CachePoolTest extends \PHPUnit\Framework\TestCase
|
|||
$pool = new CachePool();
|
||||
|
||||
self::assertFalse($pool->remove('core'));
|
||||
self::assertEquals(null, $pool->get());
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get());
|
||||
}
|
||||
|
||||
public function testGetSet()
|
||||
|
|
@ -38,7 +38,7 @@ class CachePoolTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($pool->create('abc', ['type' => 'file', 'path' => __DIR__]));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('abc'));
|
||||
self::assertTrue($pool->remove('abc'));
|
||||
self::assertEquals(null, $pool->get('abc'));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get('abc'));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('test'));
|
||||
self::assertFalse($pool->remove('abc'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Circle;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Ellipse;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Polygon;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Quadrilateral;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Rectangle;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Trapezoid;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Math\Shape\D2;
|
||||
namespace phpOMS\tests\Math\Geometry\Shape\D2;
|
||||
|
||||
use phpOMS\Math\Geometry\Shape\D2\Triangle;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
namespace phpOMS\tests\Utils;
|
||||
namespace phpOMS\tests\Stdlib\Map;
|
||||
|
||||
use phpOMS\Stdlib\Map\MultiMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,5 @@ class HuffmanTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
|
||||
self::assertEquals('', $man->decode(''));
|
||||
|
||||
$huff->removeDictionary();
|
||||
self::assertEquals(null, $huff->getDictionary());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user