diff --git a/DataStorage/Session/JWT.php b/DataStorage/Session/JWT.php index 9a6eb1694..de978f5d7 100644 --- a/DataStorage/Session/JWT.php +++ b/DataStorage/Session/JWT.php @@ -152,13 +152,15 @@ public static function validateJWT(string $secret, string $jwt) : bool } try { - $header = \json_decode(Base64Url::decode($explode[0]), true); - $payload = \json_decode(Base64Url::decode($explode[1]), true); + $header = \json_decode(Base64Url::decode($explode[0]), true); + $payload = \json_decode(Base64Url::decode($explode[1]), true); if (!\is_array($header) || !\is_array($payload)) { return false; } + /** @var array{alg:string, typ:string} $header */ + /** @var array{sub:string, uid?:string, name?:string, iat:string} $payload */ $signature = self::createSignature($secret, $header, $payload); return \hash_equals($signature, $explode[2]); diff --git a/Localization/LanguageDetection/LanguageResult.php b/Localization/LanguageDetection/LanguageResult.php index c1bbce596..dc54b8c20 100755 --- a/Localization/LanguageDetection/LanguageResult.php +++ b/Localization/LanguageDetection/LanguageResult.php @@ -77,6 +77,7 @@ public function offsetSet($offset, $value) : void if ($offset === null) { $this->result[] = $value; } else { + /** @var int $offset */ $this->result[$offset] = $value; } } diff --git a/Localization/LanguageDetection/NgramParser.php b/Localization/LanguageDetection/NgramParser.php index f8002150d..5d7cd6010 100755 --- a/Localization/LanguageDetection/NgramParser.php +++ b/Localization/LanguageDetection/NgramParser.php @@ -101,7 +101,7 @@ protected function getNgrams(string $str) : array } } - /** @var array $tokens */ + /** @var array|non-empty-array $tokens */ foreach ($tokens as $i => $token) { $sum = \array_sum($token); diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index e678a0cf8..116ad38e1 100755 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -697,11 +697,11 @@ public function det() : float * * @param self $B Matrix * - * @return int|float|self + * @return self * * @since 1.0.0 */ - public function dot(self $B) : int|float|self + public function dot(self $B) : self { $value1 = $this->matrix; $value2 = $B->getMatrix(); @@ -745,7 +745,7 @@ public function dot(self $B) : int|float|self $result += $value1[$i] * $value2[$i]; } - return $result; + return self::fromArray([[$result]]); } elseif ($isMatrix1 && !$isMatrix2) { $result = []; for ($i = 0; $i < $m1; ++$i) { // Row of 1 diff --git a/Math/Matrix/Vector.php b/Math/Matrix/Vector.php index 46fb214f5..38e01d164 100755 --- a/Math/Matrix/Vector.php +++ b/Math/Matrix/Vector.php @@ -101,7 +101,7 @@ public function cosine(self $v) : float { $dotProduct = 0.0; for ($i = 0; $i < $this->m; ++$i) { - $dotProduct += $this->matrix[$i][0] * $v[$i][0]; + $dotProduct += $this->matrix[$i][0] * $v->matrix[$i][0]; } $sumOfSquares = 0; diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 6ed578f26..fcca3e93a 100755 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -305,7 +305,7 @@ public static function arrayToXml(array $data, \SimpleXMLElement $xml = null) : * @param string $id Id to find * @param array $args CLI command list * - * @return null|T + * @return mixed * * @since 1.0.0 */ diff --git a/tests/Business/Marketing/ArticleCorrelationAffinityTest.php b/tests/Business/Recommendation/ArticleCorrelationAffinityTest.php old mode 100755 new mode 100644 similarity index 93% rename from tests/Business/Marketing/ArticleCorrelationAffinityTest.php rename to tests/Business/Recommendation/ArticleCorrelationAffinityTest.php index 24fbadd03..6892c2ef0 --- a/tests/Business/Marketing/ArticleCorrelationAffinityTest.php +++ b/tests/Business/Recommendation/ArticleCorrelationAffinityTest.php @@ -12,12 +12,12 @@ */ declare(strict_types=1); -namespace phpOMS\tests\Business\Marketing; +namespace phpOMS\tests\Business\Recommendation; -use phpOMS\Business\Marketing\ArticleCorrelationAffinity; +use phpOMS\Business\Recommendation\ArticleCorrelationAffinity; /** - * @testdox phpOMS\tests\Business\Marketing\ArticleCorrelationAffinityTest: Article affinity/correlation + * @testdox phpOMS\tests\Business\Recommendation\ArticleCorrelationAffinityTest: Article affinity/correlation * * @internal */