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 = '