diff --git a/Ai/Ocr/BasicOcr.php b/Ai/Ocr/BasicOcr.php index 740c42ed4..d15b19e63 100644 --- a/Ai/Ocr/BasicOcr.php +++ b/Ai/Ocr/BasicOcr.php @@ -90,7 +90,6 @@ final class BasicOcr throw new PathException($path); // @codeCoverageIgnore } - if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) { return []; // @codeCoverageIgnore } @@ -105,7 +104,6 @@ final class BasicOcr $numberOfImages = \min($numberOfImages, $limit); } - if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) { return []; // @codeCoverageIgnore } @@ -118,7 +116,6 @@ final class BasicOcr $images = []; for ($i = 0; $i < $numberOfImages; ++$i) { - if (($read = \fread($fp, $numberOfRows * $numberOfColumns)) === false || ($unpack = \unpack('C*', $read)) === false ) { @@ -153,7 +150,6 @@ final class BasicOcr throw new PathException($path); // @codeCoverageIgnore } - if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) { return []; // @codeCoverageIgnore } @@ -170,7 +166,6 @@ final class BasicOcr $labels = []; for ($i = 0; $i < $numberOfLabels; ++$i) { - if (($read = \fread($fp, 1)) === false || ($unpack = \unpack('C', $read)) === false) { return []; // @codeCoverageIgnore } diff --git a/Algorithm/Clustering/Point.php b/Algorithm/Clustering/Point.php index 1fe4ec93c..900c95a74 100644 --- a/Algorithm/Clustering/Point.php +++ b/Algorithm/Clustering/Point.php @@ -73,7 +73,7 @@ class Point implements PointInterface /** * {@inheritdoc} */ - public function getCoordinate(int $index) : int|float + public function getCoordinate(int $index) : int | float { return $this->coordinates[$index]; } @@ -81,7 +81,7 @@ class Point implements PointInterface /** * {@inheritdoc} */ - public function setCoordinate(int $index, int|float $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 d6d41b256..03c4a6a78 100644 --- a/Algorithm/Clustering/PointInterface.php +++ b/Algorithm/Clustering/PointInterface.php @@ -46,7 +46,7 @@ interface PointInterface * * @since 1.0.0 */ - public function getCoordinate(int $index) : int|float; + public function getCoordinate(int $index) : int | float; /** * Set the coordinate of the point @@ -58,5 +58,5 @@ interface PointInterface * * @since 1.0.0 */ - public function setCoordinate(int $index, int|float $value) : void; + public function setCoordinate(int $index, int | float $value) : void; } diff --git a/Algorithm/Graph/DependencyResolver.php b/Algorithm/Graph/DependencyResolver.php index a66146ee6..d600645e2 100644 --- a/Algorithm/Graph/DependencyResolver.php +++ b/Algorithm/Graph/DependencyResolver.php @@ -54,7 +54,7 @@ final class DependencyResolver * * @since 1.0.0 */ - private static function dependencyResolve(int|string $item, array $items, array &$resolved, array &$unresolved) : void + private static function dependencyResolve(int | string $item, array $items, array &$resolved, array &$unresolved) : void { $unresolved[] = $item; diff --git a/Algorithm/Knapsack/Backpack.php b/Algorithm/Knapsack/Backpack.php index 716156f65..9340a5389 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, int|float $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 ce398b58d..36edb833e 100644 --- a/Algorithm/Knapsack/BackpackInterface.php +++ b/Algorithm/Knapsack/BackpackInterface.php @@ -71,5 +71,5 @@ interface BackpackInterface * * @since 1.0.0 */ - public function addItem(ItemInterface $item, int|float $quantity = 1) : void; + public function addItem(ItemInterface $item, int | float $quantity = 1) : void; } diff --git a/Config/OptionsInterface.php b/Config/OptionsInterface.php index a8671f9b4..c8eed5e6e 100644 --- a/Config/OptionsInterface.php +++ b/Config/OptionsInterface.php @@ -33,7 +33,7 @@ interface OptionsInterface * * @since 1.0.0 */ - public function exists(int|string $key) : bool; + public function exists(int | string $key) : bool; /** * Updating or adding settings. @@ -46,7 +46,7 @@ interface OptionsInterface * * @since 1.0.0 */ - public function setOption(int|string $key, mixed $value, bool $overwrite = true) : bool; + public function setOption(int | string $key, mixed $value, bool $overwrite = true) : bool; /** * Updating or adding settings. @@ -69,5 +69,5 @@ interface OptionsInterface * * @since 1.0.0 */ - public function getOption(int|string $key) : mixed; + public function getOption(int | string $key) : mixed; } diff --git a/Config/OptionsTrait.php b/Config/OptionsTrait.php index a79dbd422..41c5e328c 100644 --- a/Config/OptionsTrait.php +++ b/Config/OptionsTrait.php @@ -43,7 +43,7 @@ trait OptionsTrait * * @since 1.0.0 */ - public function exists(int|string $key) : bool + public function exists(int | string $key) : bool { return isset($this->options[$key]); } @@ -57,7 +57,7 @@ trait OptionsTrait * * @since 1.0.0 */ - public function getOption(int|string $key) : mixed + public function getOption(int | string $key) : mixed { return $this->options[$key] ?? null; } @@ -95,7 +95,7 @@ trait OptionsTrait * * @since 1.0.0 */ - public function setOption(int|string $key, mixed $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; diff --git a/Config/SettingsInterface.php b/Config/SettingsInterface.php index 3880b68aa..fd92451f7 100644 --- a/Config/SettingsInterface.php +++ b/Config/SettingsInterface.php @@ -43,7 +43,7 @@ interface SettingsInterface extends OptionsInterface */ public function get( mixed $ids = null, - string|array $names = null, + string | array $names = null, string $module = null, int $group = null, int $account = null diff --git a/DataStorage/Cache/Connection/ConnectionInterface.php b/DataStorage/Cache/Connection/ConnectionInterface.php index c402bb3b7..8f7f35c75 100644 --- a/DataStorage/Cache/Connection/ConnectionInterface.php +++ b/DataStorage/Cache/Connection/ConnectionInterface.php @@ -37,7 +37,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function set(int|string $key, mixed $value, int $expire = -1) : void; + public function set(int | string $key, mixed $value, int $expire = -1) : void; /** * Increment value. @@ -49,7 +49,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function increment(int|string $key, int $value = 1) : void; + public function increment(int | string $key, int $value = 1) : void; /** * Decrement value. @@ -61,7 +61,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function decrement(int|string $key, int $value = 1) : void; + public function decrement(int | string $key, int $value = 1) : void; /** * Rename cache key. @@ -74,7 +74,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function rename(int|string $old, int|string $new, int $expire = -1) : void; + public function rename(int | string $old, int | string $new, int $expire = -1) : void; /** * Adding new data if it doesn't exist. @@ -87,7 +87,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function add(int|string $key, mixed $value, int $expire = -1) : bool; + public function add(int | string $key, mixed $value, int $expire = -1) : bool; /** * Get cache by key. @@ -99,7 +99,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function get(int|string $key, int $expire = -1) : mixed; + public function get(int | string $key, int $expire = -1) : mixed; /** * Get cache by pattern. @@ -123,7 +123,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function exists(int|string $key, int $expire = -1) : bool; + public function exists(int | string $key, int $expire = -1) : bool; /** * Remove value by key. @@ -135,7 +135,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function delete(int|string $key, int $expire = -1) : bool; + public function delete(int | string $key, int $expire = -1) : bool; /** * Remove value by pattern. @@ -180,7 +180,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function replace(int|string $key, mixed $value, int $expire = -1) : bool; + public function replace(int | string $key, mixed $value, int $expire = -1) : bool; /** * Updating expire. @@ -192,7 +192,7 @@ interface ConnectionInterface extends DataStorageConnectionInterface * * @since 1.0.0 */ - public function updateExpire(int|string $key, int $expire = -1) : bool; + public function updateExpire(int | string $key, int $expire = -1) : bool; /** * Requesting cache stats. diff --git a/DataStorage/Cache/Connection/FileCache.php b/DataStorage/Cache/Connection/FileCache.php index 268964bf4..1f409f7b2 100644 --- a/DataStorage/Cache/Connection/FileCache.php +++ b/DataStorage/Cache/Connection/FileCache.php @@ -147,7 +147,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function set(int|string $key, mixed $value, int $expire = -1) : void + public function set(int | string $key, mixed $value, int $expire = -1) : void { if ($this->status !== CacheStatus::OK) { return; @@ -168,7 +168,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function add(int|string $key, mixed $value, int $expire = -1) : bool + public function add(int | string $key, mixed $value, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -261,7 +261,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function get(int|string $key, int $expire = -1) : mixed + public function get(int | string $key, int $expire = -1) : mixed { if ($this->status !== CacheStatus::OK) { return null; @@ -362,7 +362,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function delete(int|string $key, int $expire = -1) : bool + public function delete(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -406,7 +406,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function exists(int|string $key, int $expire = -1) : bool + public function exists(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -452,7 +452,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function increment(int|string $key, int $value = 1) : void + public function increment(int | string $key, int $value = 1) : void { $path = $this->getPath($key); if (!File::exists($path)) { @@ -485,7 +485,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function decrement(int|string $key, int $value = 1) : void + public function decrement(int | string $key, int $value = 1) : void { $path = $this->getPath($key); if (!File::exists($path)) { @@ -518,7 +518,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function rename(int|string $old, int|string $new, int $expire = -1) : void + public function rename(int | string $old, int | string $new, int $expire = -1) : void { $value = $this->get($old); $this->set($new, $value, $expire); @@ -622,7 +622,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function updateExpire(int|string $key, int $expire = -1) : bool + public function updateExpire(int | string $key, int $expire = -1) : bool { $value = $this->get($key, $expire); $this->delete($key); @@ -660,7 +660,7 @@ final class FileCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function replace(int|string $key, mixed $value, int $expire = -1) : bool + public function replace(int | string $key, mixed $value, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -693,7 +693,7 @@ final class FileCache extends ConnectionAbstract * * @since 1.0.0 */ - private function getPath(int|string $key) : string + private function getPath(int | string $key) : string { $path = Directory::sanitize((string) $key, self::SANITIZE); return $this->con . '/' . \trim($path, '/') . '.cache'; diff --git a/DataStorage/Cache/Connection/MemCached.php b/DataStorage/Cache/Connection/MemCached.php index 724cdb853..63db78bf1 100644 --- a/DataStorage/Cache/Connection/MemCached.php +++ b/DataStorage/Cache/Connection/MemCached.php @@ -80,7 +80,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function set(int|string $key, mixed $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(int|string $key, mixed $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(int|string $key, int $expire = -1) : mixed + 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(int|string $key, int $expire = -1) : bool + public function delete(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -142,7 +142,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function exists(int|string $key, int $expire = -1) : bool + public function exists(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -154,7 +154,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function increment(int|string $key, int $value = 1) : void + public function increment(int | string $key, int $value = 1) : void { $this->con->increment($key, $value); } @@ -162,7 +162,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function decrement(int|string $key, int $value = 1) : void + public function decrement(int | string $key, int $value = 1) : void { $this->con->decrement($key, $value); } @@ -170,7 +170,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function rename(int|string $old, int|string $new, int $expire = -1) : void + public function rename(int | string $old, int | string $new, int $expire = -1) : void { $value = $this->get($old); $this->set($new, $value, $expire); @@ -227,7 +227,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function updateExpire(int|string $key, int $expire = -1) : bool + public function updateExpire(int | string $key, int $expire = -1) : bool { if ($expire > 0) { $this->con->touch($key, $expire); @@ -261,7 +261,7 @@ final class MemCached extends ConnectionAbstract /** * {@inheritdoc} */ - public function replace(int|string $key, mixed $value, int $expire = -1) : bool + public function replace(int | string $key, mixed $value, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; diff --git a/DataStorage/Cache/Connection/NullCache.php b/DataStorage/Cache/Connection/NullCache.php index 86250ba68..22b4ea3f5 100644 --- a/DataStorage/Cache/Connection/NullCache.php +++ b/DataStorage/Cache/Connection/NullCache.php @@ -34,28 +34,28 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function set(int|string $key, mixed $value, int $expire = -1) : void + public function set(int | string $key, mixed $value, int $expire = -1) : void { } /** * {@inheritdoc} */ - public function increment(int|string $key, int $value = 1) : void + public function increment(int | string $key, int $value = 1) : void { } /** * {@inheritdoc} */ - public function decrement(int|string $key, int $value = 1) : void + public function decrement(int | string $key, int $value = 1) : void { } /** * {@inheritdoc} */ - public function add(int|string $key, mixed $value, int $expire = -1) : bool + public function add(int | string $key, mixed $value, int $expire = -1) : bool { return true; } @@ -63,7 +63,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function get(int|string $key, int $expire = -1) : mixed + public function get(int | string $key, int $expire = -1) : mixed { return null; } @@ -71,7 +71,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function delete(int|string $key, int $expire = -1) : bool + public function delete(int | string $key, int $expire = -1) : bool { return true; } @@ -95,7 +95,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function replace(int|string $key, mixed $value, int $expire = -1) : bool + public function replace(int | string $key, mixed $value, int $expire = -1) : bool { return true; } @@ -119,7 +119,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function exists(int|string $key, int $expire = -1) : bool + public function exists(int | string $key, int $expire = -1) : bool { return false; } @@ -127,7 +127,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function rename(int|string $old, int|string $new, int $expire = -1) : void + public function rename(int | string $old, int | string $new, int $expire = -1) : void { } @@ -150,7 +150,7 @@ final class NullCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function updateExpire(int|string $key, int $expire = -1) : bool + public function updateExpire(int | string $key, int $expire = -1) : bool { return true; } diff --git a/DataStorage/Cache/Connection/RedisCache.php b/DataStorage/Cache/Connection/RedisCache.php index 4899574f2..e74768ce0 100644 --- a/DataStorage/Cache/Connection/RedisCache.php +++ b/DataStorage/Cache/Connection/RedisCache.php @@ -104,7 +104,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function set(int|string $key, mixed $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(int|string $key, mixed $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(int|string $key, int $expire = -1) : mixed + 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(int|string $key, int $expire = -1) : bool + public function delete(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -170,7 +170,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function exists(int|string $key, int $expire = -1) : bool + public function exists(int | string $key, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; @@ -182,7 +182,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function increment(int|string $key, int $value = 1) : void + public function increment(int | string $key, int $value = 1) : void { $this->con->incrBy($key, $value); } @@ -190,7 +190,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function decrement(int|string $key, int $value = 1) : void + public function decrement(int | string $key, int $value = 1) : void { $this->con->decrBy($key, $value); } @@ -198,7 +198,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function rename(int|string $old, int|string $new, int $expire = -1) : void + public function rename(int | string $old, int | string $new, int $expire = -1) : void { $this->con->rename($old, $new); @@ -257,7 +257,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function updateExpire(int|string $key, int $expire = -1) : bool + public function updateExpire(int | string $key, int $expire = -1) : bool { if ($expire > 0) { $this->con->expire($key, $expire); @@ -291,7 +291,7 @@ final class RedisCache extends ConnectionAbstract /** * {@inheritdoc} */ - public function replace(int|string $key, mixed $value, int $expire = -1) : bool + public function replace(int | string $key, mixed $value, int $expire = -1) : bool { if ($this->status !== CacheStatus::OK) { return false; diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 150775cb4..9407035f9 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -333,7 +333,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function bind(string|array $binds) : self + public function bind(string | array $binds) : self { if (\is_array($binds)) { $this->binds += $binds; @@ -541,7 +541,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function where(string|array|Where $columns, string|array $operator = null, mixed $values = null, string|array $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]; @@ -580,7 +580,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function andWhere(string|array|Where $where, string|array $operator = null, mixed $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'); } @@ -596,7 +596,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function orWhere(string|array|Where $where, string|array $operator = null, mixed $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'); } @@ -612,7 +612,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function whereIn(string|array|Where $column, mixed $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); @@ -629,7 +629,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function whereNull(string|array|Where $column, string $boolean = 'and') : self + public function whereNull(string | array | Where $column, string $boolean = 'and') : self { $this->where($column, '=', null, $boolean); @@ -646,7 +646,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function whereNotNull(string|array|Where $column, string $boolean = 'and') : self + public function whereNotNull(string | array | Where $column, string $boolean = 'and') : self { $this->where($column, '!=', null, $boolean); @@ -719,7 +719,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function orderBy(string|array $columns, string|array $order = 'DESC') : self + public function orderBy(string | array $columns, string | array $order = 'DESC') : self { if (\is_string($columns)) { if (!\is_string($order)) { @@ -1112,7 +1112,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function join(string|self $table, string $type = JoinType::JOIN, string $alias = null) : self + public function join(string | self $table, string $type = JoinType::JOIN, string $alias = null) : self { $this->joins[$alias ?? $table] = ['type' => $type, 'table' => $table, 'alias' => $alias]; @@ -1129,7 +1129,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function leftJoin(string|self $column, string $alias = null) : self + public function leftJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::LEFT_JOIN, $alias); } @@ -1144,7 +1144,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function leftOuterJoin(string|self $column, string $alias = null) : self + public function leftOuterJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::LEFT_OUTER_JOIN, $alias); } @@ -1159,7 +1159,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function leftInnerJoin(string|self $column, string $alias = null) : self + public function leftInnerJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::LEFT_INNER_JOIN, $alias); } @@ -1174,7 +1174,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function rightJoin(string|self $column, string $alias = null) : self + public function rightJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::RIGHT_JOIN, $alias); } @@ -1189,7 +1189,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function rightOuterJoin(string|self $column, string $alias = null) : self + public function rightOuterJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::RIGHT_OUTER_JOIN, $alias); } @@ -1204,7 +1204,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function rightInnerJoin(string|self $column, string $alias = null) : self + public function rightInnerJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::RIGHT_INNER_JOIN, $alias); } @@ -1219,7 +1219,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function outerJoin(string|self $column, string $alias = null) : self + public function outerJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::OUTER_JOIN, $alias); } @@ -1234,7 +1234,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function innerJoin(string|self $column, string $alias = null) : self + public function innerJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::INNER_JOIN, $alias); } @@ -1249,7 +1249,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function crossJoin(string|self $column, string $alias = null) : self + public function crossJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::CROSS_JOIN, $alias); } @@ -1264,7 +1264,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function fullJoin(string|self $column, string $alias = null) : self + public function fullJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::FULL_JOIN, $alias); } @@ -1279,7 +1279,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function fullOuterJoin(string|self $column, string $alias = null) : self + public function fullOuterJoin(string | self $column, string $alias = null) : self { return $this->join($column, JoinType::FULL_OUTER_JOIN, $alias); } @@ -1309,7 +1309,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function on(string|array $columns, string|array $operator = null, string|array $values = null, string|array $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.'); @@ -1355,7 +1355,7 @@ class Builder extends BuilderAbstract * * @since 1.0.0 */ - public function orOn(string|array $columns, string|array $operator = null, string|array $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, string|array $operator = null, string|array $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'); } @@ -1412,7 +1412,7 @@ class Builder extends BuilderAbstract $sth->execute(); } catch (\Throwable $t) { - var_dump($this->toSql()); + \var_dump($this->toSql()); } return $sth; diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index 84aaec997..90e1db545 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -62,7 +62,7 @@ final class Dispatcher implements DispatcherInterface /** * {@inheritdoc} */ - public function dispatch(array|string|\Closure $controller, ...$data) : array + public function dispatch(array | string | \Closure $controller, ...$data) : array { $views = []; diff --git a/Dispatcher/DispatcherInterface.php b/Dispatcher/DispatcherInterface.php index 962feb6fd..5975e1b1b 100644 --- a/Dispatcher/DispatcherInterface.php +++ b/Dispatcher/DispatcherInterface.php @@ -36,5 +36,5 @@ interface DispatcherInterface * * @since 1.0.0 */ - public function dispatch(array|string|\Closure $controller, ...$data) : array; + public function dispatch(array | string | \Closure $controller, ...$data) : array; } diff --git a/Event/EventManager.php b/Event/EventManager.php index 9880bdd68..a93360aae 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -70,7 +70,7 @@ final class EventManager implements \Countable /** * {@inheritdoc} */ - public function dispatch(array|string|\Closure $func, ...$data) : array + public function dispatch(array | string | \Closure $func, ...$data) : array { if (!($func instanceof \Closure)) { return []; @@ -132,7 +132,7 @@ final class EventManager implements \Countable * * @since 1.0.0 */ - public function attach(string $group, string|\Closure $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' => []]; diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index 408ab6b90..d74011177 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -211,7 +211,7 @@ final class L11nManager * * @since 1.0.0 */ - public function getNumeric(Localization $l11n, int|float $numeric, string $format = null) : string + public function getNumeric(Localization $l11n, int | float $numeric, string $format = null) : string { return \number_format( $numeric, @@ -254,7 +254,7 @@ final class L11nManager * * @since 1.0.0 */ - public function getCurrency(Localization $l11n, int|float $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(); diff --git a/Localization/Money.php b/Localization/Money.php index aae0c2fbd..021c47980 100644 --- a/Localization/Money.php +++ b/Localization/Money.php @@ -83,7 +83,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function __construct(int|float|string $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; @@ -222,7 +222,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function add(int|float|string|self $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); @@ -256,7 +256,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function sub(int|float|string|self $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); @@ -278,7 +278,7 @@ final class Money implements \Serializable * * @since 1.0.0 */ - public function mult(int|float $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(int|float $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(int|float $value) : self + public function pow(int | float $value) : self { $this->value = (int) ($this->value ** $value); diff --git a/Math/Functions/Gamma.php b/Math/Functions/Gamma.php index 27ac78402..7b907ec82 100644 --- a/Math/Functions/Gamma.php +++ b/Math/Functions/Gamma.php @@ -43,7 +43,7 @@ final class Gamma * * @since 1.0.0 */ - public static function gamma(int|float $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(int|float $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(int|float $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(int|float $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(int|float $z) : float + public static function logGamma(int | float $z) : float { static $approx = [ 76.18009172947146,-86.50532032941677, diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 0c774985f..eb4f7b495 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -109,7 +109,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - public function set(int $m, int $n, int|float $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) : int|float + 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); @@ -382,7 +382,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - public function sub(int|float|self $value) : self + public function sub(int | float | self $value) : self { if (\is_numeric($value)) { return $this->addScalar(-$value); @@ -400,7 +400,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - public function add(int|float|self $value) : self + public function add(int | float | self $value) : self { if (\is_numeric($value)) { return $this->addScalar($value); @@ -472,7 +472,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - private function addScalar(int|float $scalar) : self + private function addScalar(int | float $scalar) : self { $newMatrixArr = $this->matrix; @@ -497,7 +497,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - public function mult(int|float|self $value) : self + public function mult(int | float | self $value) : self { if (\is_numeric($value)) { return $this->multScalar($value); @@ -554,7 +554,7 @@ class Matrix implements \ArrayAccess, \Iterator * * @since 1.0.0 */ - private function multScalar(int|float $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 e21242335..0f8830b9a 100644 --- a/Math/Matrix/Vector.php +++ b/Math/Matrix/Vector.php @@ -51,7 +51,7 @@ final class Vector extends Matrix * * @since 1.0.0 */ - public function setV(int $m, int|float $value) : void + public function setV(int $m, int | float $value) : void { parent::set($m , 0, $value); } @@ -65,7 +65,7 @@ final class Vector extends Matrix * * @since 1.0.0 */ - public function getV(int $m) : int|float + public function getV(int $m) : int | float { return parent::get($m, 0); } diff --git a/Math/Number/Complex.php b/Math/Number/Complex.php index 53d404ff3..fe5527fda 100644 --- a/Math/Number/Complex.php +++ b/Math/Number/Complex.php @@ -48,7 +48,7 @@ final class Complex * * @since 1.0.0 */ - public function __construct(int|float $re = 0, int|float $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() : int|float + public function re() : int | float { return $this->re; } @@ -73,7 +73,7 @@ final class Complex * * @since 1.0.0 */ - public function im() : int|float + public function im() : int | float { return $this->im; } @@ -129,7 +129,7 @@ final class Complex * * @since 1.0.0 */ - public function abs() : int|float + public function abs() : int | float { return \sqrt($this->re ** 2 + $this->im ** 2); } @@ -155,7 +155,7 @@ final class Complex * * @since 1.0.0 */ - public function pow(int|float|self $value) : self + public function pow(int | float | self $value) : self { if (\is_int($value)) { return $this->powInteger($value); @@ -209,7 +209,7 @@ final class Complex * * @since 1.0.0 */ - public function powScalar(int|float $value) : self + public function powScalar(int | float $value) : self { return $this; } @@ -223,7 +223,7 @@ final class Complex * * @since 1.0.0 */ - public function add(int|float|self $value) : self + public function add(int | float | self $value) : self { if (\is_numeric($value)) { return $this->addScalar($value); @@ -255,7 +255,7 @@ final class Complex * * @since 1.0.0 */ - private function addScalar(int|float $val) : self + private function addScalar(int | float $val) : self { return new self($this->re + $val, $this->im); } @@ -269,7 +269,7 @@ final class Complex * * @since 1.0.0 */ - public function sub(int|float|self $value) : self + public function sub(int | float | self $value) : self { if (\is_numeric($value)) { return $this->subScalar($value); @@ -301,7 +301,7 @@ final class Complex * * @since 1.0.0 */ - private function subScalar(int|float $val) : self + private function subScalar(int | float $val) : self { return new self($this->re - $val, $this->im); } @@ -315,7 +315,7 @@ final class Complex * * @since 1.0.0 */ - public function mult(int|float|self $value) : self + public function mult(int | float | self $value) : self { if (\is_numeric($value)) { return $this->multScalar($value); @@ -350,7 +350,7 @@ final class Complex * * @since 1.0.0 */ - private function multScalar(int|float $val) : self + private function multScalar(int | float $val) : self { return new self($this->re * $val, $this->im * $val); } @@ -366,7 +366,7 @@ final class Complex * * @since 1.0.0 */ - public function div(int|float|self $value) : self + public function div(int | float | self $value) : self { if (\is_numeric($value)) { return $this->divScalar($value); @@ -401,7 +401,7 @@ final class Complex * * @since 1.0.0 */ - private function divScalar(int|float $val) : self + private function divScalar(int | float $val) : self { return new self($this->re / $val, $this->im / $val); } diff --git a/Math/Numerics/Interpolation/CubicSplineInterpolation.php b/Math/Numerics/Interpolation/CubicSplineInterpolation.php index a2c88d645..420444e53 100644 --- a/Math/Numerics/Interpolation/CubicSplineInterpolation.php +++ b/Math/Numerics/Interpolation/CubicSplineInterpolation.php @@ -144,7 +144,7 @@ final class CubicSplineInterpolation implements InterpolationInterface /** * {@inheritdoc} */ - public function interpolate(int|float $x) : float + public function interpolate(int | float $x) : float { $n = \count($this->points); $xPos = $n - 1; diff --git a/Math/Numerics/Interpolation/InterpolationInterface.php b/Math/Numerics/Interpolation/InterpolationInterface.php index 9978e5fa3..6908b126d 100644 --- a/Math/Numerics/Interpolation/InterpolationInterface.php +++ b/Math/Numerics/Interpolation/InterpolationInterface.php @@ -33,5 +33,5 @@ interface InterpolationInterface * * @since 1.0.0 */ - public function interpolate(int|float $x) : float; + public function interpolate(int | float $x) : float; } diff --git a/Math/Numerics/Interpolation/LagrangeInterpolation.php b/Math/Numerics/Interpolation/LagrangeInterpolation.php index e3f05b407..76b86abd9 100644 --- a/Math/Numerics/Interpolation/LagrangeInterpolation.php +++ b/Math/Numerics/Interpolation/LagrangeInterpolation.php @@ -46,7 +46,7 @@ final class LagrangeInterpolation implements InterpolationInterface /** * {@inheritdoc} */ - public function interpolate(int|float $x) : float + public function interpolate(int | float $x) : float { $n = \count($this->points); $result = 0.0; diff --git a/Math/Numerics/Interpolation/LinearInterpolation.php b/Math/Numerics/Interpolation/LinearInterpolation.php index 56d630057..0f23e1950 100644 --- a/Math/Numerics/Interpolation/LinearInterpolation.php +++ b/Math/Numerics/Interpolation/LinearInterpolation.php @@ -96,7 +96,7 @@ final class LinearInterpolation implements InterpolationInterface /** * {@inheritdoc} */ - public function interpolate(int|float $x) : float + public function interpolate(int | float $x) : float { $n = \count($this->points); $xPos = $n - 1; diff --git a/Math/Parser/Evaluator.php b/Math/Parser/Evaluator.php index 622b03635..aedbf4d34 100644 --- a/Math/Parser/Evaluator.php +++ b/Math/Parser/Evaluator.php @@ -81,7 +81,7 @@ final class Evaluator * * @since 1.0.0 */ - private static function parseValue(int|float|string $value) : int|float + private static function parseValue(int | float | string $value) : int | float { return !\is_string($value) ? $value diff --git a/Message/Mail/Email.php b/Message/Mail/Email.php index 5380d46a7..41c16dc18 100644 --- a/Message/Mail/Email.php +++ b/Message/Mail/Email.php @@ -20,11 +20,11 @@ declare(strict_types=1); namespace phpOMS\Message\Mail; use phpOMS\System\CharsetType; -use phpOMS\System\MimeType; -use phpOMS\Validation\Network\Email as EmailValidator; use phpOMS\System\File\FileUtils; -use phpOMS\Utils\MbStringUtils; +use phpOMS\System\MimeType; use phpOMS\System\SystemUtils; +use phpOMS\Utils\MbStringUtils; +use phpOMS\Validation\Network\Email as EmailValidator; /** * Mail class. @@ -563,8 +563,8 @@ class Email implements MessageInterface * Parse and validate a string containing one or more RFC822-style comma-separated email addresses * of the form "display name
" into an array of name/address pairs. * - * @param string $addrstr Address line - * @param bool $useImap Use imap for parsing + * @param string $addrstr Address line + * @param bool $useImap Use imap for parsing * * @return array * @@ -580,7 +580,7 @@ class Email implements MessageInterface && EmailValidator::isValid($address->mailbox . '@' . $address->host) ) { $addresses[] = [ - 'name' => (\property_exists($address, 'personal') ? $address->personal : ''), + 'name' => (\property_exists($address, 'personal') ? $address->personal : ''), 'address' => $address->mailbox . '@' . $address->host, ]; } @@ -591,11 +591,11 @@ class Email implements MessageInterface $list = \explode(',', $addrstr); foreach ($list as $address) { - $address = trim($address); + $address = \trim($address); if (\strpos($address, '<') === false) { if (EmailValidator::isValid($address)) { $addresses[] = [ - 'name' => '', + 'name' => '', 'address' => $address, ]; } @@ -605,7 +605,7 @@ class Email implements MessageInterface if (EmailValidator::isValid($email)) { $addresses[] = [ - 'name' => \trim(\str_replace(['"', "'"], '', $name)), + 'name' => \trim(\str_replace(['"', "'"], '', $name)), 'address' => $email, ]; } @@ -670,7 +670,7 @@ class Email implements MessageInterface $this->bodyMime ); - $this->headerMime = rtrim($this->headerMime, " \r\n\t") . self::$LE . + $this->headerMime = \rtrim($this->headerMime, " \r\n\t") . self::$LE . self::normalizeBreaks($headerDkim, self::$LE) . self::$LE; } @@ -876,7 +876,7 @@ class Email implements MessageInterface $domain = \mb_convert_encoding($domain, 'UTF-8', $charset); $errorcode = 0; - if (defined('INTL_IDNA_VARIANT_UTS46')) { + if (\defined('INTL_IDNA_VARIANT_UTS46')) { $punycode = \idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46); } else { $punycode = \idn_to_ascii($domain, $errorcode); @@ -999,7 +999,7 @@ class Email implements MessageInterface $body .= $mimePre; $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, MimeType::M_TEXT, $altBodyEncoding); $body .= $this->encodeString($this->bodyAlt, $altBodyEncoding) . self::$LE; - $body .= $this->getBoundary( $this->boundary[1], $bodyCharSet, MimeType::M_HTML, $bodyEncoding); + $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, MimeType::M_HTML, $bodyEncoding); $body .= $this->encodeString($this->body, $bodyEncoding) . self::$LE; if (!empty($this->ical)) { @@ -1085,7 +1085,7 @@ class Email implements MessageInterface } if (!empty($this->signKeyFile)) { - if (!defined('PKCS7_TEXT')) { + if (!\defined('PKCS7_TEXT')) { return ''; } @@ -1104,7 +1104,7 @@ class Email implements MessageInterface 'file://' . \realpath($this->signCertFile), ['file://' . \realpath($this->signKeyFile), $this->signKeyPass], [], - PKCS7_DETACHED, + \PKCS7_DETACHED, $this->signExtracertFiles ); @@ -1235,7 +1235,7 @@ class Email implements MessageInterface // Allow for bypassing the Content-Disposition header if (!empty($disposition)) { $encodedName = $this->encodeHeader(\trim(\str_replace(["\r", "\n"], '', $name))); - $mime[] = !empty($encodedName) + $mime[] = !empty($encodedName) ? \sprintf('Content-Disposition: %s; filename=%s%s', $disposition, self::quotedString($encodedName), @@ -1317,7 +1317,7 @@ class Email implements MessageInterface private function encodeString(string $str, string $encoding = EncodingType::E_BASE64) : string { $encoded = ''; - switch (strtolower($encoding)) { + switch (\strtolower($encoding)) { case EncodingType::E_BASE64: $encoded = \chunk_split(\base64_encode($str), self::STD_LINE_LENGTH, self::$LE); break; @@ -1406,7 +1406,6 @@ class Email implements MessageInterface return false; } - /** * Create address list * @@ -1424,7 +1423,7 @@ class Email implements MessageInterface $addresses[] = $this->addrFormat($address); } - return $type . ': ' . implode(', ', $addresses) . static::$LE; + return $type . ': ' . \implode(', ', $addresses) . static::$LE; } /** @@ -1582,7 +1581,7 @@ class Email implements MessageInterface return $str === $encoded && !\preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str) ? $encoded - : "\"$encoded\""; + : "\"${encoded}\""; } $matchcount = \preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); @@ -1628,13 +1627,13 @@ class Email implements MessageInterface $maxLen -= $maxLen % 4; $encoded = \trim(\chunk_split($encoded, $maxLen, "\n")); } - $encoded = \preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded); + $encoded = \preg_replace('/^(.*)$/m', ' =?' . $charset . "?${encoding}?\\1?=", $encoded); break; case 'Q': $encoded = $this->encodeQ($str, $position); $encoded = $this->wrapText($encoded, $maxLen, true); $encoded = \str_replace('=' . self::$LE, "\n", \trim($encoded)); - $encoded = \preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded); + $encoded = \preg_replace('/^(.*)$/m', ' =?' . $charset . "?${encoding}?\\1?=", $encoded); break; default: return $str; @@ -1710,7 +1709,7 @@ class Email implements MessageInterface $end = '?='; $encoded = ''; - $mbLength = \mb_strlen($str, $this->charset); + $mbLength = \mb_strlen($str, $this->charset); $length = 75 - \strlen($start) - \strlen($end); $ratio = $mbLength / \strlen($str); $avgLength = \floor($length * $ratio * .75); @@ -1721,8 +1720,8 @@ class Email implements MessageInterface do { $offset = $avgLength - $lookBack; - $chunk = \mb_substr($str, $i, $offset, $this->charset); - $chunk = \base64_encode($chunk); + $chunk = \mb_substr($str, $i, $offset, $this->charset); + $chunk = \base64_encode($chunk); ++$lookBack; } while (\strlen($chunk) > $length); @@ -1732,7 +1731,6 @@ class Email implements MessageInterface return \substr($encoded, 0, -\strlen($linebreak)); } - /** * Add an attachment from a path on the filesystem. * @@ -2181,7 +2179,7 @@ class Email implements MessageInterface */ public function dkimSign(string $signHeader) : string { - if (!defined('PKCS7_TEXT')) { + if (!\defined('PKCS7_TEXT')) { return ''; } @@ -2319,7 +2317,7 @@ class Email implements MessageInterface foreach ($parsedHeaders as $header) { if (\in_array(\strtolower($header['label']), $autoSignHeaders, true)) { $headersToSignKeys[] = $header['label']; - $headersToSign[] = $header['label'] . ': ' . $header['value']; + $headersToSign[] = $header['label'] . ': ' . $header['value']; if ($this->dkimCopyHeader) { $copiedHeaders[] = $header['label'] . ':' @@ -2333,7 +2331,7 @@ class Email implements MessageInterface foreach ($this->customHeader as $customHeader) { if ($customHeader[0] === $header['label']) { $headersToSignKeys[] = $header['label']; - $headersToSign[] = $header['label'] . ': ' . $header['value']; + $headersToSign[] = $header['label'] . ': ' . $header['value']; if ($this->dkimCopyHeader) { $copiedHeaders[] = $header['label'] . ':' diff --git a/Message/Mail/Imap.php b/Message/Mail/Imap.php index b9088b779..6dd7368d3 100644 --- a/Message/Mail/Imap.php +++ b/Message/Mail/Imap.php @@ -112,12 +112,12 @@ class Imap extends MailHandler implements MailBoxInterface return \imap_num_recent($this->mailbox); } - public function copyMail(string|array $messages, string $box) : bool + public function copyMail(string | array $messages, string $box) : bool { return \imap_mail_copy($this->mailbox, !\is_string($messages) ? \implode(',', $messages) : $messages, $box); } - public function moveMail(string|array $messages, string $box) : bool + public function moveMail(string | array $messages, string $box) : bool { return \imap_mail_copy($this->mailbox, !\is_string($messages) ? \implode(',', $messages) : $messages, $box); } diff --git a/Message/Mail/MailHandler.php b/Message/Mail/MailHandler.php index 401ddf006..41d7ba382 100644 --- a/Message/Mail/MailHandler.php +++ b/Message/Mail/MailHandler.php @@ -18,10 +18,10 @@ declare(strict_types=1); namespace phpOMS\Message\Mail; -use phpOMS\Validation\Network\Email as EmailValidator; -use phpOMS\Utils\StringUtils; -use phpOMS\Validation\Network\Hostname; use phpOMS\System\SystemUtils; +use phpOMS\Utils\StringUtils; +use phpOMS\Validation\Network\Email as EmailValidator; +use phpOMS\Validation\Network\Hostname; /** * Mail class. @@ -410,11 +410,11 @@ class MailHandler /** * Call mail() in a safe_mode-aware fashion. * - * @param string $to To - * @param Email $mail Mail - * @param string $body Message Body - * @param string $header Additional Header(s) - * @param null|string $params Params + * @param string $to To + * @param Email $mail Mail + * @param string $body Message Body + * @param string $header Additional Header(s) + * @param null|string $params Params * * @return bool * @@ -502,7 +502,7 @@ class MailHandler } $this->smtp->timeout = $this->timeout; - $this->smtp->doVerp = $this->useVerp; + $this->smtp->doVerp = $this->useVerp; $hosts = \explode(';', $this->host); foreach ($hosts as $hostentry) { @@ -540,7 +540,7 @@ class MailHandler } //Do we need the OpenSSL extension? - $sslExt = defined('OPENSSL_ALGO_SHA256'); + $sslExt = \defined('OPENSSL_ALGO_SHA256'); if (($secure === EncryptionType::TLS || $secure === EncryptionType::SMTPS) && !$sslExt ) { @@ -580,7 +580,7 @@ class MailHandler } return !($this->useSMTPAuth - && !$this->smtp->authenticate($this->username, $this->password, $this->authType, $this->oauth ) + && !$this->smtp->authenticate($this->username, $this->password, $this->authType, $this->oauth) ); } } diff --git a/Message/Mail/Pop3.php b/Message/Mail/Pop3.php index 309689b77..0647de90c 100644 --- a/Message/Mail/Pop3.php +++ b/Message/Mail/Pop3.php @@ -120,12 +120,12 @@ class Pop3 extends MailHandler implements MailBoxInterface return \imap_num_recent($this->mailbox); } - public function copyMail(string|array $messages, string $box) : bool + public function copyMail(string | array $messages, string $box) : bool { return \imap_mail_copy($this->mailbox, !\is_string($messages) ? \implode(',', $messages) : $messages, $box); } - public function moveMail(string|array $messages, string $box) : bool + public function moveMail(string | array $messages, string $box) : bool { return \imap_mail_copy($this->mailbox, !\is_string($messages) ? \implode(',', $messages) : $messages, $box); } diff --git a/Message/Mail/Smtp.php b/Message/Mail/Smtp.php index 575272c34..d304d4d05 100644 --- a/Message/Mail/Smtp.php +++ b/Message/Mail/Smtp.php @@ -210,7 +210,7 @@ class Smtp } $crypto_method = \STREAM_CRYPTO_METHOD_TLS_CLIENT; - if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { + if (\defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { $crypto_method |= \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; $crypto_method |= \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } @@ -342,13 +342,13 @@ class Smtp // Creates an md5 HMAC. // by Lance Rushing $byteLen = 64; - if (strlen($key) > $byteLen) { + if (\strlen($key) > $byteLen) { $key = \pack('H*', \md5($key)); } - $key = \str_pad($key, $byteLen, \chr(0x00)); - $ipad = \str_pad('', $byteLen, \chr(0x36)); - $opad = \str_pad('', $byteLen, \chr(0x5c)); + $key = \str_pad($key, $byteLen, \chr(0x00)); + $ipad = \str_pad('', $byteLen, \chr(0x36)); + $opad = \str_pad('', $byteLen, \chr(0x5c)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; @@ -392,7 +392,7 @@ class Smtp $this->heloRply = ''; if (\is_resource($this->con)) { - fclose($this->con); + \fclose($this->con); $this->con = null; } } @@ -526,7 +526,7 @@ class Smtp protected function parseHelloFields(string $type) : void { $this->serverCaps = []; - $lines = \explode("\n", $this->heloRply); + $lines = \explode("\n", $this->heloRply); foreach ($lines as $n => $s) { //First 4 chars contain response code followed by - or space @@ -538,7 +538,7 @@ class Smtp $fields = \explode(' ', $s); if (!empty($fields)) { if (!$n) { - $name = $type; + $name = $type; $fields = $fields[0]; } else { $name = \array_shift($fields); @@ -650,7 +650,7 @@ class Smtp * * @since 1.0.0 */ - protected function sendCommand(string $command, string $commandstring, int|array $expect) : bool + protected function sendCommand(string $command, string $commandstring, int | array $expect) : bool { if (!$this->isConnected()) { return false; @@ -703,7 +703,7 @@ class Smtp */ public function sendAndMail(string $from) : bool { - return $this->sendCommand('SAML', "SAML FROM:$from", 250); + return $this->sendCommand('SAML', "SAML FROM:${from}", 250); } /** @@ -717,7 +717,7 @@ class Smtp */ public function verify(string $name) : bool { - return $this->sendCommand('VRFY', "VRFY $name", [250, 251]); + return $this->sendCommand('VRFY', "VRFY ${name}", [250, 251]); } /** @@ -877,7 +877,7 @@ class Smtp $this->lastSmtpTransactionId = ''; } else { $this->lastSmtpTransactionId = ''; - $patterns = SmtpTransactionPattern::getConstants(); + $patterns = SmtpTransactionPattern::getConstants(); foreach ($patterns as $pattern) { $matches = []; diff --git a/Message/MessageInterface.php b/Message/MessageInterface.php index e0db4252e..65d45046a 100644 --- a/Message/MessageInterface.php +++ b/Message/MessageInterface.php @@ -25,11 +25,11 @@ namespace phpOMS\Message; interface MessageInterface { /** - * Gets the body of the message. - * - * @return string - * - * @since 1.0.0 - */ + * Gets the body of the message. + * + * @return string + * + * @since 1.0.0 + */ public function getBody() : string; } diff --git a/Message/Socket/SocketResponse.php b/Message/Socket/SocketResponse.php index 9ffdfd0b3..daa9f9336 100644 --- a/Message/Socket/SocketResponse.php +++ b/Message/Socket/SocketResponse.php @@ -46,14 +46,14 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa } /** - * Remove response by ID. - * - * @param mixed $id Response ID - * - * @return bool - * - * @since 1.0.0 - */ + * Remove response by ID. + * + * @param mixed $id Response ID + * + * @return bool + * + * @since 1.0.0 + */ public function remove($id) : bool { if (isset($this->response[$id])) { @@ -66,8 +66,8 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getJsonData() : array { return \json_decode($this->getRaw(), true); diff --git a/Module/ModuleAbstract.php b/Module/ModuleAbstract.php index 210b82281..c4ed5e858 100644 --- a/Module/ModuleAbstract.php +++ b/Module/ModuleAbstract.php @@ -320,7 +320,7 @@ abstract class ModuleAbstract * * @since 1.0.0 */ - protected function updateModel(int $account, mixed $old, mixed $new, string|\Closure $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; diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index b490ab78e..3eb8aa74b 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -710,7 +710,7 @@ final class ModuleManager * * @since 1.0.0 */ - public function initModule(string|array $modules) : void + public function initModule(string | array $modules) : void { $modules = (array) $modules; foreach ($modules as $module) { diff --git a/Module/StatusAbstract.php b/Module/StatusAbstract.php index e2ee42315..f1b5ca40b 100644 --- a/Module/StatusAbstract.php +++ b/Module/StatusAbstract.php @@ -14,15 +14,15 @@ declare(strict_types=1); namespace phpOMS\Module; +use phpOMS\Application\ApplicationInfo; use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\System\File\Local\Directory; use phpOMS\System\File\Local\File; use phpOMS\System\File\PathException; use phpOMS\System\File\PermissionException; -use phpOMS\Utils\Parser\Php\ArrayParser; -use phpOMS\Application\ApplicationInfo; use phpOMS\Utils\ArrayUtils; +use phpOMS\Utils\Parser\Php\ArrayParser; /** * Status abstract class. diff --git a/Stdlib/Base/Enum.php b/Stdlib/Base/Enum.php index 960d4c8a5..b3624b2db 100644 --- a/Stdlib/Base/Enum.php +++ b/Stdlib/Base/Enum.php @@ -102,7 +102,7 @@ abstract class Enum * * @since 1.0.0 */ - public static function getName(string $value) : bool|int|string + public static function getName(string $value) : bool | int | string { $arr = self::getConstants(); diff --git a/Stdlib/Graph/Graph.php b/Stdlib/Graph/Graph.php index e4efd26d7..84acf96a9 100644 --- a/Stdlib/Graph/Graph.php +++ b/Stdlib/Graph/Graph.php @@ -88,7 +88,7 @@ class Graph * * @since 1.0.0 */ - public function getNode(int|string $key) : ?Node + public function getNode(int | string $key) : ?Node { return $this->nodes[$key] ?? null; } @@ -117,7 +117,7 @@ class Graph * * @since 1.0.0 */ - public function hasNode(int|string $key) : bool + public function hasNode(int | string $key) : bool { return isset($this->nodes[$key]); } @@ -167,7 +167,7 @@ class Graph * * @since 1.0.0 */ - public function getCost() : int|float + public function getCost() : int | float { $edges = $this->getEdges(); $costs = 0; @@ -555,7 +555,7 @@ class Graph * * @since 1.0.0 */ - public function longestPathBetweenNodes(int|string|Node $node1, int|string|Node $node2) : array + public function longestPathBetweenNodes(int | string | Node $node1, int | string | Node $node2) : array { if (!($node1 instanceof Node)) { $node1 = $this->getNode($node1); diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php index dc45effb0..31919efde 100644 --- a/Stdlib/Map/MultiMap.php +++ b/Stdlib/Map/MultiMap.php @@ -182,7 +182,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function get(int|string|array $key) : mixed + public function get(int | string | array $key) : mixed { if ($this->keyType === KeyType::MULTIPLE || \is_array($key)) { return $this->getMultiple($key); @@ -200,7 +200,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function getSingle(int|string $key) : mixed + private function getSingle(int | string $key) : mixed { return isset($this->keys[$key]) ? $this->values[$this->keys[$key]] ?? null : null; } @@ -214,7 +214,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function getMultiple(int|string|array $key) : mixed + private function getMultiple(int | string | array $key) : mixed { if (\is_array($key)) { if ($this->orderType === OrderType::LOOSE) { @@ -248,7 +248,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function set(int|string|array $key, mixed $value) : bool + public function set(int | string | array $key, mixed $value) : bool { if ($this->keyType === KeyType::MULTIPLE || \is_array($key)) { return $this->setMultiple($key, $value); @@ -267,7 +267,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function setMultiple(int|string|array $key, mixed $value) : bool + private function setMultiple(int | string | array $key, mixed $value) : bool { $key = \is_array($key) ? $key : [$key]; @@ -297,7 +297,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function setSingle(int|string $key, mixed $value) : bool + private function setSingle(int | string $key, mixed $value) : bool { if (isset($this->keys[$key])) { $this->values[$this->keys[$key]] = $value; @@ -317,7 +317,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function remove(int|string|array $key) : bool + public function remove(int | string | array $key) : bool { if ($this->keyType === KeyType::MULTIPLE || \is_array($key)) { return $this->removeMultiple($key); @@ -335,7 +335,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function removeMultiple(int|string|array $key) : bool + private function removeMultiple(int | string | array $key) : bool { $key = \is_array($key) ? $key : [$key]; @@ -367,7 +367,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function removeSingle(int|string $key) : bool + private function removeSingle(int | string $key) : bool { if (isset($this->keys[$key])) { $id = $this->keys[$key]; @@ -394,7 +394,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function remap(int|string $old, int|string $new) : bool + public function remap(int | string $old, int | string $new) : bool { if ($this->keyType === KeyType::MULTIPLE) { return false; @@ -422,7 +422,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function removeKey(int|string $key) : bool + public function removeKey(int | string $key) : bool { if ($this->keyType === KeyType::MULTIPLE) { return false; @@ -442,7 +442,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function removeKeySingle(int|string $key) : bool + private function removeKeySingle(int | string $key) : bool { if (isset($this->keys[$key])) { unset($this->keys[$key]); @@ -464,7 +464,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function getSiblings(int|string|array $key) : array + public function getSiblings(int | string | array $key) : array { if ($this->keyType === KeyType::MULTIPLE || \is_array($key)) { return $this->getSiblingsMultiple($key); @@ -482,7 +482,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - public function getSiblingsMultiple(int|string|array $key) : array + public function getSiblingsMultiple(int | string | array $key) : array { if ($this->orderType === OrderType::LOOSE) { $key = \is_array($key) ? $key : [$key]; @@ -502,7 +502,7 @@ final class MultiMap implements \Countable * * @since 1.0.0 */ - private function getSiblingsSingle(int|string $key) : array + private function getSiblingsSingle(int | string $key) : array { $siblings = []; if (!isset($this->keys[$key])) { diff --git a/System/File/FileUtils.php b/System/File/FileUtils.php index 3a6dc7a7b..6d1a1b490 100644 --- a/System/File/FileUtils.php +++ b/System/File/FileUtils.php @@ -202,7 +202,7 @@ final class FileUtils * * @since 1.0.0 */ - public static function mb_pathinfo(string $path, int|string $options = null) : string|array + public static function mb_pathinfo(string $path, int | string $options = null) : string | array { $ret = ['dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '']; $pathinfo = []; diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 09a7dbc05..f8b52bfe1 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -694,7 +694,7 @@ class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public function next() + public function next() : void { $next = \next($this->nodes); if ($next instanceof self) { diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index b598d3871..0ab3b747a 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -517,7 +517,7 @@ final class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public function next() + public function next() : void { $next = \next($this->nodes); if ($next instanceof self) { diff --git a/System/SystemUtils.php b/System/SystemUtils.php index 3c411bd84..c468de7ac 100644 --- a/System/SystemUtils.php +++ b/System/SystemUtils.php @@ -138,7 +138,7 @@ final class SystemUtils { if (isset($_SERVER['SERVER_NAME'])) { return $_SERVER['SERVER_NAME']; - } elseif (($result = gethostname()) !== false) { + } elseif (($result = \gethostname()) !== false) { return $result; } elseif (\php_uname('n') !== false) { return \php_uname('n'); diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 88095675c..888270108 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -334,7 +334,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function arraySum(array $array, int $start = 0, int $count = 0) : int|float + public static function arraySum(array $array, int $start = 0, int $count = 0) : int | float { $count = $count === 0 ? \count($array) : $start + $count; $sum = 0; @@ -391,7 +391,7 @@ final class ArrayUtils * * @since 1.0.0 */ - public static function power(array $values, int|float $exp = 2) : array + public static function power(array $values, int | float $exp = 2) : array { $squared = []; diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php index 0c89aaf87..c0f5bede2 100644 --- a/Utils/Git/Repository.php +++ b/Utils/Git/Repository.php @@ -292,7 +292,7 @@ class Repository * * @since 1.0.0 */ - public function add(string|array $files = '*') : string + public function add(string | array $files = '*') : string { $files = $this->parseFileList($files); @@ -309,7 +309,7 @@ class Repository * * @since 1.0.0 */ - public function rm(string|array $files = '*', bool $cached = false) : string + public function rm(string | array $files = '*', bool $cached = false) : string { $files = $this->parseFileList($files); @@ -327,7 +327,7 @@ class Repository * * @since 1.0.0 */ - private function parseFileList(string|array $files) : string + private function parseFileList(string | array $files) : string { if (\is_array($files)) { return '"' . \implode('" "', $files) . '"'; diff --git a/Utils/IO/Zip/ArchiveInterface.php b/Utils/IO/Zip/ArchiveInterface.php index fdc1e0374..3f9a42142 100644 --- a/Utils/IO/Zip/ArchiveInterface.php +++ b/Utils/IO/Zip/ArchiveInterface.php @@ -35,7 +35,7 @@ interface ArchiveInterface * * @since 1.0.0 */ - public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool; + public static function pack(string | array $sources, string $destination, bool $overwrite = false) : bool; /** * Unpack archive. diff --git a/Utils/IO/Zip/Gz.php b/Utils/IO/Zip/Gz.php index 1f0e39de0..79e6b5ba3 100644 --- a/Utils/IO/Zip/Gz.php +++ b/Utils/IO/Zip/Gz.php @@ -29,7 +29,7 @@ class Gz implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack(string|array $source, string $destination, bool $overwrite = false) : bool + public static function pack(string | array $source, string $destination, bool $overwrite = false) : bool { $destination = \str_replace('\\', '/', $destination); if ($destination === false diff --git a/Utils/IO/Zip/Tar.php b/Utils/IO/Zip/Tar.php index b8c5d2c37..8459c31f7 100644 --- a/Utils/IO/Zip/Tar.php +++ b/Utils/IO/Zip/Tar.php @@ -31,7 +31,7 @@ class Tar implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool + public static function pack(string | array $sources, string $destination, bool $overwrite = false) : bool { $destination = FileUtils::absolute(\str_replace('\\', '/', $destination)); if (!$overwrite && \is_file($destination)) { diff --git a/Utils/IO/Zip/TarGz.php b/Utils/IO/Zip/TarGz.php index a2ef4ae48..8d74486e8 100644 --- a/Utils/IO/Zip/TarGz.php +++ b/Utils/IO/Zip/TarGz.php @@ -31,7 +31,7 @@ class TarGz implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack(string|array $source, string $destination, bool $overwrite = false) : bool + public static function pack(string | array $source, string $destination, bool $overwrite = false) : bool { $destination = \str_replace('\\', '/', $destination); if (!$overwrite && \is_file($destination)) { diff --git a/Utils/IO/Zip/Zip.php b/Utils/IO/Zip/Zip.php index 2319c45d5..33ab83793 100644 --- a/Utils/IO/Zip/Zip.php +++ b/Utils/IO/Zip/Zip.php @@ -31,7 +31,7 @@ class Zip implements ArchiveInterface /** * {@inheritdoc} */ - public static function pack(string|array $sources, string $destination, bool $overwrite = false) : bool + public static function pack(string | array $sources, string $destination, bool $overwrite = false) : bool { $destination = FileUtils::absolute(\str_replace('\\', '/', $destination)); if (!$overwrite && \is_file($destination) diff --git a/Utils/MbStringUtils.php b/Utils/MbStringUtils.php index 7e17a3b7c..e3c05db0d 100644 --- a/Utils/MbStringUtils.php +++ b/Utils/MbStringUtils.php @@ -80,7 +80,7 @@ final class MbStringUtils * * @since 1.0.0 */ - public static function mb_startsWith(string $haystack, string|array $needles) : bool + public static function mb_startsWith(string $haystack, string | array $needles) : bool { if (\is_string($needles)) { $needles = [$needles]; @@ -112,7 +112,7 @@ final class MbStringUtils * * @since 1.0.0 */ - public static function mb_endsWith(string $haystack, string|array $needles) : bool + public static function mb_endsWith(string $haystack, string | array $needles) : bool { if (\is_string($needles)) { $needles = [$needles]; diff --git a/Utils/Permutation.php b/Utils/Permutation.php index 463547d03..ea5bc4d0a 100644 --- a/Utils/Permutation.php +++ b/Utils/Permutation.php @@ -109,7 +109,7 @@ final class Permutation * * @since 1.0.0 */ - public static function permutate(string|array $toPermute, array $key) : string|array + public static function permutate(string | array $toPermute, array $key) : string | array { $length = \is_array($toPermute) ? \count($toPermute) : \strlen($toPermute); diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index c94bce119..358336c02 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -82,7 +82,7 @@ final class StringUtils * * @since 1.0.0 */ - public static function endsWith(string $haystack, string|array $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, string|array $needles) : bool + public static function startsWith(string $haystack, string | array $needles) : bool { if (\is_string($needles)) { $needles = [$needles]; @@ -412,7 +412,7 @@ final class StringUtils public static function isShellSafe(string $string) { if (\escapeshellcmd($string) !== $string - || !\in_array(\escapeshellarg($string), ["'$string'", "\"$string\""]) + || !\in_array(\escapeshellarg($string), ["'${string}'", "\"${string}\""]) ) { return false; } diff --git a/Validation/Validator.php b/Validation/Validator.php index ca83cbeab..fb8979e7d 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -72,7 +72,7 @@ final class Validator extends ValidatorAbstract * * @since 1.0.0 */ - public static function isType(mixed $var, string|array $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, string|array $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(int|float $var, int|float $min = 0, int|float $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; diff --git a/Views/View.php b/Views/View.php index 428b11bae..2d252ba26 100644 --- a/Views/View.php +++ b/Views/View.php @@ -304,7 +304,7 @@ class View extends ViewAbstract * * @since 1.0.0 */ - public function getNumeric(int|float $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(int|float $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); } diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index 9c4da3af0..be72be635 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -127,7 +127,7 @@ abstract class ViewAbstract implements RenderableInterface * * @since 1.0.0 */ - public function getView(string $id) : bool|self + public function getView(string $id) : bool | self { if (!isset($this->views[$id])) { return false; diff --git a/tests/Algorithm/Sort/NumericElement.php b/tests/Algorithm/Sort/NumericElement.php index bf0c4d972..3cad47053 100644 --- a/tests/Algorithm/Sort/NumericElement.php +++ b/tests/Algorithm/Sort/NumericElement.php @@ -21,9 +21,11 @@ require_once __DIR__ . '/../../Autoloader.php'; class NumericElement implements SortableInterface { - public int|float $value = 0; + public int | - public function __construct(int|float $value) +float $value = 0; + + public function __construct(int | float $value) { $this->value = $value; } @@ -38,12 +40,12 @@ class NumericElement implements SortableInterface return $this->value === $obj->getValue(); } - public function getValue() : int|float + public function getValue() : int | float { return $this->value; } - public static function max(array $list) : int|float + public static function max(array $list) : int | float { $values = []; foreach ($list as $element) { @@ -53,7 +55,7 @@ class NumericElement implements SortableInterface return \max($values); } - public static function min(array $list) : int|float + public static function min(array $list) : int | float { $values = []; foreach ($list as $element) { diff --git a/tests/Application/ApplicationManagerTest.php b/tests/Application/ApplicationManagerTest.php index 12df4cc92..5413b45b7 100644 --- a/tests/Application/ApplicationManagerTest.php +++ b/tests/Application/ApplicationManagerTest.php @@ -44,12 +44,12 @@ class ApplicationManagerTest extends \PHPUnit\Framework\TestCase $app->dbPool = $GLOBALS['dbpool']; $app->router = new WebRouter(); $app->dispatcher = new Dispatcher($app); - $app->appSettings = new class implements SettingsInterface { + $app->appSettings = new class() implements SettingsInterface { use OptionsTrait; public function get( mixed $ids = null, - string|array $names = null, + string | array $names = null, string $module = null, int $group = null, int $account = null diff --git a/tests/DataStorage/Cache/Connection/NullCacheTest.php b/tests/DataStorage/Cache/Connection/NullCacheTest.php index 536bf86b0..e3ff815bc 100644 --- a/tests/DataStorage/Cache/Connection/NullCacheTest.php +++ b/tests/DataStorage/Cache/Connection/NullCacheTest.php @@ -14,8 +14,8 @@ declare(strict_types=1); namespace phpOMS\tests\DataStorage\Cache\Connection; -use phpOMS\DataStorage\Cache\CacheType; use phpOMS\DataStorage\Cache\CacheStatus; +use phpOMS\DataStorage\Cache\CacheType; use phpOMS\DataStorage\Cache\Connection\NullCache; /** diff --git a/tests/Dispatcher/DispatcherTest.php b/tests/Dispatcher/DispatcherTest.php index a8a224d3e..067965842 100644 --- a/tests/Dispatcher/DispatcherTest.php +++ b/tests/Dispatcher/DispatcherTest.php @@ -19,9 +19,9 @@ use phpOMS\Dispatcher\Dispatcher; use phpOMS\Localization\Localization; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; +use phpOMS\Module\ModuleAbstract; use phpOMS\Router\WebRouter; use phpOMS\Uri\HttpUri; -use phpOMS\Module\ModuleAbstract; require_once __DIR__ . '/../Autoloader.php'; @@ -36,7 +36,7 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase protected function setUp() : void { - $this->app = new class() extends ApplicationAbstract { + $this->app = new class() extends ApplicationAbstract { protected string $appName = 'Api'; }; @@ -56,7 +56,11 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase public function testControllerInputOutput() : void { - $this->app->dispatcher->set(new class extends ModuleAbstract { public string $name = 'test'; public function testFunction() { return $this->name; } }, 'test'); + $this->app->dispatcher->set(new class() extends ModuleAbstract { + public string $name = 'test'; + + public function testFunction() { return $this->name; } + }, 'test'); $localization = new Localization(); diff --git a/tests/Message/Mail/EmailTest.php b/tests/Message/Mail/EmailTest.php index 78f0caac9..79c0447b2 100644 --- a/tests/Message/Mail/EmailTest.php +++ b/tests/Message/Mail/EmailTest.php @@ -28,7 +28,7 @@ class EmailTestTest extends \PHPUnit\Framework\TestCase { protected Email $mail; - public function setUp() : void + protected function setUp() : void { $this->mail = new Email(); } @@ -58,9 +58,9 @@ class EmailTestTest extends \PHPUnit\Framework\TestCase public function testHtml() : void { - $message = \file_get_contents(__DIR__ . '/files/utf8.html'); + $message = \file_get_contents(__DIR__ . '/files/utf8.html'); $this->mail->charset = CharsetType::UTF_8; - $this->mail->body = ''; + $this->mail->body = ''; $this->mail->bodyAlt = ''; $this->mail->msgHTML($message, __DIR__ . '/files'); diff --git a/tests/Message/Mail/MailHandlerTest.php b/tests/Message/Mail/MailHandlerTest.php index 866ed5c91..3747d450f 100644 --- a/tests/Message/Mail/MailHandlerTest.php +++ b/tests/Message/Mail/MailHandlerTest.php @@ -16,10 +16,10 @@ namespace phpOMS\tests\Message; require_once __DIR__ . '/../../Autoloader.php'; -use phpOMS\Message\Mail\MailHandler; -use phpOMS\Message\Mail\SubmitType; use phpOMS\Message\Mail\Email; use phpOMS\Message\Mail\Imap; +use phpOMS\Message\Mail\MailHandler; +use phpOMS\Message\Mail\SubmitType; use phpOMS\System\CharsetType; /** @@ -31,7 +31,7 @@ class MailHandlerTest extends \PHPUnit\Framework\TestCase { protected MailHandler $handler; - public function setUp() : void + protected function setUp() : void { $this->handler = new MailHandler(); } @@ -93,9 +93,9 @@ class MailHandlerTest extends \PHPUnit\Framework\TestCase $mail->addBCC('test3@orange-management.email', 'Dennis Eichhorn'); $mail->addReplyTo('test4@orange-management.email', 'Dennis Eichhorn'); $mail->subject = 'testSendHtmlWithMail'; - $message = \file_get_contents(__DIR__ . '/files/utf8.html'); + $message = \file_get_contents(__DIR__ . '/files/utf8.html'); $mail->charset = CharsetType::UTF_8; - $mail->body = ''; + $mail->body = ''; $mail->bodyAlt = ''; $mail->msgHTML($message, __DIR__ . '/files'); @@ -119,9 +119,9 @@ class MailHandlerTest extends \PHPUnit\Framework\TestCase $mail->addBCC('test3@orange-management.email', 'Dennis Eichhorn'); $mail->addReplyTo('test4@orange-management.email', 'Dennis Eichhorn'); $mail->subject = 'testSendHtmlWithSendmail'; - $message = \file_get_contents(__DIR__ . '/files/utf8.html'); + $message = \file_get_contents(__DIR__ . '/files/utf8.html'); $mail->charset = CharsetType::UTF_8; - $mail->body = ''; + $mail->body = ''; $mail->bodyAlt = ''; $mail->msgHTML($message, __DIR__ . '/files');