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
-------
f891fb2e5e
Changed private static array-properties to const static properties newly introduced in 5.1
This commit is contained in:
commit
ac61623ef8
@ -35,7 +35,7 @@ use Symfony\Component\Security\Http\SecurityEvents;
|
|||||||
*/
|
*/
|
||||||
class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface
|
class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface
|
||||||
{
|
{
|
||||||
private static $eventBubblingEvents = [
|
private const EVENT_BUBBLING_EVENTS = [
|
||||||
CheckPassportEvent::class,
|
CheckPassportEvent::class,
|
||||||
LoginFailureEvent::class,
|
LoginFailureEvent::class,
|
||||||
LoginSuccessEvent::class,
|
LoginSuccessEvent::class,
|
||||||
@ -73,7 +73,7 @@ class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$methodCallArguments = $methodCall[1];
|
$methodCallArguments = $methodCall[1];
|
||||||
if (!\in_array($methodCallArguments[0], self::$eventBubblingEvents, true)) {
|
if (!\in_array($methodCallArguments[0], self::EVENT_BUBBLING_EVENTS, true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ This conversation was marked as resolved by lstrojny
|
|||||||
|
|
||||||
protected $maxIdLength = 250;
|
protected $maxIdLength = 250;
|
||||||
|
|
||||||
private static $defaultClientOptions = [
|
private const DEFAULT_CLIENT_OPTIONS = [
|
||||||
'persistent_id' => null,
|
'persistent_id' => null,
|
||||||
'username' => null,
|
'username' => null,
|
||||||
'password' => 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); });
|
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
|
||||||
try {
|
try {
|
||||||
$options += static::$defaultClientOptions;
|
$options += static::DEFAULT_CLIENT_OPTIONS;
|
||||||
$client = new \Memcached($options['persistent_id']);
|
$client = new \Memcached($options['persistent_id']);
|
||||||
$username = $options['username'];
|
$username = $options['username'];
|
||||||
$password = $options['password'];
|
$password = $options['password'];
|
||||||
|
@ -138,7 +138,7 @@ final class EnglishInflector implements InflectorInterface
|
|||||||
*
|
*
|
||||||
* @see http://english-zone.com/spelling/plurals.html
|
* @see http://english-zone.com/spelling/plurals.html
|
||||||
*/
|
*/
|
||||||
private static $singularMap = [
|
private const SINGULAR_MAP = [
|
||||||
// First entry: singular suffix, reversed
|
// First entry: singular suffix, reversed
|
||||||
// Second entry: length of singular suffix
|
// Second entry: length of singular suffix
|
||||||
// Third entry: Whether the suffix may succeed a vocal
|
// 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.
|
* A list of words which should not be inflected, reversed.
|
||||||
*/
|
*/
|
||||||
private static $uninflected = [
|
private const UNINFLECTED = [
|
||||||
'',
|
'',
|
||||||
'atad',
|
'atad',
|
||||||
'reed',
|
'reed',
|
||||||
@ -327,7 +327,7 @@ final class EnglishInflector implements InflectorInterface
|
|||||||
$pluralLength = \strlen($lowerPluralRev);
|
$pluralLength = \strlen($lowerPluralRev);
|
||||||
|
|
||||||
// Check if the word is one which is not inflected, return early if so
|
// 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];
|
return [$plural];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ final class EnglishInflector implements InflectorInterface
|
|||||||
$singularLength = \strlen($lowerSingularRev);
|
$singularLength = \strlen($lowerSingularRev);
|
||||||
|
|
||||||
// Check if the word is one which is not inflected, return early if so
|
// 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];
|
return [$singular];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ final class EnglishInflector implements InflectorInterface
|
|||||||
// The inner loop $j iterates over the characters of the singular suffix
|
// 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
|
// in the singular table to compare them with the characters of the actual
|
||||||
// given singular suffix
|
// given singular suffix
|
||||||
foreach (self::$singularMap as $map) {
|
foreach (self::SINGULAR_MAP as $map) {
|
||||||
$suffix = $map[0];
|
$suffix = $map[0];
|
||||||
$suffixLength = $map[1];
|
$suffixLength = $map[1];
|
||||||
$j = 0;
|
$j = 0;
|
||||||
|
Reference in New Issue
Block a user