From 8b3ee7ab47c7048d69d6b04565f850c89b4797ec Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Thu, 25 Apr 2024 18:06:22 +0200 Subject: [PATCH] Fix CS --- phpstan-baseline.neon | 7 +------ psalm-baseline.xml | 29 ++++++----------------------- src/ResourceLoaderSCSSModule.php | 3 ++- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 47e1a93..124a394 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -11,11 +11,6 @@ parameters: path: src/ResourceLoaderSCSSModule.php - - message: "#^Method SCSS\\\\ResourceLoaderSCSSModule\\:\\:collateStyleFilesByPosition\\(\\) should return array\\\\> but returns array\\\\>\\.$#" - count: 1 - path: src/ResourceLoaderSCSSModule.php - - - - message: "#^Offset 'position' on \\*NEVER\\* on left side of \\?\\? always exists and is always null\\.$#" + message: "#^Offset 'position' on \\*NEVER\\* on left side of \\?\\? always exists and is not nullable\\.$#" count: 1 path: src/ResourceLoaderSCSSModule.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 167d6da..42e41ec 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,38 +1,21 @@ - + - is_array( $value ) + - - - - - $collatedFiles[$optionValue] - $collatedFiles[$optionValue] - $collatedFiles[$optionValue] - - - $collatedFiles[$optionValue] - - $cacheResult - $collatedFiles[$optionValue][] - $optionValue + cacheTriggers]]> paths]]> variables]]> - - $collatedFiles - string[][] - - $triggerFile !== null - is_int( $key ) + + - ResourceLoaderSCSSModule + diff --git a/src/ResourceLoaderSCSSModule.php b/src/ResourceLoaderSCSSModule.php index e293edb..b47fcc5 100644 --- a/src/ResourceLoaderSCSSModule.php +++ b/src/ResourceLoaderSCSSModule.php @@ -30,6 +30,7 @@ use Exception; use MediaWiki\ResourceLoader\Context; use MediaWiki\ResourceLoader\FileModule; +use MediaWiki\ResourceLoader\FilePath; use ObjectCache; use ScssPhp\ScssPhp\Compiler; @@ -273,7 +274,7 @@ private function collateStyleFilesByPosition(): array { if ( !isset( $collatedFiles['main'] ) ) { $collatedFiles['main'] = []; } - $collatedFiles['main'][] = $value; + $collatedFiles['main'][] = $value instanceof FilePath ? $value->getPath() : $value; } elseif ( is_array( $value ) ) { // File name as the key, options array as the value $optionValue = $value['position'] ?? 'main';