start impl. php 8.0 typehints

This commit is contained in:
Dennis Eichhorn 2020-12-03 20:49:09 +01:00
parent d35b600cd3
commit 2bfb2c1329
36 changed files with 195 additions and 276 deletions

View File

@ -73,7 +73,7 @@ class Point implements PointInterface
/**
* {@inheritdoc}
*/
public function getCoordinate(int $index)
public function getCoordinate(int $index) : int|float
{
return $this->coordinates[$index];
}

View File

@ -46,7 +46,7 @@ interface PointInterface
*
* @since 1.0.0
*/
public function getCoordinate(int $index);
public function getCoordinate(int $index) : int|float;
/**
* Set the coordinate of the point

View File

@ -54,7 +54,7 @@ final class DependencyResolver
*
* @since 1.0.0
*/
private static function dependencyResolve($item, array $items, array &$resolved, array &$unresolved) : void
private static function dependencyResolve(int|string $item, array $items, array &$resolved, array &$unresolved) : void
{
$unresolved[] = $item;

View File

@ -37,13 +37,13 @@ trait OptionsTrait
/**
* 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
{
return isset($this->options[$key]);
}
@ -51,13 +51,13 @@ trait OptionsTrait
/**
* 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
{
return $this->options[$key] ?? null;
}
@ -65,13 +65,13 @@ trait OptionsTrait
/**
* Get options by keys.
*
* @param array $key Unique option key
* @param array<int, int|string> $key Unique option key
*
* @return array Option values
*
* @since 1.0.0
*/
public function getOptions(array $key)
public function getOptions(array $key) : array
{
$options = [];
@ -87,15 +87,15 @@ trait OptionsTrait
/**
* 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
{
if ($overwrite || !isset($this->options[$key])) {
$this->options[$key] = $value;

View File

@ -29,52 +29,52 @@ interface ConnectionInterface extends DataStorageConnectionInterface
/**
* Updating or adding cache data.
*
* @param mixed $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s). Negative expiration means no expiration.
* @param int|string $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s). Negative expiration means no expiration.
*
* @return void
*
* @since 1.0.0
*/
public function set($key, $value, int $expire = -1) : void;
public function set(int|string $key, mixed $value, int $expire = -1) : void;
/**
* Adding new data if it doesn't exist.
*
* @param mixed $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s)
* @param int|string $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s)
*
* @return bool
*
* @since 1.0.0
*/
public function add($key, $value, int $expire = -1) : bool;
public function add(int|string $key, mixed $value, int $expire = -1) : bool;
/**
* Get cache by key.
*
* @param mixed $key Unique cache key
* @param int $expire Valid duration (in s). In case the data needs to be newer than the defined expiration time. If the expiration date is larger than the defined expiration time and supposed to be expired it will not remove the outdated cache.
* @param int|string $key Unique cache key
* @param int $expire Valid duration (in s). In case the data needs to be newer than the defined expiration time. If the expiration date is larger than the defined expiration time and supposed to be expired it will not remove the outdated cache.
*
* @return mixed Cache value
*
* @since 1.0.0
*/
public function get($key, int $expire = -1);
public function get(int|string $key, int $expire = -1) : mixed;
/**
* Remove value by key.
*
* @param mixed $key Unique cache key
* @param int $expire Valid duration (in s)
* @param int|string $key Unique cache key
* @param int $expire Valid duration (in s)
*
* @return bool
*
* @since 1.0.0
*/
public function delete($key, int $expire = -1) : bool;
public function delete(int|string $key, int $expire = -1) : bool;
/**
* Removing all cache elements larger or equal to the expiration date. Call flushAll for removing persistent cache elements (expiration is negative) as well.
@ -99,15 +99,15 @@ interface ConnectionInterface extends DataStorageConnectionInterface
/**
* Updating existing value/key.
*
* @param mixed $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s)
* @param int|string $key Unique cache key
* @param mixed $value Cache value
* @param int $expire Valid duration (in s)
*
* @return bool
*
* @since 1.0.0
*/
public function replace($key, $value, int $expire = -1) : bool;
public function replace(int|string $key, mixed $value, int $expire = -1) : bool;
/**
* Requesting cache stats.

View File

@ -147,7 +147,7 @@ final class FileCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function set($key, $value, int $expire = -1) : void
public function set(int|string $key, mixed $value, int $expire = -1) : void
{
if ($this->status !== CacheStatus::OK) {
return;
@ -161,7 +161,7 @@ final class FileCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function add($key, $value, int $expire = -1) : bool
public function add(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -188,7 +188,7 @@ final class FileCache extends ConnectionAbstract
*
* @since 1.0.0
*/
private function build($value, int $expire) : string
private function build(mixed $value, int $expire) : string
{
$type = $this->dataType($value);
$raw = $this->stringify($value, $type);
@ -208,7 +208,7 @@ final class FileCache extends ConnectionAbstract
*
* @since 1.0.0
*/
private function stringify($value, int $type) : string
private function stringify(mixed $value, int $type) : string
{
if ($type === CacheValueType::_INT || $type === CacheValueType::_STRING || $type === CacheValueType::_BOOL) {
return (string) $value;
@ -247,7 +247,7 @@ final class FileCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function get($key, int $expire = -1)
public function get(int|string $key, int $expire = -1) : mixed
{
if ($this->status !== CacheStatus::OK) {
return null;
@ -348,7 +348,7 @@ final class FileCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function delete($key, int $expire = -1) : bool
public function delete(int|string $key, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -418,7 +418,7 @@ final class FileCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
public function replace(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -444,7 +444,7 @@ final class FileCache extends ConnectionAbstract
*
* @since 1.0.0
*/
private function getPath($key) : string
private function getPath(int|string $key) : string
{
$path = Directory::sanitize($key, self::SANITIZE);
return $this->con . '/' . \trim($path, '/') . '.cache';

View File

@ -80,7 +80,7 @@ final class MemCached extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function set($key, $value, int $expire = -1) : void
public function set(int|string $key, mixed $value, int $expire = -1) : void
{
if ($this->status !== CacheStatus::OK) {
return;
@ -96,7 +96,7 @@ final class MemCached extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function add($key, $value, int $expire = -1) : bool
public function add(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -112,7 +112,7 @@ final class MemCached extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function get($key, int $expire = -1)
public function get(int|string $key, int $expire = -1) : mixed
{
if ($this->status !== CacheStatus::OK) {
return null;
@ -130,7 +130,7 @@ final class MemCached extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function delete($key, int $expire = -1) : bool
public function delete(int|string $key, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -164,7 +164,7 @@ final class MemCached extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
public function replace(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;

View File

@ -34,14 +34,14 @@ final class NullCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function set($key, $value, int $expire = -1) : void
public function set(int|string $key, mixed $value, int $expire = -1) : void
{
}
/**
* {@inheritdoc}
*/
public function add($key, $value, int $expire = -1) : bool
public function add(int|string $key, mixed $value, int $expire = -1) : bool
{
return true;
}
@ -49,7 +49,7 @@ final class NullCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function get($key, int $expire = -1)
public function get(int|string $key, int $expire = -1) : mixed
{
return null;
}
@ -57,7 +57,7 @@ final class NullCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function delete($key, int $expire = -1) : bool
public function delete(int|string $key, int $expire = -1) : bool
{
return true;
}
@ -81,7 +81,7 @@ final class NullCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
public function replace(int|string $key, mixed $value, int $expire = -1) : bool
{
return true;
}

View File

@ -104,7 +104,7 @@ final class RedisCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function set($key, $value, int $expire = -1) : void
public function set(int|string $key, mixed $value, int $expire = -1) : void
{
if ($this->status !== CacheStatus::OK) {
return;
@ -122,7 +122,7 @@ final class RedisCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function add($key, $value, int $expire = -1) : bool
public function add(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -138,7 +138,7 @@ final class RedisCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function get($key, int $expire = -1)
public function get(int|string $key, int $expire = -1) : mixed
{
if ($this->status !== CacheStatus::OK || $this->con->exists($key) < 1) {
return null;
@ -158,7 +158,7 @@ final class RedisCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function delete($key, int $expire = -1) : bool
public function delete(int|string $key, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -192,7 +192,7 @@ final class RedisCache extends ConnectionAbstract
/**
* {@inheritdoc}
*/
public function replace($key, $value, int $expire = -1) : bool
public function replace(int|string $key, mixed $value, int $expire = -1) : bool
{
if ($this->status !== CacheStatus::OK) {
return false;
@ -253,7 +253,7 @@ final class RedisCache extends ConnectionAbstract
*
* @since 1.0.0
*/
private function build($value)
private function build(mixed $value)
{
$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($value, int $type)
private function cachify(mixed $value, int $type)
{
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, $raw, int $start)
private function reverseValue(int $type, mixed $raw, int $start)
{
switch ($type) {
case CacheValueType::_INT:

View File

@ -121,7 +121,7 @@ final class CookieJar
*
* @since 1.0.0
*/
public function get(string $id)
public function get(string $id) : mixed
{
return $this->cookies[$id] ?? null;
}

View File

@ -465,7 +465,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function create($obj, int $relations = RelationType::ALL)
public static function create($obj, int $relations = RelationType::ALL) : mixed
{
if (!isset($obj)) {
return null;
@ -507,7 +507,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function createArray(array &$obj, int $relations = RelationType::ALL)
public static function createArray(array &$obj, int $relations = RelationType::ALL) : mixed
{
self::$relations = $relations;
@ -538,7 +538,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createModel(object $obj, \ReflectionClass $refClass)
private static function createModel(object $obj, \ReflectionClass $refClass) : mixed
{
$query = new Builder(self::$db);
$query->into(static::$table);
@ -616,7 +616,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createModelArray(array &$obj)
private static function createModelArray(array &$obj) : mixed
{
$query = new Builder(self::$db);
$query->into(static::$table);
@ -670,7 +670,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function getObjectId(object $obj, \ReflectionClass $refClass = null)
public static function getObjectId(object $obj, \ReflectionClass $refClass = null) : mixed
{
$refClass ??= new \ReflectionClass($obj);
$propertyName = static::$columns[static::$primaryField]['internal'];
@ -943,7 +943,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createOwnsOne(string $propertyName, $obj)
private static function createOwnsOne(string $propertyName, $obj) : mixed
{
if (!\is_object($obj)) {
return $obj;
@ -972,7 +972,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createOwnsOneArray(string $propertyName, array &$obj)
private static function createOwnsOneArray(string $propertyName, array &$obj) : mixed
{
/** @var self $mapper */
$mapper = static::$ownsOne[$propertyName]['mapper'];
@ -993,7 +993,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createBelongsTo(string $propertyName, $obj)
private static function createBelongsTo(string $propertyName, $obj) : mixed
{
if (!\is_object($obj)) {
return $obj;
@ -1018,7 +1018,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function createBelongsToArray(string $propertyName, array $obj)
private static function createBelongsToArray(string $propertyName, array $obj) : mixed
{
/** @var self $mapper */
$mapper = static::$belongsTo[$propertyName]['mapper'];
@ -1081,7 +1081,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function parseValue(string $type, $value = null)
private static function parseValue(string $type, $value = null) : mixed
{
if ($value === null) {
return null;
@ -1277,7 +1277,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function updateRelationTable(array $objsIds, $objId)
private static function updateRelationTable(array $objsIds, $objId) : mixed
{
$many = self::getHasManyRaw($objId);
@ -1339,7 +1339,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function updateOwnsOne(string $propertyName, $obj, int $depth = 1)
private static function updateOwnsOne(string $propertyName, $obj, int $depth = 1) : mixed
{
if (!\is_object($obj)) {
return $obj;
@ -1364,7 +1364,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function updateOwnsOneArray(string $propertyName, array $obj, int $depth = 1)
private static function updateOwnsOneArray(string $propertyName, array $obj, int $depth = 1) : mixed
{
/** @var self $mapper */
$mapper = static::$ownsOne[$propertyName]['mapper'];
@ -1385,7 +1385,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function updateBelongsTo(string $propertyName, $obj, int $depth = 1)
private static function updateBelongsTo(string $propertyName, $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)
private static function updateBelongsToArray(string $propertyName, $obj, int $depth = 1) : mixed
{
if (!\is_array($obj)) {
return $obj;
@ -1572,7 +1572,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function update($obj, int $relations = RelationType::ALL, int $depth = 3)
public static function update($obj, int $relations = RelationType::ALL, int $depth = 3) : mixed
{
if (!isset($obj)) {
return null;
@ -1615,7 +1615,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function updateArray(array &$obj, int $relations = RelationType::ALL, int $depth = 1)
public static function updateArray(array &$obj, int $relations = RelationType::ALL, int $depth = 1) : mixed
{
if (empty($obj)) {
return null;
@ -1731,7 +1731,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
private static function deleteOwnsOne(string $propertyName, $obj)
private static function deleteOwnsOne(string $propertyName, $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)
private static function deleteBelongsTo(string $propertyName, $obj) : mixed
{
if (!\is_object($obj)) {
return $obj;
@ -1847,7 +1847,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* @since 1.0.0
*/
public static function delete($obj, int $relations = RelationType::REFERENCE)
public static function delete($obj, int $relations = RelationType::REFERENCE) : mixed
{
// @todo: only do this if RelationType !== NONE
if (\is_scalar($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)
public static function populateOwnsOne(string $member, array $result, int $depth = 3, $default = null) : mixed
{
/** @var self $mapper */
$mapper = static::$ownsOne[$member]['mapper'];

View File

@ -297,7 +297,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function selectAs($column, string $alias) : self
public function selectAs(mixed $column, string $alias) : self
{
$this->type = QueryType::SELECT;
$this->selects[$alias] = $column;
@ -327,20 +327,18 @@ class Builder extends BuilderAbstract
/**
* Bind parameter.
*
* @param mixed $binds Binds
* @param string|array $binds Binds
*
* @return Builder
*
* @since 1.0.0
*/
public function bind($binds) : self
public function bind(string|array $binds) : self
{
if (\is_array($binds)) {
$this->binds += $binds;
} elseif (\is_string($binds)) {
$this->binds[] = $binds;
} else {
throw new \InvalidArgumentException();
$this->binds[] = $binds;
}
return $this;
@ -522,7 +520,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function fromAs($column, string $alias) : self
public function fromAs(mixed $column, string $alias) : self
{
$this->from[$alias] = $column;
@ -532,10 +530,10 @@ class Builder extends BuilderAbstract
/**
* Where.
*
* @param array|string|Where $columns Columns
* @param array|string $operator Operator
* @param string|array|Where $columns Columns
* @param string|array $operator Operator
* @param mixed $values Values
* @param array|string $boolean Boolean condition
* @param string|array $boolean Boolean condition
*
* @return Builder
*
@ -543,7 +541,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function where($columns, $operator = null, $values = null, $boolean = 'and') : self
public function where(string|array|Where $columns, string|array $operator = null, mixed $values = null, string|array $boolean = 'and') : self
{
if (!\is_array($columns)) {
$columns = [$columns];
@ -574,15 +572,15 @@ class Builder extends BuilderAbstract
/**
* Where and sub condition.
*
* @param array|string|Where $where Where sub condition
* @param mixed $operator Operator
* @param string|array|Where $where Where sub condition
* @param string|array $operator Operator
* @param mixed $values Values
*
* @return Builder
*
* @since 1.0.0
*/
public function andWhere($where, $operator = null, $values = null) : self
public function andWhere(string|array|Where $where, string|array $operator = null, mixed $values = null) : self
{
return $this->where($where, $operator, $values, 'and');
}
@ -590,15 +588,15 @@ class Builder extends BuilderAbstract
/**
* Where or sub condition.
*
* @param array|string|Where $where Where sub condition
* @param mixed $operator Operator
* @param string|array|Where $where Where sub condition
* @param string|array $operator Operator
* @param mixed $values Values
*
* @return Builder
*
* @since 1.0.0
*/
public function orWhere($where, $operator = null, $values = null) : self
public function orWhere(string|array|Where $where, string|array $operator = null, mixed $values = null) : self
{
return $this->where($where, $operator, $values, 'or');
}
@ -606,15 +604,15 @@ class Builder extends BuilderAbstract
/**
* Where in.
*
* @param array|string|Where $column Column
* @param mixed $values Values
* @param string|array|Where $column Column
* @param string|array $values Values
* @param string $boolean Boolean condition
*
* @return Builder
*
* @since 1.0.0
*/
public function whereIn($column, $values = null, string $boolean = 'and') : self
public function whereIn(string|array|Where $column, mixed $values = null, string $boolean = 'and') : self
{
$this->where($column, 'in', $values, $boolean);
@ -624,14 +622,14 @@ class Builder extends BuilderAbstract
/**
* Where null.
*
* @param array|string|Where $column Column
* @param string|array|Where $column Column
* @param string $boolean Boolean condition
*
* @return Builder
*
* @since 1.0.0
*/
public function whereNull($column, string $boolean = 'and') : self
public function whereNull(string|array|Where $column, string $boolean = 'and') : self
{
$this->where($column, '=', null, $boolean);
@ -641,14 +639,14 @@ class Builder extends BuilderAbstract
/**
* Where not null.
*
* @param array|string|Where $column Column
* @param string|array|Where $column Column
* @param string $boolean Boolean condition
*
* @return Builder
*
* @since 1.0.0
*/
public function whereNotNull($column, string $boolean = 'and') : self
public function whereNotNull(string|array|Where $column, string $boolean = 'and') : self
{
$this->where($column, '!=', null, $boolean);
@ -714,14 +712,14 @@ class Builder extends BuilderAbstract
/**
* Order by oldest.
*
* @param array|string $columns Columns
* @param string|array $columns Columns
* @param string|string[] $order Orders
*
* @return Builder
*
* @since 1.0.0
*/
public function orderBy($columns, $order = 'DESC') : self
public function orderBy(string|array $columns, string|array $order = 'DESC') : self
{
if (\is_string($columns)) {
if (!\is_string($order)) {
@ -733,12 +731,10 @@ class Builder extends BuilderAbstract
}
$this->orders[$order][] = $columns;
} elseif (\is_array($columns)) {
} else {
foreach ($columns as $key => $column) {
$this->orders[\is_string($order) ? $order : $order[$key]][] = $column;
}
} else {
throw new \InvalidArgumentException();
}
return $this;
@ -785,7 +781,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function union($query) : self
public function union(mixed $query) : self
{
if (!\is_array($query)) {
$this->unions[] = $query;
@ -983,7 +979,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function value($value) : self
public function value(mixed $value) : self
{
\end($this->values);
@ -1026,7 +1022,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function set($set) : self
public function set(mixed $set) : self
{
$this->sets[\key($set)] = \current($set);
@ -1116,14 +1112,8 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function join($table, string $type = JoinType::JOIN, string $alias = null) : self
public function join(string|self $table, string $type = JoinType::JOIN, string $alias = null) : self
{
if ((!\is_string($table) && !($table instanceof self))
|| ($alias === null && !\is_string($table))
) {
throw new \InvalidArgumentException();
}
$this->joins[$alias ?? $table] = ['type' => $type, 'table' => $table, 'alias' => $alias];
return $this;
@ -1132,14 +1122,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function leftJoin($column, string $alias = null) : self
public function leftJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::LEFT_JOIN, $alias);
}
@ -1147,14 +1137,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function leftOuterJoin($column, string $alias = null) : self
public function leftOuterJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::LEFT_OUTER_JOIN, $alias);
}
@ -1162,14 +1152,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function leftInnerJoin($column, string $alias = null) : self
public function leftInnerJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::LEFT_INNER_JOIN, $alias);
}
@ -1177,14 +1167,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function rightJoin($column, string $alias = null) : self
public function rightJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::RIGHT_JOIN, $alias);
}
@ -1192,14 +1182,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function rightOuterJoin($column, string $alias = null) : self
public function rightOuterJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::RIGHT_OUTER_JOIN, $alias);
}
@ -1207,14 +1197,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function rightInnerJoin($column, string $alias = null) : self
public function rightInnerJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::RIGHT_INNER_JOIN, $alias);
}
@ -1222,14 +1212,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function outerJoin($column, string $alias = null) : self
public function outerJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::OUTER_JOIN, $alias);
}
@ -1237,14 +1227,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function innerJoin($column, string $alias = null) : self
public function innerJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::INNER_JOIN, $alias);
}
@ -1252,14 +1242,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function crossJoin($column, string $alias = null) : self
public function crossJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::CROSS_JOIN, $alias);
}
@ -1267,14 +1257,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function fullJoin($column, string $alias = null) : self
public function fullJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::FULL_JOIN, $alias);
}
@ -1282,14 +1272,14 @@ class Builder extends BuilderAbstract
/**
* Join.
*
* @param mixed $column Join query
* @param string|self $column Join query
* @param null|string $alias Alias name (empty = none)
*
* @return Builder
*
* @since 1.0.0
*/
public function fullOuterJoin($column, string $alias = null) : self
public function fullOuterJoin(string|self $column, string $alias = null) : self
{
return $this->join($column, JoinType::FULL_OUTER_JOIN, $alias);
}
@ -1319,7 +1309,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function on($columns, $operator = null, $values = null, $boolean = 'and', string $table = null) : self
public function on(string|array $columns, string|array $operator = null, string|array $values = null, string|array $boolean = 'and', string $table = null) : self
{
if ($operator !== null && !\is_array($operator) && !\in_array(\strtolower($operator), self::OPERATORS)) {
throw new \InvalidArgumentException('Unknown operator.');
@ -1365,7 +1355,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function orOn($columns, $operator = null, $values = null) : self
public function orOn(string|array $columns, $operator = null, $values = null) : self
{
return $this->on($columns, $operator, $values, 'or');
}
@ -1381,7 +1371,7 @@ class Builder extends BuilderAbstract
*
* @since 1.0.0
*/
public function andOn($columns, $operator = null, $values = null) : self
public function andOn(string|array $columns, $operator = null, $values = null) : self
{
return $this->on($columns, $operator, $values, 'and');
}

View File

@ -254,7 +254,7 @@ final class L11nManager
*
* @since 1.0.0
*/
public function getCurrency(Localization $l11n, $currency, string $format = null, string $symbol = null, int $divide = 1) : string
public function getCurrency(Localization $l11n, int|float $currency, string $format = null, string $symbol = null, int $divide = 1) : string
{
$language = $l11n->getLanguage() ?? 'en';
$symbol ??= $l11n->getCurrency();

View File

@ -83,7 +83,7 @@ final class Money implements \Serializable
*
* @since 1.0.0
*/
public function __construct($value = 0, string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0)
public function __construct(int|float|string $value = 0, string $thousands = ',', string $decimal = '.', string $symbol = '', int $position = 0)
{
$this->value = \is_int($value) ? $value : self::toInt((string) $value);
$this->thousands = $thousands;
@ -216,19 +216,19 @@ final class Money implements \Serializable
/**
* Add money.
*
* @param int|float|Money|string $value Value to add
* @param int|float|string|Money $value Value to add
*
* @return Money
*
* @since 1.0.0
*/
public function add($value) : self
public function add(int|float|string|self $value) : self
{
if (\is_string($value) || \is_float($value)) {
$this->value += self::toInt((string) $value, $this->thousands, $this->decimal);
} elseif (\is_int($value)) {
$this->value += $value;
} elseif ($value instanceof self) {
} else {
$this->value += $value->getInt();
}
@ -250,19 +250,19 @@ final class Money implements \Serializable
/**
* Sub money.
*
* @param int|float|Money|string $value Value to subtract
* @param int|float|string|Money $value Value to subtract
*
* @return Money
*
* @since 1.0.0
*/
public function sub($value) : self
public function sub(int|float|string|self $value) : self
{
if (\is_string($value) || \is_float($value)) {
$this->value -= self::toInt((string) $value, $this->thousands, $this->decimal);
} elseif (\is_int($value)) {
$this->value -= $value;
} elseif ($value instanceof self) {
} else {
$this->value -= $value->getInt();
}

View File

@ -43,7 +43,7 @@ final class Gamma
*
* @since 1.0.0
*/
public static function gamma($z) : float
public static function gamma(int|float $z) : float
{
return \exp(self::logGamma($z));
}
@ -68,7 +68,7 @@ final class Gamma
*
* @since 1.0.0
*/
public static function lanczosApproximationReal($z) : float
public static function lanczosApproximationReal(int|float $z) : float
{
if ($z < 0.5) {
return \M_PI / (\sin(\M_PI * $z) * self::lanczosApproximationReal(1 - $z));
@ -94,7 +94,7 @@ final class Gamma
*
* @since 1.0.0
*/
public static function stirlingApproximation($x) : float
public static function stirlingApproximation(int|float $x) : float
{
return \sqrt(2.0 * \M_PI / $x) * \pow($x / \M_E, $x);
}
@ -108,7 +108,7 @@ final class Gamma
*
* @since 1.0.0
*/
public static function spougeApproximation($z) : float
public static function spougeApproximation(int|float $z) : float
{
$k1_fact = 1.0;
$c = [\sqrt(2.0 * \M_PI)];
@ -139,7 +139,7 @@ final class Gamma
*
* @since 1.0.0
*/
public static function logGamma($z) : float
public static function logGamma(int|float $z) : float
{
static $approx = [
76.18009172947146,-86.50532032941677,

View File

@ -109,7 +109,7 @@ class Matrix implements \ArrayAccess, \Iterator
*
* @since 1.0.0
*/
public function set(int $m, int $n, $value) : void
public function set(int $m, int $n, int|float $value) : void
{
if (!isset($this->matrix[$m], $this->matrix[$m][$n])) {
throw new InvalidDimensionException($m . 'x' . $n);
@ -130,7 +130,7 @@ class Matrix implements \ArrayAccess, \Iterator
*
* @since 1.0.0
*/
public function get(int $m, int $n = 0)
public function get(int $m, int $n = 0) : int|float
{
if (!isset($this->matrix[$m], $this->matrix[$m][$n])) {
throw new InvalidDimensionException($m . 'x' . $n);

View File

@ -65,7 +65,7 @@ final class Vector extends Matrix
*
* @since 1.0.0
*/
public function getV(int $m)
public function getV(int $m) : int|float
{
return parent::get($m, 0);
}

View File

@ -48,7 +48,7 @@ final class Complex
*
* @since 1.0.0
*/
public function __construct($re = 0, $im = 0)
public function __construct(int|float $re = 0, int|float $im = 0)
{
$this->re = $re;
$this->im = $im;
@ -61,7 +61,7 @@ final class Complex
*
* @since 1.0.0
*/
public function re()
public function re() : int|float
{
return $this->re;
}
@ -73,7 +73,7 @@ final class Complex
*
* @since 1.0.0
*/
public function im()
public function im() : int|float
{
return $this->im;
}
@ -129,7 +129,7 @@ final class Complex
*
* @since 1.0.0
*/
public function abs()
public function abs() : int|float
{
return \sqrt($this->re ** 2 + $this->im ** 2);
}
@ -149,25 +149,21 @@ final class Complex
/**
* Pow opperator
*
* @param mixed $value Value to pow
* @param int|float|self $value Value to pow
*
* @return Complex
*
* @throws \InvalidArgumentException This exception is thrown if the argument has an invalid type
*
* @since 1.0.0
*/
public function pow($value) : self
public function pow(int|float|self $value) : self
{
if (\is_int($value)) {
return $this->powInteger($value);
} elseif (\is_float($value)) {
return $this->powScalar($value);
} elseif ($value instanceof self) {
return $this->powComplex($value);
}
throw new \InvalidArgumentException();
return $this->powComplex($value);
}
/**
@ -213,7 +209,7 @@ final class Complex
*
* @since 1.0.0
*/
public function powScalar($value) : self
public function powScalar(int|float $value) : self
{
return $this;
}

View File

@ -144,7 +144,7 @@ final class CubicSplineInterpolation implements InterpolationInterface
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
public function interpolate(int|float $x) : float
{
$n = \count($this->points);
$xPos = $n - 1;

View File

@ -33,5 +33,5 @@ interface InterpolationInterface
*
* @since 1.0.0
*/
public function interpolate($x) : float;
public function interpolate(int|float $x) : float;
}

View File

@ -46,7 +46,7 @@ final class LagrangeInterpolation implements InterpolationInterface
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
public function interpolate(int|float $x) : float
{
$n = \count($this->points);
$result = 0.0;

View File

@ -96,7 +96,7 @@ final class LinearInterpolation implements InterpolationInterface
/**
* {@inheritdoc}
*/
public function interpolate($x) : float
public function interpolate(int|float $x) : float
{
$n = \count($this->points);
$xPos = $n - 1;

View File

@ -171,7 +171,7 @@ final class Error
*/
public static function getRootMeanSquaredError(array $errors) : float
{
return \sqrt(Average::arithmeticMean(ArrayUtils::powerInt($errors, 2)));
return \sqrt(Average::arithmeticMean(ArrayUtils::power($errors, 2)));
}
/**
@ -290,7 +290,7 @@ final class Error
*/
public static function getMeanSquaredScaledError(array $scaledErrors) : float
{
return Average::arithmeticMean(ArrayUtils::powerInt($scaledErrors, 2));
return Average::arithmeticMean(ArrayUtils::power($scaledErrors, 2));
}
/**

View File

@ -316,15 +316,17 @@ abstract class ModuleAbstract
*
* @since 1.0.0
*/
protected function updateModel(int $account, $old, $new, $mapper, string $trigger, string $ip) : void
protected function updateModel(int $account, mixed $old, mixed $new, string|\Closure $mapper, string $trigger, string $ip) : void
{
$this->app->eventManager->triggerSimilar('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-update', '', $old);
$id = 0;
if (\is_string($mapper)) {
$id = $mapper::update($new);
} elseif ($mapper instanceof \Closure) {
} else {
$mapper();
}
$this->app->eventManager->triggerSimilar('POST:Module:' . static::MODULE_NAME . '-' . $trigger . '-update', '', [
$account,
$old, $new,
@ -349,7 +351,7 @@ abstract class ModuleAbstract
*
* @since 1.0.0
*/
protected function deleteModel(int $account, $obj, string $mapper, string $trigger, string $ip) : void
protected function deleteModel(int $account, mixed $obj, string $mapper, string $trigger, string $ip) : void
{
$this->app->eventManager->triggerSimilar('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-delete', '', $obj);
$id = $mapper::delete($obj);
@ -379,7 +381,7 @@ abstract class ModuleAbstract
*
* @since 1.0.0
*/
protected function createModelRelation(int $account, $rel1, $rel2, string $mapper, string $field, string $trigger, string $ip) : void
protected function createModelRelation(int $account, mixed $rel1, mixed $rel2, string $mapper, string $field, string $trigger, string $ip) : void
{
$this->app->eventManager->triggerSimilar('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-relation', '', $rel1);
$mapper::createRelation($field, $rel1, $rel2);

View File

@ -719,7 +719,7 @@ final class ModuleManager
*
* @since 1.0.0
*/
public function initModule($modules) : void
public function initModule(string|array $modules) : void
{
$modules = (array) $modules;
foreach ($modules as $module) {

View File

@ -84,7 +84,7 @@ abstract class Enum
*
* @since 1.0.0
*/
public static function getByName(string $name)
public static function getByName(string $name) : mixed
{
if (!self::isValidName($name)) {
throw new \UnexpectedValueException($name);
@ -102,7 +102,7 @@ abstract class Enum
*
* @since 1.0.0
*/
public static function getName(string $value)
public static function getName(string $value) : bool|int|string
{
$arr = self::getConstants();

View File

@ -88,7 +88,7 @@ class Graph
*
* @since 1.0.0
*/
public function getNode($key) : ?Node
public function getNode(mixed $key) : ?Node
{
return $this->nodes[$key] ?? null;
}
@ -167,7 +167,7 @@ class Graph
*
* @since 1.0.0
*/
public function getCost()
public function getCost() : int|float
{
$edges = $this->getEdges();
$costs = 0;

View File

@ -334,7 +334,7 @@ final class ArrayUtils
*
* @since 1.0.0
*/
public static function arraySum(array $array, int $start = 0, int $count = 0)
public static function arraySum(array $array, int $start = 0, int $count = 0) : int|float
{
$count = $count === 0 ? \count($array) : $start + $count;
$sum = 0;
@ -391,28 +391,7 @@ final class ArrayUtils
*
* @since 1.0.0
*/
public static function powerFloat(array $values, float $exp = 2.0) : array
{
$squared = [];
foreach ($values as $value) {
$squared[] = $value ** $exp;
}
return $squared;
}
/**
* Power all values in array.
*
* @param array<int|float> $values Values to square
* @param int $exp Exponent
*
* @return array<int|float>
*
* @since 1.0.0
*/
public static function powerInt(array $values, int $exp = 2) : array
public static function power(array $values, int|float $exp = 2) : array
{
$squared = [];

View File

@ -287,7 +287,7 @@ class Repository
*
* @since 1.0.0
*/
public function add($files = '*') : string
public function add(string|array $files = '*') : string
{
$files = $this->parseFileList($files);
@ -304,7 +304,7 @@ class Repository
*
* @since 1.0.0
*/
public function rm($files = '*', bool $cached = false) : string
public function rm(string|array $files = '*', bool $cached = false) : string
{
$files = $this->parseFileList($files);
@ -322,12 +322,10 @@ class Repository
*
* @since 1.0.0
*/
private function parseFileList($files) : string
private function parseFileList(string|array $files) : string
{
if (\is_array($files)) {
return '"' . \implode('" "', $files) . '"';
} elseif (!\is_string($files)) {
throw new \InvalidArgumentException('Wrong type for $files.');
}
return $files;

View File

@ -112,7 +112,7 @@ final class MbStringUtils
*
* @since 1.0.0
*/
public static function mb_endsWith(string $haystack, $needles) : bool
public static function mb_endsWith(string $haystack, string|array $needles) : bool
{
if (\is_string($needles)) {
$needles = [$needles];

View File

@ -82,7 +82,7 @@ final class StringUtils
*
* @since 1.0.0
*/
public static function endsWith(string $haystack, $needles) : bool
public static function endsWith(string $haystack, string|array $needles) : bool
{
if (\is_string($needles)) {
$needles = [$needles];
@ -114,7 +114,7 @@ final class StringUtils
*
* @since 1.0.0
*/
public static function startsWith(string $haystack, $needles) : bool
public static function startsWith(string $haystack, string|array $needles) : bool
{
if (\is_string($needles)) {
$needles = [$needles];

View File

@ -72,7 +72,7 @@ final class Validator extends ValidatorAbstract
*
* @since 1.0.0
*/
public static function isType($var, $constraint) : bool
public static function isType(mixed $var, string|array $constraint) : bool
{
if (!\is_array($constraint)) {
$constraint = [$constraint];
@ -119,7 +119,7 @@ final class Validator extends ValidatorAbstract
*
* @since 1.0.0
*/
public static function contains(string $var, $substr) : bool
public static function contains(string $var, string|array $substr) : bool
{
return \is_string($substr) ? \strpos($var, $substr) !== false : StringUtils::contains($var, $substr);
}
@ -150,7 +150,7 @@ final class Validator extends ValidatorAbstract
*
* @since 1.0.0
*/
public static function hasLimit($var, $min = 0, $max = \PHP_INT_MAX) : bool
public static function hasLimit(int|float $var, int|float $min = 0, int|float $max = \PHP_INT_MAX) : bool
{
if ($var <= $max && $var >= $min) {
return true;

View File

@ -289,7 +289,7 @@ class View extends ViewAbstract
*
* @since 1.0.0
*/
public function getHtml($translation, string $module = null, string $theme = null) : string
public function getHtml(mixed $translation, string $module = null, string $theme = null) : string
{
return \htmlspecialchars($this->getText($translation, $module, $theme));
}
@ -304,7 +304,7 @@ class View extends ViewAbstract
*
* @since 1.0.0
*/
public function getNumeric($numeric, string $format = null) : string
public function getNumeric(int|float $numeric, string $format = null) : string
{
return $this->l11nManager->getNumeric($this->l11n, $numeric, $format);
}
@ -336,7 +336,7 @@ class View extends ViewAbstract
*
* @since 1.0.0
*/
public function getCurrency($currency, string $format = null, string $symbol = null, int $divide = 1) : string
public function getCurrency(int|float $currency, string $format = null, string $symbol = null, int $divide = 1) : string
{
return $this->l11nManager->getCurrency($this->l11n, $currency, $format, $symbol, $divide);
}

View File

@ -494,18 +494,6 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
$query->where('a', 'invalid', 'b');
}
/**
* @testdox Invalid join types throw a InvalidArgumentException
* @group framework
*/
public function testInvalidJoinTable() : void
{
$this->expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->join(null);
}
/**
* @testdox Invalid join operators throw a InvalidArgumentException
* @group framework
@ -518,18 +506,6 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
$query->join('b')->on('a', 'invalid', 'b');
}
/**
* @testdox Invalid order types throw a InvalidArgumentException
* @group framework
*/
public function testInvalidOrderType() : void
{
$this->expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->orderBy('a', 1);
}
/**
* @testdox Invalid order column types throw a InvalidArgumentException
* @group framework
@ -539,6 +515,6 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
$this->expectException(\InvalidArgumentException::class);
$query = new Builder($this->con, true);
$query->orderBy(null, 'DESC');
$query->orderBy('valid', ['invalid']);
}
}

View File

@ -271,17 +271,4 @@ class ComplexTest extends \PHPUnit\Framework\TestCase
$cpl = new Complex(4, 3);
$cpl->div(true);
}
/**
* @testdox The power of a invalid type throws a InvalidArgumentException
* @covers phpOMS\Math\Number\Complex
* @group framework
*/
public function testInvalidPow() : void
{
$this->expectException(\InvalidArgumentException::class);
$cpl = new Complex(4, 3);
$cpl->pow(true);
}
}

View File

@ -280,27 +280,18 @@ class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox All array values in an array can be potentiated by an integer
* @testdox All array values in an array can be potentiated by a numeric value
* @covers phpOMS\Utils\ArrayUtils
*
* @group framework
*/
public function testPowerInt() : void
public function test() : void
{
self::assertEquals([4, 9, 16], ArrayUtils::powerInt([2, 3, 4], 2));
self::assertEquals([8, 27, 64], ArrayUtils::powerInt([2, 3, 4], 3));
}
self::assertEquals([4, 9, 16], ArrayUtils::power([2, 3, 4], 2));
self::assertEquals([8, 27, 64], ArrayUtils::power([2, 3, 4], 3));
/**
* @testdox All array values in an array can be potentiated by a float
* @covers phpOMS\Utils\ArrayUtils
*
* @group framework
*/
public function testPowerFloat() : void
{
self::assertEqualsWithDelta([2.0, 3.0, 4.0], ArrayUtils::powerFloat([4, 9, 16], 1 / 2), 0.0);
self::assertEqualsWithDelta([2.0, 3.0, 4.0], ArrayUtils::powerFloat([8, 27, 64], 1 / 3), 0.0);
self::assertEqualsWithDelta([2.0, 3.0, 4.0], ArrayUtils::power([4, 9, 16], 1 / 2), 0.0);
self::assertEqualsWithDelta([2.0, 3.0, 4.0], ArrayUtils::power([8, 27, 64], 1 / 3), 0.0);
}
/**