From f891fb2e5e49c5ce76295e82877d6e5f84aa41ef Mon Sep 17 00:00:00 2001 From: Simon Berger Date: Mon, 25 Jan 2021 15:27:34 +0100 Subject: [PATCH] Changed private static array-properties to const static properties newly introduced in 5.1 --- .../RegisterGlobalSecurityEventListenersPass.php | 4 ++-- .../Component/Cache/Adapter/MemcachedAdapter.php | 4 ++-- .../Component/String/Inflector/EnglishInflector.php | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php index dc3d498e34..56fb248fc6 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php @@ -35,7 +35,7 @@ use Symfony\Component\Security\Http\SecurityEvents; */ class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface { - private static $eventBubblingEvents = [ + private const EVENT_BUBBLING_EVENTS = [ CheckPassportEvent::class, LoginFailureEvent::class, LoginSuccessEvent::class, @@ -73,7 +73,7 @@ class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface } $methodCallArguments = $methodCall[1]; - if (!\in_array($methodCallArguments[0], self::$eventBubblingEvents, true)) { + if (!\in_array($methodCallArguments[0], self::EVENT_BUBBLING_EVENTS, true)) { continue; } diff --git a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php index 4d931b05ac..436880ff37 100644 --- a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php @@ -33,7 +33,7 @@ This conversation was marked as resolved by lstrojny protected $maxIdLength = 250; - private static $defaultClientOptions = [ + private const DEFAULT_CLIENT_OPTIONS = [ 'persistent_id' => null, 'username' => null, 'password' => null, @@ -108,7 +108,7 @@ This conversation was marked as resolved by lstrojny } set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); }); try { - $options += static::$defaultClientOptions; + $options += static::DEFAULT_CLIENT_OPTIONS; $client = new \Memcached($options['persistent_id']); $username = $options['username']; $password = $options['password']; diff --git a/src/Symfony/Component/String/Inflector/EnglishInflector.php b/src/Symfony/Component/String/Inflector/EnglishInflector.php index cb6b4c7096..addfac1344 100644 --- a/src/Symfony/Component/String/Inflector/EnglishInflector.php +++ b/src/Symfony/Component/String/Inflector/EnglishInflector.php @@ -138,7 +138,7 @@ final class EnglishInflector implements InflectorInterface * * @see http://english-zone.com/spelling/plurals.html */ - private static $singularMap = [ + private const SINGULAR_MAP = [ // First entry: singular suffix, reversed // Second entry: length of singular suffix // Third entry: Whether the suffix may succeed a vocal @@ -304,7 +304,7 @@ final class EnglishInflector implements InflectorInterface /** * A list of words which should not be inflected, reversed. */ - private static $uninflected = [ + private const UNINFLECTED = [ '', 'atad', 'reed', @@ -327,7 +327,7 @@ final class EnglishInflector implements InflectorInterface $pluralLength = \strlen($lowerPluralRev); // Check if the word is one which is not inflected, return early if so - if (\in_array($lowerPluralRev, self::$uninflected, true)) { + if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) { return [$plural]; } @@ -406,7 +406,7 @@ final class EnglishInflector implements InflectorInterface $singularLength = \strlen($lowerSingularRev); // Check if the word is one which is not inflected, return early if so - if (\in_array($lowerSingularRev, self::$uninflected, true)) { + if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) { return [$singular]; } @@ -414,7 +414,7 @@ final class EnglishInflector implements InflectorInterface // The inner loop $j iterates over the characters of the singular suffix // in the singular table to compare them with the characters of the actual // given singular suffix - foreach (self::$singularMap as $map) { + foreach (self::SINGULAR_MAP as $map) { $suffix = $map[0]; $suffixLength = $map[1]; $j = 0;