From 5a84f3b140d49eea7d49c1f16e41f5daeb72cda6 Mon Sep 17 00:00:00 2001 From: "erpeldinger.g" Date: Thu, 6 Feb 2025 17:37:13 +0100 Subject: [PATCH] fix(issue-107): explicit nullable type --- src/CipherSweet.php | 2 +- src/EncryptedField.php | 2 +- src/EncryptedRow.php | 4 ++-- tests/EncryptedMultiRowsTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CipherSweet.php b/src/CipherSweet.php index f00d77d..59830b0 100644 --- a/src/CipherSweet.php +++ b/src/CipherSweet.php @@ -36,7 +36,7 @@ final class CipherSweet */ public function __construct( KeyProviderInterface $keyProvider, - BackendInterface $backend = null + ?BackendInterface $backend = null ) { $this->keyProvider = $keyProvider; $this->backend = $backend ?: new BoringCrypto(); diff --git a/src/EncryptedField.php b/src/EncryptedField.php index 4fdd31d..f74130d 100644 --- a/src/EncryptedField.php +++ b/src/EncryptedField.php @@ -266,7 +266,7 @@ protected function getBlindIndexRaw( #[\SensitiveParameter] string $name, #[\SensitiveParameter] - SymmetricKey $key = null + ?SymmetricKey $key = null ): string { if (!isset($this->blindIndexes[$name])) { throw new BlindIndexNotFoundException( diff --git a/src/EncryptedRow.php b/src/EncryptedRow.php index 0a66899..05d0420 100644 --- a/src/EncryptedRow.php +++ b/src/EncryptedRow.php @@ -814,7 +814,7 @@ protected function calcBlindIndexRaw( array $row, string $column, BlindIndex $index, - SymmetricKey $key = null + ?SymmetricKey $key = null ): string { if (!$key) { $key = $this->engine->getBlindIndexRootKey( @@ -879,7 +879,7 @@ protected function calcCompoundIndexRaw( #[\SensitiveParameter] array $row, CompoundIndex $index, - SymmetricKey $key = null + ?SymmetricKey $key = null ): string { if (!$key) { $key = $this->engine->getBlindIndexRootKey( diff --git a/tests/EncryptedMultiRowsTest.php b/tests/EncryptedMultiRowsTest.php index d879a6a..b7bc6e9 100644 --- a/tests/EncryptedMultiRowsTest.php +++ b/tests/EncryptedMultiRowsTest.php @@ -236,7 +236,7 @@ private function getDummyPlaintext(): array * @throws CipherSweetException * @throws SodiumException */ - public function testXAllEngines(CipherSweet $engine = null): void + public function testXAllEngines(?CipherSweet $engine = null): void { $mr = $this->getMultiRows($engine); $rows = $this->getDummyPlaintext();