Skip to content

Commit 15fc10e

Browse files
authored
Fix/phpstan issues (#412)
* Ongoing cleanup * WP_CLI adjusted
1 parent 9f1c75d commit 15fc10e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+867
-816
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.idea/
33
.phpunit.cache
44
.phpunit.result.cache
5+
.vscode/
56
composer.lock
67
composer.phar
78
js/msls-widget-block/

MultisiteLanguageSwitcher.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,5 @@ function msls_get_query(): ?\lloc\Msls\MslsOptionsQuery {
231231
}
232232

233233
lloc\Msls\MslsPlugin::init();
234-
if ( defined( 'WP_CLI' ) && WP_CLI ) {
235-
lloc\Msls\MslsCli::init();
236-
}
234+
lloc\Msls\MslsCli::init();
237235
}

bin/flags-png.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
$content = file_get_contents( 'build/translations.json' );
3131
$json = json_decode( $content );
3232
$glob = glob( 'flags/*.png' );
33-
$icons = $not_found = [];
34-
$exceptions = [
33+
$icons = $not_found = array();
34+
$exceptions = array(
3535
'ca' => 'catalonia.png',
3636
'eo' => 'europeanunion.png',
3737
'cy' => 'wales.png',
@@ -83,7 +83,7 @@
8383
'de_CH_informal' => 'ch.png',
8484
'de_DE_formal' => 'de.png',
8585
'nl_NL_formal' => 'nl.png',
86-
];
86+
);
8787

8888
echo '<?php', PHP_EOL, PHP_EOL;
8989

@@ -121,9 +121,12 @@
121121
if ( $count > 0 ) {
122122
echo '/**', PHP_EOL, " * {$count} unused icons in flags/", PHP_EOL, ' * ', PHP_EOL;
123123

124-
array_walk( $glob, function ( &$item ) {
125-
$item = substr( $item, 6 );
126-
} );
124+
array_walk(
125+
$glob,
126+
function ( &$item ) {
127+
$item = substr( $item, 6 );
128+
}
129+
);
127130

128131
foreach ( array_chunk( $glob, 15 ) as $flags ) {
129132
echo ' * ', implode( ', ', $flags ), PHP_EOL;

build/translations.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"scripts": {
3737
"test": "vendor/bin/phpunit",
3838
"coverage": "@php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-html tests/coverage",
39-
"analyze": "vendor/bin/phpstan analyze",
39+
"phpstan": "vendor/bin/phpstan analyze",
4040
"playwright": "npx playwright test",
4141
"php74": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 7.4",
4242
"php81": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1",

0 commit comments

Comments
 (0)