From f87af02c112e4afdc42ee002e3ce86531df70ab5 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 28 Nov 2024 08:28:44 +0000 Subject: [PATCH] Bring lib/ up to php8.4 standards (Breaking the diff against shish/safe into smaller parts for easier reviewing) --- lib/Exceptions/CurlException.php | 1 - lib/Exceptions/JsonException.php | 1 - lib/Exceptions/OpensslException.php | 1 - lib/Exceptions/PcreException.php | 3 +-- lib/Exceptions/SafeExceptionInterface.php | 2 -- lib/Exceptions/SimplexmlException.php | 1 + lib/special_cases.php | 12 ++++++------ 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/Exceptions/CurlException.php b/lib/Exceptions/CurlException.php index 3401b57b..802c37df 100644 --- a/lib/Exceptions/CurlException.php +++ b/lib/Exceptions/CurlException.php @@ -1,6 +1,5 @@ 'PREG_BAD_UTF8_OFFSET_ERROR', PREG_JIT_STACKLIMIT_ERROR => 'PREG_JIT_STACKLIMIT_ERROR', ]; - $errMsg = $errorMap[preg_last_error()] ?? 'Unknown PCRE error: '.preg_last_error(); + $errMsg = $errorMap[preg_last_error()] ?? 'Unknown PCRE error: ' . preg_last_error(); return new self($errMsg, \preg_last_error()); } } diff --git a/lib/Exceptions/SafeExceptionInterface.php b/lib/Exceptions/SafeExceptionInterface.php index fbea6ad2..cc7f71fc 100644 --- a/lib/Exceptions/SafeExceptionInterface.php +++ b/lib/Exceptions/SafeExceptionInterface.php @@ -1,9 +1,7 @@ = 80100) { - /** @phpstan-ignore-next-line */ $result = \fputcsv($stream, $fields, $separator, $enclosure, $escape, $eol); } else { $result = \fputcsv($stream, $fields, $separator, $enclosure, $escape); @@ -431,7 +431,7 @@ function fputcsv($stream, array $fields, string $separator = ",", string $enclos * @throws FilesystemException * */ -function fgetcsv($stream, int $length = null, string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false +function fgetcsv($stream, ?int $length = null, string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false { error_clear_last(); $safeResult = \fgetcsv($stream, $length, $separator, $enclosure, $escape);