diff --git a/.php_cs.dist b/.php_cs.dist index 8523be670698e..85c75692eb44f 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -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'], ]) diff --git a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php index 3f6ffeebb6e2d..24da0b8deec02 100644 --- a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php +++ b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php @@ -58,7 +58,7 @@ public static function createTestConfiguration() $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()); diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 47cb2bd730317..cf0ed8c962101 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -186,7 +186,7 @@ private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, return $this->formatValue($value, self::PRETTY_DATE); } - if (\method_exists($value, '__toString')) { + if (method_exists($value, '__toString')) { return (string) $value; } diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 7c12b7015e620..7acc1c65420b7 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -58,7 +58,7 @@ public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = $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 @@ public function getProxyCode(Definition $definition) */ private static function getProxyManagerVersion() { - if (!\class_exists(Version::class)) { + if (!class_exists(Version::class)) { return '0.0.1'; } diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index f0822d4616422..5328c9ae1227d 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -103,7 +103,7 @@ public function getPrivatePublicDefinitions() [ (new Definition(__CLASS__)) ->setPublic(false), - \method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates', + method_exists(ContainerBuilder::class, 'addClassResource') ? 'services' : 'privates', ], [ (new Definition(__CLASS__)) diff --git a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php index 3b9e479da0791..2f4cc9cd870f7 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php @@ -70,7 +70,7 @@ public function testWithGlobals() $display = $tester->getDisplay(); - $this->assertContains(\json_encode($message), $display); + $this->assertContains(json_encode($message), $display); } public function testWithGlobalsJson() @@ -81,7 +81,7 @@ public function testWithGlobalsJson() $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 @@ public function testWithFilter() $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); } diff --git a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php index 8476e89cab0ee..9c2d18b4a4d6e 100644 --- a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php +++ b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php @@ -84,7 +84,7 @@ public static function onUndefinedFunction($name) 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)); } diff --git a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php index e96462abf7e53..ea996a217cf13 100644 --- a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php @@ -90,7 +90,7 @@ public function warmUp(array $values) 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))); } diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index 36c614fe65bc6..3cc02b2428486 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -136,7 +136,7 @@ protected function doSave(array $values, $lifetime) 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))); } diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index b728b9b90fee2..9ceac9af162b0 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -168,7 +168,7 @@ public function loadClass($class) 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 @@ private function checkClass($class, $file = null) } $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 @@ public function checkAnnotations(\ReflectionClass $refl, $class) $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 @@ public function checkAnnotations(\ReflectionClass $refl, $class) } // 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 @@ public function checkAnnotations(\ReflectionClass $refl, $class) 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 @@ public function checkAnnotations(\ReflectionClass $refl, $class) } 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]; } diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 3c61fc15048fe..a6e372ebf15a3 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -746,16 +746,16 @@ private function getSchemeAndHierarchy($filename) 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; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index bc088e7740bc8..9369740eb6dd5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -683,7 +683,7 @@ private function doAdvisoryLock($sessionId) 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)'); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php index f48db705686b6..7ab14b7cb856a 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php @@ -47,7 +47,7 @@ public function collect(Request $request, Response $response, \Exception $except '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), ]; } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php index 1efad607e8277..7037c497cc9c6 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php @@ -132,12 +132,12 @@ public function update(Response $response) $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 @@ public function update(Response $response) } } - 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); diff --git a/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php b/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php index a701b235464ba..895207152bd19 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php @@ -31,7 +31,7 @@ public static function handle(HttpKernelInterface $kernel, Request $request, $ty // 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), diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php index 6756f3de42647..e044e5e1add53 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -52,6 +52,6 @@ public function testCollect() $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()); } } diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index f3f5b4e51f1ad..83f85abda2a12 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -139,7 +139,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AnonymousToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AnonymousToken.php index 1ee85363c4925..7677b90d274df 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AnonymousToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AnonymousToken.php @@ -61,7 +61,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php index ddad0a539cd30..7ff0cfe8a5ba4 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php @@ -81,7 +81,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php index 031e4c6b98c76..6e846dd27c18d 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php @@ -96,7 +96,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php index 3c052722bee38..9b71520a2b1c0 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php @@ -93,7 +93,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index 6f8a43b014531..53c016397632d 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -26,7 +26,7 @@ public static function isSupported() 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 @@ public function isPasswordValid($encoded, $raw, $salt) 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 @@ private function encodePasswordNative($raw) 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; } diff --git a/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php b/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php index cb91b42364bc4..60aea70269a68 100644 --- a/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php +++ b/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php @@ -46,7 +46,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php index 2c6c7344a467f..032156e263bc9 100644 --- a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php @@ -51,7 +51,7 @@ public function serialize() $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); } /** diff --git a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php index ed9fb1bd339b9..9cf253b309238 100644 --- a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php @@ -62,7 +62,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php b/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php index b4b8047f341f9..c5e517d01d612 100644 --- a/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php +++ b/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php @@ -56,7 +56,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index 7516759c0aa8e..564ca872401a6 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php @@ -50,7 +50,7 @@ public function serialize() { $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) diff --git a/src/Symfony/Component/Security/Guard/Token/PostAuthenticationGuardToken.php b/src/Symfony/Component/Security/Guard/Token/PostAuthenticationGuardToken.php index 00048226b6aa3..fbdcca1fe8312 100644 --- a/src/Symfony/Component/Security/Guard/Token/PostAuthenticationGuardToken.php +++ b/src/Symfony/Component/Security/Guard/Token/PostAuthenticationGuardToken.php @@ -78,7 +78,7 @@ public function serialize() { $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); } /** diff --git a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php index 99c8fcab4e645..de985fb3155da 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php @@ -107,7 +107,7 @@ protected function attemptAuthentication(Request $request) $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))); } diff --git a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php index 2f54156732948..37bdfdcafb327 100644 --- a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -85,7 +85,7 @@ protected function attemptAuthentication(Request $request) $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))); } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 00bd8a2a52faf..b6aea185e789b 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -313,7 +313,7 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec 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__); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 38908a9323ba1..7201e5c095751 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -380,7 +380,7 @@ private function isMaxDepthReached(array $attributesMetadata, $class, $attribute 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; diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 854962da6c94d..c1b3dd260e243 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -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.'); } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 4528e385a7ff6..f63cf67bdf7ed 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -191,7 +191,7 @@ public function denormalize($data, $type, $format = null, array $context = []) 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 @@ public function supportsNormalization($data, $format = null/*, array $context = 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 @@ final public function decode($data, $format, array $context = []) 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 @@ public function supportsEncoding($format/*, array $context = []*/) 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__); diff --git a/src/Symfony/Component/Translation/Resources/bin/translation-status.php b/src/Symfony/Component/Translation/Resources/bin/translation-status.php index 0d37c3e0aa38b..96ccc105741b7 100644 --- a/src/Symfony/Component/Translation/Resources/bin/translation-status.php +++ b/src/Symfony/Component/Translation/Resources/bin/translation-status.php @@ -73,7 +73,7 @@ $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; diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index f418aa089488d..9e50f23501154 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -79,7 +79,7 @@ protected function doClone($var) } if ($gk !== $k) { $fromObjCast = true; - $refs = $vals = \array_values($queue[$i]); + $refs = $vals = array_values($queue[$i]); break; } } @@ -90,7 +90,7 @@ protected function doClone($var) 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 @@ protected function doClone($var) } $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 @@ protected function doClone($var) 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 @@ protected function doClone($var) 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 @@ protected function doClone($var) 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 @@ protected function doClone($var) 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;