Merge branch '3.4' into 4.2
* 3.4: fixed CS [HttpKernel] Remove TestEventDispatcher.
This commit is contained in:
commit
0f958aabfa
|
@ -15,7 +15,7 @@ return PhpCsFixer\Config::create()
|
|||
'ordered_imports' => true,
|
||||
'protected_to_private' => false,
|
||||
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
|
||||
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
|
||||
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
|
||||
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
|
||||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
||||
])
|
||||
|
|
|
@ -58,7 +58,7 @@ class DoctrineTestHelper
|
|||
$config = new Configuration();
|
||||
$config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures']);
|
||||
$config->setAutoGenerateProxyClasses(true);
|
||||
$config->setProxyDir(\sys_get_temp_dir());
|
||||
$config->setProxyDir(sys_get_temp_dir());
|
||||
$config->setProxyNamespace('SymfonyTests\Doctrine');
|
||||
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
|
||||
$config->setQueryCacheImpl(new ArrayCache());
|
||||
|
|
|
@ -186,7 +186,7 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||
return $this->formatValue($value, self::PRETTY_DATE);
|
||||
}
|
||||
|
||||
if (\method_exists($value, '__toString')) {
|
||||
if (method_exists($value, '__toString')) {
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class UndefinedCallableHandler
|
|||
|
||||
private static function onUndefined($name, $type, $component)
|
||||
{
|
||||
if (\class_exists(FullStack::class) && isset(self::$fullStackEnable[$component])) {
|
||||
if (class_exists(FullStack::class) && isset(self::$fullStackEnable[$component])) {
|
||||
throw new SyntaxError(sprintf('Did you forget to %s? Unknown %s "%s".', self::$fullStackEnable[$component], $type, $name));
|
||||
}
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
|||
switch ($this->driver) {
|
||||
case 'mysql':
|
||||
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
|
||||
$lockId = \substr($sessionId, 0, 64);
|
||||
$lockId = substr($sessionId, 0, 64);
|
||||
// should we handle the return value? 0 on timeout, null on error
|
||||
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
|
||||
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
|
||||
|
|
|
@ -47,7 +47,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
|||
'token' => $response->headers->get('X-Debug-Token'),
|
||||
'start_time' => $startTime * 1000,
|
||||
'events' => [],
|
||||
'stopwatch_installed' => \class_exists(Stopwatch::class, false),
|
||||
'stopwatch_installed' => class_exists(Stopwatch::class, false),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -132,12 +132,12 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
|||
$maxAge = null;
|
||||
$sMaxage = null;
|
||||
|
||||
if (\is_numeric($this->ageDirectives['max-age'])) {
|
||||
if (is_numeric($this->ageDirectives['max-age'])) {
|
||||
$maxAge = $this->ageDirectives['max-age'] + $this->age;
|
||||
$response->headers->addCacheControlDirective('max-age', $maxAge);
|
||||
}
|
||||
|
||||
if (\is_numeric($this->ageDirectives['s-maxage'])) {
|
||||
if (is_numeric($this->ageDirectives['s-maxage'])) {
|
||||
$sMaxage = $this->ageDirectives['s-maxage'] + $this->age;
|
||||
|
||||
if ($maxAge !== $sMaxage) {
|
||||
|
@ -145,7 +145,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
|||
}
|
||||
}
|
||||
|
||||
if (\is_numeric($this->ageDirectives['expires'])) {
|
||||
if (is_numeric($this->ageDirectives['expires'])) {
|
||||
$date = clone $response->getDate();
|
||||
$date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
|
||||
$response->setExpires($date);
|
||||
|
|
|
@ -52,6 +52,6 @@ class TimeDataCollectorTest extends TestCase
|
|||
|
||||
$c->collect($request, new Response());
|
||||
$this->assertEquals(123456000, $c->getStartTime());
|
||||
$this->assertSame(\class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
|
||||
$this->assertSame(class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
|
||||
|
||||
class TestEventDispatcher extends TraceableEventDispatcher
|
||||
{
|
||||
public function getCalledListeners()
|
||||
{
|
||||
return ['foo'];
|
||||
}
|
||||
|
||||
public function getNotCalledListeners()
|
||||
{
|
||||
return ['bar'];
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
}
|
||||
|
||||
public function getOrphanedEvents()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -138,7 +138,7 @@ abstract class AbstractToken implements TokenInterface
|
|||
{
|
||||
$serialized = [$this->user, $this->authenticated, $this->roles, $this->attributes];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,7 +61,7 @@ class AnonymousToken extends AbstractToken
|
|||
{
|
||||
$serialized = [$this->secret, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ class PreAuthenticatedToken extends AbstractToken
|
|||
{
|
||||
$serialized = [$this->credentials, $this->providerKey, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,7 +96,7 @@ class RememberMeToken extends AbstractToken
|
|||
{
|
||||
$serialized = [$this->secret, $this->providerKey, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,7 @@ class UsernamePasswordToken extends AbstractToken
|
|||
{
|
||||
$serialized = [$this->credentials, $this->providerKey, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
|
|||
return true;
|
||||
}
|
||||
|
||||
if (\class_exists('ParagonIE_Sodium_Compat') && \method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
|
||||
if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
|
||||
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
|
|||
return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded);
|
||||
}
|
||||
if (\function_exists('sodium_crypto_pwhash_str_verify')) {
|
||||
$valid = !$this->isPasswordTooLong($raw) && \sodium_crypto_pwhash_str_verify($encoded, $raw);
|
||||
\sodium_memzero($raw);
|
||||
$valid = !$this->isPasswordTooLong($raw) && sodium_crypto_pwhash_str_verify($encoded, $raw);
|
||||
sodium_memzero($raw);
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
|
|||
|
||||
private function encodePasswordSodiumFunction($raw)
|
||||
{
|
||||
$hash = \sodium_crypto_pwhash_str(
|
||||
$hash = sodium_crypto_pwhash_str(
|
||||
$raw,
|
||||
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
|
||||
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
|
||||
);
|
||||
\sodium_memzero($raw);
|
||||
sodium_memzero($raw);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class AccountStatusException extends AuthenticationException
|
|||
{
|
||||
$serialized = [$this->user, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,7 @@ class AuthenticationException extends RuntimeException implements \Serializable
|
|||
$this->line,
|
||||
];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ class CustomUserMessageAuthenticationException extends AuthenticationException
|
|||
{
|
||||
$serialized = [parent::serialize(true), $this->messageKey, $this->messageData];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,7 @@ class UsernameNotFoundException extends AuthenticationException
|
|||
{
|
||||
$serialized = [$this->username, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,7 @@ class ConcreteToken extends AbstractToken
|
|||
{
|
||||
$serialized = [$this->credentials, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
public function unserialize($serialized)
|
||||
|
|
|
@ -78,7 +78,7 @@ class PostAuthenticationGuardToken extends AbstractToken implements GuardTokenIn
|
|||
{
|
||||
$serialized = [$this->providerKey, parent::serialize(true)];
|
||||
|
||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||
return $this->doSerialize($serialized, \func_num_args() ? func_get_arg(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -97,7 +97,7 @@ class SimpleFormAuthenticationListener extends AbstractAuthenticationListener
|
|||
$password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']);
|
||||
}
|
||||
|
||||
if (!\is_string($username) && (!\is_object($username) || !\method_exists($username, '__toString'))) {
|
||||
if (!\is_string($username) && (!\is_object($username) || !method_exists($username, '__toString'))) {
|
||||
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username)));
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL
|
|||
$password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']);
|
||||
}
|
||||
|
||||
if (!\is_string($username) && (!\is_object($username) || !\method_exists($username, '__toString'))) {
|
||||
if (!\is_string($username) && (!\is_object($username) || !method_exists($username, '__toString'))) {
|
||||
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username)));
|
||||
}
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
|
|||
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
|
||||
{
|
||||
if (\func_num_args() >= 3) {
|
||||
$format = \func_get_arg(2);
|
||||
$format = func_get_arg(2);
|
||||
} else {
|
||||
// will be deprecated in version 4
|
||||
$format = null;
|
||||
|
|
|
@ -73,7 +73,7 @@ foreach ($config['original_files'] as $originalFilePath) {
|
|||
$translationStatus = calculateTranslationStatus($originalFilePath, $translationFilePaths);
|
||||
|
||||
$totalMissingTranslations += array_sum(array_map(function ($translation) {
|
||||
return \count($translation['missingKeys']);
|
||||
return count($translation['missingKeys']);
|
||||
}, array_values($translationStatus)));
|
||||
|
||||
printTranslationStatus($originalFilePath, $translationStatus, $config['verbose_output']);
|
||||
|
@ -113,8 +113,8 @@ function calculateTranslationStatus($originalFilePath, $translationFilePaths)
|
|||
$missingKeys = array_diff_key($allTranslationKeys, $translatedKeys);
|
||||
|
||||
$translationStatus[$locale] = [
|
||||
'total' => \count($allTranslationKeys),
|
||||
'translated' => \count($translatedKeys),
|
||||
'total' => count($allTranslationKeys),
|
||||
'translated' => count($translatedKeys),
|
||||
'missingKeys' => $missingKeys,
|
||||
];
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ function printTable($translations, $verboseOutput)
|
|||
|
||||
textColorNormal();
|
||||
|
||||
if (true === $verboseOutput && \count($translation['missingKeys']) > 0) {
|
||||
if (true === $verboseOutput && count($translation['missingKeys']) > 0) {
|
||||
echo str_repeat('-', 80).PHP_EOL;
|
||||
echo '| Missing Translations:'.PHP_EOL;
|
||||
|
||||
|
|
Reference in New Issue