Skip to content

Commit ba59a1e

Browse files
committed
Implemented PHPCompatibilityWP
1 parent 2eec5f2 commit ba59a1e

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"support",
1212
"documentation"
1313
],
14-
"license": "GPL-2.0-or-later",
14+
"license": "gpl-2.0-or-later",
15+
"homepage": "https://webberzone.com/plugins/knowledgebase/",
1516
"authors": [
1617
{
1718
"name": "WebberZone",
@@ -24,10 +25,12 @@
2425
"require-dev": {
2526
"szepeviktor/phpstan-wordpress": "^1",
2627
"phpstan/extension-installer": "^1",
28+
"phpstan/phpstan": "^1",
2729
"php-stubs/wordpress-stubs": "^6",
2830
"wp-coding-standards/wpcs": "^3",
2931
"dealerdirect/phpcodesniffer-composer-installer": "^1",
30-
"phpcompatibility/phpcompatibility-wp": "^2",
32+
"phpcompatibility/phpcompatibility-wp": "*",
33+
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",
3134
"yoast/phpunit-polyfills": "^3",
3235
"phpunit/phpunit": "^9 || ^10 || ^11 || ^12"
3336
},
@@ -37,6 +40,8 @@
3740
"dealerdirect/phpcodesniffer-composer-installer": true
3841
}
3942
},
43+
"minimum-stability": "dev",
44+
"prefer-stable": true,
4045
"scripts": {
4146
"phpstan": "vendor/bin/phpstan analyse --memory-limit=2048M",
4247
"phpstan-baseline": "vendor/bin/phpstan analyse --memory-limit=2048M --generate-baseline",

includes/admin/settings/class-metabox-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function sanitize_post_meta( $settings ) {
331331
$ids = array();
332332
$names = array();
333333

334-
$taxes = array_unique( str_getcsv( $settings[ $key ] ) );
334+
$taxes = array_unique( str_getcsv( $settings[ $key ], ',', '"', '' ) );
335335

336336
foreach ( $taxes as $tax ) {
337337
$tax_name = get_term_by( 'name', $tax, $fields['tax'] );

includes/admin/settings/class-settings-api.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ public function add_custom_menu_page( $menu ) {
418418
* Add admin menu.
419419
*/
420420
public function admin_menu() {
421-
global ${$this->prefix . '_menu_pages'};
422-
423421
foreach ( $this->menus as $menu ) {
424422
$menu_page = $this->add_custom_menu_page( $menu );
425423

@@ -428,7 +426,6 @@ public function admin_menu() {
428426
$this->settings_page = $menu_page;
429427
}
430428
}
431-
${$this->prefix . '_menu_pages'} = $this->menu_pages;
432429

433430
// Load the settings contextual help.
434431
add_action( 'load-' . $this->settings_page, array( $this, 'settings_help' ) );

includes/admin/settings/class-settings-sanitize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public static function str_putcsv( $input_array, $delimiter = ',', $enclosure =
416416
*/
417417
public static function sanitize_tax_slugs( &$settings, $source_key, $target_key ) {
418418
if ( isset( $settings[ $source_key ] ) ) {
419-
$slugs = array_unique( str_getcsv( $settings[ $source_key ] ) );
419+
$slugs = array_unique( str_getcsv( $settings[ $source_key ], ',', '"', '' ) );
420420

421421
foreach ( $slugs as $slug ) {
422422
// Pattern is Name (taxonomy:term_taxonomy_id).

phpcs.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@
3737
<rule ref="Generic.Commenting.Todo"/>
3838
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
3939

40+
<!-- Check for PHP 7.4+ compatibility. -->
41+
<config name="testVersion" value="7.4-"/>
42+
<rule ref="PHPCompatibilityWP"/>
43+
4044
</ruleset>

0 commit comments

Comments
 (0)