Skip to content

Commit a8691d0

Browse files
committed
Changed private static array-properties to const
1 parent 35bcd7a commit a8691d0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Inflector.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class Inflector
2323
*
2424
* @see http://english-zone.com/spelling/plurals.html
2525
*/
26-
private static $pluralMap = [
26+
private const PLURAL_MAP = [
2727
// First entry: plural suffix, reversed
2828
// Second entry: length of plural suffix
2929
// Third entry: Whether the suffix may succeed a vocal
@@ -143,7 +143,7 @@ final class Inflector
143143
*
144144
* @see http://english-zone.com/spelling/plurals.html
145145
*/
146-
private static $singularMap = [
146+
private const SINGULAR_MAP = [
147147
// First entry: singular suffix, reversed
148148
// Second entry: length of singular suffix
149149
// Third entry: Whether the suffix may succeed a vocal
@@ -309,7 +309,7 @@ final class Inflector
309309
/**
310310
* A list of words which should not be inflected, reversed.
311311
*/
312-
private static $uninflected = [
312+
private const UNINFLECTED = [
313313
'',
314314
'atad',
315315
'reed',
@@ -346,15 +346,15 @@ public static function singularize(string $plural)
346346
$pluralLength = \strlen($lowerPluralRev);
347347

348348
// Check if the word is one which is not inflected, return early if so
349-
if (\in_array($lowerPluralRev, self::$uninflected, true)) {
349+
if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
350350
return $plural;
351351
}
352352

353353
// The outer loop iterates over the entries of the plural table
354354
// The inner loop $j iterates over the characters of the plural suffix
355355
// in the plural table to compare them with the characters of the actual
356356
// given plural suffix
357-
foreach (self::$pluralMap as $map) {
357+
foreach (self::PLURAL_MAP as $map) {
358358
$suffix = $map[0];
359359
$suffixLength = $map[1];
360360
$j = 0;
@@ -432,15 +432,15 @@ public static function pluralize(string $singular)
432432
$singularLength = \strlen($lowerSingularRev);
433433

434434
// Check if the word is one which is not inflected, return early if so
435-
if (\in_array($lowerSingularRev, self::$uninflected, true)) {
435+
if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
436436
return $singular;
437437
}
438438

439439
// The outer loop iterates over the entries of the singular table
440440
// The inner loop $j iterates over the characters of the singular suffix
441441
// in the singular table to compare them with the characters of the actual
442442
// given singular suffix
443-
foreach (self::$singularMap as $map) {
443+
foreach (self::SINGULAR_MAP as $map) {
444444
$suffix = $map[0];
445445
$suffixLength = $map[1];
446446
$j = 0;

0 commit comments

Comments
 (0)