From 29503101e58ae1b1f826e61f482f34982e61bde8 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 11 Mar 2024 22:44:41 +0100 Subject: [PATCH] build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0 Change-Id: I14948431331e02e0659e80b159f4b2e0ed0469ef --- composer.json | 7 +++++- includes/Hooks.php | 2 +- includes/RSSParser.php | 54 +++++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index 605b0a5..735a230 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "mediawiki/mediawiki-codesniffer": "41.0.0", + "mediawiki/mediawiki-codesniffer": "43.0.0", "mediawiki/mediawiki-phan-config": "0.14.0", "mediawiki/minus-x": "1.1.1", "php-parallel-lint/php-console-highlighter": "1.0.0", @@ -18,5 +18,10 @@ ], "phan": "phan -d . --long-progress-bar", "phpcs": "phpcs -sp --cache" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/includes/Hooks.php b/includes/Hooks.php index 2f24cd4..dc6fb31 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -30,7 +30,7 @@ class Hooks implements ParserFirstCallInitHook { */ public static function renderRss( $input, array $args, Parser $parser, PPFrame $frame ) { global $wgRSSCacheAge, $wgRSSCacheCompare, $wgRSSNamespaces, - $wgRSSUrlWhitelist,$wgRSSAllowedFeeds; + $wgRSSUrlWhitelist, $wgRSSAllowedFeeds; if ( is_array( $wgRSSNamespaces ) && count( $wgRSSNamespaces ) ) { $nsUsed = $parser->getTitle()->getNamespace(); diff --git a/includes/RSSParser.php b/includes/RSSParser.php index 1dbbb5f..02f6814 100644 --- a/includes/RSSParser.php +++ b/includes/RSSParser.php @@ -71,7 +71,7 @@ class RSSParser { * @param array $args */ public function __construct( $url, $args ) { - global $wgRSSDateDefaultFormat,$wgRSSItemMaxLength; + global $wgRSSDateDefaultFormat, $wgRSSItemMaxLength; $this->url = $url; @@ -223,7 +223,7 @@ class RSSParser { return false; } - list( $etag, $lastModified, $rss ) = $data; + [ $etag, $lastModified, $rss ] = $data; if ( !isset( $rss->items ) ) { return false; } @@ -424,29 +424,29 @@ class RSSParser { foreach ( array_keys( $item ) as $info ) { if ( $item[$info] != "" ) { switch ( $info ) { - // ATOM elements and RSS elements are item link urls - case 'id': - $txt = $this->sanitizeUrl( $item['id'] ); - $renderedItem = str_replace( '{{{link}}}', $txt, $renderedItem ); - break; - case 'link': - $txt = $this->sanitizeUrl( $item['link'] ); - $renderedItem = str_replace( '{{{link}}}', $txt, $renderedItem ); - break; - case 'date': - $tempTimezone = date_default_timezone_get(); - date_default_timezone_set( 'UTC' ); - $txt = date( $this->date, - strtotime( $this->escapeTemplateParameter( $item['date'] ) ) ); - date_default_timezone_set( $tempTimezone ); - $renderedItem = str_replace( '{{{date}}}', $txt, $renderedItem ); - break; - default: - $str = $this->escapeTemplateParameter( $item[$info] ); - $str = $parser->getTargetLanguage()->truncateForVisual( $str, $this->ItemMaxLength ); - $str = $this->highlightTerms( $str ); - $renderedItem = str_replace( '{{{' . $info . '}}}', - $this->insertStripItem( $str ), $renderedItem ); + // ATOM elements and RSS elements are item link urls + case 'id': + $txt = $this->sanitizeUrl( $item['id'] ); + $renderedItem = str_replace( '{{{link}}}', $txt, $renderedItem ); + break; + case 'link': + $txt = $this->sanitizeUrl( $item['link'] ); + $renderedItem = str_replace( '{{{link}}}', $txt, $renderedItem ); + break; + case 'date': + $tempTimezone = date_default_timezone_get(); + date_default_timezone_set( 'UTC' ); + $txt = date( $this->date, + strtotime( $this->escapeTemplateParameter( $item['date'] ) ) ); + date_default_timezone_set( $tempTimezone ); + $renderedItem = str_replace( '{{{date}}}', $txt, $renderedItem ); + break; + default: + $str = $this->escapeTemplateParameter( $item[$info] ); + $str = $parser->getTargetLanguage()->truncateForVisual( $str, $this->ItemMaxLength ); + $str = $this->highlightTerms( $str ); + $renderedItem = str_replace( '{{{' . $info . '}}}', + $this->insertStripItem( $str ), $renderedItem ); } } } @@ -527,8 +527,8 @@ class RSSParser { $text = str_replace( [ - '[', '|', ']', '\'', 'ISBN ', - 'RFC ', '://', "\n=", '{{', '}}', + '[', '|', ']', '\'', 'ISBN ', + 'RFC ', '://', "\n=", '{{', '}}', ], [ '[', '|', ']', ''', 'ISBN ',