Skip to content

Commit

Permalink
Fix/phpstan issues (#412)
Browse files Browse the repository at this point in the history
* Ongoing cleanup

* WP_CLI adjusted
  • Loading branch information
lloc authored Feb 14, 2025
1 parent 9f1c75d commit 15fc10e
Show file tree
Hide file tree
Showing 41 changed files with 867 additions and 816 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.phpunit.cache
.phpunit.result.cache
.vscode/
composer.lock
composer.phar
js/msls-widget-block/
Expand Down
4 changes: 1 addition & 3 deletions MultisiteLanguageSwitcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,5 @@ function msls_get_query(): ?\lloc\Msls\MslsOptionsQuery {
}

lloc\Msls\MslsPlugin::init();
if ( defined( 'WP_CLI' ) && WP_CLI ) {
lloc\Msls\MslsCli::init();
}
lloc\Msls\MslsCli::init();
}
15 changes: 9 additions & 6 deletions bin/flags-png.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
$content = file_get_contents( 'build/translations.json' );
$json = json_decode( $content );
$glob = glob( 'flags/*.png' );
$icons = $not_found = [];
$exceptions = [
$icons = $not_found = array();
$exceptions = array(
'ca' => 'catalonia.png',
'eo' => 'europeanunion.png',
'cy' => 'wales.png',
Expand Down Expand Up @@ -83,7 +83,7 @@
'de_CH_informal' => 'ch.png',
'de_DE_formal' => 'de.png',
'nl_NL_formal' => 'nl.png',
];
);

echo '<?php', PHP_EOL, PHP_EOL;

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

array_walk( $glob, function ( &$item ) {
$item = substr( $item, 6 );
} );
array_walk(
$glob,
function ( &$item ) {
$item = substr( $item, 6 );
}
);

foreach ( array_chunk( $glob, 15 ) as $flags ) {
echo ' * ', implode( ', ', $flags ), PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion build/translations.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"scripts": {
"test": "vendor/bin/phpunit",
"coverage": "@php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-html tests/coverage",
"analyze": "vendor/bin/phpstan analyze",
"phpstan": "vendor/bin/phpstan analyze",
"playwright": "npx playwright test",
"php74": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 7.4",
"php81": "phpcs -p ./*.php includes/ --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1",
Expand Down
Loading

0 comments on commit 15fc10e

Please sign in to comment.