From cbc6205bf78115c593f028aeed1bf6d2e63cfb8b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 3 Dec 2016 23:00:05 +0100 Subject: [PATCH] Type hint fixes/prep for null return type --- Asset/AssetManager.php | 2 +- Config/OptionsTrait.php | 2 +- DataStorage/Cookie/CookieJar.php | 10 ++++++--- DataStorage/Database/BuilderAbstract.php | 4 ++-- .../Connection/ConnectionAbstract.php | 2 +- .../Connection/ConnectionInterface.php | 4 ++-- .../Database/Connection/MysqlConnection.php | 2 +- .../Connection/SqlServerConnection.php | 2 +- DataStorage/Database/DataMapperAbstract.php | 6 ++--- DataStorage/Database/DatabasePool.php | 6 ++--- DataStorage/Database/Query/Builder.php | 4 ++-- DataStorage/Session/HttpSession.php | 2 +- DataStorage/Session/SessionInterface.php | 4 ++-- DataStorage/Session/SocketSession.php | 2 +- Datatypes/Iban.php | 4 ++-- Datatypes/Location.php | 2 +- Event/EventManager.php | 4 ++-- Localization/L11nManager.php | 8 +++---- Localization/Money.php | 2 +- Log/FileLogger.php | 22 +++++++++---------- Log/LoggerInterface.php | 18 +++++++-------- Math/Functions/Functions.php | 6 ++--- Math/Shape/D2/Ellipse.php | 4 ++-- Math/Shape/D2/Polygon.php | 4 ++-- Math/Shape/D3/Sphere.php | 8 +++---- Math/Statistic/Average.php | 10 ++++----- Message/HeaderAbstract.php | 4 ++-- Message/Http/Request.php | 14 ++++++------ Message/MessageInterface.php | 4 ++-- Message/RequestAbstract.php | 4 ++-- Model/Html/Head.php | 2 +- Module/ActivateAbstract.php | 6 ++--- Module/DeactivateAbstract.php | 6 ++--- Module/InfoManager.php | 4 ++-- Module/InstallerAbstract.php | 12 +++++----- Module/ModuleAbstract.php | 5 ++--- Module/ModuleFactory.php | 4 ++-- Module/ModuleManager.php | 18 ++++++++------- Module/UninstallAbstract.php | 2 +- Module/UpdateAbstract.php | 2 +- Pattern/Mediator.php | 8 +++---- Router/Router.php | 2 +- Socket/Packets/Header.php | 2 +- Stdlib/Map/MultiMap.php | 4 +++- Stdlib/Queue/PriorityQueue.php | 4 ++-- System/File/Local/Directory.php | 2 +- System/File/Local/File.php | 2 +- System/File/Local/FileAbstract.php | 2 +- System/File/StorageAbstract.php | 2 +- UnhandledHandler.php | 4 ++-- Uri/Http.php | 2 +- Uri/UriFactory.php | 8 +++---- Utils/ArrayUtils.php | 2 +- Utils/Converter/Currency.php | 2 +- Utils/Encoding/Huffman/Dictionary.php | 6 ++--- Utils/Encoding/Huffman/Huffman.php | 2 +- Utils/Git/Commit.php | 2 +- Utils/JsonBuilder.php | 6 ++--- Utils/Parser/Php/ClassParser.php | 18 +++++++-------- Utils/Parser/Php/FunctionParser.php | 8 +++---- Utils/RnG/DateTime.php | 2 +- Utils/RnG/Name.php | 2 +- Utils/RnG/Text.php | 10 ++++----- Utils/TaskSchedule/CronJob.php | 2 +- Utils/TaskSchedule/Interval.php | 2 +- Utils/TaskSchedule/Schedule.php | 2 +- Utils/TaskSchedule/SchedulerAbstract.php | 4 ++-- Utils/TaskSchedule/TaskScheduler.php | 2 +- Validation/Base/BIC.php | 2 +- Validation/Base/CreditCard.php | 2 +- Validation/Base/DateTime.php | 2 +- Validation/Base/Hostname.php | 2 +- Validation/Base/IP.php | 2 +- Validation/ModelValidationTrait.php | 2 +- Validation/Validator.php | 12 +++++----- Views/View.php | 8 +++---- Views/ViewAbstract.php | 4 ++-- 77 files changed, 194 insertions(+), 187 deletions(-) diff --git a/Asset/AssetManager.php b/Asset/AssetManager.php index c5108af37..92e9d6bbd 100644 --- a/Asset/AssetManager.php +++ b/Asset/AssetManager.php @@ -101,7 +101,7 @@ class AssetManager implements \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function get(string $id) + public function get(string $id) /* : ?string */ { if (isset($this->assets[$id])) { return $this->assets[$id]; diff --git a/Config/OptionsTrait.php b/Config/OptionsTrait.php index 0ecec2485..0a6fe85f0 100644 --- a/Config/OptionsTrait.php +++ b/Config/OptionsTrait.php @@ -36,7 +36,7 @@ trait OptionsTrait /** * {@inheritdoc} */ - public function exists($key) + public function exists($key) : bool { return isset($this->options[$key]); } diff --git a/DataStorage/Cookie/CookieJar.php b/DataStorage/Cookie/CookieJar.php index 958c17235..ff1c47e8d 100644 --- a/DataStorage/Cookie/CookieJar.php +++ b/DataStorage/Cookie/CookieJar.php @@ -63,7 +63,7 @@ class CookieJar * @since 1.0.0 * @author Dennis Eichhorn */ - public static function lock() + public static function lock() /* : void */ { self::$isLocked = true; } @@ -126,7 +126,7 @@ class CookieJar * @since 1.0.0 * @author Dennis Eichhorn */ - public function delete(string $id) + public function delete(string $id) /* : void */ { $this->remove($id); setcookie($id, '', time() - 3600); @@ -156,10 +156,14 @@ class CookieJar /** * Save cookie * + * @return void + * + * @throws LockException + * * @since 1.0.0 * @author Dennis Eichhorn */ - public function save() + public function save() /* : void */ { if (self::$isLocked) { throw new LockException('CookieJar'); diff --git a/DataStorage/Database/BuilderAbstract.php b/DataStorage/Database/BuilderAbstract.php index 3e016245c..0aba6abd5 100644 --- a/DataStorage/Database/BuilderAbstract.php +++ b/DataStorage/Database/BuilderAbstract.php @@ -68,12 +68,12 @@ abstract class BuilderAbstract * * @param string $prefix Prefix * - * @return $this + * @return BuilderAbstract * * @since 1.0.0 * @author Dennis Eichhorn */ - public function prefix(string $prefix) + public function prefix(string $prefix) : BuilderAbstract { $this->prefix = $prefix; diff --git a/DataStorage/Database/Connection/ConnectionAbstract.php b/DataStorage/Database/Connection/ConnectionAbstract.php index e49619dac..1c59d9f66 100644 --- a/DataStorage/Database/Connection/ConnectionAbstract.php +++ b/DataStorage/Database/Connection/ConnectionAbstract.php @@ -165,7 +165,7 @@ abstract class ConnectionAbstract implements ConnectionInterface /** * {@inheritdoc} */ - public function close() + public function close() /* : void */ { $this->con = null; $this->status = DatabaseStatus::CLOSED; diff --git a/DataStorage/Database/Connection/ConnectionInterface.php b/DataStorage/Database/Connection/ConnectionInterface.php index 935902421..2ab211839 100644 --- a/DataStorage/Database/Connection/ConnectionInterface.php +++ b/DataStorage/Database/Connection/ConnectionInterface.php @@ -44,7 +44,7 @@ interface ConnectionInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function connect(array $dbdata); + public function connect(array $dbdata) /* : void */; /** * Get the database type. @@ -74,7 +74,7 @@ interface ConnectionInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function close(); + public function close() /* : void */; /** * Return grammar for this connection. diff --git a/DataStorage/Database/Connection/MysqlConnection.php b/DataStorage/Database/Connection/MysqlConnection.php index 937b6b87a..9487afad7 100644 --- a/DataStorage/Database/Connection/MysqlConnection.php +++ b/DataStorage/Database/Connection/MysqlConnection.php @@ -58,7 +58,7 @@ class MysqlConnection extends ConnectionAbstract /** * {@inheritdoc} */ - public function connect(array $dbdata = null) + public function connect(array $dbdata = null) /* : void */ { $this->close(); diff --git a/DataStorage/Database/Connection/SqlServerConnection.php b/DataStorage/Database/Connection/SqlServerConnection.php index b8779b650..5c7a22f82 100644 --- a/DataStorage/Database/Connection/SqlServerConnection.php +++ b/DataStorage/Database/Connection/SqlServerConnection.php @@ -57,7 +57,7 @@ class SqlServerConnection extends ConnectionAbstract /** * {@inheritdoc} */ - public function connect(array $dbdata = null) + public function connect(array $dbdata = null) /* : void */ { $this->close(); diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index c2af1d607..c08cd14df 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -216,7 +216,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 * @author Dennis Eichhorn */ - private static function extend($class) + private static function extend($class) /* : void */ { /* todo: have to implement this in the queries, so far not used */ self::$collection['primaryField'][] = $class::$primaryField; @@ -264,7 +264,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function with(...$objects) + public static function with(...$objects) /* : void */ { // todo: how to handle with of parent objects/extends/relations @@ -283,7 +283,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function clear() + public static function clear() /* : void */ { self::$overwrite = true; self::$primaryField = ''; diff --git a/DataStorage/Database/DatabasePool.php b/DataStorage/Database/DatabasePool.php index ca9a19b7b..67e68d932 100644 --- a/DataStorage/Database/DatabasePool.php +++ b/DataStorage/Database/DatabasePool.php @@ -78,15 +78,15 @@ class DatabasePool * * @param mixed $key Database key * - * @return ConnectionAbstract|false + * @return ConnectionAbstract|null * * @since 1.0.0 * @author Dennis Eichhorn */ - public function get(string $key = 'core') + public function get(string $key = 'core') /* : ?ConnectionAbstract */ { if (!isset($this->pool[$key])) { - return false; /* todo: return nullconnection */ + return null; /* todo: return nullconnection */ } return $this->pool[$key]; diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 35147355b..2ed7e587e 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -481,7 +481,7 @@ class Builder extends BuilderAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function andWhere(Where $where) + public function andWhere(Where $where) : Builder { $this->wheres[][] = [ 'column' => $where, @@ -501,7 +501,7 @@ class Builder extends BuilderAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function orWhere(Where $where) + public function orWhere(Where $where) : Builder { $this->wheres[][] = [ 'column' => $where, diff --git a/DataStorage/Session/HttpSession.php b/DataStorage/Session/HttpSession.php index 2bc104b2d..29875f5be 100644 --- a/DataStorage/Session/HttpSession.php +++ b/DataStorage/Session/HttpSession.php @@ -154,7 +154,7 @@ class HttpSession implements SessionInterface /** * {@inheritdoc} */ - public function save() + public function save() /* : void */ { if(!self::$isLocked) { $_SESSION = $this->sessionData; diff --git a/DataStorage/Session/SessionInterface.php b/DataStorage/Session/SessionInterface.php index 77a03f195..2f0a43868 100644 --- a/DataStorage/Session/SessionInterface.php +++ b/DataStorage/Session/SessionInterface.php @@ -79,7 +79,7 @@ interface SessionInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function save(); + public function save() /* : void */; /** * @return int|string @@ -97,6 +97,6 @@ interface SessionInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function setSID($sid); + public function setSID($sid) /* : void */; } diff --git a/DataStorage/Session/SocketSession.php b/DataStorage/Session/SocketSession.php index 462857ebd..a956edd18 100644 --- a/DataStorage/Session/SocketSession.php +++ b/DataStorage/Session/SocketSession.php @@ -92,7 +92,7 @@ class SocketSession implements SessionInterface /** * {@inheritdoc} */ - public function save() + public function save() /* : void */ { } diff --git a/Datatypes/Iban.php b/Datatypes/Iban.php index 484683d2d..c395f4c3c 100644 --- a/Datatypes/Iban.php +++ b/Datatypes/Iban.php @@ -63,7 +63,7 @@ class Iban implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - private function parse(string $iban) + private function parse(string $iban) /* : void */ { $this->iban = self::normalize($iban); @@ -276,7 +276,7 @@ class Iban implements \Serializable * @return string the string representation of the object or null * @since 5.1.0 */ - public function serialize() /* : void */ + public function serialize() { return $this->prettyPrint(); } diff --git a/Datatypes/Location.php b/Datatypes/Location.php index d20399da6..af42b8c72 100644 --- a/Datatypes/Location.php +++ b/Datatypes/Location.php @@ -237,7 +237,7 @@ class Location implements \JsonSerializable, \Serializable * @return string the string representation of the object or null * @since 5.1.0 */ - public function serialize() /* : void */ + public function serialize() { return $this->jsonSerialize(); } diff --git a/Event/EventManager.php b/Event/EventManager.php index be7446beb..b970dca52 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -75,7 +75,7 @@ class EventManager implements Mediator /** * {@inheritdoc} */ - public function trigger(string $group, string $id = '') + public function trigger(string $group, string $id = '') /* : void */ { if (isset($this->groups[$group])) { unset($this->groups[$group][$id]); @@ -117,7 +117,7 @@ class EventManager implements Mediator /** * {@inheritdoc} */ - public function addGroup(string $group, string $id) + public function addGroup(string $group, string $id) /* : void */ { if (!isset($this->groups[$group])) { $this->groups[$group] = []; diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index ac2cb1cc2..9ae1bd211 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -94,7 +94,7 @@ class L11nManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function loadLanguage(string $language, string $from, array $translation) + public function loadLanguage(string $language, string $from, array $translation) /* : void */ { if (!isset($translation[$from])) { throw new \Exception('Unexpected language key: ' . $from); @@ -123,7 +123,7 @@ class L11nManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function loadLanguageFromFile(string $language, string $from, string $file) + public function loadLanguageFromFile(string $language, string $from, string $file) /* : void */ { $lang = []; if (file_exists(file)) { @@ -164,12 +164,12 @@ class L11nManager * @param string $theme Theme * @param string $translation Text * - * @return array + * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ - public function getText(string $code, string $module, string $theme, string $translation) + public function getText(string $code, string $module, string $theme, string $translation) : string { if (!isset($this->language[$code][$module][$translation])) { /** @var ModuleAbstract $class */ diff --git a/Localization/Money.php b/Localization/Money.php index 7e4cfb5f9..bd0a5fb7a 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -345,7 +345,7 @@ class Money implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { return $this->getInt(); } diff --git a/Log/FileLogger.php b/Log/FileLogger.php index deb278542..7d5b976f2 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -127,7 +127,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - private function createFile() + private function createFile() /* : void */ { if (!$this->created && !file_exists($this->path)) { File::create($this->path); @@ -306,7 +306,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - private function write(string $message) + private function write(string $message) /* : void */ { $this->createFile(); $this->fp = fopen($this->path, 'a'); @@ -335,7 +335,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function emergency(string $message, array $context = []) + public function emergency(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::EMERGENCY); $this->write($message); @@ -355,7 +355,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function alert(string $message, array $context = []) + public function alert(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::ALERT); $this->write($message); @@ -374,7 +374,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function critical(string $message, array $context = []) + public function critical(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::CRITICAL); $this->write($message); @@ -392,7 +392,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function error(string $message, array $context = []) + public function error(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::ERROR); $this->write($message); @@ -412,7 +412,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function warning(string $message, array $context = []) + public function warning(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::WARNING); $this->write($message); @@ -429,7 +429,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function notice(string $message, array $context = []) + public function notice(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::NOTICE); $this->write($message); @@ -448,7 +448,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function info(string $message, array $context = []) + public function info(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::INFO); $this->write($message); @@ -465,7 +465,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function debug(string $message, array $context = []) + public function debug(string $message, array $context = []) /* : void */ { $message = $this->interpolate($message, $context, LogLevel::DEBUG); $this->write($message); @@ -483,7 +483,7 @@ class FileLogger implements LoggerInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function log(string $level, string $message, array $context = []) + public function log(string $level, string $message, array $context = []) /* : void */ { if (!LogLevel::isValidValue($level)) { throw new InvalidEnumValue($level); diff --git a/Log/LoggerInterface.php b/Log/LoggerInterface.php index 01ac8761a..c2ef56e71 100644 --- a/Log/LoggerInterface.php +++ b/Log/LoggerInterface.php @@ -37,7 +37,7 @@ interface LoggerInterface * * @return null */ - public function emergency(string $message, array $context = []); + public function emergency(string $message, array $context = []) /* : void */; /** * Action must be taken immediately. @@ -50,7 +50,7 @@ interface LoggerInterface * * @return null */ - public function alert(string $message, array $context = []); + public function alert(string $message, array $context = []) /* : void */; /** * Critical conditions. @@ -62,7 +62,7 @@ interface LoggerInterface * * @return null */ - public function critical(string $message, array $context = []); + public function critical(string $message, array $context = []) /* : void */; /** * Runtime errors that do not require immediate action but should typically @@ -73,7 +73,7 @@ interface LoggerInterface * * @return null */ - public function error(string $message, array $context = []); + public function error(string $message, array $context = []) /* : void */; /** * Exceptional occurrences that are not errors. @@ -86,7 +86,7 @@ interface LoggerInterface * * @return null */ - public function warning(string $message, array $context = []); + public function warning(string $message, array $context = []) /* : void */; /** * Normal but significant events. @@ -96,7 +96,7 @@ interface LoggerInterface * * @return null */ - public function notice(string $message, array $context = []); + public function notice(string $message, array $context = []) /* : void */; /** * Interesting events. @@ -108,7 +108,7 @@ interface LoggerInterface * * @return null */ - public function info(string $message, array $context = []); + public function info(string $message, array $context = []) /* : void */; /** * Detailed debug information. @@ -118,7 +118,7 @@ interface LoggerInterface * * @return null */ - public function debug(string $message, array $context = []); + public function debug(string $message, array $context = []) /* : void */; /** * Logs with an arbitrary level. @@ -129,5 +129,5 @@ interface LoggerInterface * * @return null */ - public function log(string $level, string $message, array $context = []); + public function log(string $level, string $message, array $context = []) /* : void */; } diff --git a/Math/Functions/Functions.php b/Math/Functions/Functions.php index 5ea36b9fd..9c5e5c195 100644 --- a/Math/Functions/Functions.php +++ b/Math/Functions/Functions.php @@ -170,7 +170,7 @@ class Functions * @since 1.0.0 * @author Dennis Eichhorn */ - public static function invMod(int $a, int $n) + public static function invMod(int $a, int $n) : int { if ($n < 0) { $n = -$n; @@ -217,7 +217,7 @@ class Functions * @since 1.0.0 * @author Dennis Eichhorn */ - public static function mod($a, $b) + public static function mod($a, $b) : int { if ($a < 0) { return ($a + $b) % $b; @@ -277,7 +277,7 @@ class Functions * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getRelativeDegree($value, $length, $start = 0) + public static function getRelativeDegree($value, $length, $start = 0) : int { return abs(self::mod($value - $start, $length)); } diff --git a/Math/Shape/D2/Ellipse.php b/Math/Shape/D2/Ellipse.php index e7583011d..5ac9b28dd 100644 --- a/Math/Shape/D2/Ellipse.php +++ b/Math/Shape/D2/Ellipse.php @@ -45,7 +45,7 @@ class Ellipse implements D2ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getSurface(float $a, float $b) + public static function getSurface(float $a, float $b) : float { return pi() * $a * $b; } @@ -66,7 +66,7 @@ class Ellipse implements D2ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getPerimeter(float $a, float $b) + public static function getPerimeter(float $a, float $b) : float { return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1); } diff --git a/Math/Shape/D2/Polygon.php b/Math/Shape/D2/Polygon.php index 4949aad4c..9cb6e4453 100644 --- a/Math/Shape/D2/Polygon.php +++ b/Math/Shape/D2/Polygon.php @@ -288,7 +288,7 @@ class Polygon implements D2ShapeInterface /** * {@inheritdoc} */ - public function reset() + public function reset() /* : void */ { $this->coord = []; $this->barycenter = ['x' => 0.0, 'y' => 0.0]; @@ -311,7 +311,7 @@ class Polygon implements D2ShapeInterface /** * {@inheritdoc} */ - public function getPerimeter() + public function getPerimeter() : float { $count = count($this->coord); $this->perimeter = sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2); diff --git a/Math/Shape/D3/Sphere.php b/Math/Shape/D3/Sphere.php index 18711b2b0..7c05d3633 100644 --- a/Math/Shape/D3/Sphere.php +++ b/Math/Shape/D3/Sphere.php @@ -88,7 +88,7 @@ class Sphere implements D3ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getRadiusByVolume(float $V) + public static function getRadiusByVolume(float $V) : float { return pow($V * 3 / (4 * pi()), 1 / 3); } @@ -108,7 +108,7 @@ class Sphere implements D3ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getRadiusBySurface(float $S) + public static function getRadiusBySurface(float $S) : float { return sqrt($S / (4 * pi())); } @@ -128,7 +128,7 @@ class Sphere implements D3ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getVolumeByRadius(float $r) + public static function getVolumeByRadius(float $r) : float { return 4 / 3 * pi() * $r ** 3; } @@ -153,7 +153,7 @@ class Sphere implements D3ShapeInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getSurfaceByRadius(float $r) + public static function getSurfaceByRadius(float $r) : float { return 4 * pi() * $r ** 2; } diff --git a/Math/Statistic/Average.php b/Math/Statistic/Average.php index e52dfeb94..b003dc352 100644 --- a/Math/Statistic/Average.php +++ b/Math/Statistic/Average.php @@ -158,7 +158,7 @@ class Average * @since 1.0.0 * @author Dennis Eichhorn */ - public static function arithmeticMean(array $values) + public static function arithmeticMean(array $values) : float { $count = count($values); @@ -233,7 +233,7 @@ class Average * @since 1.0.0 * @author Dennis Eichhorn */ - public static function geometricMean(array $values, int $offset = 0) + public static function geometricMean(array $values, int $offset = 0) : float { $count = count($values); @@ -259,7 +259,7 @@ class Average * @since 1.0.0 * @author Dennis Eichhorn */ - public static function harmonicMean(array $values, int $offset = 0) + public static function harmonicMean(array $values, int $offset = 0) : float { sort($values); @@ -294,7 +294,7 @@ class Average * @since 1.0.0 * @author Dennis Eichhorn */ - public static function angleMean($angles, int $offset = 0) + public static function angleMean($angles, int $offset = 0) : float { $y = $x = 0; $size = count($angles); @@ -371,7 +371,7 @@ class Average * @since 1.0.0 * @author Dennis Eichhorn */ - public static function angleMean2(array $angles, int $offset = 0) + public static function angleMean2(array $angles, int $offset = 0) : float { sort($angles); diff --git a/Message/HeaderAbstract.php b/Message/HeaderAbstract.php index 650206aab..f16233686 100644 --- a/Message/HeaderAbstract.php +++ b/Message/HeaderAbstract.php @@ -59,7 +59,7 @@ abstract class HeaderAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - abstract public function generate(string $statusCode); + abstract public function generate(string $statusCode) /* : void */; /** * Get header by key. @@ -91,7 +91,7 @@ abstract class HeaderAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function lock() + public static function lock() /* : void */ { // todo: maybe pass session as member and make lock not static self::$isLocked = true; diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 310a3b487..75ffee681 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -106,7 +106,7 @@ class Request extends RequestAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function init($uri = null) + public function init($uri = null) /* : void */ { if (!isset($uri)) { $this->initCurrentRequest(); @@ -135,7 +135,7 @@ class Request extends RequestAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private function initCurrentRequest() + private function initCurrentRequest() /* : void */ { $this->data = $_GET ?? []; $this->files = $_FILES ?? []; @@ -166,7 +166,7 @@ class Request extends RequestAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private function initPseudoRequest($uri) + private function initPseudoRequest($uri) /* : void */ { $this->setMethod($uri['type']); $this->uri->set($uri['uri']); @@ -180,7 +180,7 @@ class Request extends RequestAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private function cleanupGlobals() + private function cleanupGlobals() /* : void */ { unset($_FILES); unset($_GET); @@ -224,7 +224,7 @@ class Request extends RequestAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private function createRequestHashs() + private function createRequestHashs() /* : void */ { $this->hash = []; foreach ($this->path as $key => $path) { @@ -312,12 +312,12 @@ class Request extends RequestAbstract /** * Determine request OS. * - * @return OSType + * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ - public function getOS() : OSType + public function getOS() : string { if (!isset($this->os)) { $arr = OSType::getConstants(); diff --git a/Message/MessageInterface.php b/Message/MessageInterface.php index ff64bb3b0..57585e026 100644 --- a/Message/MessageInterface.php +++ b/Message/MessageInterface.php @@ -67,7 +67,7 @@ interface MessageInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function setStatusCode(string $status); + public function setStatusCode(string $status) /* : void */; /** * Get status code. @@ -99,5 +99,5 @@ interface MessageInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function setAccount(int $account); + public function setAccount(int $account) /* : void */; } diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index dd72bb544..b8496cf24 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -227,7 +227,7 @@ abstract class RequestAbstract implements MessageInterface /** * {@inheritdoc} */ - public function getPath($key = null) + public function getPath($key = null) /* : ?string */ { if ($key === null) { return $this->path; @@ -316,7 +316,7 @@ abstract class RequestAbstract implements MessageInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function lock() + public function lock() /* : void */ { $this->lock = true; } diff --git a/Model/Html/Head.php b/Model/Html/Head.php index c9b52190c..497b69b46 100644 --- a/Model/Html/Head.php +++ b/Model/Html/Head.php @@ -154,7 +154,7 @@ class Head implements RenderableInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public function addAsset(string $type, string $uri) + public function addAsset(string $type, string $uri) /* : void */ { $this->assets[$uri] = $type; } diff --git a/Module/ActivateAbstract.php b/Module/ActivateAbstract.php index aa9675124..9fddaff36 100644 --- a/Module/ActivateAbstract.php +++ b/Module/ActivateAbstract.php @@ -43,7 +43,7 @@ class ActivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function activate(DatabasePool $dbPool, InfoManager $info) + public static function activate(DatabasePool $dbPool, InfoManager $info) /* : void */ { self::activateRoutes(ROOT_PATH . '/Web/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/http.php'); self::activateInDatabase($dbPool, $info); @@ -60,7 +60,7 @@ class ActivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private static function activateRoutes(string $destRoutePath, string $srcRoutePath) + private static function activateRoutes(string $destRoutePath, string $srcRoutePath) /* : void */ { // todo: remove route } @@ -76,7 +76,7 @@ class ActivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function activateInDatabase(DatabasePool $dbPool, InfoManager $info) + public static function activateInDatabase(DatabasePool $dbPool, InfoManager $info) /* : void */ { switch ($dbPool->get()->getType()) { case DatabaseType::MYSQL: diff --git a/Module/DeactivateAbstract.php b/Module/DeactivateAbstract.php index 9fa0c0c71..ae4bdf904 100644 --- a/Module/DeactivateAbstract.php +++ b/Module/DeactivateAbstract.php @@ -43,7 +43,7 @@ class DeactivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function deactivate(DatabasePool $dbPool, InfoManager $info) + public static function deactivate(DatabasePool $dbPool, InfoManager $info) /* : void */ { self::deactivateRoutes(ROOT_PATH . '/Web/Routes.php', ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes/http.php'); self::deactivateInDatabase($dbPool, $info); @@ -60,7 +60,7 @@ class DeactivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private static function deactivateRoutes(string $destRoutePath, string $srcRoutePath) + private static function deactivateRoutes(string $destRoutePath, string $srcRoutePath) /* : void */ { // todo: remove route } @@ -76,7 +76,7 @@ class DeactivateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function deactivateInDatabase(DatabasePool $dbPool, InfoManager $info) + public static function deactivateInDatabase(DatabasePool $dbPool, InfoManager $info) /* : void */ { switch ($dbPool->get()->getType()) { case DatabaseType::MYSQL: diff --git a/Module/InfoManager.php b/Module/InfoManager.php index f7929f4c7..83b083f07 100644 --- a/Module/InfoManager.php +++ b/Module/InfoManager.php @@ -71,7 +71,7 @@ class InfoManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function load() + public function load() /* : void */ { if (!file_exists($this->path)) { throw new PathException($this->path); @@ -88,7 +88,7 @@ class InfoManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function update() + public function update() /* : void */ { file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT)); } diff --git a/Module/InstallerAbstract.php b/Module/InstallerAbstract.php index 922349482..d2fc22ab9 100644 --- a/Module/InstallerAbstract.php +++ b/Module/InstallerAbstract.php @@ -46,7 +46,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function registerInDatabase(DatabasePool $dbPool, InfoManager $info) + public static function registerInDatabase(DatabasePool $dbPool, InfoManager $info) /* : void */ { switch ($dbPool->get()->getType()) { case DatabaseType::MYSQL: @@ -99,7 +99,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function install(string $routePath, DatabasePool $dbPool, InfoManager $info) + public static function install(string $routePath, DatabasePool $dbPool, InfoManager $info) /* : void */ { self::registerInDatabase($dbPool, $info); self::initRoutes($routePath, $info); @@ -117,7 +117,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private static function activate(DatabasePool $dbPool, InfoManager $info) + private static function activate(DatabasePool $dbPool, InfoManager $info) /* : void */ { /** @var ActivateAbstract $class */ $class = '\Modules\\' . $info->getDirectory() . '\Admin\Activate'; @@ -135,7 +135,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function reInit(string $routePath, InfoManager $info) + public static function reInit(string $routePath, InfoManager $info) /* : void */ { self::initRoutes($routePath, $info); } @@ -153,7 +153,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private static function initRoutes(string $routePath, InfoManager $info) + private static function initRoutes(string $routePath, InfoManager $info) /* : void */ { // todo: maybe use static::__DIR__ ? $directories = new Directory(ROOT_PATH . '/Modules/' . $info->getDirectory() . '/Admin/Routes'); @@ -180,7 +180,7 @@ class InstallerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - private static function installRoutes(string $destRoutePath, string $srcRoutePath) + private static function installRoutes(string $destRoutePath, string $srcRoutePath) /* : void */ { if (!file_exists($destRoutePath)) { file_put_contents($destRoutePath, ' */ - public static function installExternal() + public static function installExternal() /* : void */ { - return false; } /** @@ -135,7 +134,7 @@ abstract class ModuleAbstract /** * {@inheritdoc} */ - public function addReceiving(string $module) + public function addReceiving(string $module) /* : void */ { $this->receiving[] = $module; } diff --git a/Module/ModuleFactory.php b/Module/ModuleFactory.php index a63294078..783063bdd 100644 --- a/Module/ModuleFactory.php +++ b/Module/ModuleFactory.php @@ -103,7 +103,7 @@ class ModuleFactory * @since 1.0.0 * @author Dennis Eichhorn */ - private static function registerRequesting(ModuleAbstract $obj) + private static function registerRequesting(ModuleAbstract $obj) /* : void */ { foreach ($obj->getProviding() as $providing) { if (isset(self::$loaded[$providing])) { @@ -122,7 +122,7 @@ class ModuleFactory * @since 1.0.0 * @author Dennis Eichhorn */ - private static function registerProvided(ModuleAbstract $obj) + private static function registerProvided(ModuleAbstract $obj) /* : void */ { $name = $obj->getName(); if (isset(self::$providing[$name])) { diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index f3ad39463..d16dfae30 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -433,7 +433,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - private function installDependencies(array $dependencies) + private function installDependencies(array $dependencies) /* : void */ { foreach ($dependencies as $key => $version) { $this->install($key); @@ -452,7 +452,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - private function installModule(InfoManager $info) + private function installModule(InfoManager $info) /* : void */ { /** @var $class InstallerAbstract */ $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer'; @@ -476,7 +476,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - private function deactivateModule(InfoManager $info) + private function deactivateModule(InfoManager $info) /* : void */ { $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Deactivate'; @@ -500,7 +500,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - private function activateModule(InfoManager $info) + private function activateModule(InfoManager $info) /* : void */ { $class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Deactivate'; @@ -572,7 +572,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function installProviding(string $from, string $for) + public function installProviding(string $from, string $for) /* : void */ { if (file_exists(self::MODULE_PATH . '/' . $from . '/Admin/Install/' . $for . '.php')) { $class = '\\Modules\\' . $from . '\\Admin\\Install\\' . $for; @@ -586,12 +586,14 @@ class ModuleManager * * @param string|array $modules Module name * + * @return void + * * @throws \InvalidArgumentException * * @since 1.0.0 * @author Dennis Eichhorn */ - public function initModule($modules) + public function initModule($modules) /* : void */ { $modules = (array) $modules; @@ -618,7 +620,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - private function initModuleController(string $module) + private function initModuleController(string $module) /* : void */ { try { $this->running[$module] = ModuleFactory::getInstance($module, $this->app); @@ -640,7 +642,7 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function get(string $module) + public function get(string $module) : ModuleAbstract { try { if (!isset($this->running[$module])) { diff --git a/Module/UninstallAbstract.php b/Module/UninstallAbstract.php index b80667e3d..9162b6774 100644 --- a/Module/UninstallAbstract.php +++ b/Module/UninstallAbstract.php @@ -42,7 +42,7 @@ class UninstallAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function uninstall(DatabasePool $dbPool, InfoManager $info) + public static function uninstall(DatabasePool $dbPool, InfoManager $info) /* : void */ { } diff --git a/Module/UpdateAbstract.php b/Module/UpdateAbstract.php index 6c43b7b83..3b93e90b3 100644 --- a/Module/UpdateAbstract.php +++ b/Module/UpdateAbstract.php @@ -42,7 +42,7 @@ class UpdateAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function update(DatabasePool $dbPool, InfoManager $info) + public static function update(DatabasePool $dbPool, InfoManager $info) /* : void */ { } } diff --git a/Pattern/Mediator.php b/Pattern/Mediator.php index 39c5e6f4b..f291f7f07 100644 --- a/Pattern/Mediator.php +++ b/Pattern/Mediator.php @@ -38,12 +38,12 @@ interface Mediator extends \Countable * @param \Closure $callback Function to call if the event gets triggered * @param bool $remove Remove event after execution * - * @return void + * @return bool * * @since 1.0.0 * @author Dennis Eichhorn */ - public function attach(string $group, \Closure $callback, bool $remove = false); + public function attach(string $group, \Closure $callback, bool $remove = false) : bool; /** * Removing a event. @@ -70,7 +70,7 @@ interface Mediator extends \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function addGroup(string $group, string $id); + public function addGroup(string $group, string $id) /* : void */; /** * Trigger event. @@ -85,5 +85,5 @@ interface Mediator extends \Countable * @since 1.0.0 * @author Dennis Eichhorn */ - public function trigger(string $group, string $id); + public function trigger(string $group, string $id) /* : void */; } diff --git a/Router/Router.php b/Router/Router.php index 161581ebc..b429c8c80 100644 --- a/Router/Router.php +++ b/Router/Router.php @@ -83,7 +83,7 @@ class Router * @since 1.0.0 * @author Dennis Eichhorn */ - public function add(string $route, $destination, int $verb = RouteVerb::GET) + public function add(string $route, $destination, int $verb = RouteVerb::GET) /* : void */ { if (!isset($this->routes[$route])) { $this->routes[$route] = []; diff --git a/Socket/Packets/Header.php b/Socket/Packets/Header.php index b676689f9..f9d5a7461 100644 --- a/Socket/Packets/Header.php +++ b/Socket/Packets/Header.php @@ -158,7 +158,7 @@ class Header implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { return $this->__toString(); } diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index f1d3b3b96..46e0200fd 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -121,10 +121,12 @@ class MultiMap implements \Countable /** * Garbage collect unreferenced values/keys * + * @return void + * * @since 1.0.0 * @author Dennis Eichhorn */ - private function garbageCollect() + private function garbageCollect() /* : void */ { /* garbage collect keys */ foreach ($this->keys as $key => $keyValue) { diff --git a/Stdlib/Queue/PriorityQueue.php b/Stdlib/Queue/PriorityQueue.php index f13021398..b924a9d22 100644 --- a/Stdlib/Queue/PriorityQueue.php +++ b/Stdlib/Queue/PriorityQueue.php @@ -102,7 +102,7 @@ class PriorityQueue implements \Countable, \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function increaseAll(float $increase = 0.1) + public function increaseAll(float $increase = 0.1) /* : void */ { foreach ($this->queue as $key => &$ele) { $ele['priority'] += $increase; @@ -132,7 +132,7 @@ class PriorityQueue implements \Countable, \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function delete(int $id = null) + public function delete(int $id = null) /* : void */ { if ($id === null) { $this->remove(); diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index 65d116a8d..b9732c1a0 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -73,7 +73,7 @@ class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public function index() + public function index() /* : void */ { parent::index(); diff --git a/System/File/Local/File.php b/System/File/Local/File.php index 62d0199fa..b21a26501 100644 --- a/System/File/Local/File.php +++ b/System/File/Local/File.php @@ -57,7 +57,7 @@ class File extends FileAbstract implements FileInterface /** * {@inheritdoc} */ - public function index() + public function index() /* : void */ { parent::index(); diff --git a/System/File/Local/FileAbstract.php b/System/File/Local/FileAbstract.php index 7fdcf2f7a..b52bc6105 100644 --- a/System/File/Local/FileAbstract.php +++ b/System/File/Local/FileAbstract.php @@ -187,7 +187,7 @@ abstract class FileAbstract implements ContainerInterface /** * {@inheritdoc} */ - public function index() + public function index() /* : void */ { $this->createdAt->setTimestamp(filemtime($this->path)); $this->changedAt->setTimestamp(filectime($this->path)); diff --git a/System/File/StorageAbstract.php b/System/File/StorageAbstract.php index f5a8b4274..03dd15c33 100644 --- a/System/File/StorageAbstract.php +++ b/System/File/StorageAbstract.php @@ -64,7 +64,7 @@ abstract class StorageAbstract implements DirectoryInterface, FileInterface * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getInstance() + public static function getInstance() : StorageAbstract { if(!isset(static::$instance)) { static::$instance = new static(); diff --git a/UnhandledHandler.php b/UnhandledHandler.php index ae3a77f08..d695d5464 100644 --- a/UnhandledHandler.php +++ b/UnhandledHandler.php @@ -37,7 +37,7 @@ final class UnhandledHandler * @since 1.0.0 * @author Dennis Eichhorn */ - public static function exceptionHandler($e) + public static function exceptionHandler($e) /* : void */ { $logger = FileLogger::getInstance(ROOT_PATH . '/Logs'); $logger->critical(FileLogger::MSG_FULL, [ @@ -109,7 +109,7 @@ final class UnhandledHandler * @since 1.0.0 * @author Dennis Eichhorn */ - public static function shutdownHandler() + public static function shutdownHandler() /* : void */ { $e = error_get_last(); diff --git a/Uri/Http.php b/Uri/Http.php index 3725c43c2..6c92721f9 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -280,7 +280,7 @@ class Http implements UriInterface /** * {@inheritdoc} */ - public function getQuery(string $key = null) + public function getQuery(string $key = null) /* : ?string */ { return isset($key) ? $this->query[$key] ?? null : $this->queryString ?? ''; } diff --git a/Uri/UriFactory.php b/Uri/UriFactory.php index 9e2d70d7d..04db9dcd9 100644 --- a/Uri/UriFactory.php +++ b/Uri/UriFactory.php @@ -54,14 +54,14 @@ class UriFactory * * @param string $key Replacement key * - * @return false|string + * @return null|string * * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getQuery(string $key) + public static function getQuery(string $key) /* : ?string */ { - return self::$uri[$key] ?? false; + return self::$uri[$key] ?? null; } /** @@ -181,7 +181,7 @@ class UriFactory * @since 1.0.0 * @author Dennis Eichhorn */ - public static function build(string $uri, array $toMatch = []) + public static function build(string $uri, array $toMatch = []) /* : ?string */ { $parsed = preg_replace_callback('(\{[\/#\?@\.\$][a-zA-Z0-9\-]*\})', function ($match) use ($toMatch) { $match = substr($match[0], 1, strlen($match[0]) - 2); diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 20fceefa0..b64d09181 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -237,7 +237,7 @@ class ArrayUtils * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getArg(string $id, array $args) + public static function getArg(string $id, array $args) /* : ?string */ { if (($key = array_search($id, $args)) === false || $key === count($args) - 1) { return null; diff --git a/Utils/Converter/Currency.php b/Utils/Converter/Currency.php index 3cce7aaf7..c5f6b7a96 100644 --- a/Utils/Converter/Currency.php +++ b/Utils/Converter/Currency.php @@ -55,7 +55,7 @@ class Currency * @since 1.0.0 * @author Dennis Eichhorn */ - public static function resetCurrencies() + public static function resetCurrencies() /* : void */ { self::$ecbCurrencies = null; } diff --git a/Utils/Encoding/Huffman/Dictionary.php b/Utils/Encoding/Huffman/Dictionary.php index 3304f80c6..480c582bb 100644 --- a/Utils/Encoding/Huffman/Dictionary.php +++ b/Utils/Encoding/Huffman/Dictionary.php @@ -77,7 +77,7 @@ final class Dictionary * @since 1.0.0 * @author Dennis Eichhorn */ - public function generate(string $source) + public function generate(string $source) /* : void */ { $this->dictionary = []; $this->min = -1; @@ -113,7 +113,7 @@ final class Dictionary * @since 1.0.0 * @author Dennis Eichhorn */ - private function fill(string $entry, string $value = '') + private function fill(string $entry, string $value = '') /* : void */ { if (!is_array($entry[0][1])) { $this->set($entry[0][1], $value . '0'); @@ -205,7 +205,7 @@ final class Dictionary * @since 1.0.0 * @author Dennis Eichhorn */ - public function getEntry(&$value) + public function getEntry(&$value) /* : ?string */ { $length = strlen($value); if ($length < $this->min) { diff --git a/Utils/Encoding/Huffman/Huffman.php b/Utils/Encoding/Huffman/Huffman.php index 4166a000d..e455cbd87 100644 --- a/Utils/Encoding/Huffman/Huffman.php +++ b/Utils/Encoding/Huffman/Huffman.php @@ -42,7 +42,7 @@ final class Huffman * @since 1.0.0 * @author Dennis Eichhorn */ - public function removeDictionary() + public function removeDictionary() /* : void */ { $this->dictionary = null; } diff --git a/Utils/Git/Commit.php b/Utils/Git/Commit.php index 6d17fdb08..291592ef5 100644 --- a/Utils/Git/Commit.php +++ b/Utils/Git/Commit.php @@ -347,7 +347,7 @@ class Commit * @since 1.0.0 * @author Dennis Eichhorn */ - private function addChange(string $path, int $line, string $old, string $new) + private function addChange(string $path, int $line, string $old, string $new) /* : void */ { if (!isset($this->files[$path])) { throw new \Exception(); diff --git a/Utils/JsonBuilder.php b/Utils/JsonBuilder.php index 5f438cead..6f597cd62 100644 --- a/Utils/JsonBuilder.php +++ b/Utils/JsonBuilder.php @@ -72,7 +72,7 @@ class JsonBuilder implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function add(string $path, $value, bool $overwrite = true) + public function add(string $path, $value, bool $overwrite = true) /* : void */ { $this->json = ArrayUtils::setArray($path, $this->json, $value, '/', $overwrite); } @@ -87,7 +87,7 @@ class JsonBuilder implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function remove(string $path) + public function remove(string $path) /* : void */ { $this->json = ArrayUtils::unsetArray($path, $this->json, '/'); } @@ -98,7 +98,7 @@ class JsonBuilder implements \Serializable * @return string the string representation of the object or null * @since 5.1.0 */ - public function serialize() /* : void */ + public function serialize() { return json_encode($this->json); } diff --git a/Utils/Parser/Php/ClassParser.php b/Utils/Parser/Php/ClassParser.php index 2b504a66f..e66497b27 100644 --- a/Utils/Parser/Php/ClassParser.php +++ b/Utils/Parser/Php/ClassParser.php @@ -152,7 +152,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function createFile(string $path) + public function createFile(string $path) /* : void */ { // todo: implement } @@ -279,7 +279,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function removeExtends() + public function removeExtends() /* : void */ { $this->extends = ''; } @@ -320,7 +320,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function removeNamespace() + public function removeNamespace() /* : void */ { $this->namespace = ''; } @@ -336,7 +336,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addUse(string $namespace, string $as = null) + public function addUse(string $namespace, string $as = null) /* : void */ { if (isset($as)) { $this->use[$as] = $namespace; @@ -404,7 +404,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addImplements(string $implements) + public function addImplements(string $implements) /* : void */ { $this->implements[] = $implements; @@ -421,7 +421,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addInclude(string $include) + public function addInclude(string $include) /* : void */ { $this->includes[] = $include; @@ -438,7 +438,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addRequire(string $require) + public function addRequire(string $require) /* : void */ { $this->requires[] = $require; @@ -456,7 +456,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addTrait(string $trait, string $as = null) + public function addTrait(string $trait, string $as = null) /* : void */ { if (isset($as)) { $this->traits[$as] = $trait; @@ -496,7 +496,7 @@ class ClassParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addMember(MemberParser $member) + public function addMember(MemberParser $member) /* : void */ { $this->members[$member->getName()] = $member; } diff --git a/Utils/Parser/Php/FunctionParser.php b/Utils/Parser/Php/FunctionParser.php index 3cb9ac6b1..e76910a6c 100644 --- a/Utils/Parser/Php/FunctionParser.php +++ b/Utils/Parser/Php/FunctionParser.php @@ -158,7 +158,7 @@ class FunctionParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function removeBody() + public function removeBody() /* : void */ { $this->body = ''; } @@ -289,7 +289,7 @@ class FunctionParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function removeReturn() + public function removeReturn() /* : void */ { $this->return = null; } @@ -334,7 +334,7 @@ class FunctionParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function addParameter(string $name, string $typehint = null, string $default = null) + public function addParameter(string $name, string $typehint = null, string $default = null) /* : void */ { $this->parameters[$name]['name'] = $name; $this->parameters[$name]['typehint'] = $typehint; @@ -356,7 +356,7 @@ class FunctionParser * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { $function = ''; $function .= str_repeat(' ', ClassParser::INDENT); diff --git a/Utils/RnG/DateTime.php b/Utils/RnG/DateTime.php index 036810327..4f4927840 100644 --- a/Utils/RnG/DateTime.php +++ b/Utils/RnG/DateTime.php @@ -40,7 +40,7 @@ class DateTime * @since 1.0.0 * @author Dennis Eichhorn */ - public static function generateDateTime($start, $end) + public static function generateDateTime(string $start, string $end) : \DateTime { $startDate = strtotime($start); $endDate = strtotime($end); diff --git a/Utils/RnG/Name.php b/Utils/RnG/Name.php index 8b4d161b8..cf757541c 100644 --- a/Utils/RnG/Name.php +++ b/Utils/RnG/Name.php @@ -482,7 +482,7 @@ class Name * @since 1.0.0 * @author Dennis Eichhorn */ - public static function generateName(array $type, string $origin = 'western') + public static function generateName(array $type, string $origin = 'western') : string { $rndType = rand(0, count($type) - 1); diff --git a/Utils/RnG/Text.php b/Utils/RnG/Text.php index 5aa6d8f94..d46c3daa5 100644 --- a/Utils/RnG/Text.php +++ b/Utils/RnG/Text.php @@ -276,7 +276,7 @@ class Text * @since 1.0.0 * @author Dennis Eichhorn */ - public function getSentences() + public function getSentences() : int { return $this->sentences; } @@ -292,7 +292,7 @@ class Text * @since 1.0.0 * @author Dennis Eichhorn */ - public function generateText($length, $words = null) + public function generateText(int $length, $words = null) : string { if ($length === 0) { return ''; @@ -383,7 +383,7 @@ class Text * @since 1.0.0 * @author Dennis Eichhorn */ - private function generatePunctuation($length) + private function generatePunctuation(int $length) : string { $minSentences = 4; $maxSentences = 20; @@ -450,7 +450,7 @@ class Text * @since 1.0.0 * @author Dennis Eichhorn */ - private function generateParagraph($length) + private function generateParagraph(int $length) /* : void */ { $minSentence = 3; $maxSentence = 10; @@ -481,7 +481,7 @@ class Text * @since 1.0.0 * @author Dennis Eichhorn */ - private function generateFormatting($length) + private function generateFormatting(int $length) : array { $probCursive = 0.005; $probBold = 0.005; diff --git a/Utils/TaskSchedule/CronJob.php b/Utils/TaskSchedule/CronJob.php index 9b362c91f..05c882d6b 100644 --- a/Utils/TaskSchedule/CronJob.php +++ b/Utils/TaskSchedule/CronJob.php @@ -57,7 +57,7 @@ class CronJob extends TaskAbstract implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { $minute = $this->printValue($this->interval->getMinute()); $hour = $this->printValue($this->interval->getHour()); diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index 43c5612ac..d82f665c8 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -617,7 +617,7 @@ class Interval implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { $minute = $this->serializeTime($this->minute['minutes'], $this->minute['step']); $hour = $this->serializeTime($this->hour['hours'], $this->hour['step']); diff --git a/Utils/TaskSchedule/Schedule.php b/Utils/TaskSchedule/Schedule.php index 5d211dd85..16664e121 100644 --- a/Utils/TaskSchedule/Schedule.php +++ b/Utils/TaskSchedule/Schedule.php @@ -48,7 +48,7 @@ class Schedule extends TaskAbstract implements \Serializable * @return string the string representation of the object or null * @since 5.1.0 */ - public function serialize() /* : void */ + public function serialize() { // TODO: Implement serialize() method. } diff --git a/Utils/TaskSchedule/SchedulerAbstract.php b/Utils/TaskSchedule/SchedulerAbstract.php index 8b2dba090..686738e8c 100644 --- a/Utils/TaskSchedule/SchedulerAbstract.php +++ b/Utils/TaskSchedule/SchedulerAbstract.php @@ -109,7 +109,7 @@ abstract class SchedulerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function add(TaskAbstract $task) + public function add(TaskAbstract $task) /* : void */ { $this->tasks[$task->getId()] = $task; } @@ -186,5 +186,5 @@ abstract class SchedulerAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - abstract public function save(); + abstract public function save() /* : void */; } diff --git a/Utils/TaskSchedule/TaskScheduler.php b/Utils/TaskSchedule/TaskScheduler.php index e9055b63d..e2198d8bd 100644 --- a/Utils/TaskSchedule/TaskScheduler.php +++ b/Utils/TaskSchedule/TaskScheduler.php @@ -33,7 +33,7 @@ class TaskScheduler extends SchedulerAbstract /** * {@inheritdoc} */ - public function save() + public function save() /* : void */ { } diff --git a/Validation/Base/BIC.php b/Validation/Base/BIC.php index 5589039d0..3d41f747a 100644 --- a/Validation/Base/BIC.php +++ b/Validation/Base/BIC.php @@ -44,7 +44,7 @@ class BIC extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) + public static function isValid($value) : bool { return (bool) preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value); } diff --git a/Validation/Base/CreditCard.php b/Validation/Base/CreditCard.php index 7cfc93047..924aa9930 100644 --- a/Validation/Base/CreditCard.php +++ b/Validation/Base/CreditCard.php @@ -44,7 +44,7 @@ abstract class CreditCard extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) + public static function isValid($value) : bool { $value = preg_replace('/\D/', '', $value); diff --git a/Validation/Base/DateTime.php b/Validation/Base/DateTime.php index 51f887528..f921c25b8 100644 --- a/Validation/Base/DateTime.php +++ b/Validation/Base/DateTime.php @@ -44,7 +44,7 @@ abstract class DateTime extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) + public static function isValid($value) : bool { return (bool) strtotime($value); } diff --git a/Validation/Base/Hostname.php b/Validation/Base/Hostname.php index 4abc95f05..f640e26af 100644 --- a/Validation/Base/Hostname.php +++ b/Validation/Base/Hostname.php @@ -44,7 +44,7 @@ abstract class Hostname extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) + public static function isValid($value) : bool { return filter_var(gethostbyname($value), FILTER_VALIDATE_IP); } diff --git a/Validation/Base/IP.php b/Validation/Base/IP.php index a06883447..a25c8e438 100644 --- a/Validation/Base/IP.php +++ b/Validation/Base/IP.php @@ -44,7 +44,7 @@ abstract class IP extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value) + public static function isValid($value) : bool { return filter_var($value, FILTER_VALIDATE_IP); } diff --git a/Validation/ModelValidationTrait.php b/Validation/ModelValidationTrait.php index 311a8fbb5..a52560d23 100644 --- a/Validation/ModelValidationTrait.php +++ b/Validation/ModelValidationTrait.php @@ -60,7 +60,7 @@ trait ModelValidationTrait * @since 1.0.0 * @author Dennis Eichhorn */ - protected function isValid($var, $name) + protected function isValid($var, $name) : bool { /** @noinspection PhpUndefinedFieldInspection */ if (!isset(self::${$name . '_validate'})) { diff --git a/Validation/Validator.php b/Validation/Validator.php index b792a418a..59c5bf4ec 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -38,7 +38,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function isValid($var, array $constraints) + public static function isValid($var, array $constraints) : bool { foreach ($constraints as $callback => $settings) { $valid = self::$callback($var, ...$settings); @@ -63,7 +63,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function isType($var, $constraint) + public static function isType($var, $constraint) : bool { if (!is_array($constraint)) { $constraint = [$constraint]; @@ -90,7 +90,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function hasLength(string $var, int $min = 0, int $max = PHP_INT_MAX) + public static function hasLength(string $var, int $min = 0, int $max = PHP_INT_MAX) : bool { $length = strlen($var); @@ -112,7 +112,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function contains(string $var, $substr) + public static function contains(string $var, $substr) : bool { return is_string($substr) ? strpos($var, $substr) !== false : StringUtils::contains($var, $substr); } @@ -128,7 +128,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function matches(string $var, string $pattern) + public static function matches(string $var, string $pattern) : bool { return (preg_match($pattern, $var) !== false ? true : false); } @@ -145,7 +145,7 @@ final class Validator extends ValidatorAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public static function hasLimit($var, $min = 0, $max = PHP_INT_MAX) + public static function hasLimit($var, $min = 0, $max = PHP_INT_MAX) : bool { if ($var <= $max && $var >= $min) { return true; diff --git a/Views/View.php b/Views/View.php index c525f57f2..0ef7e2bcf 100644 --- a/Views/View.php +++ b/Views/View.php @@ -99,7 +99,7 @@ class View extends ViewAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function getData($id) + public function getData(string $id) { return $this->data[$id] ?? null; } @@ -160,14 +160,14 @@ class View extends ViewAbstract * @param string $module Module name * @param string $theme Theme name * - * @return array + * @return string * * @throws \Exception * * @since 1.0.0 * @author Dennis Eichhorn */ - protected function getText(string $translation, string $module = null, string $theme = null) + protected function getText(string $translation, string $module = null, string $theme = null) : string { if (!isset($module)) { $match = '/Modules/'; @@ -202,7 +202,7 @@ class View extends ViewAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - public function getRequest() + public function getRequest() : Request { return $this->request; } diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index e609e3f79..3d32a8558 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -166,7 +166,7 @@ abstract class ViewAbstract implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function editView(string $id, View $view, $order = null) + public function editView(string $id, View $view, $order = null) /* : void */ { $this->addView($id, $view, $order, true); } @@ -203,7 +203,7 @@ abstract class ViewAbstract implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function serialize() /* : void */ + public function serialize() { if (empty($this->template)) { return $this->toArray();