Skip to content

Commit 29ca913

Browse files
authored
Chore maintenance (#54)
* Composer update * Tested up to 6.9 * PCP issues addressed * PHPCS configured * Patch excluded from plugin check * Unit test adjusted * Packages updated
1 parent a304b12 commit 29ca913

File tree

8 files changed

+192
-166
lines changed

8 files changed

+192
-166
lines changed

.github/workflows/code-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- name: Composer dependencies
1010
run: composer install
1111
- name: Run Testsuite
12-
run: composer run-script cs
12+
run: composer run-script phpcs

.github/workflows/plugin-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ jobs:
1717
- name: Run plugin check
1818
uses: wordpress/plugin-check-action@v1
1919
with:
20-
build-dir: './multisyde'
20+
build-dir: './multisyde'
21+
exclude-files: 'modules/**/patches/*.php'

.phpcs.xml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
<arg name="extensions" value="php"/>
1212
<arg name="cache" value=".phpcs.cache"/>
1313

14+
<rule ref="PHPCompatibilityWP" />
15+
1416
<rule ref="WordPress">
1517
<!-- PSR4 -->
1618
<exclude name="WordPress.Files.FileName" />
1719
</rule>
1820
<rule ref="WordPress-Extra"/>
1921
<rule ref="WordPress-Docs"/>
22+
23+
<exclude-pattern>*/node_modules/*</exclude-pattern>
24+
<exclude-pattern>*/vendor/*</exclude-pattern>
2025
</ruleset>

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"config": {
3636
"allow-plugins": {
3737
"dealerdirect/phpcodesniffer-composer-installer": true,
38-
"phpstan/extension-installer": true
38+
"phpstan/extension-installer": true,
39+
"lloc/composer-i18n-scripts": true
3940
}
4041
},
4142
"require-dev": {
@@ -44,19 +45,20 @@
4445
"phpstan/extension-installer": "^1.4",
4546
"phpunit/phpunit": "^9.6",
4647
"brain/monkey": "^2.0@dev",
47-
"phpstan/phpstan-mockery": "^2.0"
48+
"phpstan/phpstan-mockery": "^2.0",
49+
"lloc/composer-i18n-scripts": "^1.0",
50+
"phpcompatibility/phpcompatibility-wp": "^2.1"
4851
},
4952
"scripts": {
5053
"tests": "./vendor/bin/phpunit -c ./phpunit.xml.dist",
5154
"tests:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./phpunit.xml.dist --coverage-html ./tests/coverage",
52-
"cs": "./vendor/bin/phpcs .",
53-
"cs:fix": "./vendor/bin/phpcbf .",
55+
"phpcs": "vendor/bin/phpcs .",
56+
"phpcbf": "./vendor/bin/phpcbf .",
5457
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=1G",
5558
"qa": [
5659
"@cs",
5760
"@phpstan"
5861
],
59-
"i18n:pot": "wp i18n make-pot . languages/multisyde.pot",
6062
"git-release": "bin/git-release.sh",
6163
"build": [
6264
"@composer install --no-dev",

modules/SiteActivePlugins/Feature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ final class Feature implements LoadableFeature {
1818
const NOTICE_DEACTIVATION = 'bulk_deactivated';
1919

2020
const DEFAULT_MAX_SITES = 100;
21+
const FILTER_MAX_SITES = 'multisyde_site_active_plugins_max_sites';
2122

2223
/**
2324
* The active plugins in the sites in the network.
@@ -161,7 +162,7 @@ public function populate_active_plugins(): void {
161162
*
162163
* @param int $max_sites The maximum number of sites to show for each plugin.
163164
*/
164-
$max_sites = apply_filters( 'site_active_plugins_max_sites', self::DEFAULT_MAX_SITES );
165+
$max_sites = apply_filters( self::FILTER_MAX_SITES, self::DEFAULT_MAX_SITES );
165166
$site_ids = get_sites(
166167
array(
167168
'fields' => 'ids',

modules/SiteActivePlugins/tests/unit/TestFeature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function test_populate_active_plugins_network_active(): void {
202202
public function test_populate_active_plugins_max_sites(): void {
203203
$max_sites = 5;
204204

205-
Filters\expectApplied( 'site_active_plugins_max_sites' )->once()->with( 100 )->andReturn( $max_sites );
205+
Filters\expectApplied( Feature::FILTER_MAX_SITES )->once()->with( 100 )->andReturn( $max_sites );
206206

207207
$args = array(
208208
'fields' => 'ids',

0 commit comments

Comments
 (0)