Skip to content

Commit c1736e8

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

File tree

3 files changed

+708
-323
lines changed

3 files changed

+708
-323
lines changed

phpcs-sniffs/Tests/bootstrap.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@
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+
// This fix can be removed after minimum PHP and PHPCS/nikic packages are upgraded to versions that resolve the token-type conflict.
14+
$nikic_compat = $vendor_dir . 'nikic' . $dir_separator . 'php-parser' . $dir_separator . 'lib' . $dir_separator . 'PhpParser' . $dir_separator . 'compatibility_tokens.php';
15+
if ( file_exists( $nikic_compat ) ) {
16+
require_once $nikic_compat;
17+
}
18+
819
use PHP_CodeSniffer\Util\Standards;
920

1021
if ( ! defined( 'PHP_CODESNIFFER_IN_TESTS' ) ) {
1122
define( 'PHP_CODESNIFFER_IN_TESTS', true );
1223
}
1324

14-
$dir_separator = DIRECTORY_SEPARATOR;
15-
1625
// Define the path to the PHPCS directory.
17-
$phpcs_path = dirname( __DIR__ ) . $dir_separator . 'vendor' . $dir_separator . 'squizlabs' . $dir_separator . 'php_codesniffer';
26+
$phpcs_path = $vendor_dir . 'squizlabs' . $dir_separator . 'php_codesniffer';
1827
$autoload_script_path = $phpcs_path . $dir_separator . 'autoload.php';
1928
$bootstrap_script_path = $phpcs_path . $dir_separator . 'tests' . $dir_separator . 'bootstrap.php';
2029

@@ -47,4 +56,4 @@
4756
putenv( "PHPCS_IGNORE_TESTS={$ignore_standards_string}" );
4857

4958
// Cleanup.
50-
unset( $dir_separator, $phpcs_path, $available_standards, $ignored_standards, $available_standard, $ignore_standards_string );
59+
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)