From c4af7045528c32855a69eb3f2a479bcfce02ea02 Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 2 Feb 2026 07:30:00 -0500 Subject: [PATCH] chore: fixup CryptoSessionDataTest from review Signed-off-by: Josh --- tests/lib/Session/CryptoSessionDataTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php index e4d6c0775b9..e56d277f19e 100644 --- a/tests/lib/Session/CryptoSessionDataTest.php +++ b/tests/lib/Session/CryptoSessionDataTest.php @@ -33,7 +33,7 @@ class CryptoSessionDataTest extends Session { private const TAMPERED_BLOB = 'garbage-data'; private const MALFORMED_JSON_BLOB = '{not:valid:json}'; - protected ICrypto|MockObject $crypto; + protected ICrypto&MockObject $crypto; protected ISession $session; protected function setUp(): void { @@ -171,7 +171,7 @@ class CryptoSessionDataTest extends Session { }); $crypto->method('decrypt')->willReturnCallback(function ($input, $passphrase = null) { // Only successfully decrypt if the embedded passphrase matches - if (strpos($input, $passphrase . '#') === 0 && strrpos($input, '#' . $passphrase) === strlen($input) - strlen('#' . $passphrase)) { + if (str_starts_with($input, $passphrase . '#') && str_ends_with($input, '#' . $passphrase)) { // Strip off passphrase markers and return the "decrypted" string return substr($input, strlen($passphrase . '#'), -strlen('#' . $passphrase)); }