From 41c11cc1aa1b5c70d8d3afa142694508df9cccd0 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Thu, 5 Dec 2024 16:49:29 +0545 Subject: [PATCH] Remove nonrelevant methods --- includes/Traits/Version_Utils.php | 79 ------------------- tests/phpstan/bootstrap.php | 1 - .../tests/Traits/Version_Utils_Tests.php | 15 ---- 3 files changed, 95 deletions(-) diff --git a/includes/Traits/Version_Utils.php b/includes/Traits/Version_Utils.php index de74aba48..5617b54bc 100644 --- a/includes/Traits/Version_Utils.php +++ b/includes/Traits/Version_Utils.php @@ -47,51 +47,6 @@ protected function get_wordpress_latest_version(): string { return $version ?? get_bloginfo( 'version' ); } - /** - * Returns required PHP version. - * - * @since 1.4.0 - * - * @return string Required PHP version. - */ - protected function get_php_required_version(): string { - $version = $this->get_latest_version_info( 'php_version' ); - - return $version ?? $this->get_required_php_version(); - } - - /** - * Returns required MySQL version. - * - * @since 1.4.0 - * - * @return string Required MySQL version. - */ - protected function get_mysql_required_version(): string { - $version = $this->get_latest_version_info( 'mysql_version' ); - - return $version ?? $this->get_required_mysql_version(); - } - - /** - * Returns recommended PHP version. - * - * @since 1.4.0 - * - * @return string Recommended PHP version. - */ - protected function get_php_recommended_version(): string { - $recommended_version = '7.4'; // Default fallback recommended version. - - $version_details = wp_check_php_version(); - - if ( is_array( $version_details ) && ! empty( $version_details['recommended_version'] ) ) { - $recommended_version = $version_details['recommended_version']; - } - - return $recommended_version; - } - /** * Returns relative WordPress major version. * @@ -137,38 +92,4 @@ private function get_latest_version_info( string $key ) { return array_key_exists( $key, $info ) ? $info[ $key ] : null; } - - /** - * Returns the current WordPress' required PHP version. - * - * @since 1.4.0 - * - * @return string The current WordPress' required PHP version. - */ - private function get_required_php_version(): string { - static $required_php_version; - - if ( ! isset( $required_php_version ) ) { - require ABSPATH . WPINC . '/version.php'; - } - - return $required_php_version; - } - - /** - * Returns the current WordPress' required MySQL version. - * - * @since 1.4.0 - * - * @return string The current WordPress' required MySQL version. - */ - private function get_required_mysql_version(): string { - static $required_mysql_version; - - if ( ! isset( $required_mysql_version ) ) { - require ABSPATH . WPINC . '/version.php'; - } - - return $required_mysql_version; - } } diff --git a/tests/phpstan/bootstrap.php b/tests/phpstan/bootstrap.php index 6ee9d7f34..cd8695960 100644 --- a/tests/phpstan/bootstrap.php +++ b/tests/phpstan/bootstrap.php @@ -1,5 +1,4 @@ assertSame( '6.7', $version ); } - public function test_wordpress_required_php_version() { - $version = $this->get_php_required_version(); - $this->assertSame( '7.2.24', $version ); - } - - public function test_wordpress_required_mysql_version() { - $version = $this->get_mysql_required_version(); - $this->assertSame( '5.5.5', $version ); - } - - public function test_wordpress_recommended_php_version() { - $version = $this->get_php_recommended_version(); - $this->assertSame( '7.4', $version ); - } - /** * @dataProvider data_wordpress_version_items */