diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 2810c03d2..c6e97aa2d 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -25,7 +25,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: 'latest' coverage: none tools: cs2pr diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 2be1b2317..f3d3852ed 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -71,12 +71,6 @@ - - - - @@ -86,7 +80,7 @@ ========================================================================== --> - + - + @@ -133,6 +127,12 @@ + + + + + + @@ -173,7 +173,7 @@ - + diff --git a/composer.json b/composer.json index 1ef18733b..94269ca4c 100644 --- a/composer.json +++ b/composer.json @@ -41,14 +41,12 @@ "ext-json": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", "requests/test-server": "dev-main", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", - "wp-coding-standards/wpcs": "^2.0", + "wp-coding-standards/wpcs": "^3.0", "yoast/phpunit-polyfills": "^2.0.0" }, "suggest": { diff --git a/library/Requests.php b/library/Requests.php index 14dcba4c0..af9acbd11 100644 --- a/library/Requests.php +++ b/library/Requests.php @@ -53,6 +53,8 @@ class Requests extends WpOrg\Requests\Requests { * * @codeCoverageIgnore * + * @phpcs:disable Universal.NamingConventions.NoReservedKeywordParameterNames.classFound -- Deprecated, so not relevant to change. + * * @param string $class Class name to load */ public static function autoloader($class) { diff --git a/src/Session.php b/src/Session.php index 6e713d3fe..21d51ba19 100644 --- a/src/Session.php +++ b/src/Session.php @@ -227,7 +227,13 @@ public function patch($url, $headers, $data = [], $options = []) { * @throws \WpOrg\Requests\Exception On invalid URLs (`nonhttp`) */ public function request($url, $headers = [], $data = [], $type = Requests::GET, $options = []) { - $request = $this->merge_request(compact('url', 'headers', 'data', 'options')); + $request = [ + 'url' => $url, + 'headers' => $headers, + 'data' => $data, + 'options' => $options, + ]; + $request = $this->merge_request($request); return Requests::request($request['url'], $request['headers'], $request['data'], $type, $request['options']); } diff --git a/tests/Autoload/AutoloadTest.php b/tests/Autoload/AutoloadTest.php index e9876bf04..75fcb7680 100644 --- a/tests/Autoload/AutoloadTest.php +++ b/tests/Autoload/AutoloadTest.php @@ -67,7 +67,7 @@ static function ($errno, $errstr) { public function testAutoloadOfOldRequestsClassDoesNotThrowAFatalForFinalClass() { define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true); - $this->assertInstanceOf(FilteredIterator::class, new Requests_utility_filteredIterator([], static function() {})); + $this->assertInstanceOf(FilteredIterator::class, new Requests_utility_filteredIterator([], static function () {})); } /** diff --git a/tests/Cookie/ConstructorTest.php b/tests/Cookie/ConstructorTest.php index d9b32b065..0d4d6d0cf 100644 --- a/tests/Cookie/ConstructorTest.php +++ b/tests/Cookie/ConstructorTest.php @@ -356,7 +356,7 @@ public function testAttributesAreNormalizedInDictionary() { * * @return array */ - private function arrayUnshiftAssoc($base_array, $key, $value ) { + private function arrayUnshiftAssoc($base_array, $key, $value) { $base_array = array_reverse($base_array, true); $base_array[$key] = $value; return array_reverse($base_array, true); diff --git a/tests/Hooks/DispatchTest.php b/tests/Hooks/DispatchTest.php index 0b28ab08e..b29d59cfd 100644 --- a/tests/Hooks/DispatchTest.php +++ b/tests/Hooks/DispatchTest.php @@ -120,48 +120,48 @@ public function testDispatchRespectsHookPriority() { // Register multiple callbacks for the same hook with a variation of priorities. $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "no prio 0\n"; } ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio 10-1\n"; }, 10 ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio -3\n"; }, -3 ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio 5\n"; }, 5 ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio 2-1\n"; }, 2 ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio 2-2\n"; }, 2 ); $this->hooks->register( 'hook_a', - static function(&$text) { + static function (&$text) { $text .= "prio 10-2\n"; }, 10 diff --git a/tests/Hooks/RegisterTest.php b/tests/Hooks/RegisterTest.php index b14639d74..2ce9697ee 100644 --- a/tests/Hooks/RegisterTest.php +++ b/tests/Hooks/RegisterTest.php @@ -183,7 +183,7 @@ public function testRegister() { public function testRegisterClosureCallback() { $this->hooks->register( 'hookname', - static function($param) { + static function () { return true; } );