diff --git a/Asset/AssetManager.php b/Asset/AssetManager.php index 8f2323a3a..049254e88 100644 --- a/Asset/AssetManager.php +++ b/Asset/AssetManager.php @@ -89,7 +89,7 @@ class AssetManager implements \Countable * * @param string $id Asset id * - * @return mixed Asset + * @return string|null * * @since 1.0.0 */ diff --git a/Business/Finance/Depreciation.php b/Business/Finance/Depreciation.php index 069801c6d..d023705e9 100644 --- a/Business/Finance/Depreciation.php +++ b/Business/Finance/Depreciation.php @@ -167,7 +167,7 @@ class Depreciation * Calculate the depreciation rate * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * * @return float @@ -183,7 +183,7 @@ class Depreciation * Calculate the depreciation value in a period * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * @param int $t Period * @@ -202,7 +202,7 @@ class Depreciation * Calculate the residual value after some periods * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * @param int $t Period * @@ -225,7 +225,7 @@ class Depreciation * Calculate the depreciation rate * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * * @return float @@ -241,7 +241,7 @@ class Depreciation * Calculate the depreciation value in a period * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * @param int $t Period * @@ -259,7 +259,7 @@ class Depreciation * Calculate the residual value after some periods * * @param float $start Value to depreciate (reduced by residual value if required) - * @param int $residual Residual value + * @param float $residual Residual value * @param int $duration Useful life time * @param int $t Period * diff --git a/Config/OptionsInterface.php b/Config/OptionsInterface.php index 17413165c..c7a6a73c1 100644 --- a/Config/OptionsInterface.php +++ b/Config/OptionsInterface.php @@ -30,11 +30,11 @@ interface OptionsInterface * * @param mixed $key Key to check for existence * - * @return void + * @return bool * * @since 1.0.0 */ - public function exists($key); + public function exists($key) : bool; /** * Updating or adding settings. diff --git a/Config/SettingsAbstract.php b/Config/SettingsAbstract.php index 651fd87eb..63f285df1 100644 --- a/Config/SettingsAbstract.php +++ b/Config/SettingsAbstract.php @@ -124,7 +124,7 @@ abstract class SettingsAbstract implements OptionsInterface * @param string[] $options Column values for filtering * @param bool $store Save this Setting immediately to database * - * @return mixed Option value + * @return void * * @since 1.0.0 */ diff --git a/DataStorage/Cache/Connection/ConnectionFactory.php b/DataStorage/Cache/Connection/ConnectionFactory.php index d65e67cea..ea980da99 100644 --- a/DataStorage/Cache/Connection/ConnectionFactory.php +++ b/DataStorage/Cache/Connection/ConnectionFactory.php @@ -58,7 +58,7 @@ class ConnectionFactory case CacheType::REDIS: return new RedisCache($cacheData); case CacheType::MEMCACHED: - return new MemcachedCache($cacheData); + return new MemCached($cacheData); case CacheType::WINCACHE: return new WinCache($cacheData); default: diff --git a/DataStorage/Cache/Connection/ConnectionInterface.php b/DataStorage/Cache/Connection/ConnectionInterface.php index 369fdf011..081c42768 100644 --- a/DataStorage/Cache/Connection/ConnectionInterface.php +++ b/DataStorage/Cache/Connection/ConnectionInterface.php @@ -39,7 +39,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function set($key, $value, int $expire = -1); /* : void */ + public function set($key, $value, int $expire = -1) : void; /** * Adding new data if it doesn't exist. diff --git a/DataStorage/Cache/Connection/MemCached.php b/DataStorage/Cache/Connection/MemCached.php index e47f4f198..85d854012 100644 --- a/DataStorage/Cache/Connection/MemCached.php +++ b/DataStorage/Cache/Connection/MemCached.php @@ -43,10 +43,12 @@ class MemCached extends ConnectionAbstract /** * Constructor. + * + * @param array $data Cache data * * @since 1.0.0 */ - public function __construct() + public function __construct(array $data) { $this->memc = null; } diff --git a/DataStorage/Cache/Connection/RedisCache.php b/DataStorage/Cache/Connection/RedisCache.php index a84d8e060..3182163b2 100644 --- a/DataStorage/Cache/Connection/RedisCache.php +++ b/DataStorage/Cache/Connection/RedisCache.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace phpOMS\DataStorage\Cache\Connection; +use phpOMS\DataStorage\Cache\CacheStatus; + /** * RedisCache class. * @@ -27,6 +29,17 @@ namespace phpOMS\DataStorage\Cache\Connection; class RedisCache extends ConnectionAbstract { + /** + * Constructor + * + * @param array $data Cache data + * + * @since 1.0.0 + */ + public function __construct(array $data) + { + } + /** * {@inheritdoc} */ diff --git a/DataStorage/Cache/Connection/WinCache.php b/DataStorage/Cache/Connection/WinCache.php index c86db5a56..40075a1ba 100644 --- a/DataStorage/Cache/Connection/WinCache.php +++ b/DataStorage/Cache/Connection/WinCache.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace phpOMS\DataStorage\Cache\Connection; +use phpOMS\DataStorage\Cache\CacheStatus; + /** * WinCache class. * @@ -26,6 +28,17 @@ namespace phpOMS\DataStorage\Cache\Connection; */ class WinCache extends ConnectionAbstract { + /** + * Constructor + * + * @param array $data Cache data + * + * @since 1.0.0 + */ + public function __construct(array $data) + { + } + /** * {@inheritdoc} */ diff --git a/DataStorage/DataStorageConnectionInterface.php b/DataStorage/DataStorageConnectionInterface.php index 3ac8a25ea..38c95455c 100644 --- a/DataStorage/DataStorageConnectionInterface.php +++ b/DataStorage/DataStorageConnectionInterface.php @@ -38,7 +38,7 @@ interface DataStorageConnectionInterface * * @since 1.0.0 */ - public function connect(array $data); /* : void */ + public function connect(array $data) : void; /** * Get the datastorage type. @@ -65,5 +65,5 @@ interface DataStorageConnectionInterface * * @since 1.0.0 */ - public function close(); /* : void */ + public function close() : void; } diff --git a/DataStorage/DataStoragePoolInterface.php b/DataStorage/DataStoragePoolInterface.php index 1e9d7ac18..4f41bce58 100644 --- a/DataStorage/DataStoragePoolInterface.php +++ b/DataStorage/DataStoragePoolInterface.php @@ -30,7 +30,7 @@ interface DataStoragePoolInterface /** * Add connection. * - * @param mixed $key Connection key + * @param string $key Connection key * @param DataStorageConnectionInterface $db Connection * * @return bool @@ -42,7 +42,7 @@ interface DataStoragePoolInterface /** * Get connection. * - * @param mixed $key Connection key + * @param string $key Connection key * * @return mixed * @@ -53,7 +53,7 @@ interface DataStoragePoolInterface /** * Remove connection. * - * @param mixed $key Connection key + * @param string $key Connection key * * @return bool * diff --git a/DataStorage/Database/Connection/ConnectionAbstract.php b/DataStorage/Database/Connection/ConnectionAbstract.php index c26428bb8..80ba4808d 100644 --- a/DataStorage/Database/Connection/ConnectionAbstract.php +++ b/DataStorage/Database/Connection/ConnectionAbstract.php @@ -37,7 +37,7 @@ abstract class ConnectionAbstract implements ConnectionInterface * * This can be used externally to define queries and execute them. * - * @var \PDO + * @var \PDO|null * @since 1.0.0 */ public $con = null; diff --git a/DataStorage/Database/Connection/NullConnection.php b/DataStorage/Database/Connection/NullConnection.php new file mode 100644 index 000000000..0eeb13ced --- /dev/null +++ b/DataStorage/Database/Connection/NullConnection.php @@ -0,0 +1,36 @@ +pool[$key])) || empty($this->pool)) { - return null; + return new NullConnection(); } if (empty($key)) { @@ -94,7 +95,7 @@ class DatabasePool implements DataStoragePoolInterface /** * Remove database. * - * @param mixed $key Database key + * @param string $key Database key * * @return bool * diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index b3277dae1..fa38c5941 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -490,7 +490,7 @@ class Builder extends BuilderAbstract throw new \InvalidArgumentException('Unknown operator.'); } - if (is_string($columns)) { + if (!is_array($columns)) { $columns = [$columns]; $operator = [$operator]; $values = [$values]; @@ -703,6 +703,10 @@ class Builder extends BuilderAbstract public function orderBy($columns, $order = 'DESC') : Builder { if (is_string($columns) || $columns instanceof \Closure) { + if (!is_string($order)) { + throw new \InvalidArgumentException(); + } + if (!isset($this->orders[$order])) { $this->orders[$order] = []; } @@ -754,7 +758,7 @@ class Builder extends BuilderAbstract /** * Union. * - * @param string|\phpOMS\DataStorage\Database\Query\Builder $query Query + * @param mixed $query Query * * @return Builder * @@ -796,7 +800,7 @@ class Builder extends BuilderAbstract /** * Create query string. * - * @return void + * @return string * * @since 1.0.0 */ diff --git a/DataStorage/Database/Query/Grammar/Grammar.php b/DataStorage/Database/Query/Grammar/Grammar.php index f6108ca2b..1dab40821 100644 --- a/DataStorage/Database/Query/Grammar/Grammar.php +++ b/DataStorage/Database/Query/Grammar/Grammar.php @@ -315,9 +315,9 @@ class Grammar extends GrammarAbstract /** * Compile value. * - * @param Builder $query Query builder - * @param array|string|\Closure $value Value - * @param string $prefix Prefix in case value is a table + * @param Builder $query Query builder + * @param mixed $value Value + * @param string $prefix Prefix in case value is a table * * @return string Returns a string representation of the value. * diff --git a/DataStorage/Session/ConsoleSession.php b/DataStorage/Session/ConsoleSession.php index fac8251cf..a37e4225d 100644 --- a/DataStorage/Session/ConsoleSession.php +++ b/DataStorage/Session/ConsoleSession.php @@ -42,7 +42,9 @@ class ConsoleSession implements SessionInterface */ public function __construct($sid = false) { - $this->sid = $sid; + if ($sid !== false) { + $this->sid = $sid; + } } /** diff --git a/DataStorage/Session/SessionInterface.php b/DataStorage/Session/SessionInterface.php index 58b44fdba..ebfc9c800 100644 --- a/DataStorage/Session/SessionInterface.php +++ b/DataStorage/Session/SessionInterface.php @@ -71,7 +71,7 @@ interface SessionInterface * * @since 1.0.0 */ - public function save(); /* : void */ + public function save() : void; /** * @return int|string @@ -87,7 +87,7 @@ interface SessionInterface * * @since 1.0.0 */ - public function setSID($sid); /* : void */ + public function setSID($sid) : void; /** * Lock session from further adjustments. @@ -96,5 +96,5 @@ interface SessionInterface * * @since 1.0.0 */ - public function lock(); /* : void */ + public function lock() : void; } diff --git a/DataStorage/Session/SocketSession.php b/DataStorage/Session/SocketSession.php index c5c6542c7..b24b816a3 100644 --- a/DataStorage/Session/SocketSession.php +++ b/DataStorage/Session/SocketSession.php @@ -42,7 +42,9 @@ class SocketSession implements SessionInterface */ public function __construct($sid = false) { - $this->sid = $sid; + if ($sid !== false) { + $this->sid = $sid; + } } /** diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index 808759464..cc04a774d 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -63,7 +63,7 @@ class Dispatcher * Dispatch controller. * * @param string|array|\Closure $controller Controller string - * @param mixed ...$data Data + * @param array|null ...$data Data * * @return array * @@ -93,8 +93,8 @@ class Dispatcher /** * Dispatch string. * - * @param string|array|\Closure $controller Controller string - * @param array $data Data + * @param string $controller Controller string + * @param array|null $data Data * * @return array * @@ -126,8 +126,8 @@ class Dispatcher /** * Dispatch array. * - * @param string|array|\Closure $controller Controller string - * @param array $data Data + * @param array $controller Controller string + * @param array|null $data Data * * @return array * @@ -146,14 +146,14 @@ class Dispatcher /** * Dispatch closure. * - * @param string|array|\Closure $controller Controller string - * @param array $data Data + * @param \Closure $controller Controller string + * @param array|null $data Data * * @return mixed * * @since 1.0.0 */ - private function dispatchClosure(\Closure $controller, array $data = null) : void + private function dispatchClosure(\Closure $controller, array $data = null) { return $controller($this->app, ...$data); } diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index c31ff098a..3c5f519c6 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -31,7 +31,7 @@ class L11nManager /** * Language. * - * @var string[][] + * @var array * @since 1.0.0 */ private $language = []; @@ -65,9 +65,9 @@ class L11nManager * One module can only be loaded once. Once the module got loaded it's not * possible to load more language files later on. * - * @param string $language Language iso code - * @param string $from Module name - * @param string[][] $translation Language files content + * @param string $language Language iso code + * @param string $from Module name + * @param array $translation Language files content * * @return void * diff --git a/Localization/Localization.php b/Localization/Localization.php index b6c17d3ab..a10e2af3a 100644 --- a/Localization/Localization.php +++ b/Localization/Localization.php @@ -99,7 +99,7 @@ class Localization /** * Weight. * - * @var string + * @var array * @since 1.0.0 */ private $weight = []; @@ -107,7 +107,7 @@ class Localization /** * Speed. * - * @var string + * @var array * @since 1.0.0 */ private $speed = []; @@ -115,7 +115,7 @@ class Localization /** * Length. * - * @var string + * @var array * @since 1.0.0 */ private $length = []; @@ -123,7 +123,7 @@ class Localization /** * Area. * - * @var string + * @var array * @since 1.0.0 */ private $area = []; @@ -131,7 +131,7 @@ class Localization /** * Volume. * - * @var string + * @var array * @since 1.0.0 */ private $volume = []; @@ -314,7 +314,7 @@ class Localization * * @param string $decimal Decimal char * - * @return string + * @return void * * @since 1.0.0 */ @@ -340,7 +340,7 @@ class Localization * * @param string $thousands Thousands char * - * @return string + * @return void * * @since 1.0.0 */ @@ -366,7 +366,7 @@ class Localization * * @param string $angle Angle * - * @return string + * @return void * * @since 1.0.0 */ @@ -392,7 +392,7 @@ class Localization * * @param string $temperature Temperature * - * @return string + * @return void * * @since 1.0.0 */ @@ -418,7 +418,7 @@ class Localization * * @param array $speed Speed * - * @return array + * @return void * * @since 1.0.0 */ @@ -444,7 +444,7 @@ class Localization * * @param array $weight Weight type * - * @return array + * @return void * * @since 1.0.0 */ @@ -470,7 +470,7 @@ class Localization * * @param array $length Length type * - * @return array + * @return void * * @since 1.0.0 */ @@ -496,7 +496,7 @@ class Localization * * @param array $area Area type * - * @return array + * @return void * * @since 1.0.0 */ @@ -522,7 +522,7 @@ class Localization * * @param array $volume Volume type * - * @return array + * @return void * * @since 1.0.0 */ diff --git a/Localization/Money.php b/Localization/Money.php index 50678b41a..edeec84b6 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -117,7 +117,7 @@ class Money implements \Serializable $right = substr($right, 0, self::MAX_DECIMALS); - return (int) (((int) $left) * 10 ** self::MAX_DECIMALS + (int) str_pad($right, self::MAX_DECIMALS, '0')); + return ((int) $left) * 10 ** self::MAX_DECIMALS + (int) str_pad($right, self::MAX_DECIMALS, '0'); } /** @@ -132,7 +132,7 @@ class Money implements \Serializable * * @since 1.0.0 */ - public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) : void + public function setLocalization(string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0) : Money { $this->thousands = $thousands; $this->decimal = $decimal; diff --git a/Log/LoggerInterface.php b/Log/LoggerInterface.php index 07e0c4933..fc331da3a 100644 --- a/Log/LoggerInterface.php +++ b/Log/LoggerInterface.php @@ -33,7 +33,7 @@ interface LoggerInterface * * @return null */ - public function emergency(string $message, array $context = []); /* : void */ + public function emergency(string $message, array $context = []) : void; /** * Action must be taken immediately. @@ -46,7 +46,7 @@ interface LoggerInterface * * @return null */ - public function alert(string $message, array $context = []); /* : void */ + public function alert(string $message, array $context = []) : void; /** * Critical conditions. @@ -58,7 +58,7 @@ interface LoggerInterface * * @return null */ - public function critical(string $message, array $context = []); /* : void */ + public function critical(string $message, array $context = []) : void; /** * Runtime errors that do not require immediate action but should typically @@ -69,7 +69,7 @@ interface LoggerInterface * * @return null */ - public function error(string $message, array $context = []); /* : void */ + public function error(string $message, array $context = []) : void; /** * Exceptional occurrences that are not errors. @@ -82,7 +82,7 @@ interface LoggerInterface * * @return null */ - public function warning(string $message, array $context = []); /* : void */ + public function warning(string $message, array $context = []) : void; /** * Normal but significant events. @@ -92,7 +92,7 @@ interface LoggerInterface * * @return null */ - public function notice(string $message, array $context = []); /* : void */ + public function notice(string $message, array $context = []) : void; /** * Interesting events. @@ -104,7 +104,7 @@ interface LoggerInterface * * @return null */ - public function info(string $message, array $context = []); /* : void */ + public function info(string $message, array $context = []) : void; /** * Detailed debug information. @@ -114,7 +114,7 @@ interface LoggerInterface * * @return null */ - public function debug(string $message, array $context = []); /* : void */ + public function debug(string $message, array $context = []) : void; /** * Logs with an arbitrary level. @@ -125,5 +125,5 @@ interface LoggerInterface * * @return null */ - public function log(string $level, string $message, array $context = []); /* : void */ + public function log(string $level, string $message, array $context = []) : void; } diff --git a/Math/Optimization/Graph/EdgeInterface.php b/Math/Optimization/Graph/EdgeInterface.php index 4b4327f83..504d01020 100644 --- a/Math/Optimization/Graph/EdgeInterface.php +++ b/Math/Optimization/Graph/EdgeInterface.php @@ -51,7 +51,7 @@ interface EdgeInterface * * @since 1.0.0 */ - public function setWeight($weight); /* : void */ + public function setWeight($weight) : void; /** * Get vertices. @@ -72,5 +72,5 @@ interface EdgeInterface * * @since 1.0.0 */ - public function setVertices(VerticeInterface $a, VerticeInterface $b); /* : void */ + public function setVertices(VerticeInterface $a, VerticeInterface $b) : void; } diff --git a/Message/HeaderAbstract.php b/Message/HeaderAbstract.php index ee7b2a528..bcc256a45 100644 --- a/Message/HeaderAbstract.php +++ b/Message/HeaderAbstract.php @@ -169,7 +169,7 @@ abstract class HeaderAbstract * * @since 1.0.0 */ - abstract public function generate(int $statusCode); /* : void */ + abstract public function generate(int $statusCode) : void; /** * Get status code @@ -203,7 +203,7 @@ abstract class HeaderAbstract * * @since 1.0.0 */ - abstract public function set(string $key, string $value, bool $overwrite = false); /* : void */ + abstract public function set(string $key, string $value, bool $overwrite = false) : void; /** * Get header by key. diff --git a/Message/Http/Request.php b/Message/Http/Request.php index f30189a0e..bcdf79138 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -80,7 +80,10 @@ class Request extends RequestAbstract $this->header = new Header(); $this->header->setL11n($l11n ?? new Localization()); - $this->uri = $uri; + if ($uri !== null) { + $this->uri = $uri; + } + $this->source = RequestSource::WEB; $this->init(); diff --git a/Message/MessageInterface.php b/Message/MessageInterface.php index 53dceb426..26059be7b 100644 --- a/Message/MessageInterface.php +++ b/Message/MessageInterface.php @@ -27,11 +27,11 @@ interface MessageInterface /** * Retrieves all message header values. * - * @return HeaderAbstract + * @return HeaderAbstract|null * * @since 1.0.0 */ - public function getHeader() : HeaderAbstract; + public function getHeader() : ?HeaderAbstract; /** * Gets the body of the message. diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index 4d51a09fe..b01b078ad 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -20,8 +20,6 @@ use phpOMS\Uri\UriInterface; /** * Request class. * - * @property mixed request - * * @package phpOMS\Message * @license OMS License 1.0 * @link http://website.orange-management.de diff --git a/Module/InfoManager.php b/Module/InfoManager.php index 19fa3de4f..b54da8d64 100644 --- a/Module/InfoManager.php +++ b/Module/InfoManager.php @@ -98,7 +98,7 @@ class InfoManager public function update() : void { if (!file_exists($this->path)) { - throw new PathException((string) $this->path); + throw new PathException($this->path); } file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT)); diff --git a/Socket/SocketInterface.php b/Socket/SocketInterface.php index b1ef31cee..ef095cad0 100644 --- a/Socket/SocketInterface.php +++ b/Socket/SocketInterface.php @@ -42,7 +42,7 @@ interface SocketInterface * * @since 1.0.0 */ - public function close(); /* : void */ + public function close() : void; /** * Run socket. @@ -51,5 +51,5 @@ interface SocketInterface * * @since 1.0.0 */ - public function run(); /* : void */ + public function run() : void; } diff --git a/System/File/ContainerInterface.php b/System/File/ContainerInterface.php index 73b9ea057..4ce9e5c0b 100644 --- a/System/File/ContainerInterface.php +++ b/System/File/ContainerInterface.php @@ -329,5 +329,5 @@ interface ContainerInterface * * @since 1.0.0 */ - public function index(); /* : void */ + public function index() : void; } diff --git a/System/File/DirectoryInterface.php b/System/File/DirectoryInterface.php index 6fa451faa..394fbc492 100644 --- a/System/File/DirectoryInterface.php +++ b/System/File/DirectoryInterface.php @@ -46,11 +46,11 @@ interface DirectoryInterface extends ContainerInterface, \Iterator, \ArrayAccess * * @param string $name File/direcotry name * - * @return mixed + * @return ContainerInterface|null * * @since 1.0.0 */ - public function getNode(string $name); + public function getNode(string $name) : ?ContainerInterface; /** * Add file or directory. diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 1b3ad5271..aeeb0b11a 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -197,7 +197,7 @@ class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public function getNode(string $name) : FileAbstract + public function getNode(string $name) : ?ContainerInterface { return $this->nodes[$name] ?? null; } diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index df2a5028c..79d9ac503 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -88,7 +88,7 @@ class Directory extends FileAbstract implements DirectoryInterface new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item ) { - $list[] = str_replace('\\', '/', $iterator->getSubPathName()); + $list[] = str_replace('\\', '/', $iterator->getSubPathname()); } return $list; @@ -114,7 +114,7 @@ class Directory extends FileAbstract implements DirectoryInterface \RecursiveIteratorIterator::SELF_FIRST) as $item ) { if ($item->getExtension() === $extension) { - $list[] = str_replace('\\', '/', $iterator->getSubPathName()); + $list[] = str_replace('\\', '/', $iterator->getSubPathname()); } } @@ -319,9 +319,9 @@ class Directory extends FileAbstract implements DirectoryInterface \RecursiveIteratorIterator::SELF_FIRST) as $item ) { if ($item->isDir()) { - mkdir($to . '/' . $iterator->getSubPathName()); + mkdir($to . '/' . $iterator->getSubPathname()); } else { - copy($from . '/' . $iterator->getSubPathName(), $to . '/' . $iterator->getSubPathName()); + copy($from . '/' . $iterator->getSubPathname(), $to . '/' . $iterator->getSubPathname()); } } @@ -371,7 +371,7 @@ class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public function getNode(string $name) : FileAbstract + public function getNode(string $name) : ?ContainerInterface { return $this->nodes[$name] ?? null; } diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index d7e1df229..7a1b9252d 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -37,15 +37,6 @@ class LocalStorage extends StorageAbstract */ private static $instance = null; - /** - * Constructor. - * - * @since 1.0.0 - */ - public function __construct() - { - } - /** * Get instance. * diff --git a/System/File/StorageAbstract.php b/System/File/StorageAbstract.php index d9fcfb4b4..d60963257 100644 --- a/System/File/StorageAbstract.php +++ b/System/File/StorageAbstract.php @@ -34,27 +34,15 @@ abstract class StorageAbstract */ protected $type = 0; - /** - * Constructor. - * - * @since 1.0.0 - * @codeCoverageIgnore - */ - private function __construct() - { - } - /** * Get instance. * - * @return mixed Storage instance. + * @return StorageAbstract Storage instance. * * @since 1.0.0 */ - public static function getInstance() : StorageAbstract - { - return null; - } + abstract public static function getInstance() : StorageAbstract; + /** * Get storage type. * diff --git a/System/OperatingSystem.php b/System/OperatingSystem.php index 410d333c4..9c3217b49 100644 --- a/System/OperatingSystem.php +++ b/System/OperatingSystem.php @@ -27,7 +27,7 @@ final class OperatingSystem /** * Get OS. * - * @return int|SystemType + * @return int * * @since 1.0.0 */ diff --git a/System/SystemUtils.php b/System/SystemUtils.php index 96a637449..ad95a52d3 100644 --- a/System/SystemUtils.php +++ b/System/SystemUtils.php @@ -87,7 +87,6 @@ class SystemUtils $freeArr = explode("\n", $free); $mem = explode(" ", $freeArr[1]); $mem = array_filter($mem); - $mem = array_merge($mem); $memUsage = $mem[2] / $mem[1] * 100; } diff --git a/Uri/UriInterface.php b/Uri/UriInterface.php index 4485cb173..2212e1f28 100644 --- a/Uri/UriInterface.php +++ b/Uri/UriInterface.php @@ -126,7 +126,7 @@ interface UriInterface * * @since 1.0.0 */ - public function setRootPath(string $root); /* : void */ + public function setRootPath(string $root) : void; /** * Get path element. @@ -213,5 +213,5 @@ interface UriInterface * * @since 1.0.0 */ - public function set(string $uri); /* : void */ + public function set(string $uri) : void; } diff --git a/Utils/IO/Csv/CsvInterface.php b/Utils/IO/Csv/CsvInterface.php index 3f1aee9cf..52e6454cf 100644 --- a/Utils/IO/Csv/CsvInterface.php +++ b/Utils/IO/Csv/CsvInterface.php @@ -48,6 +48,6 @@ namespace phpOMS\Utils\IO\Csv { * @since 1.0.0 * @author Dennis Eichhorn */ - public function importCsv($path); /* : void */ + public function importCsv($path) : void; } } diff --git a/Utils/Parser/Markdown/Markdown.php b/Utils/Parser/Markdown/Markdown.php index ce8bc2019..fe1a3840b 100644 --- a/Utils/Parser/Markdown/Markdown.php +++ b/Utils/Parser/Markdown/Markdown.php @@ -358,11 +358,11 @@ class Markdown protected static function blockCode(array $lineArray, array $block = null) : ?array { if ($block !== null && !isset($block['type']) && !isset($block['interrupted'])) { - return; + return null; } if ($lineArray['indent'] < 4) { - return; + return null; } return [ @@ -390,7 +390,7 @@ class Markdown protected static function blockCodeContinue(array $lineArray, array $block) : ?array { if ($lineArray['indent'] < 4) { - return; + return null; } if (isset($block['interrupted'])) { @@ -431,7 +431,7 @@ class Markdown protected static function blockFencedCode(array $lineArray) : ?array { if (!preg_match('/^[' . $lineArray['text'][0] . ']{3,}[ ]*([^`]+)?[ ]*$/', $lineArray['text'], $matches)) { - return; + return null; } $elementArray = [ @@ -468,7 +468,7 @@ class Markdown protected static function blockFencedCodeContinue(array $lineArray, array $block) : ?array { if (isset($block['complete'])) { - return; + return null; } if (isset($block['interrupted'])) { @@ -515,7 +515,7 @@ class Markdown protected static function blockHeader(array $lineArray) : ?array { if (!isset($lineArray['text'][1])) { - return; + return null; } $level = 1; @@ -524,7 +524,7 @@ class Markdown } if ($level > 6) { - return; + return null; } return [ @@ -550,7 +550,7 @@ class Markdown list($name, $pattern) = $lineArray['text'][0] <= '-' ? ['ul', '[*+-]'] : ['ol', '[0-9]+[.]']; if (!preg_match('/^(' . $pattern . '[ ]+)(.*)/', $lineArray['text'], $matches)) { - return; + return null; } $block = [ @@ -649,7 +649,7 @@ class Markdown protected static function blockQuote(array $lineArray) : ?array { if (!preg_match('/^>[ ]?(.*)/', $lineArray['text'], $matches)) { - return; + return null; } return [ @@ -704,7 +704,7 @@ class Markdown protected static function blockRule(array $lineArray) : ?array { if (!preg_match('/^([' . $lineArray['text'][0] . '])([ ]*\1){2,}[ ]*$/', $lineArray['text'])) { - return; + return null; } return [ @@ -727,11 +727,11 @@ class Markdown protected static function blockSetextHeader(array $lineArray, array $block = null) : ?array { if (!isset($block) || isset($block['type']) || isset($block['interrupted'])) { - return; + return null; } if (chop($lineArray['text'], $lineArray['text'][0]) !== '') { - return; + return null; } $block['element']['name'] = $lineArray['text'][0] === '=' ? 'h1' : 'h2'; @@ -751,7 +751,7 @@ class Markdown protected static function blockReference(array $lineArray) : ?array { if (!preg_match('/^\[(.+?)\]:[ ]*?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $lineArray['text'], $matches)) { - return; + return null; } $data = [ @@ -777,7 +777,7 @@ class Markdown protected static function blockTable($lineArray, array $block = null) : ?array { if (!isset($block) || isset($block['type']) || isset($block['interrupted'])) { - return; + return null; } if (strpos($block['element']['text'], '|') !== false && chop($lineArray['text'], ' -:|') === '') { @@ -872,7 +872,7 @@ class Markdown protected static function blockTableContinue(array $lineArray, array $block) : ?array { if (isset($block['interrupted'])) { - return; + return null; } if ($lineArray['text'][0] === '|' || strpos($lineArray['text'], '|')) { @@ -994,7 +994,7 @@ class Markdown $marker = $excerpt['text'][0]; if (!preg_match('/^(' . $marker . '+)[ ]*(.+?)[ ]*(?') === false || !preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $excerpt['text'], $matches)) { - return; + return null; } $url = $matches[1]; @@ -1051,7 +1051,7 @@ class Markdown protected static function inlineEmphasis(array $excerpt) : ?array { if (!isset($excerpt['text'][1])) { - return; + return null; } $marker = $excerpt['text'][0]; @@ -1061,7 +1061,7 @@ class Markdown } elseif (preg_match(self::$emRegex[$marker], $excerpt['text'], $matches)) { $emphasis = 'em'; } else { - return; + return null; } return [ @@ -1086,7 +1086,7 @@ class Markdown protected static function inlineEscapeSequence(array $excerpt) : ?array { if (!isset($excerpt['text'][1]) || !in_array($excerpt['text'][1], self::$specialCharacters)) { - return; + return null; } return [ @@ -1107,14 +1107,14 @@ class Markdown protected static function inlineImage(array $excerpt) : ?array { if (!isset($excerpt['text'][1]) || $excerpt['text'][1] !== '[') { - return; + return null; } $excerpt['text'] = substr($excerpt['text'], 1); $link = self::inlineLink($excerpt); if ($link === null) { - return; + return null; } $inline = [ @@ -1160,7 +1160,7 @@ class Markdown $remainder = $excerpt['text']; if (!preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) { - return; + return null; } $element['text'] = $matches[1]; @@ -1186,7 +1186,7 @@ class Markdown } if (!isset(self::$definitionData['Reference'][$definition])) { - return; + return null; } $def = self::$definitionData['Reference'][$definition]; @@ -1241,11 +1241,11 @@ class Markdown protected static function inlineStrikethrough(array $excerpt) : ?array { if (!isset($excerpt['text'][1])) { - return; + return null; } if ($excerpt['text'][1] !== '~' || !preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $excerpt['text'], $matches)) { - return; + return null; } return [ @@ -1270,11 +1270,11 @@ class Markdown protected static function inlineUrl(array $excerpt) : ?array { if (!isset($excerpt['text'][2]) || $excerpt['text'][2] !== '/') { - return; + return null; } if (!preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { - return; + return null; } return [ @@ -1302,7 +1302,7 @@ class Markdown protected static function inlineUrlTag(array $excerpt) : ?array { if (strpos($excerpt['text'], '>') === false || !preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $excerpt['text'], $matches)) { - return; + return null; } return [ @@ -1322,7 +1322,7 @@ class Markdown * * @param string $text Normal text * - * @return null|array + * @return string * * @since 1.0.0 */ @@ -1339,7 +1339,7 @@ class Markdown * * @param array $element Html element * - * @return null|array + * @return string * * @since 1.0.0 */ @@ -1420,7 +1420,7 @@ class Markdown * * @param array $element Element to sanitize * - * @return string + * @return array * * @since 1.0.0 */ @@ -1492,7 +1492,7 @@ class Markdown * @param string $string Text to check against * @param string $needle Needle to check * - * @return bool|string + * @return bool * * @since 1.0.0 */ diff --git a/Utils/RnG/Text.php b/Utils/RnG/Text.php index bb2928d69..f709d2931 100644 --- a/Utils/RnG/Text.php +++ b/Utils/RnG/Text.php @@ -280,7 +280,7 @@ class Text * * @since 1.0.0 */ - private function generateParagraph(int $length) : void + private function generateParagraph(int $length) : string { $minSentence = 3; $maxSentence = 10; diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index 82c39315f..3f6b0fb3a 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -620,7 +620,7 @@ class Interval implements \Serializable * * @since 1.0.0 */ - public function serializeTime($time, $step) : void + public function serializeTime($time, $step) : string { if (($count = count($time)) > 0) { $serialize = implode(',', $time); @@ -643,7 +643,7 @@ class Interval implements \Serializable * * @since 1.0.0 */ - public function serializeDayOfMonth() : void + public function serializeDayOfMonth() : string { if (($count = count($this->dayOfMonth['dayOfMonth'])) > 0) { $serialize = implode(',', $this->dayOfMonth['dayOfMonth']); @@ -670,7 +670,7 @@ class Interval implements \Serializable * * @since 1.0.0 */ - public function serializeDayOfWeek() : void + public function serializeDayOfWeek() : string { if (($count = count($this->dayOfWeek['dayOfWeek'])) > 0) { $serialize = implode(',', $this->dayOfWeek['dayOfWeek']); diff --git a/Validation/Validator.php b/Validation/Validator.php index 6fb8e5c55..ce8118d92 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -90,9 +90,9 @@ final class Validator extends ValidatorAbstract /** * Validate variable by length. * - * @param string $var Variable to validate - * @param int|float $min Min. length - * @param int|float $max Max. length + * @param string $var Variable to validate + * @param int $min Min. length + * @param int $max Max. length * * @return bool * diff --git a/Validation/ValidatorInterface.php b/Validation/ValidatorInterface.php index 4a065ecca..8b6df4c96 100644 --- a/Validation/ValidatorInterface.php +++ b/Validation/ValidatorInterface.php @@ -62,5 +62,5 @@ interface ValidatorInterface * * @since 1.0.0 */ - public static function resetError(); /* : void */ + public static function resetError() : void; } diff --git a/Views/View.php b/Views/View.php index 08c492620..aa62e64e2 100644 --- a/Views/View.php +++ b/Views/View.php @@ -50,7 +50,7 @@ class View extends ViewAbstract /** * Application. * - * @var ApplicationAbstract + * @var ApplicationAbstract|null * @since 1.0.0 */ protected $app = null; @@ -58,7 +58,7 @@ class View extends ViewAbstract /** * Request. * - * @var RequestAbstract + * @var RequestAbstract|null * @since 1.0.0 */ protected $request = null; @@ -66,7 +66,7 @@ class View extends ViewAbstract /** * Request. * - * @var ResponseAbstract + * @var ResponseAbstract|null * @since 1.0.0 */ protected $response = null; @@ -85,7 +85,7 @@ class View extends ViewAbstract $this->app = $app; $this->request = $request; $this->response = $response; - $this->l11n = $response !== null ? $response->getHeader()->getL11n() : null; + $this->l11n = $response !== null ? $response->getHeader()->getL11n() : new Localization(); } /** @@ -178,7 +178,7 @@ class View extends ViewAbstract $match = '/Modules/'; if (($start = strripos($this->template, $match)) === false) { - throw new InvalidModuleException($module); + throw new InvalidModuleException($module ?? ''); } $start = $start + strlen($match); @@ -190,7 +190,7 @@ class View extends ViewAbstract $match = '/Theme/'; if (($start = strripos($this->template, $match)) === false) { - throw new InvalidThemeException($theme); + throw new InvalidThemeException($theme ?? ''); } $start = $start + strlen($match); @@ -220,11 +220,11 @@ class View extends ViewAbstract /** * Get request of view * - * @return RequestAbstract + * @return RequestAbstract|null * * @since 1.0.0 */ - public function getRequest() : RequestAbstract + public function getRequest() : ?RequestAbstract { return $this->request; } @@ -232,11 +232,11 @@ class View extends ViewAbstract /** * Get response of view * - * @return ResponseAbstract + * @return ResponseAbstract|null * * @since 1.0.0 */ - public function getResponse() : ResponseAbstract + public function getResponse() : ?ResponseAbstract { return $this->response; }