Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
malberts committed Apr 25, 2024
1 parent 934ca91 commit 8b3ee7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
7 changes: 1 addition & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ parameters:
path: src/ResourceLoaderSCSSModule.php

-
message: "#^Method SCSS\\\\ResourceLoaderSCSSModule\\:\\:collateStyleFilesByPosition\\(\\) should return array\\<array\\<string\\>\\> but returns array\\<string, array\\<int, MediaWiki\\\\ResourceLoader\\\\FilePath\\|string\\>\\>\\.$#"
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
29 changes: 6 additions & 23 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.12.0@f90118cdeacd0088e7215e64c0c99ceca819e176">
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<file src="src/ResourceLoaderSCSSModule.php">
<DocblockTypeContradiction>
<code>is_array( $value )</code>
<code><![CDATA[is_array( $value )]]></code>
</DocblockTypeContradiction>
<MixedArrayAccess>
<code><![CDATA[$value['position']]]></code>
</MixedArrayAccess>
<MixedArrayOffset>
<code>$collatedFiles[$optionValue]</code>
<code>$collatedFiles[$optionValue]</code>
<code>$collatedFiles[$optionValue]</code>
</MixedArrayOffset>
<MixedArrayTypeCoercion>
<code>$collatedFiles[$optionValue]</code>
</MixedArrayTypeCoercion>
<MixedAssignment>
<code>$cacheResult</code>
<code>$collatedFiles[$optionValue][]</code>
<code>$optionValue</code>
<code><![CDATA[$cacheResult]]></code>
<code><![CDATA[$this->cacheTriggers]]></code>
<code><![CDATA[$this->paths]]></code>
<code><![CDATA[$this->variables]]></code>
</MixedAssignment>
<MixedReturnTypeCoercion>
<code>$collatedFiles</code>
<code>string[][]</code>
</MixedReturnTypeCoercion>
<RedundantConditionGivenDocblockType>
<code>$triggerFile !== null</code>
<code>is_int( $key )</code>
<code><![CDATA[$triggerFile !== null]]></code>
<code><![CDATA[is_int( $key )]]></code>
</RedundantConditionGivenDocblockType>
<UnusedClass>
<code>ResourceLoaderSCSSModule</code>
<code><![CDATA[ResourceLoaderSCSSModule]]></code>
</UnusedClass>
</file>
</files>
3 changes: 2 additions & 1 deletion src/ResourceLoaderSCSSModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Exception;
use MediaWiki\ResourceLoader\Context;
use MediaWiki\ResourceLoader\FileModule;
use MediaWiki\ResourceLoader\FilePath;
use ObjectCache;
use ScssPhp\ScssPhp\Compiler;

Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 8b3ee7a

Please sign in to comment.