File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,18 @@ class Config
134
134
'markdown ' => 'Markdown ' ,
135
135
];
136
136
137
+ /**
138
+ * The default configuration file names supported by PHPCS.
139
+ *
140
+ * @var array<string> The supported file names in order of precedence (highest first).
141
+ */
142
+ private const CONFIG_FILENAMES = [
143
+ '.phpcs.xml ' ,
144
+ 'phpcs.xml ' ,
145
+ '.phpcs.xml.dist ' ,
146
+ 'phpcs.xml.dist ' ,
147
+ ];
148
+
137
149
/**
138
150
* An array of settings that PHPCS and PHPCBF accept.
139
151
*
@@ -426,15 +438,8 @@ public function __construct(array $cliArgs=[], $dieOnUnknownArg=true)
426
438
// Look for a default ruleset in the current directory or higher.
427
439
$ currentDir = getcwd ();
428
440
429
- $ defaultFiles = [
430
- '.phpcs.xml ' ,
431
- 'phpcs.xml ' ,
432
- '.phpcs.xml.dist ' ,
433
- 'phpcs.xml.dist ' ,
434
- ];
435
-
436
441
do {
437
- foreach ($ defaultFiles as $ defaultFilename ) {
442
+ foreach (self :: CONFIG_FILENAMES as $ defaultFilename ) {
438
443
$ default = $ currentDir .DIRECTORY_SEPARATOR .$ defaultFilename ;
439
444
if (is_file ($ default ) === true ) {
440
445
$ this ->standards = [$ default ];
You can’t perform that action at this time.
0 commit comments