@@ -122,6 +122,18 @@ class Config
122
122
'no-cache ' => 'cache ' ,
123
123
];
124
124
125
+ /**
126
+ * A list of valid generators.
127
+ *
128
+ * @var array<string, string> Keys are the lowercase version of the generator name, while values
129
+ * are the name of the associated PHP generator class.
130
+ */
131
+ private const VALID_GENERATORS = [
132
+ 'text ' => 'Text ' ,
133
+ 'html ' => 'HTML ' ,
134
+ 'markdown ' => 'Markdown ' ,
135
+ ];
136
+
125
137
/**
126
138
* An array of settings that PHPCS and PHPCBF accept.
127
139
*
@@ -191,21 +203,6 @@ class Config
191
203
*/
192
204
private $ cliArgs = [];
193
205
194
- /**
195
- * A list of valid generators.
196
- *
197
- * {@internal Once support for PHP < 5.6 is dropped, this property should be refactored into a
198
- * class constant.}
199
- *
200
- * @var array<string, string> Keys are the lowercase version of the generator name, while values
201
- * are the associated PHP generator class.
202
- */
203
- private $ validGenerators = [
204
- 'text ' => 'Text ' ,
205
- 'html ' => 'HTML ' ,
206
- 'markdown ' => 'Markdown ' ,
207
- ];
208
-
209
206
/**
210
207
* Command line values that the user has supplied directly.
211
208
*
@@ -1250,8 +1247,8 @@ public function processLongArgument($arg, $pos)
1250
1247
$ generatorName = substr ($ arg , 10 );
1251
1248
$ lowerCaseGeneratorName = strtolower ($ generatorName );
1252
1249
1253
- if (isset ($ this -> validGenerators [$ lowerCaseGeneratorName ]) === false ) {
1254
- $ validOptions = implode (', ' , $ this -> validGenerators );
1250
+ if (isset (self :: VALID_GENERATORS [$ lowerCaseGeneratorName ]) === false ) {
1251
+ $ validOptions = implode (', ' , self :: VALID_GENERATORS );
1255
1252
$ validOptions = substr_replace ($ validOptions , ' and ' , strrpos ($ validOptions , ', ' ), 1 );
1256
1253
$ error = sprintf (
1257
1254
'ERROR: "%s" is not a valid generator. The following generators are supported: %s. ' .PHP_EOL .PHP_EOL ,
@@ -1262,7 +1259,7 @@ public function processLongArgument($arg, $pos)
1262
1259
throw new DeepExitException ($ error , ExitCode::PROCESS_ERROR );
1263
1260
}
1264
1261
1265
- $ this ->generator = $ this -> validGenerators [$ lowerCaseGeneratorName ];
1262
+ $ this ->generator = self :: VALID_GENERATORS [$ lowerCaseGeneratorName ];
1266
1263
$ this ->overriddenDefaults ['generator ' ] = true ;
1267
1264
} else if (substr ($ arg , 0 , 9 ) === 'encoding= ' ) {
1268
1265
if (isset ($ this ->overriddenDefaults ['encoding ' ]) === true ) {
0 commit comments