diff --git a/Config/OptionsTrait.php b/Config/OptionsTrait.php index 5ac166591..64e8d69df 100644 --- a/Config/OptionsTrait.php +++ b/Config/OptionsTrait.php @@ -66,7 +66,7 @@ trait OptionsTrait /** * Get options by keys. * - * @param mixed $key Unique option key + * @param array $key Unique option key * * @return array Option values * diff --git a/Contract/StreamInterface.php b/Contract/StreamInterface.php new file mode 100644 index 000000000..4ef40f5c9 --- /dev/null +++ b/Contract/StreamInterface.php @@ -0,0 +1,291 @@ +cookies as $key => $cookie) { - \setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], ['samesite' => 'Strict']); + \setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], 'Strict'); } // @codeCoverageIgnoreEnd } diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 2cb5cdab7..cc3091c6f 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -907,18 +907,14 @@ class DataMapperAbstract implements DataMapperInterface */ private static function createOwnsOneArray(string $propertyName, array &$obj) { - if (\is_array($obj)) { - $mapper = static::$ownsOne[$propertyName]['mapper']; - $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; + $mapper = static::$ownsOne[$propertyName]['mapper']; + $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; - if (empty($primaryKey)) { - return $mapper::createArray($obj); - } - - return $primaryKey; + if (empty($primaryKey)) { + return $mapper::createArray($obj); } - return $obj; + return $primaryKey; } /** @@ -964,19 +960,15 @@ class DataMapperAbstract implements DataMapperInterface */ private static function createBelongsToArray(string $propertyName, array $obj) { - if (\is_array($obj)) { - /** @var string $mapper */ - $mapper = static::$belongsTo[$propertyName]['mapper']; - $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; + /** @var string $mapper */ + $mapper = static::$belongsTo[$propertyName]['mapper']; + $primaryKey = $obj[static::$columns[static::$primaryField]['internal']]; - if (empty($primaryKey)) { - return $mapper::createArray($obj); - } - - return $primaryKey; + if (empty($primaryKey)) { + return $mapper::createArray($obj); } - return $obj; + return $primaryKey; } /** diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 63c9ef28f..399377d45 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -362,7 +362,7 @@ class Builder extends BuilderAbstract */ public function newQuery() : self { - return new static($this->connection, $this->isReadOnly); + return new self($this->connection, $this->isReadOnly); } /** @@ -1274,6 +1274,11 @@ class Builder extends BuilderAbstract /** * On. * + * @param string|array $columns Columns to join on + * @param null|string|array $operator Comparison operator + * @param null|string|array $values Values to compare with + * @param string|array $boolean Concatonator + * * @return Builder * * @since 1.0.0 @@ -1317,6 +1322,10 @@ class Builder extends BuilderAbstract /** * On. * + * @param string|array $columns Columns to join on + * @param null|string|array $operator Comparison operator + * @param null|string|array $values Values to compare with + * * @return Builder * * @since 1.0.0 @@ -1329,6 +1338,10 @@ class Builder extends BuilderAbstract /** * On. * + * @param string|array $columns Columns to join on + * @param null|string|array $operator Comparison operator + * @param null|string|array $values Values to compare with + * * @return Builder * * @since 1.0.0 diff --git a/Math/Matrix/CholeskyDecomposition.php b/Math/Matrix/CholeskyDecomposition.php index b028cec13..f6f5c2919 100644 --- a/Math/Matrix/CholeskyDecomposition.php +++ b/Math/Matrix/CholeskyDecomposition.php @@ -123,6 +123,9 @@ final class CholeskyDecomposition * * @return Matrix * + * @throws InvalidDimensionException + * @throws \Exception + * * @since 1.0.0 */ public function solve(Matrix $B) : Matrix diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index d5851f9a9..991a5d650 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -263,7 +263,7 @@ class Matrix implements \ArrayAccess, \Iterator /** * Get matrix array. * - * @return array> + * @return array> * * @since 1.0.0 */ diff --git a/Math/Stochastic/NaiveBayesClassifier.php b/Math/Stochastic/NaiveBayesClassifier.php index 740bd3beb..6d7073784 100644 --- a/Math/Stochastic/NaiveBayesClassifier.php +++ b/Math/Stochastic/NaiveBayesClassifier.php @@ -142,7 +142,6 @@ final class NaiveBayesClassifier if (\is_array($value)) { /** - * @var string[] $value * @var string $word */ foreach ($value as $word) { diff --git a/Message/UploadedFileInterface.php b/Message/UploadedFileInterface.php index 0373b3844..31753e4bd 100644 --- a/Message/UploadedFileInterface.php +++ b/Message/UploadedFileInterface.php @@ -14,6 +14,8 @@ declare(strict_types=1); namespace phpOMS\Message; +use phpOMS\Contract\StreamInterface; + /** * Upload interface. * @@ -30,7 +32,7 @@ interface UploadedFileInterface * * @since 1.0.0 */ - public function getStream(); + public function getStream() : StreamInterface; /** * Move the uploaded file to a new location. diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index dd78ec1c9..9a0c8fe96 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -261,8 +261,12 @@ final class ModuleManager if (empty($this->all)) { \chdir($this->modulePath); $files = \glob('*', \GLOB_ONLYDIR); - $c = $files === false ? 0 : \count($files); + if ($files === false) { + return []; + } + + $c = $files === false ? 0 : \count($files); for ($i = 0; $i < $c; ++$i) { $path = $this->modulePath . '/' . $files[$i] . '/info.json'; @@ -670,6 +674,11 @@ final class ModuleManager } $dirs = \scandir($this->modulePath . '/' . $from . '/Application'); + + if ($dirs === false) { + return; + } + foreach ($dirs as $dir) { if ($dir === '.' || $dir === '..') { continue; diff --git a/Utils/IO/Csv/CsvInterface.php b/Utils/IO/Csv/CsvInterface.php index 11f0faf65..f63bf3e56 100644 --- a/Utils/IO/Csv/CsvInterface.php +++ b/Utils/IO/Csv/CsvInterface.php @@ -17,7 +17,7 @@ namespace phpOMS\Utils\IO\Csv; /** * Cvs interface. * - * @package phpOMS\Utils\IO\Csv + * @package phpOMS\Utils\IO\Csv * @license OMS License 1.0 * @link https://orange-management.org * @since 1.0.0 @@ -29,10 +29,11 @@ interface CsvInterface * * @param string $path Path to export * + * @return void + * * @since 1.0.0 - * @author Dennis Eichhorn */ - public function exportCsv($path); + public function exportCsv($path) : void; /** * Import Csv. @@ -42,7 +43,6 @@ interface CsvInterface * @return void * * @since 1.0.0 - * @author Dennis Eichhorn */ public function importCsv($path) : void; } diff --git a/composer.json b/composer.json index 94855b448..d03ac165c 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "phpunit/phpunit": "^8.5", "squizlabs/php_codesniffer": "^3.5", "phpmd/phpmd": "^2.6", - "phpstan/phpstan": "^0.12.11", + "phpstan/phpstan": "^0.12.13", "phan/phan": "^1.1.5", "codeclimate/php-test-reporter": "^0.4.4", "facebook/webdriver": "^1.7", diff --git a/composer.lock b/composer.lock index f1c70b08d..27e063af7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "043f0c2fa2b3b436d06695f23a7ff67c", + "content-hash": "fd398b982f231bd108d7943e3a14dbf1", "packages": [], "packages-dev": [ {