Skip to content

Commit 84fd9d7

Browse files
committed
Update dependencies in sniffs package
1 parent 001e1e2 commit 84fd9d7

File tree

4 files changed

+708
-324
lines changed

4 files changed

+708
-324
lines changed

phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/DiscouragedFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use WordPressCS\WordPress\Helpers\MinimumWPVersionTrait;
1616

1717
/**
18-
* Detect discouraged functions.
18+
* Detect discouraged WordPress functions.
1919
*
2020
* @link https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/
2121
*

phpcs-sniffs/Tests/bootstrap.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@
55
* @package PluginCheck
66
*/
77

8+
$dir_separator = DIRECTORY_SEPARATOR;
9+
$vendor_dir = dirname( __DIR__ ) . $dir_separator . 'vendor' . $dir_separator;
10+
11+
// Load nikic/php-parser token compatibility before PHPCS so T_PUBLIC_SET etc are int.
12+
// Otherwise PHPCS defines them as strings and nikic/php-parser throws on PHP 8.2+.
13+
$nikic_compat = $vendor_dir . 'nikic' . $dir_separator . 'php-parser' . $dir_separator . 'lib' . $dir_separator . 'PhpParser' . $dir_separator . 'compatibility_tokens.php';
14+
if ( file_exists( $nikic_compat ) ) {
15+
require_once $nikic_compat;
16+
}
17+
818
use PHP_CodeSniffer\Util\Standards;
919

1020
if ( ! defined( 'PHP_CODESNIFFER_IN_TESTS' ) ) {
1121
define( 'PHP_CODESNIFFER_IN_TESTS', true );
1222
}
1323

14-
$dir_separator = DIRECTORY_SEPARATOR;
15-
1624
// Define the path to the PHPCS directory.
17-
$phpcs_path = dirname( __DIR__ ) . $dir_separator . 'vendor' . $dir_separator . 'squizlabs' . $dir_separator . 'php_codesniffer';
25+
$phpcs_path = $vendor_dir . 'squizlabs' . $dir_separator . 'php_codesniffer';
1826
$autoload_script_path = $phpcs_path . $dir_separator . 'autoload.php';
1927
$bootstrap_script_path = $phpcs_path . $dir_separator . 'tests' . $dir_separator . 'bootstrap.php';
2028

@@ -47,4 +55,4 @@
4755
putenv( "PHPCS_IGNORE_TESTS={$ignore_standards_string}" );
4856

4957
// Cleanup.
50-
unset( $dir_separator, $phpcs_path, $available_standards, $ignored_standards, $available_standard, $ignore_standards_string );
58+
unset( $dir_separator, $vendor_dir, $nikic_compat, $phpcs_path, $available_standards, $ignored_standards, $available_standard, $ignore_standards_string );

phpcs-sniffs/composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@
2020
"ext-libxml": "*",
2121
"ext-tokenizer": "*",
2222
"ext-xmlreader": "*",
23+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
2324
"phpcsstandards/phpcsutils": "^1.0.8",
2425
"squizlabs/php_codesniffer": "^3.7.2"
2526
},
2627
"require-dev": {
2728
"php-parallel-lint/php-console-highlighter": "^1.0.0",
2829
"php-parallel-lint/php-parallel-lint": "^1.3.2",
29-
"phpcompatibility/php-compatibility": "^9.0",
30-
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
31-
"wp-coding-standards/wpcs": "^3.0",
32-
"slevomat/coding-standard": "^8"
30+
"phpcompatibility/php-compatibility": "^10.0",
31+
"phpunit/phpunit": "^9.0",
32+
"wp-coding-standards/wpcs": "^3.2.0",
33+
"slevomat/coding-standard": "^8.18"
3334
},
3435
"suggest": {
3536
"ext-mbstring": "For improved results"
@@ -42,6 +43,7 @@
4243
"php": "7.4"
4344
}
4445
},
46+
"minimum-stability": "alpha",
4547
"scripts": {
4648
"check-all": [
4749
"@lint",

0 commit comments

Comments
 (0)