8000 minor #39962 Changed private static array-properties to const (5.1) (… · symfony/symfony@ac61623 · GitHub
[go: up one dir, main page]

Skip to content

Commit ac61623

Browse files
minor #39962 Changed private static array-properties to const (5.1) (simonberger)
This PR was merged into the 5.1 branch. Discussion ---------- Changed private static array-properties to const (5.1) | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT This continues #39959 for 5.1 Just a few newly introduced readonly static array-properties. /cc @nicolas-grekas Commits ------- f891fb2 Changed private static array-properties to const static properties newly introduced in 5.1
2 parents a2ded28 + f891fb2 commit ac61623

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface
3737
{
38-
private static $eventBubblingEvents = [
38+
private const EVENT_BUBBLING_EVENTS = [
3939
CheckPassportEvent::class,
4040
LoginFailureEvent::class,
4141
LoginSuccessEvent::class,
@@ -73,7 +73,7 @@ public function process(ContainerBuilder $container)
7373
}
7474

7575
$methodCallArguments = $methodCall[1];
76-
if (!\in_array($methodCallArguments[0], self::$eventBubblingEvents, true)) {
76+
if (!\in_array($methodCallArguments[0], self::EVENT_BUBBLING_EVENTS, true)) {
7777
continue;
7878
}
7979

src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MemcachedAdapter extends AbstractAdapter
3333

3434
protected $maxIdLength = 250;
3535

36-
private static $defaultClientOptions = [
36+
private const DEFAULT_CLIENT_OPTIONS = [
3737
'persistent_id' => null,
3838
'username' => null,
3939
'password' => null,
@@ -108,7 +108,7 @@ public static function createConnection($servers, array $options = [])
108108
}
109109
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
110110
try {
111-
$options += static::$defaultClientOptions;
111+
$options += static::DEFAULT_CLIENT_OPTIONS;
112112
$client = new \Memcached($options['persistent_id']);
113 8000 113
$username = $options['username'];
114114
$password = $options['password'];

src/Symfony/Component/String/Inflector/EnglishInflector.php

Lines changed: 5 additions & 5 deletions
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)
0