Skip to content

Improve psalm (#50) #229

Improve psalm (#50)

Improve psalm (#50) #229

Triggered via push March 16, 2024 13:55
Status Success
Total duration 36s
Artifacts

mutation.yml

on: push
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L58
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ throw new \RuntimeException('Encryption requires the OpenSSL PHP extension.'); } if (!array_key_exists($cipher, self::ALLOWED_CIPHERS)) { - throw new \RuntimeException($cipher . ' is not an allowed cipher.'); + throw new \RuntimeException(' is not an allowed cipher.' . $cipher); } $this->cipher = $cipher; }
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L58
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ throw new \RuntimeException('Encryption requires the OpenSSL PHP extension.'); } if (!array_key_exists($cipher, self::ALLOWED_CIPHERS)) { - throw new \RuntimeException($cipher . ' is not an allowed cipher.'); + throw new \RuntimeException(' is not an allowed cipher.'); } $this->cipher = $cipher; }
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L58
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ throw new \RuntimeException('Encryption requires the OpenSSL PHP extension.'); } if (!array_key_exists($cipher, self::ALLOWED_CIPHERS)) { - throw new \RuntimeException($cipher . ' is not an allowed cipher.'); + throw new \RuntimeException($cipher); } $this->cipher = $cipher; }
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L229
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ $iv = random_bytes($blockSize); $encrypted = openssl_encrypt($data, $this->cipher, $key, OPENSSL_RAW_DATA, $iv); if ($encrypted === false) { - throw new \RuntimeException('OpenSSL failure on encryption: ' . openssl_error_string()); + throw new \RuntimeException(openssl_error_string() . 'OpenSSL failure on encryption: '); } $authKey = hash_hkdf($this->kdfAlgorithm, $key, $keySize, $this->authorizationKeyInfo); $signed = (new Mac())->sign($iv . $encrypted, $authKey);
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L229
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ $iv = random_bytes($blockSize); $encrypted = openssl_encrypt($data, $this->cipher, $key, OPENSSL_RAW_DATA, $iv); if ($encrypted === false) { - throw new \RuntimeException('OpenSSL failure on encryption: ' . openssl_error_string()); + throw new \RuntimeException('OpenSSL failure on encryption: '); } $authKey = hash_hkdf($this->kdfAlgorithm, $key, $keySize, $this->authorizationKeyInfo); $signed = (new Mac())->sign($iv . $encrypted, $authKey);
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L284
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ $encrypted = StringHelper::byteSubstring($data, $blockSize); $decrypted = openssl_decrypt($encrypted, $this->cipher, $key, OPENSSL_RAW_DATA, $iv); if ($decrypted === false) { - throw new \RuntimeException('OpenSSL failure on decryption: ' . openssl_error_string()); + throw new \RuntimeException(openssl_error_string() . 'OpenSSL failure on decryption: '); } return $decrypted; } }
mutation / PHP 8.1-ubuntu-latest: src/Crypt.php#L284
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ $encrypted = StringHelper::byteSubstring($data, $blockSize); $decrypted = openssl_decrypt($encrypted, $this->cipher, $key, OPENSSL_RAW_DATA, $iv); if ($decrypted === false) { - throw new \RuntimeException('OpenSSL failure on decryption: ' . openssl_error_string()); + throw new \RuntimeException('OpenSSL failure on decryption: '); } return $decrypted; } }
mutation / PHP 8.1-ubuntu-latest: src/Random.php#L38
Escaped Mutant for Mutator "Multiplication": --- Original +++ New @@ @@ } // Optimization: we can generate a quarter fewer bits to completely cover the desired length in base64 /** @psalm-suppress ArgumentTypeCoercion */ - $bytes = random_bytes((int) ceil($length * 0.75)); + $bytes = random_bytes((int) ceil($length / 0.75)); return substr(StringHelper::base64UrlEncode($bytes), 0, $length); } }
mutation / PHP 8.1-ubuntu-latest: src/Random.php#L38
Escaped Mutant for Mutator "RoundingFamily": --- Original +++ New @@ @@ } // Optimization: we can generate a quarter fewer bits to completely cover the desired length in base64 /** @psalm-suppress ArgumentTypeCoercion */ - $bytes = random_bytes((int) ceil($length * 0.75)); + $bytes = random_bytes((int) round($length * 0.75)); return substr(StringHelper::base64UrlEncode($bytes), 0, $length); } }
mutation / PHP 8.1-ubuntu-latest: src/TokenMask.php#L30
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ // The number of bytes in a mask is always equal to the number of bytes in a token. /** @psalm-suppress ArgumentTypeCoercion */ $mask = random_bytes(StringHelper::byteLength($token)); - return StringHelper::base64UrlEncode($mask . ($mask ^ $token)); + return StringHelper::base64UrlEncode(($mask ^ $token) . $mask); } /** * Unmasks a token previously masked by `mask`.