fixed CS
This commit is contained in:
parent
7a6ce5ff85
commit
106b348d3d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class ProxyDumper implements DumperInterface
|
||||
$instantiation = 'return';
|
||||
|
||||
if ($definition->isShared()) {
|
||||
$instantiation .= sprintf(' $this->%s[%s] =', \method_exists(ContainerBuilder::class, 'addClassResource') || ($definition->isPublic() && !$definition->isPrivate()) ? 'services' : 'privates', var_export($id, true));
|
||||
$instantiation .= sprintf(' $this->%s[%s] =', method_exists(ContainerBuilder::class, 'addClassResource') || ($definition->isPublic() && !$definition->isPrivate()) ? 'services' : 'privates', var_export($id, true));
|
||||
}
|
||||
|
||||
if (null === $factoryCode) {
|
||||
@ -120,7 +120,7 @@ EOF;
|
||||
*/
|
||||
private static function getProxyManagerVersion()
|
||||
{
|
||||
if (!\class_exists(Version::class)) {
|
||||
if (!class_exists(Version::class)) {
|
||||
return '0.0.1';
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ class ProxyDumperTest extends TestCase
|
||||
[
|
||||
(new Definition(__CLASS__))
|
||||
->setPublic(false),
|
||||
\method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates',
|
||||
method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates',
|
||||
],
|
||||
[
|
||||
(new Definition(__CLASS__))
|
||||
|
@ -70,7 +70,7 @@ TXT;
|
||||
|
||||
$display = $tester->getDisplay();
|
||||
|
||||
$this->assertContains(\json_encode($message), $display);
|
||||
$this->assertContains(json_encode($message), $display);
|
||||
}
|
||||
|
||||
public function testWithGlobalsJson()
|
||||
@ -81,7 +81,7 @@ TXT;
|
||||
$tester->execute(['--format' => 'json'], ['decorated' => true]);
|
||||
|
||||
$display = $tester->getDisplay();
|
||||
$display = \json_decode($display, true);
|
||||
$display = json_decode($display, true);
|
||||
|
||||
$this->assertSame($globals, $display['globals']);
|
||||
}
|
||||
@ -91,11 +91,11 @@ TXT;
|
||||
$tester = $this->createCommandTester([]);
|
||||
$tester->execute(['--format' => 'json'], ['decorated' => false]);
|
||||
$display = $tester->getDisplay();
|
||||
$display1 = \json_decode($display, true);
|
||||
$display1 = json_decode($display, true);
|
||||
|
||||
$tester->execute(['filter' => 'date', '--format' => 'json'], ['decorated' => false]);
|
||||
$display = $tester->getDisplay();
|
||||
$display2 = \json_decode($display, true);
|
||||
$display2 = json_decode($display, true);
|
||||
|
||||
$this->assertNotSame($display1, $display2);
|
||||
}
|
||||
|
@ -84,7 +84,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));
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ EOF;
|
||||
if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) {
|
||||
$value = serialize($value);
|
||||
}
|
||||
} elseif (!\is_scalar($value)) {
|
||||
} elseif (!is_scalar($value)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ trait PhpFilesTrait
|
||||
if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) {
|
||||
$value = serialize($value);
|
||||
}
|
||||
} elseif (!\is_scalar($value)) {
|
||||
} elseif (!is_scalar($value)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class DebugClassLoader
|
||||
|
||||
private function checkClass($class, $file = null)
|
||||
{
|
||||
$exists = null === $file || \class_exists($class, false) || \interface_exists($class, false) || \trait_exists($class, false);
|
||||
$exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
|
||||
|
||||
if (null !== $file && $class && '\\' === $class[0]) {
|
||||
$class = substr($class, 1);
|
||||
@ -186,13 +186,13 @@ class DebugClassLoader
|
||||
}
|
||||
$name = $refl->getName();
|
||||
|
||||
if ($name !== $class && 0 === \strcasecmp($name, $class)) {
|
||||
if ($name !== $class && 0 === strcasecmp($name, $class)) {
|
||||
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name));
|
||||
}
|
||||
|
||||
$deprecations = $this->checkAnnotations($refl, $name);
|
||||
|
||||
if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) {
|
||||
if (isset(self::$php7Reserved[strtolower($refl->getShortName())])) {
|
||||
$deprecations[] = sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName());
|
||||
}
|
||||
|
||||
@ -223,23 +223,23 @@ class DebugClassLoader
|
||||
$deprecations = [];
|
||||
|
||||
// Don't trigger deprecations for classes in the same vendor
|
||||
if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) {
|
||||
if (2 > $len = 1 + (strpos($class, '\\') ?: strpos($class, '_'))) {
|
||||
$len = 0;
|
||||
$ns = '';
|
||||
} else {
|
||||
$ns = \str_replace('_', '\\', \substr($class, 0, $len));
|
||||
$ns = str_replace('_', '\\', substr($class, 0, $len));
|
||||
}
|
||||
|
||||
// Detect annotations on the class
|
||||
if (false !== $doc = $refl->getDocComment()) {
|
||||
foreach (['final', 'deprecated', 'internal'] as $annotation) {
|
||||
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
|
||||
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
|
||||
self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parent = \get_parent_class($class);
|
||||
$parent = get_parent_class($class);
|
||||
$parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent);
|
||||
if ($parent) {
|
||||
$parentAndOwnInterfaces[$parent] = $parent;
|
||||
@ -254,22 +254,22 @@ class DebugClassLoader
|
||||
}
|
||||
|
||||
// Detect if the parent is annotated
|
||||
foreach ($parentAndOwnInterfaces + \class_uses($class, false) as $use) {
|
||||
foreach ($parentAndOwnInterfaces + class_uses($class, false) as $use) {
|
||||
if (!isset(self::$checkedClasses[$use])) {
|
||||
$this->checkClass($use);
|
||||
}
|
||||
if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) {
|
||||
if (isset(self::$deprecated[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) {
|
||||
$type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait');
|
||||
$verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
|
||||
|
||||
$deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]);
|
||||
}
|
||||
if (isset(self::$internal[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
|
||||
if (isset(self::$internal[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len)) {
|
||||
$deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class);
|
||||
}
|
||||
}
|
||||
|
||||
if (\trait_exists($class)) {
|
||||
if (trait_exists($class)) {
|
||||
return $deprecations;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ class DebugClassLoader
|
||||
|
||||
if (isset(self::$internalMethods[$class][$method->name])) {
|
||||
list($declaringClass, $message) = self::$internalMethods[$class][$method->name];
|
||||
if (\strncmp($ns, $declaringClass, $len)) {
|
||||
if (strncmp($ns, $declaringClass, $len)) {
|
||||
$deprecations[] = sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class);
|
||||
}
|
||||
}
|
||||
@ -307,7 +307,7 @@ class DebugClassLoader
|
||||
}
|
||||
|
||||
foreach (['final', 'internal'] as $annotation) {
|
||||
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
|
||||
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
|
||||
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
|
||||
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
|
||||
}
|
||||
|
@ -746,16 +746,16 @@ class Filesystem
|
||||
private static function box($func)
|
||||
{
|
||||
self::$lastError = null;
|
||||
\set_error_handler(__CLASS__.'::handleError');
|
||||
set_error_handler(__CLASS__.'::handleError');
|
||||
try {
|
||||
$result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
|
||||
\restore_error_handler();
|
||||
restore_error_handler();
|
||||
|
||||
return $result;
|
||||
} catch (\Throwable $e) {
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
\restore_error_handler();
|
||||
restore_error_handler();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
@ -683,7 +683,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);
|
||||
|
@ -31,7 +31,7 @@ class SubRequestHandler
|
||||
// save global state related to trusted headers and proxies
|
||||
$trustedProxies = Request::getTrustedProxies();
|
||||
$trustedHeaderSet = Request::getTrustedHeaderSet();
|
||||
if (\method_exists(Request::class, 'getTrustedHeaderName')) {
|
||||
if (method_exists(Request::class, 'getTrustedHeaderName')) {
|
||||
Request::setTrustedProxies($trustedProxies, -1);
|
||||
$trustedHeaders = [
|
||||
Request::HEADER_FORWARDED => Request::getTrustedHeaderName(Request::HEADER_FORWARDED, false),
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,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();
|
||||
}
|
||||
|
||||
@ -66,8 +66,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;
|
||||
}
|
||||
@ -88,12 +88,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,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)));
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
|
||||
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, string $format = null*/)
|
||||
{
|
||||
if (\func_num_args() >= 6) {
|
||||
$format = \func_get_arg(5);
|
||||
$format = func_get_arg(5);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
|
@ -380,7 +380,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;
|
||||
|
@ -30,7 +30,7 @@ class ObjectNormalizer extends AbstractObjectNormalizer
|
||||
|
||||
public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null)
|
||||
{
|
||||
if (!\class_exists(PropertyAccess::class)) {
|
||||
if (!class_exists(PropertyAccess::class)) {
|
||||
throw new RuntimeException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.');
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
||||
public function supportsNormalization($data, $format = null/*, array $context = []*/)
|
||||
{
|
||||
if (\func_num_args() > 2) {
|
||||
$context = \func_get_arg(2);
|
||||
$context = func_get_arg(2);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
@ -212,7 +212,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
||||
public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/)
|
||||
{
|
||||
if (\func_num_args() > 3) {
|
||||
$context = \func_get_arg(3);
|
||||
$context = func_get_arg(3);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
@ -286,7 +286,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
||||
public function supportsEncoding($format/*, array $context = []*/)
|
||||
{
|
||||
if (\func_num_args() > 1) {
|
||||
$context = \func_get_arg(1);
|
||||
$context = func_get_arg(1);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
@ -307,7 +307,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
|
||||
public function supportsDecoding($format/*, array $context = []*/)
|
||||
{
|
||||
if (\func_num_args() > 1) {
|
||||
$context = \func_get_arg(1);
|
||||
$context = func_get_arg(1);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -79,7 +79,7 @@ class VarCloner extends AbstractCloner
|
||||
}
|
||||
if ($gk !== $k) {
|
||||
$fromObjCast = true;
|
||||
$refs = $vals = \array_values($queue[$i]);
|
||||
$refs = $vals = array_values($queue[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ class VarCloner extends AbstractCloner
|
||||
if ($zvalIsRef = $vals[$k] === $cookie) {
|
||||
$vals[$k] = &$stub; // Break hard references to make $queue completely
|
||||
unset($stub); // independent from the original structure
|
||||
if ($v instanceof Stub && isset($hardRefs[\spl_object_hash($v)])) {
|
||||
if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) {
|
||||
$vals[$k] = $refs[$k] = $v;
|
||||
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
|
||||
++$v->value->refCount;
|
||||
@ -100,7 +100,7 @@ class VarCloner extends AbstractCloner
|
||||
}
|
||||
$refs[$k] = $vals[$k] = new Stub();
|
||||
$refs[$k]->value = $v;
|
||||
$h = \spl_object_hash($refs[$k]);
|
||||
$h = spl_object_hash($refs[$k]);
|
||||
$hardRefs[$h] = &$refs[$k];
|
||||
$values[$h] = $v;
|
||||
$vals[$k]->handle = ++$refsCounter;
|
||||
@ -118,22 +118,22 @@ class VarCloner extends AbstractCloner
|
||||
if ('' === $v) {
|
||||
continue 2;
|
||||
}
|
||||
if (!\preg_match('//u', $v)) {
|
||||
if (!preg_match('//u', $v)) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_STRING;
|
||||
$stub->class = Stub::STRING_BINARY;
|
||||
if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) {
|
||||
$stub->cut = $cut;
|
||||
$stub->value = \substr($v, 0, -$cut);
|
||||
$stub->value = substr($v, 0, -$cut);
|
||||
} else {
|
||||
$stub->value = $v;
|
||||
}
|
||||
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = \mb_strlen($v, 'UTF-8') - $maxString) {
|
||||
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_STRING;
|
||||
$stub->class = Stub::STRING_UTF8;
|
||||
$stub->cut = $cut;
|
||||
$stub->value = \mb_substr($v, 0, $maxString, 'UTF-8');
|
||||
$stub->value = mb_substr($v, 0, $maxString, 'UTF-8');
|
||||
} else {
|
||||
continue 2;
|
||||
}
|
||||
@ -179,7 +179,7 @@ class VarCloner extends AbstractCloner
|
||||
|
||||
case \is_object($v):
|
||||
case $v instanceof \__PHP_Incomplete_Class:
|
||||
if (empty($objRefs[$h = $hashMask ^ \hexdec(\substr(\spl_object_hash($v), $hashOffset, \PHP_INT_SIZE))])) {
|
||||
if (empty($objRefs[$h = $hashMask ^ hexdec(substr(spl_object_hash($v), $hashOffset, \PHP_INT_SIZE))])) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_OBJECT;
|
||||
$stub->class = \get_class($v);
|
||||
@ -190,7 +190,7 @@ class VarCloner extends AbstractCloner
|
||||
if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) {
|
||||
break;
|
||||
}
|
||||
$h = $hashMask ^ \hexdec(\substr(\spl_object_hash($stub->value), $hashOffset, \PHP_INT_SIZE));
|
||||
$h = $hashMask ^ hexdec(substr(spl_object_hash($stub->value), $hashOffset, \PHP_INT_SIZE));
|
||||
$stub->handle = $h;
|
||||
}
|
||||
$stub->value = null;
|
||||
@ -213,7 +213,7 @@ class VarCloner extends AbstractCloner
|
||||
if (empty($resRefs[$h = (int) $v])) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_RESOURCE;
|
||||
if ('Unknown' === $stub->class = @\get_resource_type($v)) {
|
||||
if ('Unknown' === $stub->class = @get_resource_type($v)) {
|
||||
$stub->class = 'Closed';
|
||||
}
|
||||
$stub->value = $v;
|
||||
|
Reference in New Issue
Block a user