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
134134 'markdown ' => 'Markdown ' ,
135135 ];
136136
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+
137149 /**
138150 * An array of settings that PHPCS and PHPCBF accept.
139151 *
@@ -426,15 +438,8 @@ public function __construct(array $cliArgs=[], $dieOnUnknownArg=true)
426438 // Look for a default ruleset in the current directory or higher.
427439 $ currentDir = getcwd ();
428440
429- $ defaultFiles = [
430- '.phpcs.xml ' ,
431- 'phpcs.xml ' ,
432- '.phpcs.xml.dist ' ,
433- 'phpcs.xml.dist ' ,
434- ];
435-
436441 do {
437- foreach ($ defaultFiles as $ defaultFilename ) {
442+ foreach (self :: CONFIG_FILENAMES as $ defaultFilename ) {
438443 $ default = $ currentDir .DIRECTORY_SEPARATOR .$ defaultFilename ;
439444 if (is_file ($ default ) === true ) {
440445 $ this ->standards = [$ default ];
You can’t perform that action at this time.
0 commit comments