From 618ef97a354799bb734f52217eeeb7bc69b0225e Mon Sep 17 00:00:00 2001 From: Robert Deutz Date: Wed, 16 Jul 2025 20:09:32 +0200 Subject: [PATCH 1/2] revert the change from call by reference to call by value --- src/OutputFilter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OutputFilter.php b/src/OutputFilter.php index be4b649e..b15a71c5 100644 --- a/src/OutputFilter.php +++ b/src/OutputFilter.php @@ -217,13 +217,13 @@ public static function ampReplace($text) /** * Cleans text of all formatting and scripting code. * - * @param ?string $text Text to clean + * @param string $text Text to clean * * @return string Cleaned text. * * @since 1.0 */ - public static function cleanText($text) + public static function cleanText(&$text) { $text = preg_replace("']*>.*?'si", '', $text); $text = preg_replace('/]*>([^<]+)<\/a>/is', '\2 (\1)', $text); From da9e4f1a44bef6b114aafa355be25d88366aacba Mon Sep 17 00:00:00 2001 From: Robert Deutz Date: Wed, 16 Jul 2025 20:11:20 +0200 Subject: [PATCH 2/2] phpstan fix --- phpstan-baseline.neon | 6 ++++++ src/OutputFilter.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5578f462..78094ae4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -17,3 +17,9 @@ parameters: identifier: function.alreadyNarrowedType count: 1 path: src/OutputFilter.php + + - + message: '#^Method Joomla\\Filter\\OutputFilter\:\:cleanText\(\) never assigns null to &\$text so it can be removed from the by\-ref type\.$#' + identifier: parameterByRef.unusedType + count: 1 + path: src/OutputFilter.php diff --git a/src/OutputFilter.php b/src/OutputFilter.php index b15a71c5..8643435c 100644 --- a/src/OutputFilter.php +++ b/src/OutputFilter.php @@ -217,7 +217,7 @@ public static function ampReplace($text) /** * Cleans text of all formatting and scripting code. * - * @param string $text Text to clean + * @param ?string $text Text to clean * * @return string Cleaned text. *