Skip to content

Commit 83bbb92

Browse files
committed
Changed private static array-properties to const static properties newly introduced in 5.1
1 parent 8a90f72 commit 83bbb92

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Inflector/EnglishInflector.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ final class EnglishInflector implements InflectorInterface
138138
*
139139
* @see http://english-zone.com/spelling/plurals.html
140140
*/
141-
private static $singularMap = [
141+
private const SINGULAR_MAP = [
142142
// First entry: singular suffix, reversed
143143
// Second entry: length of singular suffix
144144
// Third entry: Whether the suffix may succeed a vocal
@@ -304,7 +304,7 @@ final class EnglishInflector implements InflectorInterface
304304
/**
305305
* A list of words which should not be inflected, reversed.
306306
*/
307-
private static $uninflected = [
307+
private const UNINFLECTED = [
308308
'',
309309
'atad',
310310
'reed',
@@ -327,7 +327,7 @@ public function singularize(string $plural): array
327327
$pluralLength = \strlen($lowerPluralRev);
328328

329329
// Check if the word is one which is not inflected, return early if so
330-
if (\in_array($lowerPluralRev, self::$uninflected, true)) {
330+
if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
331331
return [$plural];
332332
}
333333

@@ -406,15 +406,15 @@ public function pluralize(string $singular): array
406406
$singularLength = \strlen($lowerSingularRev);
407407

408408
// Check if the word is one which is not inflected, return early if so
409-
if (\in_array($lowerSingularRev, self::$uninflected, true)) {
409+
if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
410410
return [$singular];
411411
}
412412

413413
// The outer loop iterates over the entries of the singular table
414414
// The inner loop $j iterates over the characters of the singular suffix
415415
// in the singular table to compare them with the characters of the actual
416416
// given singular suffix
417-
foreach (self::$singularMap as $map) {
417+
foreach (self::SINGULAR_MAP as $map) {
418418
$suffix = $map[0];
419419
$suffixLength = $map[1];
420420
$j = 0;

0 commit comments

Comments
 (0)