diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05e7b40..3584e6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index a857bce..a93390b 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -31,4 +31,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1', '8.2', '8.3'] + ['8.1', '8.2', '8.3', '8.4'] diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 457772a..5d6931d 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -21,4 +21,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.3'] + ['8.4'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e33eca8..d03874d 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -29,4 +29,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1', '8.2', '8.3'] + ['8.1', '8.2', '8.3', '8.4'] diff --git a/CHANGELOG.md b/CHANGELOG.md index e12ea1c..2b23d70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index 62423e0..28eeea5 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ } ], "require": { - "php": "^8.1", + "php": "8.1 - 8.4", "ext-hash": "*", "ext-openssl": "*", "yiisoft/strings": "^2.0" @@ -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": { diff --git a/psalm.xml b/psalm.xml index b48c894..679cd9b 100644 --- a/psalm.xml +++ b/psalm.xml @@ -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" diff --git a/src/Crypt.php b/src/Crypt.php index 423a57e..803730b 100644 --- a/src/Crypt.php +++ b/src/Crypt.php @@ -240,6 +240,10 @@ private function encrypt( $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()); } @@ -300,6 +304,10 @@ private function decrypt( $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()); } diff --git a/src/PasswordHasher.php b/src/PasswordHasher.php index ac44ef2..a024a6a 100644 --- a/src/PasswordHasher.php +++ b/src/PasswordHasher.php @@ -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] ?? [];