diff --git a/Account/Account.php b/Account/Account.php index 0a54cb238..06410e070 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -109,7 +109,7 @@ class Account implements \JsonSerializable, ArrayableInterface /** * Groups. * - * @var int[] + * @var Group[] * @since 1.0.0 */ protected array $groups = []; @@ -183,7 +183,7 @@ class Account implements \JsonSerializable, ArrayableInterface * Every account can belong to multiple groups. * These groups usually are used for permissions and categorize accounts. * - * @return array Returns array of all groups + * @return Group[] Returns array of all groups * * @since 1.0.0 */ @@ -195,13 +195,13 @@ class Account implements \JsonSerializable, ArrayableInterface /** * Add group. * - * @param mixed $group Group to add + * @param Group $group Group to add * * @return void * * @since 1.0.0 */ - public function addGroup($group) : void + public function addGroup(Group $group) : void { $this->groups[] = $group; } diff --git a/Account/NullGroup.php b/Account/NullGroup.php index ef3fae2b4..d9c0daa60 100644 --- a/Account/NullGroup.php +++ b/Account/NullGroup.php @@ -24,4 +24,15 @@ namespace phpOMS\Account; */ final class NullGroup extends Group { + /** + * Constructor + * + * @param int $id Model id + * + * @since 1.0.0 + */ + public function __construct(int $id = 0) + { + $this->id = $id; + } } diff --git a/Algorithm/Clustering/Point.php b/Algorithm/Clustering/Point.php index 66a13b2f0..75105243c 100644 --- a/Algorithm/Clustering/Point.php +++ b/Algorithm/Clustering/Point.php @@ -81,7 +81,7 @@ class Point implements PointInterface /** * {@inheritdoc} */ - public function setCoordinate(int $index, $value) : void + public function setCoordinate(int $index, int|float $value) : void { $this->coordinates[$index] = $value; } diff --git a/Algorithm/Clustering/PointInterface.php b/Algorithm/Clustering/PointInterface.php index d3db932bd..5f3f010e5 100644 --- a/Algorithm/Clustering/PointInterface.php +++ b/Algorithm/Clustering/PointInterface.php @@ -51,12 +51,12 @@ interface PointInterface /** * Set the coordinate of the point * - * @param int $index Index of the coordinate (e.g. 0 = x); - * @param mixed $value Value of the coordinate + * @param int $index Index of the coordinate (e.g. 0 = x); + * @param int|float $value Value of the coordinate * * @return void * * @since 1.0.0 */ - public function setCoordinate(int $index, $value) : void; + public function setCoordinate(int $index, int|float $value) : void; } diff --git a/Algorithm/Knapsack/Backpack.php b/Algorithm/Knapsack/Backpack.php index 1ebf11b6a..5e6f60510 100644 --- a/Algorithm/Knapsack/Backpack.php +++ b/Algorithm/Knapsack/Backpack.php @@ -104,7 +104,7 @@ class Backpack implements BackpackInterface /** * {@inheritdoc} */ - public function addItem(ItemInterface $item, $quantity = 1) : void + public function addItem(ItemInterface $item, int|float $quantity = 1) : void { $this->items[] = ['item' => $item, 'quantity' => $quantity]; $this->value += $item->getValue() * $quantity; diff --git a/Algorithm/Knapsack/BackpackInterface.php b/Algorithm/Knapsack/BackpackInterface.php index eba401541..986816cc5 100644 --- a/Algorithm/Knapsack/BackpackInterface.php +++ b/Algorithm/Knapsack/BackpackInterface.php @@ -65,11 +65,11 @@ interface BackpackInterface * Add item to backpack * * @param ItemInterface $item Item - * @param mixed $quantity Quantity of the item + * @param int|float $quantity Quantity of the item * * @return void * * @since 1.0.0 */ - public function addItem(ItemInterface $item, $quantity = 1) : void; + public function addItem(ItemInterface $item, int|float $quantity = 1) : void; } diff --git a/Application/ApplicationAbstract.php b/Application/ApplicationAbstract.php index 50effce73..90ad922cb 100644 --- a/Application/ApplicationAbstract.php +++ b/Application/ApplicationAbstract.php @@ -190,13 +190,13 @@ class ApplicationAbstract * Set values * * @param string $name Variable name - * @param string $value Variable value + * @param mixed $value Variable value * * @return void * * @since 1.0.0 */ - public function __set($name, $value) : void + public function __set(string $name, mixed $value) : void { if (!empty($this->{$name})) { return; @@ -214,7 +214,7 @@ class ApplicationAbstract * * @since 1.0.0 */ - public function __get($name) + public function __get(string $name) : mixed { return isset($this->{$name}) ? $this->{$name} : null; } diff --git a/Application/ApplicationInfo.php b/Application/ApplicationInfo.php index 8430fe7c0..8df15d85f 100644 --- a/Application/ApplicationInfo.php +++ b/Application/ApplicationInfo.php @@ -118,7 +118,7 @@ final class ApplicationInfo * * @since 1.0.0 */ - public function set(string $path, $data, string $delim = '/') : void + public function set(string $path, mixed $data, string $delim = '/') : void { if (!\is_scalar($data) && !\is_array($data) && !($data instanceof \JsonSerializable)) { throw new \InvalidArgumentException('Type of $data "' . \gettype($data) . '" is not supported.'); diff --git a/Business/Marketing/ArticleCorrelationAffinity.php b/Business/Marketing/ArticleCorrelationAffinity.php index 25f4b37d0..e08d1c0d0 100644 --- a/Business/Marketing/ArticleCorrelationAffinity.php +++ b/Business/Marketing/ArticleCorrelationAffinity.php @@ -99,7 +99,7 @@ final class ArticleCorrelationAffinity * * @since 1.0.0 */ - public function getAffinity($item, int $resultSize = 0) : array + public function getAffinity(mixed $item, int $resultSize = 0) : array { if (!isset($this->affinity[$item])) { return []; diff --git a/Config/OptionsInterface.php b/Config/OptionsInterface.php index 4df3a804b..cd49fab3a 100644 --- a/Config/OptionsInterface.php +++ b/Config/OptionsInterface.php @@ -27,26 +27,26 @@ interface OptionsInterface /** * Is this key set. * - * @param mixed $key Key to check for existence + * @param int|string $key Key to check for existence * * @return bool * * @since 1.0.0 */ - public function exists($key) : bool; + public function exists(int|string $key) : bool; /** * Updating or adding settings. * - * @param mixed $key Unique option key - * @param mixed $value Option value - * @param bool $overwrite Overwrite existing value + * @param int|string $key Unique option key + * @param mixed $value Option value + * @param bool $overwrite Overwrite existing value * * @return bool * * @since 1.0.0 */ - public function setOption($key, $value, bool $overwrite = true) : bool; + public function setOption(int|string $key, mixed $value, bool $overwrite = true) : bool; /** * Updating or adding settings. @@ -63,11 +63,11 @@ interface OptionsInterface /** * Get option by key. * - * @param mixed $key Unique option key + * @param int|string $key Unique option key * * @return mixed Option value * * @since 1.0.0 */ - public function getOption($key); + public function getOption(int|string $key) : mixed; } diff --git a/Contract/StreamInterface.php b/Contract/StreamInterface.php index 53330fada..9b932edac 100644 --- a/Contract/StreamInterface.php +++ b/Contract/StreamInterface.php @@ -276,7 +276,7 @@ interface StreamInterface * * @since 1.0.0 */ - public function setCustomData(string $key, $value) : self; + public function setCustomData(string $key, mixed $value) : self; /** * Get custom data from the stream diff --git a/DataStorage/Cache/Connection/ConnectionAbstract.php b/DataStorage/Cache/Connection/ConnectionAbstract.php index 942267532..c6a811c28 100644 --- a/DataStorage/Cache/Connection/ConnectionAbstract.php +++ b/DataStorage/Cache/Connection/ConnectionAbstract.php @@ -150,7 +150,7 @@ abstract class ConnectionAbstract implements ConnectionInterface * * @since 1.0.0 */ - protected function dataType($value) : int + protected function dataType(mixed $value) : int { if (\is_int($value)) { return CacheValueType::_INT; diff --git a/DataStorage/Cache/Connection/FileCache.php b/DataStorage/Cache/Connection/FileCache.php index 038bf75eb..f69ebb832 100644 --- a/DataStorage/Cache/Connection/FileCache.php +++ b/DataStorage/Cache/Connection/FileCache.php @@ -301,7 +301,7 @@ final class FileCache extends ConnectionAbstract * * @since 1.0.0 */ - private function reverseValue(int $type, string $raw, int $expireEnd) + private function reverseValue(int $type, string $raw, int $expireEnd) : mixed { switch ($type) { case CacheValueType::_INT: diff --git a/DataStorage/Cache/Connection/RedisCache.php b/DataStorage/Cache/Connection/RedisCache.php index aef5f6ae2..85c43f0af 100644 --- a/DataStorage/Cache/Connection/RedisCache.php +++ b/DataStorage/Cache/Connection/RedisCache.php @@ -253,7 +253,7 @@ final class RedisCache extends ConnectionAbstract * * @since 1.0.0 */ - private function build(mixed $value) + private function build(mixed $value) : mixed { $type = $this->dataType($value); $raw = $this->cachify($value, $type); @@ -273,7 +273,7 @@ final class RedisCache extends ConnectionAbstract * * @since 1.0.0 */ - private function cachify(mixed $value, int $type) + private function cachify(mixed $value, int $type) : mixed { if ($type === CacheValueType::_INT || $type === CacheValueType::_STRING || $type === CacheValueType::_BOOL) { return (string) $value; @@ -303,7 +303,7 @@ final class RedisCache extends ConnectionAbstract * * @since 1.0.0 */ - private function reverseValue(int $type, mixed $raw, int $start) + private function reverseValue(int $type, mixed $raw, int $start) : mixed { switch ($type) { case CacheValueType::_INT: diff --git a/DataStorage/Cookie/CookieJar.php b/DataStorage/Cookie/CookieJar.php index 93399c1ec..a56e8a934 100644 --- a/DataStorage/Cookie/CookieJar.php +++ b/DataStorage/Cookie/CookieJar.php @@ -94,7 +94,7 @@ final class CookieJar * * @since 1.0.0 */ - public function set(string $id, $value, int $expire = 86400, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, bool $overwrite = true) : bool + public function set(string $id, mixed $value, int $expire = 86400, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, bool $overwrite = true) : bool { if ($overwrite || !isset($this->cookies[$id])) { $this->cookies[$id] = [ diff --git a/DataStorage/DataMapperInterface.php b/DataStorage/DataMapperInterface.php index a60660a56..9d0165b3c 100644 --- a/DataStorage/DataMapperInterface.php +++ b/DataStorage/DataMapperInterface.php @@ -35,7 +35,7 @@ interface DataMapperInterface * * @since 1.0.0 */ - public static function create($obj); + public static function create(mixed $obj); /** * Update data. @@ -46,7 +46,7 @@ interface DataMapperInterface * * @since 1.0.0 */ - public static function update($obj); + public static function update(mixed $obj); /** * Delete data. @@ -57,7 +57,7 @@ interface DataMapperInterface * * @since 1.0.0 */ - public static function delete($obj); + public static function delete(mixed $obj); /** * Find data. @@ -90,5 +90,5 @@ interface DataMapperInterface * * @since 1.0.0 */ - public static function get($primaryKey); + public static function get(mixed $primaryKey); } diff --git a/DataStorage/Database/Connection/ConnectionAbstract.php b/DataStorage/Database/Connection/ConnectionAbstract.php index ddf540b4b..098bb917a 100644 --- a/DataStorage/Database/Connection/ConnectionAbstract.php +++ b/DataStorage/Database/Connection/ConnectionAbstract.php @@ -193,7 +193,7 @@ abstract class ConnectionAbstract implements ConnectionInterface * * @since 1.0.0 */ - public function __get($name) + public function __get(string $name) : mixed { if ($name === 'con' && !isset($this->con)) { $this->connect($this->dbdata); diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 04e26a6d4..f6bcb67b8 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -340,7 +340,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function withConditional(string $id, $value, array $models = [], string $comparison = '=') /** @todo: return : static */ + public static function withConditional(string $id, mixed $value, array $models = [], string $comparison = '=') /** @todo: return : static */ { self::$conditionals[$id] = [ 'value' => $value, @@ -465,7 +465,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function create($obj, int $relations = RelationType::ALL) : mixed + public static function create(mixed $obj, int $relations = RelationType::ALL) : mixed { if (!isset($obj)) { return null; @@ -698,7 +698,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function setObjectId(\ReflectionClass $refClass, object $obj, $objId) : void + private static function setObjectId(\ReflectionClass $refClass, object $obj, mixed $objId) : void { $propertyName = static::$columns[static::$primaryField]['internal']; $refProp = $refClass->getProperty($propertyName); @@ -726,7 +726,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function createRelation(string $member, $id1, $id2) : bool + public static function createRelation(string $member, mixed $id1, mixed $id2) : bool { if (!isset(static::$hasMany[$member]) || !isset(static::$hasMany[$member]['external'])) { return false; @@ -751,7 +751,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createHasMany(\ReflectionClass $refClass, object $obj, $objId) : void + private static function createHasMany(\ReflectionClass $refClass, object $obj, mixed $objId) : void { foreach (static::$hasMany as $propertyName => $rel) { if (!isset(static::$hasMany[$propertyName]['mapper'])) { @@ -873,7 +873,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createHasManyArray(array &$obj, $objId) : void + private static function createHasManyArray(array &$obj, mixed $objId) : void { foreach (static::$hasMany as $propertyName => $rel) { if (!isset(static::$hasMany[$propertyName]['mapper'])) { @@ -943,7 +943,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createOwnsOne(string $propertyName, $obj) : mixed + private static function createOwnsOne(string $propertyName, mixed $obj) : mixed { if (!\is_object($obj)) { return $obj; @@ -993,7 +993,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createBelongsTo(string $propertyName, $obj) : mixed + private static function createBelongsTo(string $propertyName, mixed $obj) : mixed { if (!\is_object($obj)) { return $obj; @@ -1040,7 +1040,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createRelationTable(string $propertyName, array $objsIds, $objId) : void + private static function createRelationTable(string $propertyName, array $objsIds, mixed $objId) : void { if (empty($objsIds) || !isset(static::$hasMany[$propertyName]['external'])) { return; @@ -1081,7 +1081,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function parseValue(string $type, $value = null) : mixed + private static function parseValue(string $type, mixed $value = null) : mixed { if ($value === null) { return null; @@ -1120,7 +1120,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateHasMany(\ReflectionClass $refClass, object $obj, $objId, $depth = 1) : void + private static function updateHasMany(\ReflectionClass $refClass, object $obj, mixed $objId, int $depth = 1) : void { $objsIds = []; @@ -1208,7 +1208,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateHasManyArray(array &$obj, $objId, $depth = 1) : void + private static function updateHasManyArray(array &$obj, mixed $objId, int $depth = 1) : void { $objsIds = []; @@ -1273,11 +1273,11 @@ class DataMapperAbstract implements DataMapperInterface * @param array $objsIds Object ids to insert * @param mixed $objId Model to reference * - * @return mixed + * @return void * * @since 1.0.0 */ - private static function updateRelationTable(array $objsIds, $objId) : mixed + private static function updateRelationTable(array $objsIds, mixed $objId) : void { $many = self::getHasManyRaw($objId); @@ -1306,7 +1306,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) : void + private static function deleteRelationTable(string $propertyName, array $objsIds, mixed $objId) : void { if (empty($objsIds) || static::$hasMany[$propertyName]['table'] === static::$table @@ -1339,7 +1339,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateOwnsOne(string $propertyName, $obj, int $depth = 1) : mixed + private static function updateOwnsOne(string $propertyName, mixed $obj, int $depth = 1) : mixed { if (!\is_object($obj)) { return $obj; @@ -1385,7 +1385,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateBelongsTo(string $propertyName, $obj, int $depth = 1) : mixed + private static function updateBelongsTo(string $propertyName, mixed $obj, int $depth = 1) : mixed { if (!\is_object($obj)) { return $obj; @@ -1410,7 +1410,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateBelongsToArray(string $propertyName, $obj, int $depth = 1) : mixed + private static function updateBelongsToArray(string $propertyName, mixed $obj, int $depth = 1) : mixed { if (!\is_array($obj)) { return $obj; @@ -1434,7 +1434,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateModel(object $obj, $objId, \ReflectionClass $refClass = null, int $depth = 1) : void + private static function updateModel(object $obj, mixed $objId, \ReflectionClass $refClass = null, int $depth = 1) : void { $query = new Builder(self::$db); $query->update(static::$table) @@ -1508,7 +1508,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function updateModelArray(array $obj, $objId, int $depth = 1) : void + private static function updateModelArray(array $obj, mixed $objId, int $depth = 1) : void { $query = new Builder(self::$db); $query->update(static::$table) @@ -1572,7 +1572,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function update($obj, int $relations = RelationType::ALL, int $depth = 3) : mixed + public static function update(mixed $obj, int $relations = RelationType::ALL, int $depth = 3) : mixed { if (!isset($obj)) { return null; @@ -1664,7 +1664,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function deleteHasMany(\ReflectionClass $refClass, object $obj, $objId) : void + private static function deleteHasMany(\ReflectionClass $refClass, object $obj, mixed $objId) : void { foreach (static::$hasMany as $propertyName => $rel) { if (!isset(static::$hasMany[$propertyName]['mapper'])) { @@ -1731,7 +1731,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function deleteOwnsOne(string $propertyName, $obj) : mixed + private static function deleteOwnsOne(string $propertyName, mixed $obj) : mixed { if (!\is_object($obj)) { return $obj; @@ -1761,7 +1761,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function deleteBelongsTo(string $propertyName, $obj) : mixed + private static function deleteBelongsTo(string $propertyName, mixed $obj) : mixed { if (!\is_object($obj)) { return $obj; @@ -1784,7 +1784,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function deleteModel(object $obj, $objId, \ReflectionClass $refClass = null) : void + private static function deleteModel(object $obj, mixed $objId, \ReflectionClass $refClass = null) : void { $query = new Builder(self::$db); $query->delete() @@ -1847,7 +1847,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function delete($obj, int $relations = RelationType::REFERENCE) : mixed + public static function delete(mixed $obj, int $relations = RelationType::REFERENCE) : mixed { // @todo: only do this if RelationType !== NONE if (\is_scalar($obj)) { @@ -1961,7 +1961,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateManyToMany(array $result, &$obj, int $depth = 3) : void + public static function populateManyToMany(array $result, mixed &$obj, int $depth = 3) : void { $refClass = new \ReflectionClass($obj); @@ -2039,7 +2039,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateOwnsOne(string $member, array $result, int $depth = 3, $default = null) : mixed + public static function populateOwnsOne(string $member, array $result, int $depth = 3, mixed $default = null) : mixed { /** @var self $mapper */ $mapper = static::$ownsOne[$member]['mapper']; @@ -2079,7 +2079,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateOwnsOneArray(string $member, array $result, int $depth = 3, $default = null) : array + public static function populateOwnsOneArray(string $member, array $result, int $depth = 3, mixed $default = null) : array { /** @var self $mapper */ $mapper = static::$ownsOne[$member]['mapper']; @@ -2119,7 +2119,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateBelongsTo(string $member, array $result, int $depth = 3, $default = null) + public static function populateBelongsTo(string $member, array $result, int $depth = 3, mixed $default = null) : mixed { /** @var self $mapper */ $mapper = static::$belongsTo[$member]['mapper']; @@ -2159,7 +2159,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateBelongsToArray(string $member, array $result, int $depth = 3, $default = null) : array + public static function populateBelongsToArray(string $member, array $result, int $depth = 3, mixed $default = null) : array { /** @var self $mapper */ $mapper = static::$belongsTo[$member]['mapper']; @@ -2198,7 +2198,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function populateAbstract(array $result, $obj, int $depth = 3) + public static function populateAbstract(array $result, mixed $obj, int $depth = 3) : mixed { $refClass = new \ReflectionClass($obj); @@ -2465,7 +2465,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function countBeforePivot($pivot, string $column = null) : int + public static function countBeforePivot(mixed $pivot, string $column = null) : int { $query = new Builder(self::$db); $query->where(static::$table . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '<', $pivot); @@ -2483,7 +2483,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function countAfterPivot($pivot, string $column = null) : int + public static function countAfterPivot(mixed $pivot, string $column = null) : int { $query = new Builder(self::$db); $query->where(static::$table . '.' . ($column !== null ? self::getColumnByMember($column) : static::$primaryField), '>', $pivot); @@ -2524,7 +2524,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 */ public static function getAfterPivot( - $pivot, + mixed $pivot, string $column = null, int $limit = 50, string $order = 'ASC', @@ -2559,7 +2559,7 @@ class DataMapperAbstract implements DataMapperInterface * It should just return the closes elements "before" the pivot element. */ public static function getBeforePivot( - $pivot, + mixed $pivot, string $column = null, int $limit = 50, string $order = 'ASC', @@ -2588,7 +2588,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function get($primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null) + public static function get(mixed $primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null) : mixed { if ($depth < 1) { return self::createNullModel($primaryKey); @@ -2649,7 +2649,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getArray($primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null) : array + public static function getArray(mixed $primaryKey, int $relations = RelationType::ALL, int $depth = 3, string $ref = null) : array { if ($depth < 1) { return $primaryKey; @@ -2712,7 +2712,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 * @todo by and for look the same, this cannot be correct. */ - public static function getFor($forKey, string $for, int $relations = RelationType::ALL, int $depth = 3) + public static function getFor(mixed $forKey, string $for, int $relations = RelationType::ALL, int $depth = 3) : mixed { return self::get($forKey, $relations, $depth, $for); } @@ -2730,7 +2730,7 @@ class DataMapperAbstract implements DataMapperInterface * @since 1.0.0 * @todo by and for look the same, this cannot be correct. */ - public static function getBy($byKey, string $by, int $relations = RelationType::ALL, int $depth = 3) + public static function getBy(mixed $byKey, string $by, int $relations = RelationType::ALL, int $depth = 3) : mixed { return self::get($byKey, $relations, $depth, $by); } @@ -2747,7 +2747,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getForArray($refKey, string $ref, int $relations = RelationType::ALL, int $depth = 3) + public static function getForArray(mixed $refKey, string $ref, int $relations = RelationType::ALL, int $depth = 3) : mixed { return self::getArray($refKey, $relations, $depth, $ref); } @@ -2764,7 +2764,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getByArray($byKey, string $by, int $relations = RelationType::ALL, int $depth = 3) + public static function getByArray(mixed $byKey, string $by, int $relations = RelationType::ALL, int $depth = 3) : mixed { return self::getArray($byKey, $relations, $depth, $by); } @@ -2845,7 +2845,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getByParent($value, int $depth = 3) : array + public static function getByParent(mixed $value, int $depth = 3) : array { $query = self::getQuery(); $query->where(static::$table . '_' . $depth . '.' . static::$parent, '=', $value); @@ -2886,7 +2886,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getRandom(int $amount = 1, int $relations = RelationType::ALL, int $depth = 3) + public static function getRandom(int $amount = 1, int $relations = RelationType::ALL, int $depth = 3) : mixed { if ($depth < 1) { return null; @@ -2910,7 +2910,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function fillRelations($obj, int $relations = RelationType::ALL, int $depth = 3) : void + public static function fillRelations(mixed $obj, int $relations = RelationType::ALL, int $depth = 3) : void { if ($depth < 1 || empty(static::$hasMany) @@ -2985,7 +2985,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getRaw($keys, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null) : array + public static function getRaw(mixed $keys, int $relations = RelationType::ALL, int $depth = 3, string $ref = null, Builder $query = null) : array { $comparison = \is_array($keys) && \count($keys) > 1 ? 'in' : '='; $keys = $comparison === 'in' ? $keys : \reset($keys); @@ -3067,7 +3067,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getHasManyPrimaryKeys($refKey, string $ref) : array + public static function getHasManyPrimaryKeys(mixed $refKey, string $ref) : array { $query = new Builder(self::$db); $query->select(static::$hasMany[$ref]['table'] . '.' . static::$hasMany[$ref]['self']) @@ -3092,7 +3092,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - public static function getHasManyRaw($primaryKey, int $relations = RelationType::ALL) : array + public static function getHasManyRaw(mixed $primaryKey, int $relations = RelationType::ALL) : array { $result = []; $cachedTables = []; // used by conditionals @@ -3278,7 +3278,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function addInitialized(string $mapper, $id, object $obj = null, int $depth = 3) : void + private static function addInitialized(string $mapper, mixed $id, object $obj = null, int $depth = 3) : void { if (!isset(self::$initObjects[$mapper])) { self::$initObjects[$mapper] = []; @@ -3303,7 +3303,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function addInitializedArray(string $mapper, $id, array $obj = null, int $depth = 3) : void + private static function addInitializedArray(string $mapper, mixed $id, array $obj = null, int $depth = 3) : void { if (!isset(self::$initArrays[$mapper])) { self::$initArrays[$mapper] = []; @@ -3326,7 +3326,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function isInitialized(string $mapper, $id, int $depth = 3) : bool + private static function isInitialized(string $mapper, mixed $id, int $depth = 3) : bool { return !empty($id) && isset(self::$initObjects[$mapper], self::$initObjects[$mapper][$id]) @@ -3345,7 +3345,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function isInitializedArray(string $mapper, $id, int $depth = 3) : bool + private static function isInitializedArray(string $mapper, mixed $id, int $depth = 3) : bool { return !empty($id) && isset(self::$initArrays[$mapper], self::$initArrays[$mapper][$id]) @@ -3364,7 +3364,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function getInitialized(string $mapper, $id, int $depth) + private static function getInitialized(string $mapper, mixed $id, int $depth) : mixed { if (!self::isInitialized($mapper, $id, $depth)) { return null; @@ -3384,7 +3384,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function getInitializedArray(string $mapper, $id, int $depth) + private static function getInitializedArray(string $mapper, mixed $id, int $depth) : mixed { if (!self::isInitializedArray($mapper, $id, $depth)) { return null; @@ -3399,11 +3399,11 @@ class DataMapperAbstract implements DataMapperInterface * @param string $mapper Mapper name * @param mixed $id Object id * - * @return mixed + * @return void * * @since 1.0.0 */ - private static function removeInitialized(string $mapper, $id) + private static function removeInitialized(string $mapper, mixed $id) : void { if (isset(self::$initObjects[$mapper][$id])) { unset(self::$initObjects[$mapper][$id]); @@ -3417,11 +3417,11 @@ class DataMapperAbstract implements DataMapperInterface /** * Clear cache * - * @return mixed + * @return void * * @since 1.0.0 */ - public static function clearCache() + public static function clearCache() : void { self::$initObjects = []; self::$initArrays = []; @@ -3456,7 +3456,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function isNullModel($obj) : bool + private static function isNullModel(mixed $obj) : bool { return \is_object($obj) && \strpos(\get_class($obj), '\Null') !== false; } @@ -3470,7 +3470,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createNullModel($id = null) + private static function createNullModel(mixed $id = null) : mixed { $class = empty(static::$model) ? \substr(static::class, 0, -6) : static::$model; $parts = \explode('\\', $class); @@ -3488,7 +3488,7 @@ class DataMapperAbstract implements DataMapperInterface * * @since 1.0.0 */ - private static function createBaseModel() + private static function createBaseModel() : mixed { $class = empty(static::$model) ? \substr(static::class, 0, -6) : static::$model; diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index d34a41d63..3e9378479 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -1355,7 +1355,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function orOn(string|array $columns, $operator = null, $values = null) : self + public function orOn(string|array $columns, string|array $operator = null, string|array $values = null) : self { return $this->on($columns, $operator, $values, 'or'); } @@ -1371,7 +1371,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function andOn(string|array $columns, $operator = null, $values = null) : self + public function andOn(string|array $columns, string|array $operator = null, string|array $values = null) : self { return $this->on($columns, $operator, $values, 'and'); } @@ -1399,7 +1399,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function execute() + public function execute() : mixed { $sth = $this->connection->con->prepare($this->toSql()); @@ -1425,7 +1425,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public static function getBindParamType($value) : int + public static function getBindParamType(mixed $value) : int { if (\is_int($value)) { return \PDO::PARAM_INT; @@ -1447,7 +1447,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public static function getPublicColumnName($column) : string + public static function getPublicColumnName(mixed $column) : string { if (\is_string($column)) { return $column; diff --git a/DataStorage/Database/Query/Grammar/Grammar.php b/DataStorage/Database/Query/Grammar/Grammar.php index 45e69aec9..e7be061c1 100644 --- a/DataStorage/Database/Query/Grammar/Grammar.php +++ b/DataStorage/Database/Query/Grammar/Grammar.php @@ -325,7 +325,7 @@ class Grammar extends GrammarAbstract * * @since 1.0.0 */ - protected function compileValue(Builder $query, $value) : string + protected function compileValue(Builder $query, mixed $value) : string { if (\is_string($value)) { return $query->quote($value); @@ -389,7 +389,7 @@ class Grammar extends GrammarAbstract * * @since 1.0.0 */ - protected function compileOffset(Builder $query, $offset) : string + protected function compileOffset(Builder $query, int $offset) : string { return 'OFFSET ' . $offset; } @@ -508,7 +508,7 @@ class Grammar extends GrammarAbstract * * @since 1.0.0 */ - protected function compileGroups(Builder $query, array $groups) + protected function compileGroups(Builder $query, array $groups) : string { $expression = ''; @@ -587,7 +587,7 @@ class Grammar extends GrammarAbstract * * @since 1.0.0 */ - protected function compileInto(Builder $query, $table) : string + protected function compileInto(Builder $query, string $table) : string { return 'INSERT INTO ' . $this->compileSystem($table); } diff --git a/DataStorage/Session/FileSession.php b/DataStorage/Session/FileSession.php index 25a2057c8..3b8a0998d 100644 --- a/DataStorage/Session/FileSession.php +++ b/DataStorage/Session/FileSession.php @@ -71,7 +71,7 @@ class FileSession implements SessionInterface * * @since 1.0.0 */ - public function __construct(int $liftetime = 3600, $sid = '', int $inactivityInterval = 0) + public function __construct(int $liftetime = 3600, string $sid = '', int $inactivityInterval = 0) { if (\session_id()) { \session_write_close(); // @codeCoverageIgnore @@ -105,7 +105,7 @@ class FileSession implements SessionInterface /** * {@inheritdoc} */ - public function set(string $key, $value, bool $overwrite = false) : bool + public function set(string $key, mixed $value, bool $overwrite = false) : bool { if (!$this->isLocked && ($overwrite || !isset($this->sessionData[$key]))) { $this->sessionData[$key] = $value; @@ -119,7 +119,7 @@ class FileSession implements SessionInterface /** * {@inheritdoc} */ - public function get(string $key) + public function get(string $key) : mixed { return $this->sessionData[$key] ?? null; } diff --git a/DataStorage/Session/HttpSession.php b/DataStorage/Session/HttpSession.php index 7994a5cd8..a1492dd65 100644 --- a/DataStorage/Session/HttpSession.php +++ b/DataStorage/Session/HttpSession.php @@ -72,7 +72,7 @@ final class HttpSession implements SessionInterface * * @since 1.0.0 */ - public function __construct(int $liftetime = 3600, $sid = '', int $inactivityInterval = 0) + public function __construct(int $liftetime = 3600, string $sid = '', int $inactivityInterval = 0) { if (\session_id()) { \session_write_close(); // @codeCoverageIgnore @@ -132,7 +132,7 @@ final class HttpSession implements SessionInterface /** * {@inheritdoc} */ - public function set(string $key, $value, bool $overwrite = false) : bool + public function set(string $key, mixed $value, bool $overwrite = false) : bool { if (!$this->isLocked && ($overwrite || !isset($this->sessionData[$key]))) { $this->sessionData[$key] = $value; @@ -146,7 +146,7 @@ final class HttpSession implements SessionInterface /** * {@inheritdoc} */ - public function get(string $key) + public function get(string $key) : mixed { return $this->sessionData[$key] ?? null; } diff --git a/DataStorage/Session/SessionInterface.php b/DataStorage/Session/SessionInterface.php index 9ef96056b..e7bb9ffd1 100644 --- a/DataStorage/Session/SessionInterface.php +++ b/DataStorage/Session/SessionInterface.php @@ -35,7 +35,7 @@ interface SessionInterface * * @since 1.0.0 */ - public function get(string $key); + public function get(string $key) : mixed; /** * Store session value by key. @@ -48,7 +48,7 @@ interface SessionInterface * * @since 1.0.0 */ - public function set(string $key, $value, bool $overwrite = false) : bool; + public function set(string $key, mixed $value, bool $overwrite = false) : bool; /** * Remove value from session by key. diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index f98e011cf..dfb9ef737 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -62,31 +62,27 @@ final class Dispatcher implements DispatcherInterface /** * {@inheritdoc} */ - public function dispatch($controller, ...$data) : array + public function dispatch(array|string|\Closure $controller, ...$data) : array { $views = []; - if (\is_array($controller)) { - if (isset($controller['dest'])) { - if (!empty($controller['data'])) { - $data = \array_merge( - empty($data) ? [] : $data, - \is_array($controller['data']) ? $controller['data'] : [$controller['data']] - ); - } - - $controller = $controller['dest']; + if (\is_array($controller) && isset($controller['dest'])) { + if (!empty($controller['data'])) { + $data = \array_merge( + empty($data) ? [] : $data, + \is_array($controller['data']) ? $controller['data'] : [$controller['data']] + ); } + + $controller = $controller['dest']; } if (\is_string($controller)) { $views += $this->dispatchString($controller, $data); } elseif (\is_array($controller)) { $views += $this->dispatchArray($controller, $data); - } elseif ($controller instanceof \Closure) { - $views[] = $this->dispatchClosure($controller, $data); } else { - throw new \UnexpectedValueException('Unexpected controller type.'); + $views[] = $this->dispatchClosure($controller, $data); } return $views; @@ -171,7 +167,7 @@ final class Dispatcher implements DispatcherInterface * * @since 1.0.0 */ - private function dispatchClosure(\Closure $controller, array $data = null) + private function dispatchClosure(\Closure $controller, array $data = null) : mixed { return $data === null ? $controller($this->app) : $controller($this->app, ...$data); } diff --git a/Dispatcher/DispatcherInterface.php b/Dispatcher/DispatcherInterface.php index cb36799d3..cb6535645 100644 --- a/Dispatcher/DispatcherInterface.php +++ b/Dispatcher/DispatcherInterface.php @@ -36,5 +36,5 @@ interface DispatcherInterface * * @since 1.0.0 */ - public function dispatch($controller, ...$data) : array; + public function dispatch(array|string|\Closure $controller, ...$data) : array; } diff --git a/Event/EventManager.php b/Event/EventManager.php index 81ecc4c14..f56aa6208 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -70,7 +70,7 @@ final class EventManager implements \Countable /** * {@inheritdoc} */ - public function dispatch($func, ...$data) : array + public function dispatch(array|string|\Closure $func, ...$data) : array { if (!($func instanceof \Closure)) { return []; @@ -123,16 +123,16 @@ final class EventManager implements \Countable /** * Attach new event * - * @param string $group Name of the event (unique) - * @param mixed $callback Callback or route for the event - * @param bool $remove Remove event after triggering it? - * @param bool $reset Reset event after triggering it? Remove must be false! + * @param string $group Name of the event (unique) + * @param string|\Closure $callback Callback or route for the event + * @param bool $remove Remove event after triggering it? + * @param bool $reset Reset event after triggering it? Remove must be false! * * @return bool * * @since 1.0.0 */ - public function attach(string $group, $callback, bool $remove = false, bool $reset = false) : bool + public function attach(string $group, string|\Closure $callback, bool $remove = false, bool $reset = false) : bool { if (!isset($this->callbacks[$group])) { $this->callbacks[$group] = ['remove' => $remove, 'reset' => $reset, 'callbacks' => []]; @@ -155,7 +155,7 @@ final class EventManager implements \Countable * * @since 1.0.0 */ - public function triggerSimilar(string $group, string $id = '', $data = null) : bool + public function triggerSimilar(string $group, string $id = '', mixed $data = null) : bool { $groupIsRegex = \stripos($group, '/') === 0; $idIsRegex = \stripos($id, '/') === 0; @@ -216,7 +216,7 @@ final class EventManager implements \Countable * * @since 1.0.0 */ - public function trigger(string $group, string $id = '', $data = null) : bool + public function trigger(string $group, string $id = '', mixed $data = null) : bool { if (!isset($this->callbacks[$group])) { return false; diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index b4e19088b..b741f69e3 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -147,14 +147,14 @@ final class L11nManager * @param string $code Language code * @param string $module Module name * @param string $theme Theme - * @param mixed $translation Text + * @param string $translation Text * @param null|string $app App name * * @return string In case the language element couldn't be found 'ERROR' will be returned * * @since 1.0.0 */ - public function getText(string $code, string $module, string $theme, $translation, string $app = null) : string + public function getText(string $code, string $module, string $theme, string $translation, string $app = null) : string { if (isset($this->language[$code][$module][$translation])) { return $this->language[$code][$module][$translation]; @@ -189,13 +189,13 @@ final class L11nManager * @param string $code Language code * @param string $module Module name * @param string $theme Theme - * @param mixed $translation Text + * @param string $translation Text * * @return string In case the language element couldn't be found 'ERROR' will be returned * * @since 1.0.0 */ - public function getHtml(string $code, string $module, string $theme, $translation) : string + public function getHtml(string $code, string $module, string $theme, string $translation) : string { return \htmlspecialchars($this->getText($code, $module, $theme, $translation)); } @@ -211,7 +211,7 @@ final class L11nManager * * @since 1.0.0 */ - public function getNumeric(Localization $l11n, $numeric, string $format = null) : string + public function getNumeric(Localization $l11n, int|float $numeric, string $format = null) : string { return \number_format( $numeric, diff --git a/Localization/Money.php b/Localization/Money.php index f0ad6ca53..5db473c40 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -278,7 +278,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function mult($value) : self + public function mult(int|float $value) : self { $this->value = (int) ($this->value * $value); @@ -294,7 +294,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function div($value) : self + public function div(int|float $value) : self { $this->value = (int) ($this->value / $value); @@ -324,7 +324,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function pow($value) : self + public function pow(int|float $value) : self { $this->value = (int) ($this->value ** $value); diff --git a/Log/FileLogger.php b/Log/FileLogger.php index 47ca07de8..5cec54ff7 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -368,7 +368,7 @@ final class FileLogger implements LoggerInterface * * @since 1.0.0 */ - public function countLogs() + public function countLogs() : array { $levels = []; diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 5d37ef528..bfd523cfd 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -376,45 +376,37 @@ class Matrix implements \ArrayAccess, \Iterator /** * Subtract right. * - * @param mixed $value Value + * @param int|float|self $value Value * * @return Matrix * - * @throws \InvalidArgumentException - * * @since 1.0.0 */ - public function sub($value) : self + public function sub(int|float|self $value) : self { - if ($value instanceof self) { - return $this->add($value->mult(-1)); - } elseif (!\is_string($value) && \is_numeric($value)) { - return $this->add(-$value); + if (\is_numeric($value)) { + return $this->addScalar(-$value); } - throw new \InvalidArgumentException('Type'); + return $this->add($value->mult(-1)); } /** * Add right. * - * @param mixed $value Value + * @param int|float|self $value Value * * @return Matrix * - * @throws \InvalidArgumentException - * * @since 1.0.0 */ - public function add($value) : self + public function add(int|float|self $value) : self { - if ($value instanceof self) { - return $this->addMatrix($value); - } elseif (!\is_string($value) && \is_numeric($value)) { + if (\is_numeric($value)) { return $this->addScalar($value); } - throw new \InvalidArgumentException(); + return $this->addMatrix($value); } /** @@ -424,8 +416,6 @@ class Matrix implements \ArrayAccess, \Iterator * * @return Matrix * - * @throws \Exception - * * @since 1.0.0 */ private function addMatrix(self $matrix) : self @@ -476,15 +466,13 @@ class Matrix implements \ArrayAccess, \Iterator /** * Add scalar. * - * @param mixed $scalar Scalar + * @param int|float $scalar Scalar * * @return Matrix * - * @throws \Exception - * * @since 1.0.0 */ - private function addScalar($scalar) : self + private function addScalar(int|float $scalar) : self { $newMatrixArr = $this->matrix; @@ -503,23 +491,19 @@ class Matrix implements \ArrayAccess, \Iterator /** * Multiply right. * - * @param mixed $value Factor + * @param int|float|self $value Factor * * @return Matrix * - * @throws \InvalidArgumentException - * * @since 1.0.0 */ - public function mult($value) : self + public function mult(int|float|self $value) : self { - if ($value instanceof self) { - return $this->multMatrix($value); - } elseif (!\is_string($value) && \is_numeric($value)) { + if (\is_numeric($value)) { return $this->multScalar($value); } - throw new \InvalidArgumentException('Type'); + return $this->multMatrix($value); } /** @@ -529,8 +513,6 @@ class Matrix implements \ArrayAccess, \Iterator * * @return Matrix * - * @throws \Exception - * * @since 1.0.0 */ private function multMatrix(self $matrix) : self @@ -566,15 +548,13 @@ class Matrix implements \ArrayAccess, \Iterator /** * Multiply matrix. * - * @param mixed $scalar Scalar value + * @param int|float $scalar Scalar value * * @return Matrix * - * @throws \Exception - * * @since 1.0.0 */ - private function multScalar($scalar) : self + private function multScalar(int|float $scalar) : self { $newMatrixArr = $this->matrix; diff --git a/Math/Matrix/Vector.php b/Math/Matrix/Vector.php index 3e6225710..9740ec6ec 100644 --- a/Math/Matrix/Vector.php +++ b/Math/Matrix/Vector.php @@ -44,14 +44,14 @@ final class Vector extends Matrix /** * Set vector value * - * @param int $m Position to set - * @param mixed $value Value to set + * @param int $m Position to set + * @param int|float $value Value to set * * @return void * * @since 1.0.0 */ - public function setV(int $m, $value) : void + public function setV(int $m, int|float $value) : void { parent::set($m , 0, $value); } diff --git a/Math/Number/Complex.php b/Math/Number/Complex.php index ce40e7cf9..c4b4c3528 100644 --- a/Math/Number/Complex.php +++ b/Math/Number/Complex.php @@ -217,23 +217,19 @@ final class Complex /** * Add opperator * - * @param mixed $value Value to add + * @param int|float|self $value Value to add * * @return Complex * - * @throws \InvalidArgumentException This exception is thrown if the argument has an invalid type - * * @since 1.0.0 */ - public function add($value) : self + public function add(int|float|self $value) : self { if (\is_numeric($value)) { return $this->addScalar($value); - } elseif ($value instanceof self) { - return $this->addComplex($value); } - throw new \InvalidArgumentException(); + return $this->addComplex($value); } /** @@ -253,13 +249,13 @@ final class Complex /** * Add opperator * - * @param mixed $val Value to add + * @param int|float $val Value to add * * @return Complex * * @since 1.0.0 */ - private function addScalar($val) : self + private function addScalar(int|float $val) : self { return new self($this->re + $val, $this->im); } @@ -267,23 +263,19 @@ final class Complex /** * Sub opperator * - * @param mixed $value Value to sub + * @param int|float|self $value Value to sub * * @return Complex * - * @throws \InvalidArgumentException This exception is thrown if the argument has an invalid type - * * @since 1.0.0 */ - public function sub($value) : self + public function sub(int|float|self $value) : self { if (\is_numeric($value)) { return $this->subScalar($value); - } elseif ($value instanceof self) { - return $this->subComplex($value); } - throw new \InvalidArgumentException(); + return $this->subComplex($value); } /** @@ -303,13 +295,13 @@ final class Complex /** * Sub opperator * - * @param mixed $val Value to sub + * @param int|float $val Value to sub * * @return Complex * * @since 1.0.0 */ - private function subScalar($val) : self + private function subScalar(int|float $val) : self { return new self($this->re - $val, $this->im); } @@ -317,23 +309,19 @@ final class Complex /** * Mult opperator * - * @param mixed $value Value to mult + * @param int|float|self $value Value to mult * * @return Complex * - * @throws \InvalidArgumentException This exception is thrown if the argument has an invalid type - * * @since 1.0.0 */ - public function mult($value) : self + public function mult(int|float|self $value) : self { if (\is_numeric($value)) { return $this->multScalar($value); - } elseif ($value instanceof self) { - return $this->multComplex($value); } - throw new \InvalidArgumentException(); + return $this->multComplex($value); } /** @@ -356,13 +344,13 @@ final class Complex /** * Mult opperator * - * @param mixed $val Value to mult + * @param int|float $val Value to mult * * @return Complex * * @since 1.0.0 */ - private function multScalar($val) : self + private function multScalar(int|float $val) : self { return new self($this->re * $val, $this->im * $val); } @@ -370,7 +358,7 @@ final class Complex /** * Div opperator * - * @param mixed $value Value to div + * @param int|float|self $value Value to div * * @return Complex * @@ -378,15 +366,13 @@ final class Complex * * @since 1.0.0 */ - public function div($value) : self + public function div(int|float|self $value) : self { if (\is_numeric($value)) { - return $this->divScalar($value); - } elseif ($value instanceof self) { - return $this->divComplex($value); + return $this->divScalar($value); } - throw new \InvalidArgumentException(); + return $this->divComplex($value); } /** @@ -409,13 +395,13 @@ final class Complex /** * Div opperator * - * @param mixed $val Value to div + * @param int|float $val Value to div * * @return Complex * * @since 1.0.0 */ - private function divScalar($val) : self + private function divScalar(int|float $val) : self { return new self($this->re / $val, $this->im / $val); } diff --git a/Math/Number/Integer.php b/Math/Number/Integer.php index 92b902717..a0a6b2acf 100644 --- a/Math/Number/Integer.php +++ b/Math/Number/Integer.php @@ -43,7 +43,7 @@ final class Integer * * @since 1.0.0 */ - public static function isInteger($value) : bool + public static function isInteger(mixed $value) : bool { return \is_int($value); } diff --git a/Math/Number/Natural.php b/Math/Number/Natural.php index 160023e63..cab38978f 100644 --- a/Math/Number/Natural.php +++ b/Math/Number/Natural.php @@ -43,7 +43,7 @@ final class Natural * * @since 1.0.0 */ - public static function isNatural($value) : bool + public static function isNatural(mixed $value) : bool { return \is_int($value) && $value >= 0; } diff --git a/Math/Number/OperationInterface.php b/Math/Number/OperationInterface.php index cdebd53ac..5b36a922e 100644 --- a/Math/Number/OperationInterface.php +++ b/Math/Number/OperationInterface.php @@ -33,7 +33,7 @@ interface OperationInterface * * @since 1.0.0 */ - public function add($x); + public function add(mixed $x); /** * Subtract value. @@ -44,7 +44,7 @@ interface OperationInterface * * @since 1.0.0 */ - public function sub($x); + public function sub(mixed $x); /** * Right multiplicate value. @@ -55,7 +55,7 @@ interface OperationInterface * * @since 1.0.0 */ - public function mult($x); + public function mult(mixed $x); /** * Right devision value. @@ -66,7 +66,7 @@ interface OperationInterface * * @since 1.0.0 */ - public function div($x); + public function div(mixed $x); /** * Power of value. @@ -77,7 +77,7 @@ interface OperationInterface * * @since 1.0.0 */ - public function pow($p); + public function pow(mixed $p); /** * Abs of value. @@ -86,5 +86,5 @@ interface OperationInterface * * @since 1.0.0 */ - public function abs(); + public function abs() : mixed; } diff --git a/Math/Parser/Evaluator.php b/Math/Parser/Evaluator.php index f8cf2ef3a..e634be68e 100644 --- a/Math/Parser/Evaluator.php +++ b/Math/Parser/Evaluator.php @@ -73,15 +73,17 @@ final class Evaluator /** * Parse value. * - * @param mixed $value Value to parse + * @param int|float|string $value Value to parse * - * @return mixed + * @return int|float * * @since 1.0.0 */ - private static function parseValue($value) + private static function parseValue(int|float|string $value) : int|float { - return !\is_string($value) ? $value : (\stripos($value, '.') === false ? (int) $value : (float) $value); + return !\is_string($value) + ? $value + : (\stripos($value, '.') === false ? (int) $value : (float) $value); } /** diff --git a/Math/Statistic/MeasureOfDispersion.php b/Math/Statistic/MeasureOfDispersion.php index 7e3d2245e..e9d7465ef 100644 --- a/Math/Statistic/MeasureOfDispersion.php +++ b/Math/Statistic/MeasureOfDispersion.php @@ -319,7 +319,7 @@ final class MeasureOfDispersion * * @since 1.0.0 */ - public static function meanDeviation(array $x, float $mean = null, $offset = 0) : float + public static function meanDeviation(array $x, float $mean = null, int $offset = 0) : float { $mean = $mean !== null ? $mean : Average::arithmeticMean($x); $sum = 0.0; @@ -362,7 +362,7 @@ final class MeasureOfDispersion * * @since 1.0.0 */ - public static function meanAbsoluteDeviation(array $x, float $mean = null, $offset = 0) : float + public static function meanAbsoluteDeviation(array $x, float $mean = null, int $offset = 0) : float { $mean = $mean !== null ? $mean : Average::arithmeticMean($x); $sum = 0.0; diff --git a/Math/Stochastic/Distribution/CauchyDistribution.php b/Math/Stochastic/Distribution/CauchyDistribution.php index 27ee83e83..0f4f3134e 100644 --- a/Math/Stochastic/Distribution/CauchyDistribution.php +++ b/Math/Stochastic/Distribution/CauchyDistribution.php @@ -65,7 +65,7 @@ final class CauchyDistribution * * @since 1.0.0 */ - public static function getMode($x0) : float + public static function getMode(float $x0) : float { return $x0; } diff --git a/Math/Stochastic/Distribution/ParetoDistribution.php b/Math/Stochastic/Distribution/ParetoDistribution.php index 07d526d37..5a68831f9 100644 --- a/Math/Stochastic/Distribution/ParetoDistribution.php +++ b/Math/Stochastic/Distribution/ParetoDistribution.php @@ -94,7 +94,7 @@ final class ParetoDistribution * * @since 1.0.0 */ - public static function getMode($xm) : float + public static function getMode(float $xm) : float { return $xm; } diff --git a/Message/Console/ConsoleHeader.php b/Message/Console/ConsoleHeader.php index 23ec31dd8..3ddf7624e 100644 --- a/Message/Console/ConsoleHeader.php +++ b/Message/Console/ConsoleHeader.php @@ -100,13 +100,13 @@ final class ConsoleHeader extends HeaderAbstract /** * Remove header by ID. * - * @param mixed $key Header key + * @param string $key Header key * * @return bool * * @since 1.0.0 */ - public function remove($key) : bool + public function remove(string $key) : bool { if ($this->isLocked) { return false; diff --git a/Message/Console/ConsoleResponse.php b/Message/Console/ConsoleResponse.php index 50e0012ac..b9b3b2855 100644 --- a/Message/Console/ConsoleResponse.php +++ b/Message/Console/ConsoleResponse.php @@ -70,13 +70,13 @@ final class ConsoleResponse extends ResponseAbstract implements RenderableInterf /** * Remove response by ID. * - * @param mixed $id Response ID + * @param string $id Response ID * * @return bool * * @since 1.0.0 */ - public function remove($id) : bool + public function remove(string $id) : bool { if (isset($this->response[$id])) { unset($this->response[$id]); diff --git a/Message/Http/HttpHeader.php b/Message/Http/HttpHeader.php index e1dee2069..35018c623 100644 --- a/Message/Http/HttpHeader.php +++ b/Message/Http/HttpHeader.php @@ -171,13 +171,13 @@ final class HttpHeader extends HeaderAbstract /** * Remove header by ID. * - * @param mixed $key Header key + * @param string $key Header key * * @return bool * * @since 1.0.0 */ - public function remove($key) : bool + public function remove(string $key) : bool { if ($this->isLocked) { return false; diff --git a/Message/Http/HttpResponse.php b/Message/Http/HttpResponse.php index 51f8e2f35..9e864da40 100644 --- a/Message/Http/HttpResponse.php +++ b/Message/Http/HttpResponse.php @@ -64,13 +64,13 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface /** * Remove response by ID. * - * @param mixed $id Response ID + * @param string $id Response ID * * @return bool * * @since 1.0.0 */ - public function remove($id) : bool + public function remove(string $id) : bool { if (isset($this->response[$id])) { unset($this->response[$id]); diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index 9f363209a..1e10bbdad 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -77,13 +77,13 @@ abstract class RequestAbstract implements MessageInterface /** * Get data. * - * @param mixed $key Data key + * @param string $key Data key * * @return mixed * * @since 1.0.0 */ - public function getData($key = null) + public function getData(string $key = null) : mixed { if ($key === null) { return $this->data; @@ -97,13 +97,13 @@ abstract class RequestAbstract implements MessageInterface /** * Get data. * - * @param mixed $key Data key + * @param string $key Data key * * @return array * * @since 1.0.0 */ - public function getDataJson($key) : array + public function getDataJson(string $key) : array { $key = \mb_strtolower($key); @@ -119,14 +119,14 @@ abstract class RequestAbstract implements MessageInterface /** * Get data. * - * @param mixed $key Data key + * @param string $key Data key * @param string $delim Data delimiter * * @return array * * @since 1.0.0 */ - public function getDataList($key, string $delim = ',') : array + public function getDataList(string $key, string $delim = ',') : array { $key = \mb_strtolower($key); @@ -171,13 +171,13 @@ abstract class RequestAbstract implements MessageInterface /** * Check if has data. * - * @param mixed $key Data key + * @param string $key Data key * * @return bool * * @since 1.0.0 */ - public function hasData($key) : bool + public function hasData(string $key) : bool { return isset($this->data[$key]); } @@ -185,15 +185,15 @@ abstract class RequestAbstract implements MessageInterface /** * Set request data. * - * @param mixed $key Data key - * @param mixed $value Value - * @param bool $overwrite Overwrite data + * @param string $key Data key + * @param mixed $value Value + * @param bool $overwrite Overwrite data * * @return bool * * @since 1.0.0 */ - public function setData($key, $value, bool $overwrite = false) : bool + public function setData(string $key, mixed $value, bool $overwrite = false) : bool { if (!$this->lock) { $key = \mb_strtolower($key); diff --git a/Message/ResponseAbstract.php b/Message/ResponseAbstract.php index 4ffba77a3..b81fcf6dc 100644 --- a/Message/ResponseAbstract.php +++ b/Message/ResponseAbstract.php @@ -49,7 +49,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface * * @since 1.0.0 */ - public function get($id) + public function get(mixed $id) : mixed { return $this->response[$id] ?? null; } @@ -65,7 +65,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface * * @since 1.0.0 */ - public function set($key, $response, bool $overwrite = false) : void + public function set(mixed $key, mixed $response, bool $overwrite = false) : void { // This is not working since the key contains :: from http:// //$this->response = ArrayUtils::setArray((string) $key, $this->response, $response, ':', $overwrite); diff --git a/Model/Html/FormElementGenerator.php b/Model/Html/FormElementGenerator.php index dbd369cbb..082da7ee2 100644 --- a/Model/Html/FormElementGenerator.php +++ b/Model/Html/FormElementGenerator.php @@ -37,7 +37,7 @@ final class FormElementGenerator * * @since 1.0.0 */ - public static function generate(array $json, $value = null, array $lang = []) : string + public static function generate(array $json, mixed $value = null, array $lang = []) : string { if (!isset($json['type'])) { return 'INVALID'; @@ -67,7 +67,7 @@ final class FormElementGenerator * * @since 1.0.0 */ - private static function generateInput(array $json, $value = null, array $lang = []) : string + private static function generateInput(array $json, mixed $value = null, array $lang = []) : string { $element = ' $val) { @@ -96,7 +96,7 @@ final class FormElementGenerator * * @since 1.0.0 */ - private static function generateSelect(array $json, $value = null, array $lang = []) : string + private static function generateSelect(array $json, mixed $value = null, array $lang = []) : string { $element = ' $val) { @@ -126,7 +126,7 @@ final class FormElementGenerator * * @since 1.0.0 */ - private static function generateTextarea(array $json, $value = null) : string + private static function generateTextarea(array $json, mixed $value = null) : string { $element = ' $val) { diff --git a/Module/ModuleAbstract.php b/Module/ModuleAbstract.php index 8d55d2acf..630875af1 100644 --- a/Module/ModuleAbstract.php +++ b/Module/ModuleAbstract.php @@ -238,7 +238,7 @@ abstract class ModuleAbstract * * @since 1.0.0 */ - protected function fillJsonRawResponse(RequestAbstract $request, ResponseAbstract $response, $obj) : void + protected function fillJsonRawResponse(RequestAbstract $request, ResponseAbstract $response, mixed $obj) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); $response->set($request->uri->__toString(), $obj); @@ -257,7 +257,7 @@ abstract class ModuleAbstract * * @since 1.0.0 */ - protected function createModel(int $account, $obj, string $mapper, string $trigger, string $ip) : void + protected function createModel(int $account, mixed $obj, string $mapper, string $trigger, string $ip) : void { $this->app->eventManager->triggerSimilar('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-create', '', $obj); $id = $mapper::create($obj); diff --git a/Stdlib/Base/Enum.php b/Stdlib/Base/Enum.php index 73aac083d..5d4767dca 100644 --- a/Stdlib/Base/Enum.php +++ b/Stdlib/Base/Enum.php @@ -37,7 +37,7 @@ abstract class Enum * * @since 1.0.0 */ - public static function isValidValue($value) : bool + public static function isValidValue(mixed $value) : bool { $constants = self::getConstants(); @@ -65,7 +65,7 @@ abstract class Enum * * @since 1.0.0 */ - public static function getRandom() + public static function getRandom() : mixed { $constants = self::getConstants(); $keys = \array_keys($constants); diff --git a/Stdlib/Base/EnumArray.php b/Stdlib/Base/EnumArray.php index 854e69d0b..9faf91a98 100644 --- a/Stdlib/Base/EnumArray.php +++ b/Stdlib/Base/EnumArray.php @@ -73,7 +73,7 @@ abstract class EnumArray * * @since 1.0.0 */ - public static function isValidValue($value) : bool + public static function isValidValue(mixed $value) : bool { return \in_array($value, static::$constants, true); } @@ -89,7 +89,7 @@ abstract class EnumArray * * @since 1.0.0 */ - public static function get($key) + public static function get(mixed $key) : mixed { if (!isset(static::$constants[$key])) { throw new \OutOfBoundsException('Key "' . $key . '" is not valid.'); @@ -117,7 +117,7 @@ abstract class EnumArray * * @since 1.0.0 */ - public static function getRandom() + public static function getRandom() : mixed { $keys = \array_keys(static::$constants); diff --git a/Stdlib/Base/Heap.php b/Stdlib/Base/Heap.php index f82ca1263..c5baf420e 100644 --- a/Stdlib/Base/Heap.php +++ b/Stdlib/Base/Heap.php @@ -64,7 +64,7 @@ class Heap * * @since 1.0.0 */ - public function insort($x, int $lo = 0) : void + public function insort(mixed $x, int $lo = 0) : void { $hi = \count($this->nodes); @@ -89,7 +89,7 @@ class Heap * * @since 1.0.0 */ - public function push($item) : void + public function push(mixed $item) : void { $this->nodes[] = $item; $this->siftDown(0, \count($this->nodes) - 1); @@ -102,7 +102,7 @@ class Heap * * @since 1.0.0 */ - public function pop() + public function pop() : mixed { $last = \array_pop($this->nodes); if (empty($this->nodes)) { @@ -123,7 +123,7 @@ class Heap * * @since 1.0.0 */ - public function peek() + public function peek() : mixed { return $this->nodes[0]; } @@ -137,7 +137,7 @@ class Heap * * @since 1.0.0 */ - public function contains($item) : bool + public function contains(mixed $item) : bool { foreach ($this->nodes as $key => $node) { if (\is_scalar($item)) { @@ -161,7 +161,7 @@ class Heap * * @since 1.0.0 */ - public function replace($new) + public function replace(mixed $new) : mixed { $old = $this->nodes[0]; $this->nodes[0] = $new; @@ -179,7 +179,7 @@ class Heap * * @since 1.0.0 */ - public function pushpop($item) + public function pushpop(mixed $item) : mixed { if (!empty($this->nodes) && ($this->compare)($this->nodes[0], $item) < 0) { $temp = $item; @@ -220,7 +220,7 @@ class Heap * * @since 1.0.0 */ - public function update($item) : bool + public function update(mixed $item) : bool { $pos = null; foreach ($this->nodes as $key => $node) { diff --git a/Stdlib/Graph/Graph.php b/Stdlib/Graph/Graph.php index faae6dac4..c7b29dff8 100644 --- a/Stdlib/Graph/Graph.php +++ b/Stdlib/Graph/Graph.php @@ -82,13 +82,13 @@ class Graph /** * Get graph node * - * @param mixed $key Node key + * @param int|string $key Node key * * @return null|Node * * @since 1.0.0 */ - public function getNode(mixed $key) : ?Node + public function getNode(int|string $key) : ?Node { return $this->nodes[$key] ?? null; } @@ -111,13 +111,13 @@ class Graph /** * Graph has node * - * @param mixed $key Node key + * @param int|string $key Node key * * @return bool * * @since 1.0.0 */ - public function hasNode($key) : bool + public function hasNode(int|string $key) : bool { return isset($this->nodes[$key]); } @@ -543,14 +543,14 @@ class Graph /** * Get longest path between two nodes. * - * @param mixed $node1 Graph node - * @param mixed $node2 Graph node + * @param int|string $node1 Graph node + * @param int|string $node2 Graph node * * @return Node[] * * @since 1.0.0 */ - public function longestPathBetweenNodes($node1, $node2) : array + public function longestPathBetweenNodes(int|string $node1, int|string $node2) : array { if (!($node1 instanceof Node)) { $node1 = $this->getNode($node1); diff --git a/Stdlib/Graph/Node.php b/Stdlib/Graph/Node.php index ac681bc8a..26b0eb05e 100644 --- a/Stdlib/Graph/Node.php +++ b/Stdlib/Graph/Node.php @@ -56,7 +56,7 @@ class Node * * @since 1.0.0 */ - public function __construct(string $id, $data = null) + public function __construct(string $id, mixed $data = null) { $this->id = $id; $this->data = $data; @@ -81,7 +81,7 @@ class Node * * @since 1.0.0 */ - public function getData() + public function getData() : mixed { return $this->data; } @@ -95,7 +95,7 @@ class Node * * @since 1.0.0 */ - public function setData($data) : void + public function setData(mixed $data) : void { $this->data = $data; } diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index 77e22efb0..e348ce1b3 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -83,7 +83,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function add(array $keys, $value, bool $overwrite = false) : bool + public function add(array $keys, mixed $value, bool $overwrite = false) : bool { $id = \count($this->values); $inserted = false; @@ -176,13 +176,13 @@ final class MultiMap implements \Countable /** * Get data. * - * @param mixed $key Key used to identify value + * @param int|string|array $key Key used to identify value * * @return mixed * * @since 1.0.0 */ - public function get($key) + public function get(int|string|array $key) : mixed { if ($this->keyType === KeyType::SINGLE) { return $this->getSingle($key); @@ -194,13 +194,13 @@ final class MultiMap implements \Countable /** * Get data. * - * @param mixed $key Key used to identify value + * @param int|string $key Key used to identify value * * @return mixed * * @since 1.0.0 */ - private function getSingle($key) + private function getSingle(int|string $key) : mixed { return isset($this->keys[$key]) ? $this->values[$this->keys[$key]] ?? null : null; } @@ -208,13 +208,13 @@ final class MultiMap implements \Countable /** * Get data. * - * @param mixed $key Key used to identify value + * @param int|string|array $key Key used to identify value * * @return mixed * * @since 1.0.0 */ - private function getMultiple($key) + private function getMultiple(int|string|array $key) : mixed { if (\is_array($key)) { if ($this->orderType === OrderType::LOOSE) { @@ -239,14 +239,14 @@ final class MultiMap implements \Countable /** * Set existing key with data. * - * @param mixed $key Key used to identify value - * @param mixed $value Value to store + * @param int|string|array $key Key used to identify value + * @param mixed $value Value to store * * @return bool * * @since 1.0.0 */ - public function set($key, $value) : bool + public function set(int|string|array $key, mixed $value) : bool { if ($this->keyType === KeyType::MULTIPLE && \is_array($key)) { return $this->setMultiple($key, $value); @@ -258,14 +258,14 @@ final class MultiMap implements \Countable /** * Set existing key with data. * - * @param mixed $key Key used to identify value - * @param mixed $value Value to store + * @param int|string|array $key Key used to identify value + * @param mixed $value Value to store * * @return bool * * @since 1.0.0 */ - private function setMultiple($key, $value) : bool + private function setMultiple(int|string|array $key, mixed $value) : bool { if ($this->orderType !== OrderType::STRICT) { /** @var array $permutation */ @@ -286,14 +286,14 @@ final class MultiMap implements \Countable /** * Set existing key with data. * - * @param mixed $key Key used to identify value - * @param mixed $value Value to store + * @param int|string $key Key used to identify value + * @param mixed $value Value to store * * @return bool * * @since 1.0.0 */ - private function setSingle($key, $value) : bool + private function setSingle(int|string $key, mixed $value) : bool { if (isset($this->keys[$key])) { $this->values[$this->keys[$key]] = $value; @@ -307,13 +307,13 @@ final class MultiMap implements \Countable /** * Remove value and all sibling keys based on key. * - * @param mixed $key Key used to identify value + * @param int|string|array $key Key used to identify value * * @return bool * * @since 1.0.0 */ - public function remove($key) : bool + public function remove(int|string|array $key) : bool { if ($this->keyType === KeyType::MULTIPLE && \is_array($key)) { return $this->removeMultiple($key); @@ -325,13 +325,13 @@ final class MultiMap implements \Countable /** * Remove value and all sibling keys based on key. * - * @param mixed $key Key used to identify value + * @param int|string|array $key Key used to identify value * * @return bool * * @since 1.0.0 */ - private function removeMultiple($key) : bool + private function removeMultiple(int|string|array $key) : bool { if ($this->orderType !== OrderType::LOOSE) { return $this->remove(\implode(':', $key)); @@ -355,13 +355,13 @@ final class MultiMap implements \Countable /** * Remove value and all sibling keys based on key. * - * @param mixed $key Key used to identify value + * @param int|string $key Key used to identify value * * @return bool * * @since 1.0.0 */ - private function removeSingle($key) : bool + private function removeSingle(int|string $key) : bool { if (isset($this->keys[$key])) { $id = $this->keys[$key]; @@ -381,14 +381,14 @@ final class MultiMap implements \Countable * * Both keys need to exist in the multimap. * - * @param mixed $old Old key - * @param mixed $new New key + * @param int|string|array $old Old key + * @param int|string|array $new New key * * @return bool * * @since 1.0.0 */ - public function remap($old, $new) : bool + public function remap(int|string|array $old, int|string|array $new) : bool { if ($this->keyType === KeyType::MULTIPLE) { return false; @@ -410,13 +410,13 @@ final class MultiMap implements \Countable * * This only removes the value if no other key exists for this value. * - * @param mixed $key Key used to identify value + * @param int|string|array $key Key used to identify value * * @return bool * * @since 1.0.0 */ - public function removeKey($key) : bool + public function removeKey(int|string|array $key) : bool { if ($this->keyType === KeyType::MULTIPLE) { return false; @@ -430,13 +430,13 @@ final class MultiMap implements \Countable * * This only removes the value if no other key exists for this value. * - * @param mixed $key Key used to identify value + * @param int|string $key Key used to identify value * * @return bool * * @since 1.0.0 */ - private function removeKeySingle($key) : bool + private function removeKeySingle(int|string $key) : bool { if (isset($this->keys[$key])) { unset($this->keys[$key]); @@ -452,13 +452,13 @@ final class MultiMap implements \Countable /** * Get all sibling keys. * - * @param mixed $key Key to find siblings for + * @param int|string|array $key Key to find siblings for * * @return array * * @since 1.0.0 */ - public function getSiblings($key) : array + public function getSiblings(int|string|array $key) : array { if ($this->keyType === KeyType::MULTIPLE) { return $this->getSiblingsMultiple($key); @@ -470,13 +470,13 @@ final class MultiMap implements \Countable /** * Get all sibling keys. * - * @param mixed $key Key to find siblings for + * @param int|string|array $key Key to find siblings for * * @return array * * @since 1.0.0 */ - public function getSiblingsMultiple($key) : array + public function getSiblingsMultiple(int|string|array $key) : array { if ($this->orderType === OrderType::LOOSE) { $key = \is_array($key) ? $key : [$key]; @@ -490,13 +490,13 @@ final class MultiMap implements \Countable /** * Get all sibling keys. * - * @param mixed $key Key to find siblings for + * @param int|string $key Key to find siblings for * * @return array * * @since 1.0.0 */ - private function getSiblingsSingle($key) : array + private function getSiblingsSingle(int|string $key) : array { $siblings = []; diff --git a/Stdlib/Queue/PriorityQueue.php b/Stdlib/Queue/PriorityQueue.php index c1088d35e..60338a052 100644 --- a/Stdlib/Queue/PriorityQueue.php +++ b/Stdlib/Queue/PriorityQueue.php @@ -80,7 +80,7 @@ class PriorityQueue implements \Countable, \Serializable * * @since 1.0.0 */ - public function insert($data, float $priority = 1.0) : int + public function insert(mixed $data, float $priority = 1.0) : int { do { $key = \mt_rand(); diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 9da0d5a37..4ed570c1c 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -59,7 +59,7 @@ class Directory extends FileAbstract implements DirectoryInterface * * @since 1.0.0 */ - public static function ftpConnect(HttpUri $http) + public static function ftpConnect(HttpUri $http) : mixed { $con = \ftp_connect($http->host, $http->port, 10); diff --git a/System/File/Ftp/File.php b/System/File/Ftp/File.php index 6bc22fa30..4d7c1a161 100644 --- a/System/File/Ftp/File.php +++ b/System/File/Ftp/File.php @@ -75,7 +75,7 @@ class File extends FileAbstract implements FileInterface * * @since 1.0.0 */ - public static function ftpConnect(HttpUri $http) + public static function ftpConnect(HttpUri $http) : mixed { $con = \ftp_connect($http->host, $http->port, 10); diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 4bb051c6d..dc91f2124 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -88,7 +88,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function setArray(string $path, array $data, $value, string $delim = '/', bool $overwrite = false) : array + public static function setArray(string $path, array $data, mixed $value, string $delim = '/', bool $overwrite = false) : array { $pathParts = \explode($delim, \trim($path, $delim)); $current = &$data; @@ -129,7 +129,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function getArray(string $path, array $data, string $delim = '/') + public static function getArray(string $path, array $data, string $delim = '/') : mixed { $pathParts = \explode($delim, \trim($path, $delim)); $current = $data; @@ -160,7 +160,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function inArrayRecursive($needle, array $haystack, $key = null) : bool + public static function inArrayRecursive(mixed $needle, array $haystack, $key = null) : bool { $found = false; @@ -356,7 +356,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function arraySumRecursive(array $array) + public static function arraySumRecursive(array $array) : mixed { return \array_sum(self::arrayFlatten($array)); } diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index 5d42f695b..7fda9c969 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -223,7 +223,7 @@ abstract class C128Abstract * * @since 1.0.0 */ - public function get() + public function get() : mixed { $codeString = static::$CODE_START . $this->generateCodeString() . static::$CODE_END; @@ -321,7 +321,7 @@ abstract class C128Abstract * * @since 1.0.0 */ - protected function createImage(string $codeString) + protected function createImage(string $codeString) : mixed { $dimensions = $this->calculateDimensions($codeString); $image = \imagecreate($dimensions['width'], $dimensions['height']); diff --git a/Utils/Encoding/EncodingInterface.php b/Utils/Encoding/EncodingInterface.php index 9f88d0ce1..af2a76987 100644 --- a/Utils/Encoding/EncodingInterface.php +++ b/Utils/Encoding/EncodingInterface.php @@ -33,7 +33,7 @@ interface EncodingInterface * * @since 1.0.0 */ - public static function encode($source); + public static function encode(mixed $source); /** * Dedecodes text @@ -44,5 +44,5 @@ interface EncodingInterface * * @since 1.0.0 */ - public static function decode($decoded); + public static function decode(mixed $decoded); } diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index 1e0f252de..7950d88e8 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -341,7 +341,7 @@ class Repository * * @since 1.0.0 */ - public function commit(Commit $commit, $all = true) : string + public function commit(Commit $commit, bool $all = true) : string { return \implode("\n", $this->run('commit ' . ($all ? '-av' : '-v') . ' -m ' . \escapeshellarg($commit->getMessage()))); } diff --git a/Utils/IO/Csv/CsvInterface.php b/Utils/IO/Csv/CsvInterface.php index f63bf3e56..3e9f39671 100644 --- a/Utils/IO/Csv/CsvInterface.php +++ b/Utils/IO/Csv/CsvInterface.php @@ -33,7 +33,7 @@ interface CsvInterface * * @since 1.0.0 */ - public function exportCsv($path) : void; + public function exportCsv(string $path) : void; /** * Import Csv. @@ -44,5 +44,5 @@ interface CsvInterface * * @since 1.0.0 */ - public function importCsv($path) : void; + public function importCsv(string $path) : void; } diff --git a/Utils/IO/Json/JsonInterface.php b/Utils/IO/Json/JsonInterface.php index beb2e46bb..b0d14aa29 100644 --- a/Utils/IO/Json/JsonInterface.php +++ b/Utils/IO/Json/JsonInterface.php @@ -33,7 +33,7 @@ interface JsonInterface * * @since 1.0.0 */ - public function exportJson($path) : void; + public function exportJson(string $path) : void; /** * Import Json. @@ -44,5 +44,5 @@ interface JsonInterface * * @since 1.0.0 */ - public function importJson($path) : void; + public function importJson(string $path) : void; } diff --git a/Utils/IO/Pdf/PdfInterface.php b/Utils/IO/Pdf/PdfInterface.php index 5146774ad..dd9dc304c 100644 --- a/Utils/IO/Pdf/PdfInterface.php +++ b/Utils/IO/Pdf/PdfInterface.php @@ -33,5 +33,5 @@ interface PdfInterface * * @since 1.0.0 */ - public function exportPdf($path) : void; + public function exportPdf(string $path) : void; } diff --git a/Utils/IO/Spreadsheet/SpreadsheetInterface.php b/Utils/IO/Spreadsheet/SpreadsheetInterface.php index b35905415..d75aff65e 100644 --- a/Utils/IO/Spreadsheet/SpreadsheetInterface.php +++ b/Utils/IO/Spreadsheet/SpreadsheetInterface.php @@ -33,7 +33,7 @@ interface SpreadsheetInterface * * @since 1.0.0 */ - public function exportSpreadsheet($path) : void; + public function exportSpreadsheet(string $path) : void; /** * Import Spreadsheet. @@ -44,5 +44,5 @@ interface SpreadsheetInterface * * @since 1.0.0 */ - public function importSpreadsheet($path) : void; + public function importSpreadsheet(string $path) : void; } diff --git a/Utils/IO/Zip/ArchiveInterface.php b/Utils/IO/Zip/ArchiveInterface.php index f936737fb..7df9ea537 100644 --- a/Utils/IO/Zip/ArchiveInterface.php +++ b/Utils/IO/Zip/ArchiveInterface.php @@ -27,15 +27,15 @@ interface ArchiveInterface /** * Create archive. * - * @param mixed $sources Files and directories to compress - * @param string $destination Output destination - * @param bool $overwrite Overwrite if destination is existing + * @param string|array $sources Files and directories to compress + * @param string $destination Output destination + * @param bool $overwrite Overwrite if destination is existing * * @return bool * * @since 1.0.0 */ - public static function pack($sources, string $destination, bool $overwrite = false) : bool; + public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool; /** * Unpack archive. diff --git a/Utils/IO/Zip/Gz.php b/Utils/IO/Zip/Gz.php index 1eb86ee4c..f4a7f9e3e 100644 --- a/Utils/IO/Zip/Gz.php +++ b/Utils/IO/Zip/Gz.php @@ -29,7 +29,7 @@ class Gz implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack($source, string $destination, bool $overwrite = false) : bool + public static function pack(string|array $source, string $destination, bool $overwrite = false) : bool { $destination = \str_replace('\\', '/', $destination); if (!$overwrite && \is_file($destination) || !\is_file($source)) { diff --git a/Utils/IO/Zip/Tar.php b/Utils/IO/Zip/Tar.php index 91a37f1c3..159793316 100644 --- a/Utils/IO/Zip/Tar.php +++ b/Utils/IO/Zip/Tar.php @@ -31,7 +31,7 @@ class Tar implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack($sources, string $destination, bool $overwrite = false) : bool + public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool { $destination = FileUtils::absolute(\str_replace('\\', '/', $destination)); diff --git a/Utils/IO/Zip/TarGz.php b/Utils/IO/Zip/TarGz.php index 9364afd58..298b867f5 100644 --- a/Utils/IO/Zip/TarGz.php +++ b/Utils/IO/Zip/TarGz.php @@ -31,7 +31,7 @@ class TarGz implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack($source, string $destination, bool $overwrite = false) : bool + public static function pack(string|array $source, string $destination, bool $overwrite = false) : bool { $destination = \str_replace('\\', '/', $destination); if (!$overwrite && \is_file($destination)) { diff --git a/Utils/IO/Zip/Zip.php b/Utils/IO/Zip/Zip.php index 9e84a7b37..74f442b29 100644 --- a/Utils/IO/Zip/Zip.php +++ b/Utils/IO/Zip/Zip.php @@ -31,7 +31,7 @@ class Zip implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack($sources, string $destination, bool $overwrite = false) : bool + public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool { $destination = FileUtils::absolute(\str_replace('\\', '/', $destination)); diff --git a/Utils/MbStringUtils.php b/Utils/MbStringUtils.php index a89c7834f..5aba70850 100644 --- a/Utils/MbStringUtils.php +++ b/Utils/MbStringUtils.php @@ -80,7 +80,7 @@ final class MbStringUtils * * @since 1.0.0 */ - public static function mb_startsWith(string $haystack, $needles) : bool + public static function mb_startsWith(string $haystack, string|array $needles) : bool { if (\is_string($needles)) { $needles = [$needles]; diff --git a/Utils/Parser/Php/ArrayParser.php b/Utils/Parser/Php/ArrayParser.php index 0cb96896a..dea54a529 100644 --- a/Utils/Parser/Php/ArrayParser.php +++ b/Utils/Parser/Php/ArrayParser.php @@ -63,7 +63,7 @@ class ArrayParser * * @since 1.0.0 */ - public static function parseVariable($value, int $depth = 1) : string + public static function parseVariable(mixed $value, int $depth = 1) : string { if (\is_array($value)) { return self::serializeArray($value, $depth); diff --git a/Utils/Permutation.php b/Utils/Permutation.php index 50b3781e7..ab2e71cad 100644 --- a/Utils/Permutation.php +++ b/Utils/Permutation.php @@ -103,13 +103,13 @@ final class Permutation * @param array|string $toPermute To permutate * @param array $key Permutation keys * - * @return mixed + * @return string|array * * @throws \OutOfBoundsException This exception is thrown if the permutation key is larger than the data to permute * * @since 1.0.0 */ - public static function permutate($toPermute, array $key) + public static function permutate(string|array $toPermute, array $key) : string|array { $length = \is_array($toPermute) ? \count($toPermute) : \strlen($toPermute); diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index beff26b9b..a73e73286 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -191,7 +191,7 @@ final class StringUtils * * @since 1.0.0 */ - public static function stringify($element, $option = null) : ?string + public static function stringify(mixed $element, mixed $option = null) : ?string { if ($element instanceof \JsonSerializable || \is_array($element)) { $encoded = \json_encode($element, $option !== null ? $option : 0); diff --git a/Utils/TestUtils.php b/Utils/TestUtils.php index 255b0c62e..745dabcb6 100644 --- a/Utils/TestUtils.php +++ b/Utils/TestUtils.php @@ -47,7 +47,7 @@ final class TestUtils * * @since 1.0.0 */ - public static function setMember(object $obj, string $name, $value) : bool + public static function setMember(object $obj, string $name, mixed $value) : bool { $reflectionClass = new \ReflectionClass(\get_class($obj)); @@ -80,7 +80,7 @@ final class TestUtils * * @since 1.0.0 */ - public static function getMember(object $obj, string $name) + public static function getMember(object $obj, string $name) : mixed { $reflectionClass = new \ReflectionClass($obj); diff --git a/Validation/Base/DateTime.php b/Validation/Base/DateTime.php index 970e34932..504d73965 100644 --- a/Validation/Base/DateTime.php +++ b/Validation/Base/DateTime.php @@ -29,7 +29,7 @@ abstract class DateTime extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { return (bool) \strtotime($value); } diff --git a/Validation/Base/Json.php b/Validation/Base/Json.php index 932bb9d9a..5587c9aa3 100644 --- a/Validation/Base/Json.php +++ b/Validation/Base/Json.php @@ -30,7 +30,7 @@ abstract class Json extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { \json_decode($value); diff --git a/Validation/Finance/BIC.php b/Validation/Finance/BIC.php index bbee6f5a3..14c9d882a 100644 --- a/Validation/Finance/BIC.php +++ b/Validation/Finance/BIC.php @@ -29,7 +29,7 @@ final class BIC extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { return (bool) \preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value); } diff --git a/Validation/Finance/Iban.php b/Validation/Finance/Iban.php index 2c153fa2d..2102dc5c0 100644 --- a/Validation/Finance/Iban.php +++ b/Validation/Finance/Iban.php @@ -29,7 +29,7 @@ final class Iban extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { $value = \str_replace(' ', '', \strtolower($value)); diff --git a/Validation/Network/Email.php b/Validation/Network/Email.php index a870ffac8..5d490d10d 100644 --- a/Validation/Network/Email.php +++ b/Validation/Network/Email.php @@ -39,7 +39,7 @@ abstract class Email extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { if (\filter_var($value, \FILTER_VALIDATE_EMAIL) === false) { self::$msg = 'Invalid Email by filter_var standards'; diff --git a/Validation/Network/Hostname.php b/Validation/Network/Hostname.php index 5245bfc78..dc5bf05ab 100644 --- a/Validation/Network/Hostname.php +++ b/Validation/Network/Hostname.php @@ -39,7 +39,7 @@ abstract class Hostname extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { return \filter_var(\gethostbyname($value), \FILTER_VALIDATE_IP) !== false; } diff --git a/Validation/Network/Ip.php b/Validation/Network/Ip.php index 82ccaf873..338f43036 100644 --- a/Validation/Network/Ip.php +++ b/Validation/Network/Ip.php @@ -39,7 +39,7 @@ abstract class Ip extends ValidatorAbstract /** * {@inheritdoc} */ - public static function isValid($value, array $constraints = null) : bool + public static function isValid(mixed $value, array $constraints = null) : bool { return \filter_var($value, \FILTER_VALIDATE_IP) !== false; } @@ -53,7 +53,7 @@ abstract class Ip extends ValidatorAbstract * * @since 1.0.0 */ - public static function isValidIpv6($value) : bool + public static function isValidIpv6(mixed $value) : bool { return \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6) !== false; } @@ -67,7 +67,7 @@ abstract class Ip extends ValidatorAbstract * * @since 1.0.0 */ - public static function isValidIpv4($value) : bool + public static function isValidIpv4(mixed $value) : bool { return \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4) !== false; } diff --git a/Validation/Validator.php b/Validation/Validator.php index 741abb13d..1a0e6ba75 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -38,7 +38,7 @@ final class Validator extends ValidatorAbstract * * @since 1.0.0 */ - public static function isValid($var, array $constraints = null) : bool + public static function isValid(mixed $var, array $constraints = null) : bool { if ($constraints === null) { return true; diff --git a/Validation/ValidatorInterface.php b/Validation/ValidatorInterface.php index 9df921316..ca3c41c1c 100644 --- a/Validation/ValidatorInterface.php +++ b/Validation/ValidatorInterface.php @@ -34,7 +34,7 @@ interface ValidatorInterface * * @since 1.0.0 */ - public static function isValid($value, array $constraints = null); + public static function isValid(mixed $value, array $constraints = null); /** * Get most recent error string. diff --git a/Views/View.php b/Views/View.php index 054afc5d1..709b94844 100644 --- a/Views/View.php +++ b/Views/View.php @@ -127,7 +127,7 @@ class View extends ViewAbstract * * @since 1.0.0 */ - public function getData(string $id) + public function getData(string $id) : mixed { return $this->data[$id] ?? null; } @@ -142,7 +142,7 @@ class View extends ViewAbstract * * @since 1.0.0 */ - public function setData(string $id, $data) : void + public function setData(string $id, mixed $data) : void { $this->data[$id] = $data; } @@ -177,7 +177,7 @@ class View extends ViewAbstract * * @since 1.0.0 */ - public function addData(string $id, $data) : bool + public function addData(string $id, mixed $data) : bool { if (isset($this->data[$id])) { return false; @@ -191,7 +191,7 @@ class View extends ViewAbstract /** * Get translation. * - * @param mixed $translation Text + * @param string $translation Text * @param string $module Module name * @param string $theme Theme name * @@ -199,7 +199,7 @@ class View extends ViewAbstract * * @since 1.0.0 */ - public function getText($translation, string $module = null, string $theme = null) : string + public function getText(string $translation, string $module = null, string $theme = null) : string { if ($module === null && $this->module === null) { $this->setModuleDynamically(); diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index 5c1b1de05..172e9ce52 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -81,29 +81,29 @@ abstract class ViewAbstract implements RenderableInterface /** * Print html output. * - * @param mixed $text Text + * @param string $text Text * * @return string * * @since 1.0.0 */ - public function printHtml($text) : string + public function printHtml(string $text) : string { - return \htmlspecialchars((string) $text); + return \htmlspecialchars($text); } /** * Print html output. * - * @param mixed $text Text + * @param string $text Text * * @return string * * @since 1.0.0 */ - public static function html($text) : string + public static function html(string $text) : string { - return \htmlspecialchars((string) $text); + return \htmlspecialchars($text); } /** @@ -123,11 +123,11 @@ abstract class ViewAbstract implements RenderableInterface * * @param string $id View ID * - * @return false|View + * @return false|self * * @since 1.0.0 */ - public function getView(string $id) + public function getView(string $id) : bool|self { if (!isset($this->views[$id])) { return false; diff --git a/tests/Algorithm/Sort/NumericElement.php b/tests/Algorithm/Sort/NumericElement.php index f91fde61e..84fc35f52 100644 --- a/tests/Algorithm/Sort/NumericElement.php +++ b/tests/Algorithm/Sort/NumericElement.php @@ -21,9 +21,9 @@ require_once __DIR__ . '/../../Autoloader.php'; class NumericElement implements SortableInterface { - public $value = 0; + public int|float $value = 0; - public function __construct($value) + public function __construct(int|float $value) { $this->value = $value; } @@ -38,12 +38,12 @@ class NumericElement implements SortableInterface return $this->value === $obj->getValue(); } - public function getValue() + public function getValue() : int|float { return $this->value; } - public static function max(array $list) + public static function max(array $list) : int|float { $values = []; foreach ($list as $element) { @@ -53,7 +53,7 @@ class NumericElement implements SortableInterface return \max($values); } - public static function min(array $list) + public static function min(array $list) : int|float { $values = []; foreach ($list as $element) { diff --git a/tests/Dispatcher/DispatcherTest.php b/tests/Dispatcher/DispatcherTest.php index de52e7374..425d850b7 100644 --- a/tests/Dispatcher/DispatcherTest.php +++ b/tests/Dispatcher/DispatcherTest.php @@ -192,18 +192,6 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase ); } - /** - * @testdox A invalid destination type throws UnexpectedValueException - * @covers phpOMS\Dispatcher\Dispatcher - * @group framework - */ - public function testInvalidDestination() : void - { - $this->expectException(\UnexpectedValueException::class); - - $this->app->dispatcher->dispatch(true); - } - /** * @testdox A invalid controller path throws a PathException * @covers phpOMS\Dispatcher\Dispatcher diff --git a/tests/Math/Matrix/MatrixTest.php b/tests/Math/Matrix/MatrixTest.php index 4da5869c1..832f90f29 100644 --- a/tests/Math/Matrix/MatrixTest.php +++ b/tests/Math/Matrix/MatrixTest.php @@ -438,60 +438,6 @@ class MatrixTest extends \PHPUnit\Framework\TestCase $id->get(99, 99); } - /** - * @testdox Subtracting a invalid data type from a matrix throws a InvalidArgumentException - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testInvalidSub() : void - { - $this->expectException(\InvalidArgumentException::class); - - $id = new Matrix(); - $id->setMatrix([ - [1, 0], - [0, 1], - ]); - - $id->sub(true); - } - - /** - * @testdox Adding a invalid data type from a matrix throws a InvalidArgumentException - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testInvalidAdd() : void - { - $this->expectException(\InvalidArgumentException::class); - - $id = new Matrix(); - $id->setMatrix([ - [1, 0], - [0, 1], - ]); - - $id->add(true); - } - - /** - * @testdox Multiplying a invalid data type from a matrix throws a InvalidArgumentException - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testInvalidMult() : void - { - $this->expectException(\InvalidArgumentException::class); - - $id = new Matrix(); - $id->setMatrix([ - [1, 0], - [0, 1], - ]); - - $id->mult(true); - } - /** * @testdox Adding a matrix with a different dimension to a matrix throws a InvalidDimensionException * @covers phpOMS\Math\Matrix\Matrix diff --git a/tests/Math/Number/ComplexTest.php b/tests/Math/Number/ComplexTest.php index 5c50bebab..544c52ecc 100644 --- a/tests/Math/Number/ComplexTest.php +++ b/tests/Math/Number/ComplexTest.php @@ -219,56 +219,4 @@ class ComplexTest extends \PHPUnit\Framework\TestCase $cpl2 = new Complex(-1, 3); self::assertEquals('1.04 + 1.44i', $cpl2->sqrt()->render()); } - - /** - * @testdox A invalid type addition throws a InvalidArgumentException - * @covers phpOMS\Math\Number\Complex - * @group framework - */ - public function testInvalidAdd() : void - { - $this->expectException(\InvalidArgumentException::class); - - $cpl = new Complex(4, 3); - $cpl->add(true); - } - - /** - * @testdox A invalid type subtraction throws a InvalidArgumentException - * @covers phpOMS\Math\Number\Complex - * @group framework - */ - public function testInvalidSub() : void - { - $this->expectException(\InvalidArgumentException::class); - - $cpl = new Complex(4, 3); - $cpl->sub(true); - } - - /** - * @testdox A invalid type cannot multiplication throws a InvalidArgumentException - * @covers phpOMS\Math\Number\Complex - * @group framework - */ - public function testInvalidMult() : void - { - $this->expectException(\InvalidArgumentException::class); - - $cpl = new Complex(4, 3); - $cpl->mult(true); - } - - /** - * @testdox A invalid type division throws a InvalidArgumentException - * @covers phpOMS\Math\Number\Complex - * @group framework - */ - public function testInvalidDiv() : void - { - $this->expectException(\InvalidArgumentException::class); - - $cpl = new Complex(4, 3); - $cpl->div(true); - } } diff --git a/tests/Math/Statistic/Forecast/ErrorTest.php b/tests/Math/Statistic/Forecast/ErrorTest.php index 3a5eade13..e200de1cf 100644 --- a/tests/Math/Statistic/Forecast/ErrorTest.php +++ b/tests/Math/Statistic/Forecast/ErrorTest.php @@ -130,7 +130,7 @@ class ErrorTest extends \PHPUnit\Framework\TestCase $scaledErrors = Error::getScaledErrorArray($errors, $observed); self::assertEqualsWithDelta( - Error::getMeanAbsoluteScaledError(ArrayUtils::powerInt($scaledErrors, 2)), + Error::getMeanAbsoluteScaledError(ArrayUtils::power($scaledErrors, 2)), Error::getMeanSquaredScaledError($scaledErrors), 0.01 ); }