From 61c3dc9ef66aeebb0b7111b2b63086cdbd133993 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 26 Apr 2024 16:47:30 +0200 Subject: [PATCH 1/2] update minimum supported PHP version to 7.2 (#36) --- .github/workflows/test.yml | 2 +- README.md | 4 ++-- composer.json | 13 ++++++------- phpcs.xml | 2 +- statify-blacklist.php | 6 +++--- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 949a72c..f309a02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '5.6', '7.4', '8.0', '8.2', '8.4' ] + php: [ '7.4', '8.0', '8.2', '8.4' ] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/README.md b/README.md index 5e9773b..37373ff 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ * Contributors: stklcode * Requires at least: 4.7 * Tested up to: 6.8 -* Requires PHP: 5.5 +* Requires PHP: 7.2 * Stable tag: 1.7.2 * License: GPLv2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -55,7 +55,7 @@ The plugin is capable of handling multisite installations. * Goto _Settings_ -> _Statify Filter_ to configure the plugin ### Requirements ### -* PHP 5.5 or above +* PHP 7.2 or above * WordPress 4.7 or above * _Statify_ plugin installed and activated (1.5 or above) diff --git a/composer.json b/composer.json index 065a00c..9304196 100644 --- a/composer.json +++ b/composer.json @@ -18,17 +18,16 @@ ], "type": "wordpress-plugin", "require": { - "php": ">=5.5", - "composer/installers": "~v1.12|~v2.3" + "php": ">=7.2", + "composer/installers": "~v2.3" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^v1.0", - "phpunit/phpunit": "^5|^6|^7|^8|^9", - "phpunit/php-code-coverage": "*", + "dealerdirect/phpcodesniffer-composer-installer": "^v1.1", + "phpunit/phpunit": "^8|^9", "slowprog/composer-copy-file": "~0.3", - "squizlabs/php_codesniffer": "^3.12", + "squizlabs/php_codesniffer": "^3.13", "phpcompatibility/phpcompatibility-wp": "^2.1", - "wp-coding-standards/wpcs": "^3.1" + "wp-coding-standards/wpcs": "^3.2" }, "scripts": { "test-all": [ diff --git a/phpcs.xml b/phpcs.xml index 1e0c607..41070f1 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -24,6 +24,6 @@ - + diff --git a/statify-blacklist.php b/statify-blacklist.php index 1cb2219..311f484 100644 --- a/statify-blacklist.php +++ b/statify-blacklist.php @@ -12,7 +12,7 @@ * Description: Extension for the Statify plugin to add customizable filters. (formerly "Statify Blacklist") * Version: 1.7.2 * Requires at least: 4.7 - * Requires PHP: 5.5 + * Requires PHP: 7.2 * Requires Plugins: statify * Author: Stefan Kalscheuer (@stklcode) * Author URI: https://www.stklcode.de @@ -95,7 +95,7 @@ function statify_blacklist_autoload( $class_name ) { */ function statify_blacklist_compatibility_check() { return version_compare( $GLOBALS['wp_version'], '4.7', '>=' ) && - version_compare( phpversion(), '5.5', '>=' ); + version_compare( phpversion(), '7.2', '>=' ); } /** @@ -130,7 +130,7 @@ function statify_blacklist_disabled_notice() { /* translators: minimum version numbers for WordPress and PHP inserted at placeholders */ esc_html__( 'Statify Filter requires at least WordPress %1$s and PHP %2$s.', 'statify-blacklist' ), '4.7', - '5.5' + '7.2' ); echo '
'; printf( From 05d29518bfefdd815861df186db34b6499a2d1ac Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 26 Apr 2024 16:53:52 +0200 Subject: [PATCH 2/2] add type hints to method signatures --- inc/class-statifyblacklist-admin.php | 12 +++---- inc/class-statifyblacklist-settings.php | 46 ++++++++++++------------- inc/class-statifyblacklist-system.php | 14 ++++---- inc/class-statifyblacklist.php | 26 +++++++------- statify-blacklist.php | 8 ++--- test/StatifyBlacklist_Settings_Test.php | 6 ++-- test/StatifyBlacklist_System_Test.php | 2 +- test/StatifyBlacklist_Test.php | 16 ++++----- 8 files changed, 65 insertions(+), 65 deletions(-) diff --git a/inc/class-statifyblacklist-admin.php b/inc/class-statifyblacklist-admin.php index 023321b..f257413 100644 --- a/inc/class-statifyblacklist-admin.php +++ b/inc/class-statifyblacklist-admin.php @@ -26,7 +26,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { * * @since 1.5.0 */ - public static function init() { + public static function init(): void { // Add actions. add_action( 'wpmu_new_blog', array( 'StatifyBlacklist_System', 'install_site' ) ); add_action( 'delete_blog', array( 'StatifyBlacklist_System', 'uninstall_site' ) ); @@ -55,7 +55,7 @@ public static function init() { * * @since 1.0.0 */ - public static function add_menu_page() { + public static function add_menu_page(): void { $title = __( 'Statify Filter', 'statify-blacklist' ); if ( self::$multisite ) { add_options_page( @@ -86,7 +86,7 @@ public static function add_menu_page() { * * @since 1.0.0 */ - public static function plugin_meta_link( $links, $file ) { + public static function plugin_meta_link( array $links, string $file ): array { if ( STATIFYBLACKLIST_BASE === $file ) { $links[] = 'GitHub'; } @@ -104,7 +104,7 @@ public static function plugin_meta_link( $links, $file ) { * * @since 1.0.0 */ - public static function plugin_actions_links( $links, $file ) { + public static function plugin_actions_links( array $links, string $file ): array { $base = self::$multisite ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' ); if ( STATIFYBLACKLIST_BASE === $file && current_user_can( 'manage_options' ) ) { @@ -124,7 +124,7 @@ public static function plugin_actions_links( $links, $file ) { * * @global wpdb $wpdb WordPress database. */ - public static function cleanup_database() { + public static function cleanup_database(): void { // Check user permissions. if ( ! current_user_can( 'manage_options' ) && ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { die( esc_html__( 'Are you sure you want to do this?', 'statify-blacklist' ) ); @@ -206,7 +206,7 @@ public static function cleanup_database() { * * @since 1.1.1 */ - private static function sanitize_urls( $urls ) { + private static function sanitize_urls( array $urls ): array { return array_flip( array_filter( array_map( diff --git a/inc/class-statifyblacklist-settings.php b/inc/class-statifyblacklist-settings.php index 3944816..f97bec5 100644 --- a/inc/class-statifyblacklist-settings.php +++ b/inc/class-statifyblacklist-settings.php @@ -20,7 +20,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist { * * @return void */ - public static function register_settings() { + public static function register_settings(): void { register_setting( 'statify-blacklist', 'statify-blacklist', @@ -166,7 +166,7 @@ public static function register_settings() { * * @return void */ - public static function create_settings_page() { + public static function create_settings_page(): void { ?>

@@ -225,7 +225,7 @@ public static function create_settings_page() { * * @return void */ - public static function option_referer_active() { + public static function option_referer_active(): void { ?>
@@ -245,7 +245,7 @@ public static function option_referer_active() { * * @return void */ - public static function option_referer_cron() { + public static function option_referer_cron(): void { ?>
@@ -265,7 +265,7 @@ public static function option_referer_cron() { * * @return void */ - public static function option_referer_regexp() { + public static function option_referer_regexp(): void { ?>