Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.1', '8.2', '8.3']
['8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.1', '8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.3']
['8.4']
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.1', '8.2', '8.3', '8.4']
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Enh #62: Use `SensitiveParameter` attribute to mark sensitive parameters (@dehbka, @vjik)
- Chg #66: Bump minimal required PHP version to 8.1 (@vjik)
- Enh #66: Mark readonly properties (@vjik)
- Chg #67: Change PHP constraint in `composer.json` to `8.1 - 8.4` (@vjik)
- Bug #67: Explicitly mark nullable parameters (@vjik)

## 1.0.2 March 18, 2024

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
],
"require": {
"php": "^8.1",
"php": "8.1 - 8.4",
"ext-hash": "*",
"ext-openssl": "*",
"yiisoft/strings": "^2.0"
Expand All @@ -45,7 +45,7 @@
"rector/rector": "^2.0.9",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^5.26.1"
"vimeo/psalm": "^5.26.1 || ^6.8.8"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
strictBinaryOperands="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
8 changes: 8 additions & 0 deletions src/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
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.');

Check warning on line 55 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Concat": @@ @@ 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); } } /**

Check warning on line 55 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ 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.'); } } /**

Check warning on line 55 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ 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); } } /**
}
}

Expand Down Expand Up @@ -240,7 +240,11 @@

$encrypted = openssl_encrypt($data, $this->cipher, $key, OPENSSL_RAW_DATA, $iv);
if ($encrypted === false) {
/**
* @psalm-suppress PossiblyFalseOperand `openssl_encrypt()` is returned `false`, so `openssl_error_string()`
* always returns string.
*/
throw new \RuntimeException('OpenSSL failure on encryption: ' . openssl_error_string());

Check warning on line 247 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Concat": @@ @@ * @psalm-suppress PossiblyFalseOperand `openssl_encrypt()` is returned `false`, so `openssl_error_string()` * always returns string. */ - 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);

Check warning on line 247 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ * @psalm-suppress PossiblyFalseOperand `openssl_encrypt()` is returned `false`, so `openssl_error_string()` * always returns string. */ - 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);
}

$authKey = hash_hkdf($this->kdfAlgorithm, $key, $keySize, $this->authorizationKeyInfo);
Expand Down Expand Up @@ -300,7 +304,11 @@

$decrypted = openssl_decrypt($encrypted, $this->cipher, $key, OPENSSL_RAW_DATA, $iv);
if ($decrypted === false) {
/**
* @psalm-suppress PossiblyFalseOperand `openssl_decrypt()` is returned `false`, so `openssl_error_string()`
* always returns string.
*/
throw new \RuntimeException('OpenSSL failure on decryption: ' . openssl_error_string());

Check warning on line 311 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Concat": @@ @@ * @psalm-suppress PossiblyFalseOperand `openssl_decrypt()` is returned `false`, so `openssl_error_string()` * always returns string. */ - throw new \RuntimeException('OpenSSL failure on decryption: ' . openssl_error_string()); + throw new \RuntimeException(openssl_error_string() . 'OpenSSL failure on decryption: '); } return $decrypted; } }

Check warning on line 311 in src/Crypt.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ * @psalm-suppress PossiblyFalseOperand `openssl_decrypt()` is returned `false`, so `openssl_error_string()` * always returns string. */ - throw new \RuntimeException('OpenSSL failure on decryption: ' . openssl_error_string()); + throw new \RuntimeException('OpenSSL failure on decryption: '); } return $decrypted; } }
}

return $decrypted;
Expand Down
2 changes: 1 addition & 1 deletion src/PasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class PasswordHasher
*/
public function __construct(
private readonly ?string $algorithm = PASSWORD_DEFAULT,
array $parameters = null,
?array $parameters = null,
) {
if ($parameters === null) {
$this->parameters = self::SAFE_PARAMETERS[$this->algorithm] ?? [];
Expand Down
Loading