diff --git a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php index 24a670de79..f4e37ff44e 100644 --- a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php +++ b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php @@ -67,7 +67,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } - if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) { + if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) { return $this->records[spl_object_hash($request)] ?? []; } @@ -89,7 +89,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } - if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) { + if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) { return $this->errorCount[spl_object_hash($request)] ?? 0; } diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php index 632a4ca878..bb1e8ab4c2 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php @@ -53,7 +53,7 @@ class SymfonyTestsListenerTrait Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2; } - $enableDebugClassLoader = \class_exists('Symfony\Component\Debug\DebugClassLoader'); + $enableDebugClassLoader = class_exists('Symfony\Component\Debug\DebugClassLoader'); foreach ($mockedNamespaces as $type => $namespaces) { if (!\is_array($namespaces)) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 70ca302aff..e09d540748 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -99,7 +99,7 @@ EOF; private static function getProxyManagerVersion(): string { - if (!\class_exists(Version::class)) { + if (!class_exists(Version::class)) { return '0.0.1'; } diff --git a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php index cf46c8e620..ed76f2e380 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php @@ -295,7 +295,7 @@ TXT $tester = $this->createCommandTester([], [], null, null, false, ['message' => $message]); $tester->execute([], ['decorated' => true]); $display = $tester->getDisplay(); - $this->assertContains(\json_encode($message), $display); + $this->assertContains(json_encode($message), $display); } public function testWithGlobalsJson() @@ -304,7 +304,7 @@ TXT $tester = $this->createCommandTester([], [], null, null, false, $globals); $tester->execute(['--format' => 'json'], ['decorated' => true]); $display = $tester->getDisplay(); - $display = \json_decode($display, true); + $display = json_decode($display, true); $this->assertSame($globals, $display['globals']); } @@ -313,10 +313,10 @@ 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); } diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php index f3d6a875e0..340198e5e2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php @@ -40,7 +40,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer if ($excludeRegexp instanceof CacheItemPoolInterface) { @trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED); $excludeRegexp = $debug; - $debug = 4 < \func_num_args() && \func_get_arg(4); + $debug = 4 < \func_num_args() && func_get_arg(4); } parent::__construct($phpArrayFile); $this->annotationReader = $annotationReader; diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php index 535161b119..41a8aaa04d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php @@ -36,7 +36,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer */ public function __construct(array $loaders, string $phpArrayFile) { - if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) { + if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) { @trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED); } parent::__construct($phpArrayFile); diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php index d617f7df9d..bd1e559a36 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php @@ -37,7 +37,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer */ public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile) { - if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) { + if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) { @trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED); } parent::__construct($phpArrayFile); diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 6897fbceee..ff680a46e8 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -52,9 +52,9 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg // Detect wrapped values that encode for their expiry and creation duration // For compactness, these values are packed in the key of an array using // magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F - if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = \key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) { + if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) { $item->value = $v[$k]; - $v = \unpack('Ve/Nc', \substr($k, 1, -1)); + $v = unpack('Ve/Nc', substr($k, 1, -1)); $item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET; $item->metadata[CacheItem::METADATA_CTIME] = $v['c']; } diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index cf51b90d8d..bccafcf47e 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -58,9 +58,9 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa // Detect wrapped values that encode for their expiry and creation duration // For compactness, these values are packed in the key of an array using // magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F - if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = \key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) { + if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) { $item->value = $v[$k]; - $v = \unpack('Ve/Nc', \substr($k, 1, -1)); + $v = unpack('Ve/Nc', substr($k, 1, -1)); $item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET; $item->metadata[CacheItem::METADATA_CTIME] = $v['c']; } elseif ($innerItem instanceof CacheItem) { diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index 92eb9c39df..3cc3fb8f2e 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -110,7 +110,7 @@ final class CacheItem implements ItemInterface if (!$this->isTaggable) { throw new LogicException(sprintf('Cache item "%s" comes from a non tag-aware pool: you cannot tag it.', $this->key)); } - if (!\is_iterable($tags)) { + if (!is_iterable($tags)) { $tags = [$tags]; } foreach ($tags as $tag) { diff --git a/src/Symfony/Component/Cache/Traits/ArrayTrait.php b/src/Symfony/Component/Cache/Traits/ArrayTrait.php index e585c3d48c..4d67c2df5a 100644 --- a/src/Symfony/Component/Cache/Traits/ArrayTrait.php +++ b/src/Symfony/Component/Cache/Traits/ArrayTrait.php @@ -123,7 +123,7 @@ trait ArrayTrait if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) { return serialize($value); } - } elseif (!\is_scalar($value)) { + } elseif (!is_scalar($value)) { try { $serialized = serialize($value); } catch (\Exception $e) { diff --git a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php index 0bec18a07a..4395de0252 100644 --- a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php @@ -86,7 +86,7 @@ EOF; $isStaticValue = false; } $value = var_export($value, true); - } elseif (!\is_scalar($value)) { + } elseif (!is_scalar($value)) { throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value))); } else { $value = var_export($value, true); diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index 37d25f87a9..6afdd8c3a5 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -182,7 +182,7 @@ trait PhpFilesTrait $isStaticValue = false; } $value = var_export($value, true); - } elseif (!\is_scalar($value)) { + } elseif (!is_scalar($value)) { throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value))); } else { $value = var_export($value, true); diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 7522cef8f2..5c0faa5fe9 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -779,7 +779,7 @@ class Application if (false !== strpos($message, "class@anonymous\0")) { $message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) { - return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; + return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; }, $message); } diff --git a/src/Symfony/Component/Console/Helper/ProcessHelper.php b/src/Symfony/Component/Console/Helper/ProcessHelper.php index e3a7c77b35..41f128bb49 100644 --- a/src/Symfony/Component/Console/Helper/ProcessHelper.php +++ b/src/Symfony/Component/Console/Helper/ProcessHelper.php @@ -51,7 +51,7 @@ class ProcessHelper extends Helper if (!\is_array($cmd)) { @trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), E_USER_DEPRECATED); - $cmd = [\method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)]; + $cmd = [method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)]; } if (\is_string($cmd[0] ?? null)) { diff --git a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php index 4ada2e8673..ce2c28ba1a 100644 --- a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php @@ -50,7 +50,7 @@ class ConsoleSectionOutput extends StreamOutput } if ($lines) { - \array_splice($this->content, -($lines * 2)); // Multiply lines by 2 to cater for each new line added between content + array_splice($this->content, -($lines * 2)); // Multiply lines by 2 to cater for each new line added between content } else { $lines = $this->lines; $this->content = []; diff --git a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php index 5387a9e3c2..82c6b44517 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php @@ -26,7 +26,7 @@ class ProcessHelperTest extends TestCase public function testVariousProcessRuns($expected, $cmd, $verbosity, $error) { if (\is_string($cmd)) { - $cmd = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd); + $cmd = method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd); } $helper = new ProcessHelper(); @@ -99,7 +99,7 @@ EOT; $args = new Process(['php', '-r', 'echo 42;']); $args = $args->getCommandLine(); $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); - $fromShellCommandline = \method_exists(Process::class, 'fromShellCommandline') ? [Process::class, 'fromShellCommandline'] : function ($cmd) { return new Process($cmd); }; + $fromShellCommandline = method_exists(Process::class, 'fromShellCommandline') ? [Process::class, 'fromShellCommandline'] : function ($cmd) { return new Process($cmd); }; return [ ['', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null], diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index e648bf60c5..55fd0df694 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -171,7 +171,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); @@ -189,7 +189,7 @@ 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)); } @@ -222,23 +222,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; @@ -253,22 +253,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); } } @@ -324,14 +324,14 @@ class DebugClassLoader $finalOrInternal = false; 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]; $finalOrInternal = true; } } - if ($finalOrInternal || $method->isConstructor() || false === \strpos($doc, '@param') || StatelessInvocation::class === $class) { + if ($finalOrInternal || $method->isConstructor() || false === strpos($doc, '@param') || StatelessInvocation::class === $class) { continue; } if (!preg_match_all('#\n\s+\* @param (.*?)(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, PREG_SET_ORDER)) { diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php index d016bb2fb4..ed8a4e8738 100644 --- a/src/Symfony/Component/Debug/Exception/FlattenException.php +++ b/src/Symfony/Component/Debug/Exception/FlattenException.php @@ -172,7 +172,7 @@ class FlattenException { if (false !== strpos($message, "class@anonymous\0")) { $message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) { - return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; + return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; }, $message); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 57b9c11bf6..620a5d7758 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -614,7 +614,7 @@ class XmlFileLoaderTest extends TestCase $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; $this->assertContains((string) new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources); - $prototypeRealPath = \realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype'); + $prototypeRealPath = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype'); $globResource = new GlobResource( $fixturesDir.'Prototype', '/*', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 836ce993c1..4351e3c0c1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -367,7 +367,7 @@ class YamlFileLoaderTest extends TestCase $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; $this->assertContains((string) new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources); - $prototypeRealPath = \realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype'); + $prototypeRealPath = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype'); $globResource = new GlobResource( $fixturesDir.'Prototype', '', diff --git a/src/Symfony/Component/DependencyInjection/TypedReference.php b/src/Symfony/Component/DependencyInjection/TypedReference.php index f80ac50563..56a878874e 100644 --- a/src/Symfony/Component/DependencyInjection/TypedReference.php +++ b/src/Symfony/Component/DependencyInjection/TypedReference.php @@ -34,7 +34,7 @@ class TypedReference extends Reference @trigger_error(sprintf('The $requiringClass argument of "%s()" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); $this->requiringClass = $invalidBehavior; - $invalidBehavior = 3 < \func_num_args() ? \func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + $invalidBehavior = 3 < \func_num_args() ? func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; } else { $this->name = $type === $id ? $name : null; } diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 5dbffe42c6..1c99293c0d 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1165,7 +1165,7 @@ class Crawler implements \Countable, \IteratorAggregate */ private function createCssSelectorConverter(): CssSelectorConverter { - if (!\class_exists(CssSelectorConverter::class)) { + if (!class_exists(CssSelectorConverter::class)) { throw new \LogicException('To filter with a CSS selector, install the CssSelector component ("composer require symfony/css-selector"). Or use filterXpath instead.'); } diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index fa9a2ee931..dbb70c4730 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -382,7 +382,7 @@ final class Dotenv throw new \LogicException('Resolving commands requires the Symfony Process component.'); } - $process = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline('echo '.$matches[0]) : new Process('echo '.$matches[0]); + $process = method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline('echo '.$matches[0]) : new Process('echo '.$matches[0]); $process->inheritEnvironmentVariables(true); $process->setEnv($this->values); try { diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 9ec1e94354..dc3290c9af 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -743,15 +743,15 @@ class Filesystem private static function box($func) { self::$lastError = null; - \set_error_handler(__CLASS__.'::handleError'); + set_error_handler(__CLASS__.'::handleError'); try { $result = $func(...\array_slice(\func_get_args(), 1)); - \restore_error_handler(); + restore_error_handler(); return $result; } catch (\Throwable $e) { } - \restore_error_handler(); + restore_error_handler(); throw $e; } diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 83163f51d5..7b7b1152ef 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -172,7 +172,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function name($patterns) { - $this->names = \array_merge($this->names, (array) $patterns); + $this->names = array_merge($this->names, (array) $patterns); return $this; } @@ -188,7 +188,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function notName($patterns) { - $this->notNames = \array_merge($this->notNames, (array) $patterns); + $this->notNames = array_merge($this->notNames, (array) $patterns); return $this; } @@ -210,7 +210,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function contains($patterns) { - $this->contains = \array_merge($this->contains, (array) $patterns); + $this->contains = array_merge($this->contains, (array) $patterns); return $this; } @@ -232,7 +232,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function notContains($patterns) { - $this->notContains = \array_merge($this->notContains, (array) $patterns); + $this->notContains = array_merge($this->notContains, (array) $patterns); return $this; } @@ -256,7 +256,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function path($patterns) { - $this->paths = \array_merge($this->paths, (array) $patterns); + $this->paths = array_merge($this->paths, (array) $patterns); return $this; } @@ -280,7 +280,7 @@ class Finder implements \IteratorAggregate, \Countable */ public function notPath($patterns) { - $this->notPaths = \array_merge($this->notPaths, (array) $patterns); + $this->notPaths = array_merge($this->notPaths, (array) $patterns); return $this; } diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index 9d57b07069..eda413a12b 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -65,9 +65,9 @@ class LocaleDataGenerator extends AbstractDataGenerator protected function preGenerate() { // Write parents locale file for the Translation component - \file_put_contents( + file_put_contents( __DIR__.'/../../../Translation/Resources/data/parents.json', - \json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL + json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL ); } diff --git a/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php b/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php index 2d56ff9d0c..49aec06b1f 100644 --- a/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php +++ b/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php @@ -92,10 +92,10 @@ class LocaleScanner $fallbacks = []; foreach ($locales as $locale) { - $content = \file_get_contents($sourceDir.'/'.$locale.'.txt'); + $content = file_get_contents($sourceDir.'/'.$locale.'.txt'); // Aliases contain the text "%%PARENT" followed by the aliased locale - if (\preg_match('/%%Parent{"([^"]+)"}/', $content, $matches)) { + if (preg_match('/%%Parent{"([^"]+)"}/', $content, $matches)) { $fallbacks[$locale] = $matches[1]; } } diff --git a/src/Symfony/Component/Lock/Store/ZookeeperStore.php b/src/Symfony/Component/Lock/Store/ZookeeperStore.php index c755ce1a1c..4f8b4ee374 100644 --- a/src/Symfony/Component/Lock/Store/ZookeeperStore.php +++ b/src/Symfony/Component/Lock/Store/ZookeeperStore.php @@ -127,8 +127,8 @@ class ZookeeperStore implements StoreInterface // For example: foo/bar will become /foo-bar and /foo/bar will become /-foo-bar $resource = (string) $key; - if (false !== \strpos($resource, '/')) { - $resource = \strtr($resource, ['/' => '-']).'-'.sha1($resource); + if (false !== strpos($resource, '/')) { + $resource = strtr($resource, ['/' => '-']).'-'.sha1($resource); } if ('' === $resource) { diff --git a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/Fixtures/long_receiver.php b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/Fixtures/long_receiver.php index a7d4d8dcd7..92897d2b35 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/Fixtures/long_receiver.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/Fixtures/long_receiver.php @@ -32,7 +32,7 @@ $receiver = new AmqpReceiver($connection, $serializer); $worker = new Worker($receiver, new class() implements MessageBusInterface { public function dispatch($envelope): Envelope { - echo 'Get envelope with message: '.\get_class($envelope->getMessage())."\n"; + echo 'Get envelope with message: '.get_class($envelope->getMessage())."\n"; echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), JSON_PRETTY_PRINT)); sleep(30); diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php index 19415c7aed..abe383c9e3 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php @@ -114,7 +114,7 @@ class Connection continue; } - if (!\is_numeric($arguments[$key])) { + if (!is_numeric($arguments[$key])) { throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", %s given.', $key, \gettype($arguments[$key]))); } diff --git a/src/Symfony/Component/Messenger/Transport/Receiver/StopWhenMemoryUsageIsExceededReceiver.php b/src/Symfony/Component/Messenger/Transport/Receiver/StopWhenMemoryUsageIsExceededReceiver.php index e61fe5937a..929d4e43b2 100644 --- a/src/Symfony/Component/Messenger/Transport/Receiver/StopWhenMemoryUsageIsExceededReceiver.php +++ b/src/Symfony/Component/Messenger/Transport/Receiver/StopWhenMemoryUsageIsExceededReceiver.php @@ -32,7 +32,7 @@ class StopWhenMemoryUsageIsExceededReceiver implements ReceiverInterface $this->memoryLimit = $memoryLimit; $this->logger = $logger; $this->memoryResolver = $memoryResolver ?: function () { - return \memory_get_usage(true); + return memory_get_usage(true); }; } diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index eb0a6c2480..7b9adc44f2 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -797,7 +797,7 @@ class OptionsResolver implements Options throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); } - $triggerDeprecation = 1 === \func_num_args() || \func_get_arg(1); + $triggerDeprecation = 1 === \func_num_args() || func_get_arg(1); // Shortcut for resolved options if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) { diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php index 882091dca8..b55c070fb8 100644 --- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php +++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php @@ -69,6 +69,6 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface */ public function hasMetadataFor($value) { - return \is_object($value) || (\is_string($value) && (\class_exists($value) || \interface_exists($value, false))); + return \is_object($value) || (\is_string($value) && (class_exists($value) || interface_exists($value, false))); } } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index a629920bb8..620fa8a626 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -263,7 +263,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer */ public function supportsDenormalization($data, $type, $format = null) { - return \class_exists($type) || (\interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type)); + return class_exists($type) || (interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type)); } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php index d5a1990f0b..dcf2deef80 100644 --- a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php @@ -65,7 +65,7 @@ class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, Se */ public function supportsDenormalization($data, $type, $format = null) { - return \is_subclass_of($type, DenormalizableInterface::class); + return is_subclass_of($type, DenormalizableInterface::class); } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index f766286b2b..118e9856f5 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -36,7 +36,7 @@ class ObjectNormalizer extends AbstractObjectNormalizer public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, callable $objectClassResolver = null, array $defaultContext = []) { - if (!\class_exists(PropertyAccess::class)) { + if (!class_exists(PropertyAccess::class)) { throw new LogicException('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 b950ba58b0..c7ccd9fd9f 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -84,7 +84,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface } if (!($normalizer instanceof NormalizerInterface || $normalizer instanceof DenormalizerInterface)) { - @trigger_error(\sprintf('Passing normalizers ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing normalizers ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class), E_USER_DEPRECATED); // throw new \InvalidArgumentException(\sprintf('The class "%s" does not implement "%s" or "%s".', \get_class($normalizer), NormalizerInterface::class, DenormalizerInterface::class)); } } @@ -104,7 +104,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface } if (!($encoder instanceof EncoderInterface || $encoder instanceof DecoderInterface)) { - @trigger_error(\sprintf('Passing encoders ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($encoder), EncoderInterface::class, DecoderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing encoders ("%s") which do not implement either "%s" or "%s" has been deprecated since Symfony 4.2.', \get_class($encoder), EncoderInterface::class, DecoderInterface::class), E_USER_DEPRECATED); // throw new \InvalidArgumentException(\sprintf('The class "%s" does not implement "%s" or "%s".', \get_class($normalizer), EncoderInterface::class, DecoderInterface::class)); } } diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index ee8609fada..77c276073f 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -32,7 +32,7 @@ class PluralizationRules */ public static function get($number, $locale/*, bool $triggerDeprecation = true*/) { - if (3 > \func_num_args() || \func_get_arg(2)) { + if (3 > \func_num_args() || func_get_arg(2)) { @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED); } diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 8a2b2dd9d0..ec312ae787 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -430,7 +430,7 @@ EOF protected function computeFallbackLocales($locale) { if (null === $this->parentLocales) { - $parentLocales = \json_decode(\file_get_contents(__DIR__.'/Resources/data/parents.json'), true); + $parentLocales = json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); } $locales = []; diff --git a/src/Symfony/Component/VarDumper/Caster/ClassStub.php b/src/Symfony/Component/VarDumper/Caster/ClassStub.php index b655ae960e..0b9329dbe9 100644 --- a/src/Symfony/Component/VarDumper/Caster/ClassStub.php +++ b/src/Symfony/Component/VarDumper/Caster/ClassStub.php @@ -57,7 +57,7 @@ class ClassStub extends ConstStub if (false !== strpos($identifier, "class@anonymous\0")) { $this->value = $identifier = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) { - return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; + return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; }, $identifier); } diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index 06cd11e63d..83296bbc1a 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -283,7 +283,7 @@ class ExceptionCaster if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "class@anonymous\0")) { $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) { - return \class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; + return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0]; }, $a[Caster::PREFIX_PROTECTED.'message']); } diff --git a/src/Symfony/Component/VarDumper/Caster/ProxyManagerCaster.php b/src/Symfony/Component/VarDumper/Caster/ProxyManagerCaster.php index da037b6b3e..d8afd70400 100644 --- a/src/Symfony/Component/VarDumper/Caster/ProxyManagerCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ProxyManagerCaster.php @@ -21,7 +21,7 @@ class ProxyManagerCaster { public static function castProxy(ProxyInterface $c, array $a, Stub $stub, $isNested) { - if ($parent = \get_parent_class($c)) { + if ($parent = get_parent_class($c)) { $stub->class .= ' - '.$parent; } $stub->class .= '@proxy'; diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index b8318c514f..58c2117737 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -73,7 +73,7 @@ class VarCloner extends AbstractCloner } if ($gk !== $k) { $fromObjCast = true; - $refs = $vals = \array_values($queue[$i]); + $refs = $vals = array_values($queue[$i]); break; } } @@ -84,7 +84,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_id($v)])) { + if ($v instanceof Stub && isset($hardRefs[spl_object_id($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; @@ -94,7 +94,7 @@ class VarCloner extends AbstractCloner } $refs[$k] = $vals[$k] = new Stub(); $refs[$k]->value = $v; - $h = \spl_object_id($refs[$k]); + $h = spl_object_id($refs[$k]); $hardRefs[$h] = &$refs[$k]; $values[$h] = $v; $vals[$k]->handle = ++$refsCounter; @@ -112,22 +112,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; } @@ -173,7 +173,7 @@ class VarCloner extends AbstractCloner case \is_object($v): case $v instanceof \__PHP_Incomplete_Class: - if (empty($objRefs[$h = \spl_object_id($v)])) { + if (empty($objRefs[$h = spl_object_id($v)])) { $stub = new Stub(); $stub->type = Stub::TYPE_OBJECT; $stub->class = \get_class($v); @@ -184,7 +184,7 @@ class VarCloner extends AbstractCloner if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) { break; } - $stub->handle = $h = \spl_object_id($stub->value); + $stub->handle = $h = spl_object_id($stub->value); } $stub->value = null; if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) { @@ -206,7 +206,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; diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index 74a324691e..87b3156d41 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -40,7 +40,7 @@ class Exporter $refs = $values; foreach ($values as $k => $value) { if (\is_resource($value)) { - throw new NotInstantiableTypeException(\get_resource_type($value).' resource'); + throw new NotInstantiableTypeException(get_resource_type($value).' resource'); } $refs[$k] = $objectsPool; @@ -115,14 +115,14 @@ class Exporter goto handle_value; } - if (\method_exists($class, '__sleep')) { + if (method_exists($class, '__sleep')) { if (!\is_array($sleep = $value->__sleep())) { trigger_error('serialize(): __sleep should return an array only containing the names of instance-variables to serialize', E_USER_NOTICE); $value = null; goto handle_value; } foreach ($sleep as $name) { - if (\property_exists($value, $name) && !$reflector->hasProperty($name)) { + if (property_exists($value, $name) && !$reflector->hasProperty($name)) { $arrayValue[$name] = $value->$name; } } @@ -171,7 +171,7 @@ class Exporter $objectsPool[$value] = [$id = \count($objectsPool)]; $properties = self::prepare($properties, $objectsPool, $refsPool, $objectsCount, $valueIsStatic); ++$objectsCount; - $objectsPool[$value] = [$id, $class, $properties, \method_exists($class, '__unserialize') ? -$objectsCount : (\method_exists($class, '__wakeup') ? $objectsCount : 0)]; + $objectsPool[$value] = [$id, $class, $properties, method_exists($class, '__unserialize') ? -$objectsCount : (method_exists($class, '__wakeup') ? $objectsCount : 0)]; $value = new Reference($id); diff --git a/src/Symfony/Component/VarExporter/Internal/Hydrator.php b/src/Symfony/Component/VarExporter/Internal/Hydrator.php index 5f64adf96f..364d292d91 100644 --- a/src/Symfony/Component/VarExporter/Internal/Hydrator.php +++ b/src/Symfony/Component/VarExporter/Internal/Hydrator.php @@ -65,7 +65,7 @@ class Hydrator }; } - if (!\class_exists($class) && !\interface_exists($class, false) && !\trait_exists($class, false)) { + if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) { throw new ClassNotFoundException($class); } $classReflector = new \ReflectionClass($class); diff --git a/src/Symfony/Component/VarExporter/Internal/Registry.php b/src/Symfony/Component/VarExporter/Internal/Registry.php index b5069dd16a..dd2792133e 100644 --- a/src/Symfony/Component/VarExporter/Internal/Registry.php +++ b/src/Symfony/Component/VarExporter/Internal/Registry.php @@ -65,7 +65,7 @@ class Registry public static function getClassReflector($class, $instantiableWithoutConstructor = false, $cloneable = null) { - if (!($isClass = \class_exists($class)) && !\interface_exists($class, false) && !\trait_exists($class, false)) { + if (!($isClass = class_exists($class)) && !interface_exists($class, false) && !trait_exists($class, false)) { throw new ClassNotFoundException($class); } $reflector = new \ReflectionClass($class); @@ -86,14 +86,14 @@ class Registry $proto = $reflector->newInstanceWithoutConstructor(); $instantiableWithoutConstructor = true; } catch (\ReflectionException $e) { - $proto = $reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__unserialize')) ? 'C:' : 'O:'; + $proto = $reflector->implementsInterface('Serializable') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize')) ? 'C:' : 'O:'; if ('C:' === $proto && !$reflector->getMethod('unserialize')->isInternal()) { $proto = null; } elseif (false === $proto = @unserialize($proto.\strlen($class).':"'.$class.'":0:{}')) { throw new NotInstantiableTypeException($class); } } - if (null !== $proto && !$proto instanceof \Throwable && !$proto instanceof \Serializable && !\method_exists($class, '__sleep') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__serialize'))) { + if (null !== $proto && !$proto instanceof \Throwable && !$proto instanceof \Serializable && !method_exists($class, '__sleep') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__serialize'))) { try { serialize($proto); } catch (\Exception $e) { @@ -103,7 +103,7 @@ class Registry } if (null === $cloneable) { - if (($proto instanceof \Reflector || $proto instanceof \ReflectionGenerator || $proto instanceof \ReflectionType || $proto instanceof \IteratorIterator || $proto instanceof \RecursiveIteratorIterator) && (!$proto instanceof \Serializable && !\method_exists($proto, '__wakeup') && (\PHP_VERSION_ID < 70400 || !\method_exists($class, '__unserialize')))) { + if (($proto instanceof \Reflector || $proto instanceof \ReflectionGenerator || $proto instanceof \ReflectionType || $proto instanceof \IteratorIterator || $proto instanceof \RecursiveIteratorIterator) && (!$proto instanceof \Serializable && !method_exists($proto, '__wakeup') && (\PHP_VERSION_ID < 70400 || !method_exists($class, '__unserialize')))) { throw new NotInstantiableTypeException($class); } diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php index 5a1654ae55..c0247014e7 100644 --- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php @@ -213,7 +213,7 @@ class GraphvizDumper implements DumperInterface */ protected function escape($value): string { - return \is_bool($value) ? ($value ? '1' : '0') : \addslashes($value); + return \is_bool($value) ? ($value ? '1' : '0') : addslashes($value); } private function addAttributes(array $attributes): string diff --git a/src/Symfony/Component/Workflow/Tests/StateMachineTest.php b/src/Symfony/Component/Workflow/Tests/StateMachineTest.php index 7f76c4a70b..8354229a35 100644 --- a/src/Symfony/Component/Workflow/Tests/StateMachineTest.php +++ b/src/Symfony/Component/Workflow/Tests/StateMachineTest.php @@ -78,7 +78,7 @@ class StateMachineTest extends TestCase $net = new StateMachine($definition, null, $dispatcher); $dispatcher->addListener('workflow.guard', function (GuardEvent $event) { - $event->addTransitionBlocker(new TransitionBlocker(\sprintf('Transition blocker of place %s', $event->getTransition()->getFroms()[0]), 'blocker')); + $event->addTransitionBlocker(new TransitionBlocker(sprintf('Transition blocker of place %s', $event->getTransition()->getFroms()[0]), 'blocker')); }); $subject = new \stdClass(); diff --git a/src/Symfony/Contracts/Translation/TranslatorTrait.php b/src/Symfony/Contracts/Translation/TranslatorTrait.php index c1021923c8..488b4f4f23 100644 --- a/src/Symfony/Contracts/Translation/TranslatorTrait.php +++ b/src/Symfony/Contracts/Translation/TranslatorTrait.php @@ -91,7 +91,7 @@ EOF; } } else { $leftNumber = '-Inf' === $matches['left'] ? -INF : (float) $matches['left']; - $rightNumber = \is_numeric($matches['right']) ? (float) $matches['right'] : INF; + $rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : INF; if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber) && (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber) @@ -117,7 +117,7 @@ EOF; $message = sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $id, $locale, $number); - if (\class_exists(InvalidArgumentException::class)) { + if (class_exists(InvalidArgumentException::class)) { throw new InvalidArgumentException($message); }