Skip to content

Commit 7526ead

Browse files
committed
Modernize: Config: use class constant for constant array [2]
1 parent 1d23cb9 commit 7526ead

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/Config.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff 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];

0 commit comments

Comments
 (0)