Skip to content

Commit 182f87a

Browse files
committed
Miscellaneous other changes after dropping JS/CSS support
Closes squizlabs/PHP_CodeSniffer 2448 Related to 6
1 parent 1861a7d commit 182f87a

10 files changed

+14
-37
lines changed

.cspell.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"dictionaries": ["php"],
44
"allowCompoundWords": true,
55
"ignorePaths": [
6-
"src/Standards/*/Tests/*/*.{inc,js,css}",
7-
"src/Standards/*/Tests/*/*.{inc,js,css}.fixed"
6+
"src/Standards/*/Tests/*/*.inc",
7+
"src/Standards/*/Tests/*/*.inc.fixed"
88
],
99
"ignoreRegExpList": ["email", "^\\s+\\*\\s+@(author|copyright)\\s+.*$"],
1010
"words": [

.github/CONTRIBUTING.md

-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ To help you with this, a number of convenience scripts are available:
265265
which will be placed in a `build/coverage-html` subdirectory.
266266
* `composer build` will build the phpcs.phar and phpcbf.phar files.
267267

268-
N.B.: You can ignore any skipped tests as these are for external tools.
269-
270268

271269
### Writing Tests
272270

.github/workflows/quicktest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ concurrency:
2020
jobs:
2121
#### QUICK TEST ####
2222
# This is a much quicker test run which only runs the unit tests against the low/medium/high
23-
# supported PHP versions and skips the PHAR test and the tests for external JS/CSS tooling.
23+
# supported PHP versions and skips the PHAR test.
2424
# These are basically the same builds as in the Test->Coverage workflow, but then without doing
2525
# the code-coverage.
2626
quicktest:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
## About
2222

23-
PHP_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
23+
PHP_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
2424

2525

2626
## Requirements

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "squizlabs/php_codesniffer",
3-
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
3+
"description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.",
44
"license": "BSD-3-Clause",
55
"type": "library",
66
"keywords": [

phpcs.xml.dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<file>src</file>
1010
<file>tests</file>
1111

12-
<exclude-pattern>*/src/Standards/*/Tests/*\.(inc|css|js)$</exclude-pattern>
13-
<exclude-pattern>*/tests/Core/*/*\.(inc|css|js)$</exclude-pattern>
12+
<exclude-pattern>*/src/Standards/*/Tests/*\.inc$</exclude-pattern>
13+
<exclude-pattern>*/tests/Core/*/*\.inc$</exclude-pattern>
1414
<exclude-pattern>*/tests/Core/*/Fixtures/*\.php$</exclude-pattern>
1515

1616
<arg name="basepath" value="."/>

tests/Core/AbstractMethodUnitTest.php

+3-14
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@
1919
abstract class AbstractMethodUnitTest extends TestCase
2020
{
2121

22-
/**
23-
* The file extension of the test case file (without leading dot).
24-
*
25-
* This allows child classes to overrule the default `inc` with, for instance,
26-
* `js` or `css` when applicable.
27-
*
28-
* @var string
29-
*/
30-
protected static $fileExtension = 'inc';
31-
3222
/**
3323
* The tab width setting to use when tokenizing the file.
3424
*
@@ -68,7 +58,7 @@ public static function initializeFile()
6858
// Default to a file with the same name as the test class. Extension is property based.
6959
$relativeCN = str_replace(__NAMESPACE__, '', get_called_class());
7060
$relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
71-
$pathToTestFile = realpath(__DIR__).$relativePath.'.'.static::$fileExtension;
61+
$pathToTestFile = realpath(__DIR__).$relativePath.'.inc';
7262

7363
// Make sure the file gets parsed correctly based on the file type.
7464
$contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;
@@ -100,9 +90,8 @@ public static function reset()
10090
self::$phpcsFile->config->__destruct();
10191
}
10292

103-
self::$fileExtension = 'inc';
104-
self::$tabWidth = 4;
105-
self::$phpcsFile = null;
93+
self::$tabWidth = 4;
94+
self::$phpcsFile = null;
10695

10796
}//end reset()
10897

tests/Core/Ruleset/PopulateTokenListenersTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function testSetsIncludeAndIgnorePatterns($token, $sniffClass, $patternTy
390390
$expected = [
391391
'/no-transformation/',
392392
'/simple.*transformation/.*',
393-
'/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.css',
393+
'/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.inc',
394394
'/pat?tern(is|regex)\\.php$',
395395
];
396396

tests/Core/Ruleset/PopulateTokenListenersTest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
<rule ref="Generic.NamingConventions.UpperCaseConstantName">
2828
<include-pattern>/no-transformation/</include-pattern>
2929
<include-pattern>/simple*transformation/*</include-pattern>
30-
<include-pattern>/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.css</include-pattern>
30+
<include-pattern>/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.inc</include-pattern>
3131
<include-pattern>/pat?tern(is|regex)\.php$</include-pattern>
3232
</rule>
3333

3434
<!-- Test handling of exclude patterns. -->
3535
<rule ref="PSR1.Files.SideEffects">
3636
<exclude-pattern>/no-transformation/</exclude-pattern>
3737
<exclude-pattern>/simple*transformation/*</exclude-pattern>
38-
<exclude-pattern>/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.css</exclude-pattern>
38+
<exclude-pattern>/escaped\\,comma/becomes/comma/to/allow/commas/in/filenames.inc</exclude-pattern>
3939
<exclude-pattern>/pat?tern(is|regex)\.php$</exclude-pattern>
4040
</rule>
4141

tests/Core/Tokenizers/AbstractTokenizerTestCase.php

+1-11
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@
2222
abstract class AbstractTokenizerTestCase extends TestCase
2323
{
2424

25-
/**
26-
* The file extension of the test case file (without leading dot).
27-
*
28-
* This allows child classes to overrule the default `inc` with, for instance,
29-
* `js` or `css` when applicable.
30-
*
31-
* @var string
32-
*/
33-
protected $fileExtension = 'inc';
34-
3525
/**
3626
* The tab width setting to use when tokenizing the file.
3727
*
@@ -73,7 +63,7 @@ protected function initializeFile()
7363
// Default to a file with the same name as the test class. Extension is property based.
7464
$relativeCN = str_replace(__NAMESPACE__, '', get_called_class());
7565
$relativePath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeCN);
76-
$pathToTestFile = realpath(__DIR__).$relativePath.'.'.$this->fileExtension;
66+
$pathToTestFile = realpath(__DIR__).$relativePath.'.inc';
7767

7868
// Make sure the file gets parsed correctly based on the file type.
7969
$contents = 'phpcs_input_file: '.$pathToTestFile.PHP_EOL;

0 commit comments

Comments
 (0)