Skip to content

Commit de04095

Browse files
committed
Lint fix
1 parent ed1adba commit de04095

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

tests/tests/TestWPVersionResolverTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
class TestWPVersionResolverTest extends TestCase {
77

8-
private $temp_file;
8+
/**
9+
* @var string
10+
*/
11+
private $temp_file = '';
912

1013
protected function set_up() {
1114
parent::set_up();
@@ -25,7 +28,10 @@ protected function tear_down() {
2528
parent::tear_down();
2629
}
2730

28-
private function wp_versions_data() {
31+
/**
32+
* @return array<string, string>
33+
*/
34+
private function wp_versions_data(): array {
2935
return array(
3036
'5.4' => 'insecure',
3137
'5.9' => 'insecure',
@@ -45,7 +51,10 @@ private function wp_versions_data() {
4551
);
4652
}
4753

48-
public static function data_wp_version_resolver() {
54+
/**
55+
* @return array<int, array{0: string, 1: string}>
56+
*/
57+
public static function data_wp_version_resolver(): array {
4958
return array(
5059
array( '5.0', '5.0' ), // Does not match any version. So return as it is.
5160
array( '5', '5.9.2' ), // Return the latest major version.
@@ -68,8 +77,11 @@ public static function data_wp_version_resolver() {
6877

6978
/**
7079
* @dataProvider data_wp_version_resolver
80+
*
81+
* @param string $env
82+
* @param string $expected
7183
*/
72-
public function test_wp_version_resolver( $env, $expected ) {
84+
public function test_wp_version_resolver( $env, $expected ): void {
7385
if ( $env ) {
7486
putenv( "WP_VERSION=$env" );
7587
}

utils/wp-version-resolver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
2020

2121
curl_exec( $ch );
22-
curl_close( $ch );
22+
if ( PHP_VERSION_ID < 80000 ) { // curl_close() has no effect as of PHP 8.0.
23+
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.curl_closeDeprecated,Generic.PHP.DeprecatedFunctions.Deprecated
24+
curl_close( $ch );
25+
}
2326
fclose( $fp );
2427
}
2528

0 commit comments

Comments
 (0)