From cc7b6c5e5adf1411ee527e5c9cc2bdfad2d568fb Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Fri, 28 Aug 2020 21:37:16 +0200 Subject: [PATCH 1/8] [PhpunitBridge] Fix deprecation type detection When using several vendor directories --- .../DeprecationErrorHandler/Deprecation.php | 11 +++-- .../fake_app/AppService.php | 19 ++++++++ .../fake_vendor/composer/autoload_real.php | 30 +++++++++++- .../fake_vendor_bis/autoload.php | 5 ++ .../composer/autoload_real.php | 47 +++++++++++++++++++ .../fake_vendor_bis/composer/installed.json | 1 + .../foo/lib/SomeOtherService.php | 14 ++++++ .../multiple_autoloads.phpt | 45 ++++++++++++++++++ 8 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_app/AppService.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/installed.json create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php create mode 100644 src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/multiple_autoloads.phpt diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index 62e09c461c..7cb021aa57 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -264,7 +264,10 @@ class Deprecation if (file_exists($v.'/composer/installed.json')) { self::$vendors[] = $v; $loader = require $v.'/autoload.php'; - $paths = self::getSourcePathsFromPrefixes(array_merge($loader->getPrefixes(), $loader->getPrefixesPsr4())); + $paths = self::addSourcePathsFromPrefixes( + array_merge($loader->getPrefixes(), $loader->getPrefixesPsr4()), + $paths + ); } } } @@ -280,15 +283,17 @@ class Deprecation return self::$vendors; } - private static function getSourcePathsFromPrefixes(array $prefixesByNamespace) + private static function addSourcePathsFromPrefixes(array $prefixesByNamespace, array $paths) { foreach ($prefixesByNamespace as $prefixes) { foreach ($prefixes as $prefix) { if (false !== realpath($prefix)) { - yield realpath($prefix); + $paths[] = realpath($prefix); } } } + + return $paths; } /** diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_app/AppService.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_app/AppService.php new file mode 100644 index 0000000000..8baaf34d92 --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_app/AppService.php @@ -0,0 +1,19 @@ +deprecatedApi(); + + $service2 = new SomeOtherService(); + $service2->deprecatedApi(); + } +} + diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php index 0d649e4ddd..2446550e2a 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php @@ -9,14 +9,40 @@ class ComposerLoaderFake public function getPrefixesPsr4() { - return []; + return [ + 'App\\Services\\' => [__DIR__.'/../../fake_app/'], + 'acme\\lib\\' => [__DIR__.'/../acme/lib/'], + ]; + } + + public function loadClass($className) + { + foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) { + if (strpos($className, $prefix) !== 0) { + continue; + } + + foreach ($baseDirs as $baseDir) { + $file = str_replace([$prefix, '\\'], [$baseDir, '/'], $className.'.php'); + if (file_exists($file)) { + require $file; + } + } + } } } class ComposerAutoloaderInitFake { + private static $loader; + public static function getLoader() { - return new ComposerLoaderFake(); + if (null === self::$loader) { + self::$loader = new ComposerLoaderFake(); + spl_autoload_register([self::$loader, 'loadClass']); + } + + return self::$loader; } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php new file mode 100644 index 0000000000..c1c963926b --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php @@ -0,0 +1,5 @@ + [__DIR__.'/../foo/lib/'], + ]; + } + + public function loadClass($className) + { + foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) { + if (strpos($className, $prefix) !== 0) { + continue; + } + + foreach ($baseDirs as $baseDir) { + $file = str_replace([$prefix, '\\'], [$baseDir, '/'], $className.'.php'); + if (file_exists($file)) { + require $file; + } + } + } + } +} + +class ComposerAutoloaderInitFakeBis +{ + private static $loader; + + public static function getLoader() + { + if (null === self::$loader) { + self::$loader = new ComposerLoaderFakeBis(); + spl_autoload_register([self::$loader, 'loadClass']); + } + + return self::$loader; + } +} diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/installed.json b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/installed.json new file mode 100644 index 0000000000..bf4fecc9fb --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/installed.json @@ -0,0 +1 @@ +{"just here": "for the detection"} diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php new file mode 100644 index 0000000000..b1e8fab2bd --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php @@ -0,0 +1,14 @@ +directDeprecations(); +?> +--EXPECTF-- +Remaining direct deprecation notices (2) + + 1x: deprecatedApi is deprecated! You should stop relying on it! + 1x in AppService::directDeprecations from App\Services + + 1x: deprecatedApi from foo is deprecated! You should stop relying on it! + 1x in AppService::directDeprecations from App\Services From 7bdf3eeab35bf4445d6c68f681c1813fca24d757 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 2 Sep 2020 10:09:24 +0200 Subject: [PATCH 2/8] Update CHANGELOG for 4.4.13 --- CHANGELOG-4.4.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index ce1903a958..2c30e0de97 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,15 @@ in 4.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.4.0...v4.4.1 +* 4.4.13 (2020-09-02) + + * security #cve-2020-15094 Remove headers with internal meaning from HttpClient responses (mpdude) + * bug #38024 [Console] Fix undefined index for inconsistent command name definition (chalasr) + * bug #38023 [DI] fix inlining of non-shared services (nicolas-grekas) + * bug #38020 [PhpUnitBridge] swallow deprecations (xabbuh) + * bug #38010 [Cache] Psr16Cache does not handle Proxy cache items (alex-dev) + * bug #37937 [Serializer] fixed fix encoding of cache keys with anonymous classes (michaelzangerle) + * 4.4.12 (2020-08-31) * bug #37966 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response (fancyweb) From 7982e499d6d74f5006b2c82d81ce3b9d5431c438 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 2 Sep 2020 10:09:29 +0200 Subject: [PATCH 3/8] Update VERSION for 4.4.13 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index e7c70c8fd4..f11acbb9bf 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.13-DEV'; + const VERSION = '4.4.13'; const VERSION_ID = 40413; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; const RELEASE_VERSION = 13; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From 27c131ca7ae9a5520299a942ff62baa6fc5377c7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 2 Sep 2020 10:14:21 +0200 Subject: [PATCH 4/8] Bump Symfony version to 4.4.14 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index f11acbb9bf..18d3c01f33 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.13'; - const VERSION_ID = 40413; + const VERSION = '4.4.14-DEV'; + const VERSION_ID = 40414; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; - const RELEASE_VERSION = 13; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 14; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2022'; const END_OF_LIFE = '11/2023'; From 63a8570a423a90c2eab0429722a67b64159029f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Wed, 2 Sep 2020 10:51:13 +0200 Subject: [PATCH 5/8] Add a warning comment on ldap empty password --- src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php index 65fef964a4..afe3e48f6e 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php @@ -50,6 +50,8 @@ class Connection extends AbstractConnection /** * {@inheritdoc} + * + * @param string $password WARNING: When the LDAP server allows unauthenticated binds, a blank $password will always be valid. */ public function bind($dn = null, $password = null) { From ddede31d0938872fcb4b60209aa82bab2a860a3f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 2 Sep 2020 14:17:05 +0200 Subject: [PATCH 6/8] Fix CS --- src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php index afe3e48f6e..2b224fe72b 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php @@ -51,7 +51,7 @@ class Connection extends AbstractConnection /** * {@inheritdoc} * - * @param string $password WARNING: When the LDAP server allows unauthenticated binds, a blank $password will always be valid. + * @param string $password WARNING: When the LDAP server allows unauthenticated binds, a blank $password will always be valid */ public function bind($dn = null, $password = null) { From b82d9a2dc732d806a73ca2a492a3ca9aa49cf528 Mon Sep 17 00:00:00 2001 From: Gocha Ossinkine Date: Wed, 26 Aug 2020 12:23:17 +0500 Subject: [PATCH 7/8] Make AbstractPhpFileCacheWarmer public --- .../FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php index 9e0984dfb5..aca75b5071 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php @@ -19,9 +19,6 @@ use Symfony\Component\Cache\Adapter\ProxyAdapter; use Symfony\Component\Config\Resource\ClassExistenceResource; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; -/** - * @internal - */ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface { private $phpArrayFile; From 4351a70637105102f832216e4b6f6cbe1cb9ab0f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Sep 2020 18:06:40 +0200 Subject: [PATCH 8/8] Enable "native_constant_invocation" CS rule --- .php_cs.dist | 1 + .../AbstractDoctrineExtension.php | 6 +- .../DoctrineParserCache.php | 2 +- .../Form/ChoiceList/DoctrineChoiceLoader.php | 2 +- .../MergeDoctrineCollectionListener.php | 2 +- .../HttpFoundation/DbalSessionHandler.php | 2 +- .../DbalSessionHandlerSchema.php | 2 +- .../Bridge/Doctrine/ManagerRegistry.php | 4 +- .../Monolog/Formatter/ConsoleFormatter.php | 2 +- .../Bridge/Monolog/Handler/DebugHandler.php | 2 +- .../Monolog/Handler/ServerLogHandler.php | 4 +- .../PhpUnit/DeprecationErrorHandler.php | 14 +- .../Bridge/PhpUnit/Tests/DnsMockTest.php | 6 +- .../ExpectedDeprecationAnnotationTest.php | 6 +- .../PhpUnit/Tests/ProcessIsolationTest.php | 4 +- src/Symfony/Bridge/PhpUnit/bootstrap.php | 2 +- .../LazyProxy/PhpDumper/ProxyDumper.php | 4 +- .../Bridge/Twig/Command/DebugCommand.php | 10 +- .../Bridge/Twig/Command/LintCommand.php | 16 +-- .../Bridge/Twig/Extension/CodeExtension.php | 6 +- .../Bridge/Twig/Extension/FormExtension.php | 10 +- .../Bridge/Twig/Extension/YamlExtension.php | 2 +- src/Symfony/Bridge/Twig/Form/TwigRenderer.php | 2 +- .../Bridge/Twig/Form/TwigRendererEngine.php | 4 +- .../Bridge/Twig/Translation/TwigExtractor.php | 2 +- .../CacheWarmer/ClassCacheCacheWarmer.php | 2 +- .../CacheWarmer/RouterCacheWarmer.php | 2 +- .../CacheWarmer/TranslationsCacheWarmer.php | 2 +- .../FrameworkBundle/Command/AboutCommand.php | 6 +- .../Command/AbstractConfigCommand.php | 2 +- .../Command/AssetsInstallCommand.php | 2 +- .../Command/CacheClearCommand.php | 4 +- .../Command/CachePoolClearCommand.php | 2 +- .../Command/CacheWarmupCommand.php | 2 +- .../Command/EventDispatcherDebugCommand.php | 2 +- .../Command/RouterDebugCommand.php | 2 +- .../Command/RouterMatchCommand.php | 2 +- .../Command/TranslationDebugCommand.php | 2 +- .../Command/TranslationUpdateCommand.php | 4 +- .../Command/XliffLintCommand.php | 2 +- .../Command/YamlLintCommand.php | 2 +- .../Console/Descriptor/JsonDescriptor.php | 2 +- .../Controller/RedirectController.php | 8 +- .../Controller/TemplateController.php | 2 +- .../Compiler/AddCacheClearerPass.php | 2 +- .../Compiler/AddCacheWarmerPass.php | 2 +- .../Compiler/AddConsoleCommandPass.php | 2 +- .../Compiler/AddConstraintValidatorsPass.php | 2 +- .../Compiler/AddValidatorInitializersPass.php | 2 +- .../Compiler/CompilerDebugDumpPass.php | 2 +- .../Compiler/ConfigCachePass.php | 2 +- .../ControllerArgumentValueResolverPass.php | 2 +- .../DependencyInjection/Compiler/FormPass.php | 2 +- .../Compiler/ProfilerPass.php | 2 +- .../Compiler/PropertyInfoPass.php | 2 +- .../Compiler/RoutingResolverPass.php | 2 +- .../Compiler/SerializerPass.php | 2 +- .../Compiler/TranslationDumperPass.php | 2 +- .../Compiler/TranslationExtractorPass.php | 2 +- .../Compiler/TranslatorPass.php | 2 +- .../Compiler/ValidateWorkflowsPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../FrameworkExtension.php | 2 +- .../EventListener/SessionListener.php | 2 +- .../EventListener/TestSessionListener.php | 2 +- .../FrameworkBundle/FrameworkBundle.php | 2 +- .../Templating/Helper/CodeHelper.php | 8 +- .../Templating/Helper/FormHelper.php | 4 +- .../Templating/TemplateNameParser.php | 2 +- .../FrameworkBundle/Test/KernelTestCase.php | 6 +- .../Descriptor/AbstractDescriptorTest.php | 4 +- .../Tests/Controller/ControllerTraitTest.php | 2 +- .../Translation/PhpExtractor.php | 2 +- .../Translation/PhpStringTokenParser.php | 2 +- .../Translation/TranslationLoader.php | 2 +- .../Translation/Translator.php | 2 +- .../Validator/ConstraintValidatorFactory.php | 2 +- .../SecurityBundle/Command/InitAclCommand.php | 2 +- .../SecurityBundle/Command/SetAclCommand.php | 2 +- .../Command/UserPasswordEncoderCommand.php | 4 +- .../Compiler/AddSecurityVotersPass.php | 2 +- .../Security/Factory/HttpDigestFactory.php | 2 +- .../DependencyInjection/SecurityExtension.php | 6 +- .../EventListener/AclSchemaListener.php | 2 +- .../Security/FirewallContext.php | 2 +- .../SecurityBundle/Security/FirewallMap.php | 8 +- .../UserPasswordEncoderCommandTest.php | 6 +- .../CacheWarmer/TemplateCacheWarmer.php | 2 +- .../TwigBundle/Command/DebugCommand.php | 2 +- .../ContainerAwareRuntimeLoader.php | 2 +- .../Twig/WebProfilerExtension.php | 2 +- .../WebServerBundle/Resources/router.php | 8 +- src/Symfony/Component/BrowserKit/Client.php | 22 +-- .../Cache/Adapter/AbstractAdapter.php | 2 +- .../Component/Cache/Adapter/ArrayAdapter.php | 4 +- .../Component/Cache/Adapter/ChainAdapter.php | 2 +- .../Cache/Adapter/PhpArrayAdapter.php | 2 +- .../Cache/Adapter/PhpFilesAdapter.php | 2 +- src/Symfony/Component/Cache/CacheItem.php | 2 +- .../Component/Cache/Simple/ArrayCache.php | 2 +- .../Component/Cache/Simple/PhpArrayCache.php | 2 +- .../Component/Cache/Simple/PhpFilesCache.php | 2 +- .../Cache/Tests/Adapter/ApcuAdapterTest.php | 4 +- .../Tests/Adapter/MemcachedAdapterTest.php | 4 +- .../Cache/Tests/Simple/ApcuCacheTest.php | 2 +- .../Cache/Tests/Simple/MemcachedCacheTest.php | 4 +- .../Component/Cache/Traits/AbstractTrait.php | 2 +- .../Component/Cache/Traits/ApcuTrait.php | 8 +- .../Component/Cache/Traits/DoctrineTrait.php | 2 +- .../Component/Cache/Traits/MemcachedTrait.php | 4 +- .../Component/Cache/Traits/PhpFilesTrait.php | 8 +- .../Component/ClassLoader/ApcClassLoader.php | 2 +- .../ClassLoader/ClassCollectionLoader.php | 14 +- .../Component/ClassLoader/ClassLoader.php | 2 +- .../ClassLoader/ClassMapGenerator.php | 22 +-- .../Component/ClassLoader/MapClassLoader.php | 2 +- .../Component/ClassLoader/Psr4ClassLoader.php | 2 +- .../ClassLoader/Tests/ApcClassLoaderTest.php | 4 +- .../ClassLoader/Tests/ClassLoaderTest.php | 2 +- .../ClassLoader/WinCacheClassLoader.php | 2 +- .../ClassLoader/XcacheClassLoader.php | 2 +- .../Component/Config/Definition/ArrayNode.php | 2 +- .../Builder/ArrayNodeDefinition.php | 4 +- .../Definition/Dumper/XmlReferenceDumper.php | 4 +- .../DependencyInjection/ConfigCachePass.php | 2 +- src/Symfony/Component/Config/FileLocator.php | 2 +- .../Config/Resource/GlobResource.php | 2 +- .../Config/ResourceCheckerConfigCache.php | 2 +- .../Config/Tests/Definition/ArrayNodeTest.php | 2 +- .../Dumper/XmlReferenceDumperTest.php | 2 +- .../Tests/Definition/ScalarNodeTest.php | 2 +- .../Config/Tests/Loader/LoaderTest.php | 2 +- .../Config/Tests/Util/XmlUtilsTest.php | 4 +- .../Component/Config/Util/XmlUtils.php | 12 +- src/Symfony/Component/Console/Application.php | 16 +-- .../Component/Console/Command/Command.php | 2 +- .../Console/Descriptor/JsonDescriptor.php | 4 +- .../Console/Descriptor/TextDescriptor.php | 4 +- .../Console/Event/ConsoleExceptionEvent.php | 2 +- .../Console/Formatter/OutputFormatter.php | 6 +- .../Component/Console/Helper/ProgressBar.php | 4 +- .../Console/Helper/QuestionHelper.php | 6 +- .../Console/Helper/SymfonyQuestionHelper.php | 2 +- .../Component/Console/Helper/TableStyle.php | 4 +- .../Console/Input/InputDefinition.php | 2 +- .../Console/Output/BufferedOutput.php | 2 +- .../Console/Output/ConsoleOutput.php | 2 +- .../Component/Console/Output/StreamOutput.php | 2 +- .../Component/Console/Style/OutputStyle.php | 2 +- .../Component/Console/Style/SymfonyStyle.php | 4 +- .../Console/Tester/ApplicationTester.php | 4 +- .../Console/Tester/CommandTester.php | 4 +- .../Console/Tests/ApplicationTest.php | 14 +- .../Console/Tests/Command/CommandTest.php | 16 +-- .../Descriptor/AbstractDescriptorTest.php | 2 +- .../Tests/Descriptor/JsonDescriptorTest.php | 2 +- .../Tests/Descriptor/ObjectsProvider.php | 4 +- .../Tests/Helper/ProcessHelperTest.php | 6 +- .../Console/Tests/Helper/ProgressBarTest.php | 26 ++-- .../Tests/Helper/ProgressIndicatorTest.php | 10 +- .../Helper/SymfonyQuestionHelperTest.php | 2 +- .../Console/Tests/Helper/TableTest.php | 8 +- .../Tests/Logger/ConsoleLoggerTest.php | 2 +- .../Console/Tests/Output/StreamOutputTest.php | 2 +- .../Tests/Tester/ApplicationTesterTest.php | 4 +- .../Tests/Tester/CommandTesterTest.php | 4 +- src/Symfony/Component/Debug/Debug.php | 6 +- .../Component/Debug/DebugClassLoader.php | 6 +- src/Symfony/Component/Debug/ErrorHandler.php | 94 ++++++------- .../Debug/Exception/ContextErrorException.php | 2 +- .../Debug/Exception/FatalThrowableError.php | 6 +- .../Component/Debug/ExceptionHandler.php | 4 +- .../Debug/Tests/ErrorHandlerTest.php | 130 +++++++++--------- .../Tests/Exception/FlattenExceptionTest.php | 6 +- .../Debug/Tests/ExceptionHandlerTest.php | 2 +- .../Compiler/AutowireExceptionPass.php | 2 +- .../Compiler/AutowirePass.php | 8 +- .../DependencyInjection/Compiler/Compiler.php | 6 +- .../Compiler/DecoratorServicePass.php | 2 +- .../Compiler/FactoryReturnTypePass.php | 4 +- .../Compiler/InlineServiceDefinitionsPass.php | 2 +- .../Compiler/LoggingFormatter.php | 2 +- .../Compiler/PassConfig.php | 2 +- .../ResolveDefinitionTemplatesPass.php | 2 +- .../Config/AutowireServiceResource.php | 2 +- .../DependencyInjection/Container.php | 24 ++-- .../DependencyInjection/ContainerBuilder.php | 14 +- .../DependencyInjection/Definition.php | 10 +- .../DefinitionDecorator.php | 2 +- .../DependencyInjection/Dumper/PhpDumper.php | 4 +- .../DependencyInjection/EnvVarProcessor.php | 2 +- .../Loader/IniFileLoader.php | 4 +- .../Loader/PhpFileLoader.php | 2 +- .../Loader/XmlFileLoader.php | 12 +- .../Loader/YamlFileLoader.php | 12 +- .../ParameterBag/ParameterBag.php | 2 +- .../DependencyInjection/ServiceLocator.php | 2 +- .../Tests/EnvVarProcessorTest.php | 2 +- .../Tests/Loader/FileLoaderTest.php | 2 +- .../Tests/Loader/IniFileLoaderTest.php | 4 +- .../Tests/Loader/XmlFileLoaderTest.php | 8 +- .../Tests/Loader/YamlFileLoaderTest.php | 4 +- .../DomCrawler/AbstractUriElement.php | 4 +- src/Symfony/Component/DomCrawler/Crawler.php | 12 +- .../DomCrawler/Field/FileFormField.php | 6 +- src/Symfony/Component/DomCrawler/Form.php | 2 +- .../Tests/Field/FileFormFieldTest.php | 8 +- .../ContainerAwareEventDispatcher.php | 8 +- .../Component/ExpressionLanguage/Compiler.php | 6 +- .../ExpressionLanguage/ExpressionLanguage.php | 2 +- .../Component/ExpressionLanguage/Lexer.php | 2 +- .../ParserCache/ArrayParserCache.php | 2 +- .../ParserCache/ParserCacheInterface.php | 2 +- .../ExpressionLanguage/SyntaxError.php | 2 +- .../Tests/ExpressionLanguageTest.php | 2 +- .../Component/Filesystem/Filesystem.php | 12 +- .../Component/Filesystem/LockHandler.php | 6 +- .../Filesystem/Tests/FilesystemTest.php | 2 +- .../Filesystem/Tests/FilesystemTestCase.php | 2 +- src/Symfony/Component/Finder/Finder.php | 6 +- .../Iterator/DepthRangeFilterIterator.php | 4 +- .../Iterator/DepthRangeFilterIteratorTest.php | 4 +- .../Factory/PropertyAccessDecorator.php | 14 +- .../Form/ChoiceList/LazyChoiceList.php | 12 +- .../Component/Form/Command/DebugCommand.php | 2 +- .../Console/Descriptor/JsonDescriptor.php | 2 +- .../NumberToLocalizedStringTransformer.php | 8 +- .../Core/EventListener/ResizeFormListener.php | 2 +- .../Form/Extension/Core/Type/ChoiceType.php | 2 +- .../Form/Extension/Core/Type/CountryType.php | 2 +- .../Form/Extension/Core/Type/CurrencyType.php | 2 +- .../Form/Extension/Core/Type/FileType.php | 6 +- .../Form/Extension/Core/Type/LanguageType.php | 2 +- .../Form/Extension/Core/Type/LocaleType.php | 2 +- .../Form/Extension/Core/Type/TimeType.php | 6 +- .../Form/Extension/Core/Type/TimezoneType.php | 8 +- .../DataCollector/FormDataExtractor.php | 2 +- .../DependencyInjectionExtension.php | 2 +- src/Symfony/Component/Form/Form.php | 2 +- src/Symfony/Component/Form/FormRenderer.php | 4 +- .../Component/Form/NativeRequestHandler.php | 4 +- .../Form/Tests/AbstractRequestHandlerTest.php | 16 +-- .../Component/Form/Tests/CompoundFormTest.php | 14 +- .../Descriptor/AbstractDescriptorTest.php | 12 +- ...teTimeToLocalizedStringTransformerTest.php | 4 +- .../MoneyToLocalizedStringTransformerTest.php | 6 +- ...NumberToLocalizedStringTransformerTest.php | 2 +- .../Extension/Core/Type/FileTypeTest.php | 24 ++-- .../Form/Tests/NativeRequestHandlerTest.php | 12 +- .../Component/HttpFoundation/AcceptHeader.php | 2 +- .../HttpFoundation/AcceptHeaderItem.php | 2 +- .../File/MimeType/FileinfoMimeTypeGuesser.php | 2 +- .../HttpFoundation/File/UploadedFile.php | 26 ++-- .../Component/HttpFoundation/FileBag.php | 2 +- .../Component/HttpFoundation/HeaderBag.php | 4 +- .../Component/HttpFoundation/IpUtils.php | 4 +- .../Component/HttpFoundation/JsonResponse.php | 4 +- .../Component/HttpFoundation/ParameterBag.php | 8 +- .../HttpFoundation/RedirectResponse.php | 4 +- .../Component/HttpFoundation/Request.php | 16 +-- .../Component/HttpFoundation/Response.php | 4 +- .../Handler/AbstractSessionHandler.php | 6 +- .../Handler/MemcacheSessionHandler.php | 2 +- .../Storage/Handler/MongoDbSessionHandler.php | 2 +- .../Storage/Handler/NativeSessionHandler.php | 2 +- .../Storage/Handler/PdoSessionHandler.php | 2 +- .../Handler/WriteCheckSessionHandler.php | 2 +- .../Session/Storage/NativeSessionStorage.php | 12 +- .../Session/Storage/Proxy/AbstractProxy.php | 2 +- .../Session/Storage/Proxy/NativeProxy.php | 2 +- .../Tests/File/UploadedFileTest.php | 28 ++-- .../HttpFoundation/Tests/FileBagTest.php | 6 +- .../HttpFoundation/Tests/JsonResponseTest.php | 4 +- .../HttpFoundation/Tests/ParameterBagTest.php | 16 +-- .../Tests/ResponseFunctionalTest.php | 2 +- .../HttpFoundation/Tests/ResponseTest.php | 20 +-- .../Handler/AbstractSessionHandlerTest.php | 2 +- .../Storage/Handler/PdoSessionHandlerTest.php | 2 +- .../Component/HttpKernel/Bundle/Bundle.php | 2 +- .../CacheClearer/ChainCacheClearer.php | 2 +- .../CacheClearer/Psr6CacheClearer.php | 2 +- .../CacheWarmer/CacheWarmerAggregate.php | 4 +- src/Symfony/Component/HttpKernel/Client.php | 2 +- .../Controller/ControllerResolver.php | 4 +- .../TraceableControllerResolver.php | 2 +- .../DataCollector/ConfigDataCollector.php | 6 +- .../DataCollector/DataCollector.php | 6 +- .../DataCollector/DumpDataCollector.php | 2 +- .../DataCollector/EventDataCollector.php | 2 +- .../DataCollector/LoggerDataCollector.php | 6 +- .../DataCollector/RequestDataCollector.php | 4 +- .../DataCollector/Util/ValueExporter.php | 2 +- .../HttpKernel/Debug/FileLinkFormatter.php | 2 +- .../AddClassesToCachePass.php | 2 +- .../DependencyInjection/Extension.php | 4 +- .../LazyLoadingFragmentHandler.php | 2 +- ...RegisterControllerArgumentLocatorsPass.php | 2 +- .../EventListener/DebugHandlersListener.php | 8 +- .../AbstractSurrogateFragmentRenderer.php | 2 +- .../Fragment/HIncludeFragmentRenderer.php | 2 +- .../Component/HttpKernel/HttpCache/Esi.php | 4 +- .../Component/HttpKernel/HttpCache/Ssi.php | 4 +- .../Component/HttpKernel/HttpCache/Store.php | 12 +- .../Component/HttpKernel/HttpKernel.php | 4 +- src/Symfony/Component/HttpKernel/Kernel.php | 36 ++--- .../Component/HttpKernel/Log/Logger.php | 2 +- .../Profiler/FileProfilerStorage.php | 4 +- .../HttpKernel/Profiler/Profiler.php | 2 +- .../Component/HttpKernel/Tests/ClientTest.php | 12 +- .../DataCollector/ConfigDataCollectorTest.php | 8 +- .../DataCollector/LoggerDataCollectorTest.php | 24 ++-- .../DebugHandlersListenerTest.php | 4 +- .../Tests/HttpCache/HttpCacheTest.php | 58 ++++---- .../HttpKernel/Tests/Log/LoggerTest.php | 4 +- .../Profiler/FileProfilerStorageTest.php | 2 +- .../Component/HttpKernel/UriSigner.php | 2 +- .../Component/Intl/Collator/Collator.php | 6 +- .../Data/Bundle/Writer/JsonBundleWriter.php | 2 +- .../Intl/Data/Util/LocaleScanner.php | 2 +- .../DateFormatter/DateFormat/Transformer.php | 2 +- src/Symfony/Component/Intl/Intl.php | 2 +- .../Intl/NumberFormatter/NumberFormatter.php | 10 +- .../Component/Intl/Resources/bin/common.php | 2 +- .../Ldap/Adapter/ExtLdap/Adapter.php | 2 +- src/Symfony/Component/Ldap/LdapClient.php | 4 +- .../Component/Lock/Store/FlockStore.php | 4 +- .../Lock/Store/RetryTillSaveStore.php | 2 +- .../Tests/Store/BlockingStoreTestTrait.php | 12 +- .../Lock/Tests/Store/SemaphoreStoreTest.php | 12 +- .../Component/Process/ExecutableFinder.php | 6 +- .../Component/Process/PhpExecutableFinder.php | 10 +- src/Symfony/Component/Process/PhpProcess.php | 2 +- .../Component/Process/Pipes/WindowsPipes.php | 10 +- src/Symfony/Component/Process/Process.php | 30 ++-- .../Component/Process/ProcessBuilder.php | 2 +- .../Component/Process/ProcessUtils.php | 4 +- .../Process/Tests/ErrorProcessInitiator.php | 4 +- .../Process/Tests/ExecutableFinderTest.php | 18 +-- .../Process/Tests/NonStopableProcess.php | 8 +- .../Process/Tests/PhpExecutableFinderTest.php | 4 +- .../Process/Tests/PhpProcessTest.php | 2 +- .../PipeStdinInStdoutStdErrStreamSelect.php | 28 ++-- .../Component/Process/Tests/ProcessTest.php | 20 +-- .../Process/Tests/SignalListener.php | 2 +- .../PropertyAccess/PropertyAccessor.php | 4 +- .../Component/PropertyAccess/StringUtil.php | 2 +- .../Routing/Generator/UrlGenerator.php | 2 +- .../Routing/Loader/AnnotationFileLoader.php | 16 +-- .../Routing/Loader/PhpFileLoader.php | 2 +- .../Routing/Loader/XmlFileLoader.php | 10 +- .../Routing/Loader/YamlFileLoader.php | 4 +- .../Component/Routing/RouteCompiler.php | 8 +- .../Authentication/Token/AbstractToken.php | 2 +- .../Authorization/AccessDecisionManager.php | 4 +- .../TraceableAccessDecisionManager.php | 2 +- .../Core/Encoder/Argon2iPasswordEncoder.php | 8 +- .../Core/Encoder/BCryptPasswordEncoder.php | 2 +- .../Exception/AuthenticationException.php | 2 +- .../Core/Exception/NonceExpiredException.php | 2 +- .../NativeSessionTokenStorageTest.php | 4 +- .../NativeSessionTokenStorage.php | 2 +- .../Guard/AbstractGuardAuthenticator.php | 2 +- .../AbstractFormLoginAuthenticator.php | 2 +- .../Firewall/GuardAuthenticationListener.php | 2 +- .../DigestAuthenticationEntryPoint.php | 2 +- .../Http/Firewall/ContextListener.php | 2 +- .../Firewall/DigestAuthenticationListener.php | 6 +- .../Component/Security/Http/HttpUtils.php | 2 +- .../Http/Logout/LogoutUrlGenerator.php | 2 +- .../Serializer/Encoder/JsonDecode.php | 4 +- .../Serializer/Encoder/JsonEncode.php | 4 +- .../Serializer/Encoder/XmlEncoder.php | 16 +-- .../Mapping/Factory/ClassMetadataFactory.php | 2 +- .../Normalizer/AbstractNormalizer.php | 2 +- .../Component/Serializer/Serializer.php | 8 +- .../Tests/Encoder/JsonEncodeTest.php | 2 +- .../Tests/Encoder/JsonEncoderTest.php | 10 +- .../Templating/Loader/FilesystemLoader.php | 2 +- .../Component/Templating/PhpEngine.php | 6 +- .../Translation/Command/XliffLintCommand.php | 8 +- .../DependencyInjection/TranslatorPass.php | 2 +- .../Translation/Dumper/FileDumper.php | 2 +- .../Translation/Dumper/JsonFileDumper.php | 2 +- .../Translation/Extractor/PhpExtractor.php | 14 +- .../Translation/Loader/JsonFileLoader.php | 10 +- .../Translation/Loader/PhpFileLoader.php | 2 +- .../Translation/Loader/XliffFileLoader.php | 4 +- .../Translation/Loader/YamlFileLoader.php | 2 +- .../Resources/bin/translation-status.php | 20 +-- .../Tests/Dumper/JsonFileDumperTest.php | 2 +- .../Tests/Loader/XliffFileLoaderTest.php | 4 +- .../Component/Translation/Translator.php | 2 +- .../Translation/Writer/TranslationWriter.php | 2 +- .../Validator/Constraints/ChoiceValidator.php | 2 +- .../Validator/Constraints/FileValidator.php | 28 ++-- .../Validator/Constraints/IpValidator.php | 24 ++-- .../Validator/Constraints/UrlValidator.php | 4 +- .../Mapping/Loader/YamlFileLoader.php | 2 +- .../Tests/Constraints/FileValidatorTest.php | 26 ++-- .../Mapping/Loader/YamlFileLoaderTest.php | 2 +- .../Validator/TraceableValidator.php | 2 +- .../Component/VarDumper/Caster/AmqpCaster.php | 36 ++--- .../Component/VarDumper/Caster/Caster.php | 2 +- .../Component/VarDumper/Caster/DOMCaster.php | 70 +++++----- .../VarDumper/Caster/ExceptionCaster.php | 30 ++-- .../VarDumper/Caster/MongoCaster.php | 2 +- .../VarDumper/Caster/PgSqlCaster.php | 54 ++++---- .../VarDumper/Caster/ReflectionCaster.php | 2 +- .../VarDumper/Caster/XmlResourceCaster.php | 44 +++--- .../VarDumper/Cloner/AbstractCloner.php | 2 +- .../Component/VarDumper/Cloner/Data.php | 2 +- .../Component/VarDumper/Cloner/VarCloner.php | 2 +- .../VarDumper/Dumper/AbstractDumper.php | 6 +- .../Component/VarDumper/Dumper/CliDumper.php | 4 +- .../Component/VarDumper/Dumper/HtmlDumper.php | 6 +- .../VarDumper/Test/VarDumperTestTrait.php | 4 +- .../VarDumper/Tests/Caster/DateCasterTest.php | 6 +- .../VarDumper/Tests/Cloner/VarClonerTest.php | 4 +- .../VarDumper/Tests/Dumper/CliDumperTest.php | 2 +- .../VarDumper/Tests/Dumper/HtmlDumperTest.php | 4 +- src/Symfony/Component/Workflow/Registry.php | 2 +- .../Component/Yaml/Command/LintCommand.php | 10 +- src/Symfony/Component/Yaml/Dumper.php | 6 +- .../Yaml/Exception/ParseException.php | 2 +- src/Symfony/Component/Yaml/Inline.php | 46 +++---- src/Symfony/Component/Yaml/Parser.php | 34 ++--- .../Component/Yaml/Tests/InlineTest.php | 24 ++-- .../Component/Yaml/Tests/ParserTest.php | 2 +- src/Symfony/Component/Yaml/Yaml.php | 10 +- 429 files changed, 1354 insertions(+), 1353 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index b73611c430..d95806e181 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -13,6 +13,7 @@ return PhpCsFixer\Config::create() 'array_syntax' => ['syntax' => 'short'], 'fopen_flags' => false, 'protected_to_private' => false, + 'native_constant_invocation' => true, ]) ->setRiskyAllowed(true) ->setFinder( diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index db15a8d5c7..0dda98d6d2 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -256,11 +256,11 @@ abstract class AbstractDoctrineExtension extends Extension $configPath = $this->getMappingResourceConfigDirectory(); $extension = $this->getMappingResourceExtension(); - if (glob($dir.'/'.$configPath.'/*.'.$extension.'.xml', GLOB_NOSORT)) { + if (glob($dir.'/'.$configPath.'/*.'.$extension.'.xml', \GLOB_NOSORT)) { $driver = 'xml'; - } elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.yml', GLOB_NOSORT)) { + } elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.yml', \GLOB_NOSORT)) { $driver = 'yml'; - } elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.php', GLOB_NOSORT)) { + } elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.php', \GLOB_NOSORT)) { $driver = 'php'; } else { // add the closest existing directory as a resource diff --git a/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php b/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php index 3b028ab7a4..1a508050d3 100644 --- a/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php +++ b/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Doctrine\ExpressionLanguage; -@trigger_error('The '.__NAMESPACE__.'\DoctrineParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\DoctrineAdapter class instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\DoctrineParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\DoctrineAdapter class instead.', \E_USER_DEPRECATED); use Doctrine\Common\Cache\Cache; use Symfony\Component\ExpressionLanguage\ParsedExpression; diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php index 244d6331e4..29d38ac640 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php @@ -52,7 +52,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface { // BC to be removed and replace with type hints in 4.0 if ($manager instanceof ChoiceListFactoryInterface) { - @trigger_error(sprintf('Passing a ChoiceListFactoryInterface to %s is deprecated since Symfony 3.1 and will no longer be supported in 4.0. You should either call "%s::loadChoiceList" or override it to return a ChoiceListInterface.', __CLASS__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a ChoiceListFactoryInterface to %s is deprecated since Symfony 3.1 and will no longer be supported in 4.0. You should either call "%s::loadChoiceList" or override it to return a ChoiceListInterface.', __CLASS__, __CLASS__), \E_USER_DEPRECATED); // Provide a BC layer since $factory has changed // form first to last argument as of 3.1 diff --git a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php index 27be3afc55..5700ea4056 100644 --- a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php +++ b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php @@ -47,7 +47,7 @@ class MergeDoctrineCollectionListener implements EventSubscriberInterface { if ($this->bc) { // onBind() has been overridden from a child class - @trigger_error('The onBind() method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the onSubmit() method instead.', E_USER_DEPRECATED); + @trigger_error('The onBind() method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the onSubmit() method instead.', \E_USER_DEPRECATED); if (!$this->bcLayer) { // If parent::onBind() has not been called, then logic has been executed diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 7d824100b7..bc80895547 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Doctrine\HttpFoundation; -@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler instead.', DbalSessionHandler::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler instead.', DbalSessionHandler::class), \E_USER_DEPRECATED); use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\DriverException; diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php index 9736e356ba..bed4389c42 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Doctrine\HttpFoundation; -@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::createTable instead.', DbalSessionHandlerSchema::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::createTable instead.', DbalSessionHandlerSchema::class), \E_USER_DEPRECATED); use Doctrine\DBAL\Schema\Schema; diff --git a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php index 852aa3898a..a089d98f05 100644 --- a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php +++ b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php @@ -50,7 +50,7 @@ trait ManagerRegistryTrait */ public function setContainer(SymfonyContainerInterface $container = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a PSR-11 container using the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a PSR-11 container using the constructor instead.', __METHOD__), \E_USER_DEPRECATED); $this->container = $container; } @@ -74,7 +74,7 @@ trait ManagerRegistryTrait $manager = $this->container->get($name); if (!$manager instanceof LazyLoadingInterface) { - @trigger_error(sprintf('Resetting a non-lazy manager service is deprecated since Symfony 3.2 and will throw an exception in version 4.0. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name), E_USER_DEPRECATED); + @trigger_error(sprintf('Resetting a non-lazy manager service is deprecated since Symfony 3.2 and will throw an exception in version 4.0. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name), \E_USER_DEPRECATED); $this->container->set($name, null); diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index 0cf1e8bd29..35b1c99e9f 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -57,7 +57,7 @@ class ConsoleFormatter implements FormatterInterface { // BC Layer if (!\is_array($options)) { - @trigger_error(sprintf('The constructor arguments $format, $dateFormat, $allowInlineLineBreaks, $ignoreEmptyContextAndExtra of "%s" are deprecated since Symfony 3.3 and will be removed in 4.0. Use $options instead.', self::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The constructor arguments $format, $dateFormat, $allowInlineLineBreaks, $ignoreEmptyContextAndExtra of "%s" are deprecated since Symfony 3.3 and will be removed in 4.0. Use $options instead.', self::class), \E_USER_DEPRECATED); $args = \func_get_args(); $options = []; if (isset($args[0])) { diff --git a/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php b/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php index 760ae081f8..d5f8b3677f 100644 --- a/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Monolog\Handler; -@trigger_error('The '.__NAMESPACE__.'\DebugHandler class is deprecated since Symfony 3.2 and will be removed in 4.0. Use Symfony\Bridge\Monolog\Processor\DebugProcessor instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\DebugHandler class is deprecated since Symfony 3.2 and will be removed in 4.0. Use Symfony\Bridge\Monolog\Processor\DebugProcessor instead.', \E_USER_DEPRECATED); use Monolog\Handler\TestHandler; use Monolog\Logger; diff --git a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php index 22582b68ef..faa36512c5 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php @@ -61,7 +61,7 @@ class ServerLogHandler extends AbstractHandler try { if (-1 === stream_socket_sendto($this->socket, $recordFormatted)) { - stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR); + stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR); // Let's retry: the persistent connection might just be stale if ($this->socket = $this->createSocket()) { @@ -89,7 +89,7 @@ class ServerLogHandler extends AbstractHandler private function createSocket() { - $socket = stream_socket_client($this->host, $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_PERSISTENT, $this->context); + $socket = stream_socket_client($this->host, $errno, $errstr, 0, \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT | \STREAM_CLIENT_PERSISTENT, $this->context); if ($socket) { stream_set_blocking($socket, false); diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index e9c8d19d8f..0909e3700d 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -109,7 +109,7 @@ class DeprecationErrorHandler 'remaining vendor' => array(), ); $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) { - if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { + if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context); } @@ -285,7 +285,7 @@ class DeprecationErrorHandler { $deprecations = array(); $previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, &$previousErrorHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) { + if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) { if ($previousErrorHandler) { return $previousErrorHandler($type, $msg, $file, $line, $context); } @@ -314,7 +314,7 @@ class DeprecationErrorHandler return (class_exists('PHPUnit_Util_ErrorHandler', false) ? 'PHPUnit_Util_' : 'PHPUnit\Util\\').'ErrorHandler::handleError'; } - foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { + foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { if (isset($frame['object']) && $frame['object'] instanceof TestResult) { return new ErrorHandler( $frame['object']->getConvertDeprecationsToExceptions(), @@ -348,21 +348,21 @@ class DeprecationErrorHandler if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') - && sapi_windows_vt100_support(STDOUT)) + && sapi_windows_vt100_support(\STDOUT)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } if (\function_exists('stream_isatty')) { - return stream_isatty(STDOUT); + return stream_isatty(\STDOUT); } if (\function_exists('posix_isatty')) { - return posix_isatty(STDOUT); + return posix_isatty(\STDOUT); } - $stat = fstat(STDOUT); + $stat = fstat(\STDOUT); // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php index a178ac7e89..74b9da7590 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php @@ -141,8 +141,8 @@ class DnsMockTest extends TestCase $this->assertFalse(DnsMock::dns_get_record('foobar.com')); $this->assertSame($records, DnsMock::dns_get_record('example.com')); - $this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_ALL)); - $this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_A | DNS_PTR)); - $this->assertSame(array($ptr), DnsMock::dns_get_record('example.com', DNS_PTR)); + $this->assertSame($records, DnsMock::dns_get_record('example.com', \DNS_ALL)); + $this->assertSame($records, DnsMock::dns_get_record('example.com', \DNS_A | \DNS_PTR)); + $this->assertSame(array($ptr), DnsMock::dns_get_record('example.com', \DNS_PTR)); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php index 259c99162a..329bf694d2 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php @@ -24,7 +24,7 @@ final class ExpectedDeprecationAnnotationTest extends TestCase */ public function testOne() { - @trigger_error('foo', E_USER_DEPRECATED); + @trigger_error('foo', \E_USER_DEPRECATED); } /** @@ -37,7 +37,7 @@ final class ExpectedDeprecationAnnotationTest extends TestCase */ public function testMany() { - @trigger_error('foo', E_USER_DEPRECATED); - @trigger_error('bar', E_USER_DEPRECATED); + @trigger_error('foo', \E_USER_DEPRECATED); + @trigger_error('bar', \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php index b8125dc558..d12e138210 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php @@ -18,7 +18,7 @@ class ProcessIsolationTest extends TestCase */ public function testIsolation() { - @trigger_error('Test abc', E_USER_DEPRECATED); + @trigger_error('Test abc', \E_USER_DEPRECATED); $this->addToAssertionCount(1); } @@ -28,6 +28,6 @@ class ProcessIsolationTest extends TestCase $this->expectException($class); $this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.'); - trigger_error('Test that PHPUnit\'s error handler fires.', E_USER_WARNING); + trigger_error('Test that PHPUnit\'s error handler fires.', \E_USER_WARNING); } } diff --git a/src/Symfony/Bridge/PhpUnit/bootstrap.php b/src/Symfony/Bridge/PhpUnit/bootstrap.php index 5de9467891..b1657f8462 100644 --- a/src/Symfony/Bridge/PhpUnit/bootstrap.php +++ b/src/Symfony/Bridge/PhpUnit/bootstrap.php @@ -25,7 +25,7 @@ if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Comman } // Enforce a consistent locale -setlocale(LC_ALL, 'C'); +setlocale(\LC_ALL, 'C'); if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) { if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 549b154f62..09cd24ccf8 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -62,10 +62,10 @@ class ProxyDumper implements DumperInterface } if (null === $factoryCode) { - @trigger_error(sprintf('The "%s()" method expects a third argument defining the code to execute to construct your service since Symfony 3.4, providing it will be required in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method expects a third argument defining the code to execute to construct your service since Symfony 3.4, providing it will be required in 4.0.', __METHOD__), \E_USER_DEPRECATED); $factoryCode = '$this->get'.Container::camelize($id).'Service(false)'; } elseif (false === strpos($factoryCode, '(')) { - @trigger_error(sprintf('The "%s()" method expects its third argument to define the code to execute to construct your service since Symfony 3.4, providing it will be required in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method expects its third argument to define the code to execute to construct your service since Symfony 3.4, providing it will be required in 4.0.', __METHOD__), \E_USER_DEPRECATED); $factoryCode = "\$this->$factoryCode(false)"; } $proxyClass = $this->getProxyClassName($definition); diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index da06aae9b5..e196f1b82d 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -40,7 +40,7 @@ class DebugCommand extends Command public function __construct($twig = null, $projectDir = null) { if (!$twig instanceof Environment) { - @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); parent::__construct($twig); @@ -55,7 +55,7 @@ class DebugCommand extends Command public function setTwigEnvironment(Environment $twig) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); $this->twig = $twig; } @@ -65,7 +65,7 @@ class DebugCommand extends Command */ protected function getTwigEnvironment() { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); return $this->twig; } @@ -107,7 +107,7 @@ EOF if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, 'getTwigEnvironment'); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED); + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), \E_USER_DEPRECATED); $this->twig = $this->getTwigEnvironment(); } @@ -134,7 +134,7 @@ EOF } $data['loader_paths'] = $this->getLoaderPaths(); - $data = json_encode($data, JSON_PRETTY_PRINT); + $data = json_encode($data, \JSON_PRETTY_PRINT); $io->writeln($decorated ? OutputFormatter::escape($data) : $data); return 0; diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index c4343d60b7..c23c27b37c 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -43,7 +43,7 @@ class LintCommand extends Command public function __construct($twig = null) { if (!$twig instanceof Environment) { - @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); parent::__construct($twig); @@ -57,7 +57,7 @@ class LintCommand extends Command public function setTwigEnvironment(Environment $twig) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); $this->twig = $twig; } @@ -67,7 +67,7 @@ class LintCommand extends Command */ protected function getTwigEnvironment() { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); return $this->twig; } @@ -108,7 +108,7 @@ EOF if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, 'getTwigEnvironment'); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED); + @trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), \E_USER_DEPRECATED); $this->twig = $this->getTwigEnvironment(); } @@ -120,13 +120,13 @@ EOF $filenames = $input->getArgument('filename'); if (0 === \count($filenames)) { - if (0 !== ftell(STDIN)) { + if (0 !== ftell(\STDIN)) { throw new RuntimeException('Please provide a filename or pipe template content to STDIN.'); } $template = ''; - while (!feof(STDIN)) { - $template .= fread(STDIN, 1024); + while (!feof(\STDIN)) { + $template .= fread(\STDIN, 1024); } return $this->display($input, $output, $io, [$this->validate($template, uniqid('sf_', true))]); @@ -226,7 +226,7 @@ EOF } }); - $output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + $output->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); return min($errors, 1); } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 717d4de697..dec4b61212 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -102,7 +102,7 @@ class CodeExtension extends AbstractExtension } elseif ('resource' === $item[0]) { $formattedValue = 'resource'; } else { - $formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset)); + $formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)); } $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); @@ -188,7 +188,7 @@ class CodeExtension extends AbstractExtension } if (false !== $link = $this->getFileLink($file, $line)) { - return sprintf('%s', htmlspecialchars($link, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset), $text); + return sprintf('%s', htmlspecialchars($link, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $text); } return $text; @@ -236,7 +236,7 @@ class CodeExtension extends AbstractExtension } } - return htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); + return htmlspecialchars($message, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); } /** diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index 2df9300943..84626c22c5 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -38,7 +38,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __construct($renderer = null) { if ($renderer instanceof TwigRendererInterface) { - @trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), \E_USER_DEPRECATED); } elseif (null !== $renderer && !(\is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) { throw new \InvalidArgumentException(sprintf('Passing any arguments to the constructor of "%s" is reserved for internal use.', __CLASS__)); } @@ -116,7 +116,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __get($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); if (\is_array($this->renderer)) { $renderer = $this->renderer[0]->get($this->renderer[1]); @@ -136,7 +136,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __set($name, $value) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); } $this->$name = $value; @@ -148,7 +148,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __isset($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); } return isset($this->$name); @@ -160,7 +160,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface public function __unset($name) { if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); } unset($this->$name); diff --git a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php index bb8d5a12bd..fb364346df 100644 --- a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php @@ -44,7 +44,7 @@ class YamlExtension extends AbstractExtension if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { if (\is_bool($dumpObjects)) { - @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); + @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED); $flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0; } else { diff --git a/src/Symfony/Bridge/Twig/Form/TwigRenderer.php b/src/Symfony/Bridge/Twig/Form/TwigRenderer.php index b4cb7faa4d..34407d088c 100644 --- a/src/Symfony/Bridge/Twig/Form/TwigRenderer.php +++ b/src/Symfony/Bridge/Twig/Form/TwigRenderer.php @@ -15,7 +15,7 @@ use Symfony\Component\Form\FormRenderer; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Twig\Environment; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), \E_USER_DEPRECATED); /** * @author Bernhard Schussek diff --git a/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php b/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php index 73e7bc4c88..f5097be454 100644 --- a/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php +++ b/src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php @@ -34,7 +34,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE public function __construct(array $defaultThemes = [], Environment $environment = null) { if (null === $environment) { - @trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), \E_USER_DEPRECATED); } parent::__construct($defaultThemes); @@ -49,7 +49,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE public function setEnvironment(Environment $environment) { if ($this->environment) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), \E_USER_DEPRECATED); } $this->environment = $environment; diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php index 107d8cc4bf..3d01ca57c7 100644 --- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php +++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php @@ -91,7 +91,7 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface */ protected function canBeExtracted($file) { - return $this->isFile($file) && 'twig' === pathinfo($file, PATHINFO_EXTENSION); + return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassCacheCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassCacheCacheWarmer.php index 058d22bcb2..4a6bee4128 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassCacheCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassCacheCacheWarmer.php @@ -28,7 +28,7 @@ class ClassCacheCacheWarmer implements CacheWarmerInterface public function __construct(array $declaredClasses = null) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); } $this->declaredClasses = $declaredClasses; diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 1e033e3eae..5106f0c2e1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -38,7 +38,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf $this->router = $container->get('router'); // For BC, the $router property must be populated in the constructor } elseif ($container instanceof RouterInterface) { $this->router = $container; - @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', RouterInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', RouterInterface::class, __CLASS__, ContainerInterface::class), \E_USER_DEPRECATED); } else { throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php index 4c0387bdc6..2e15796065 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php @@ -39,7 +39,7 @@ class TranslationsCacheWarmer implements CacheWarmerInterface, ServiceSubscriber $this->container = $container; } elseif ($container instanceof TranslatorInterface) { $this->translator = $container; - @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', TranslatorInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', TranslatorInterface::class, __CLASS__, ContainerInterface::class), \E_USER_DEPRECATED); } else { throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 118d0aed27..7d4206a18c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -80,12 +80,12 @@ EOT new TableSeparator(), ['PHP'], new TableSeparator(), - ['Version', PHP_VERSION], + ['Version', \PHP_VERSION], ['Architecture', (\PHP_INT_SIZE * 8).' bits'], ['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'], ['Timezone', date_default_timezone_get().' ('.(new \DateTime())->format(\DateTime::W3C).')'], - ['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], - ['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], + ['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], + ['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], ['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'], ]; diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index 9f512ae20a..3e5b4698cf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -62,7 +62,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand protected function findExtension($name) { $bundles = $this->initializeBundles(); - $minScore = INF; + $minScore = \INF; foreach ($bundles as $bundle) { if ($name === $bundle->getName()) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 199e1ad0da..394fedadf8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -47,7 +47,7 @@ class AssetsInstallCommand extends ContainerAwareCommand public function __construct($filesystem = null) { if (!$filesystem instanceof Filesystem) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Filesystem::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Filesystem::class), \E_USER_DEPRECATED); parent::__construct($filesystem); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index af1e16cad5..aa8541ea1b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -46,7 +46,7 @@ class CacheClearCommand extends ContainerAwareCommand public function __construct($cacheClearer = null, Filesystem $filesystem = null) { if (!$cacheClearer instanceof CacheClearerInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, CacheClearerInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, CacheClearerInterface::class), \E_USER_DEPRECATED); parent::__construct($cacheClearer); @@ -133,7 +133,7 @@ EOF $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers')); if ($this->warning) { - @trigger_error($this->warning, E_USER_DEPRECATED); + @trigger_error($this->warning, \E_USER_DEPRECATED); $io->warning($this->warning); $this->warning = null; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php index dfb4df194f..13a619630e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php @@ -36,7 +36,7 @@ final class CachePoolClearCommand extends ContainerAwareCommand public function __construct($poolClearer = null) { if (!$poolClearer instanceof Psr6CacheClearer) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Psr6CacheClearer::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, Psr6CacheClearer::class), \E_USER_DEPRECATED); parent::__construct($poolClearer); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php index 0893f2db53..720a028891 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php @@ -36,7 +36,7 @@ class CacheWarmupCommand extends ContainerAwareCommand public function __construct($cacheWarmer = null) { if (!$cacheWarmer instanceof CacheWarmerAggregate) { - @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); parent::__construct($cacheWarmer); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php index 846895323a..c5d85ab2a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php @@ -37,7 +37,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand public function __construct($dispatcher = null) { if (!$dispatcher instanceof EventDispatcherInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, EventDispatcherInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, EventDispatcherInterface::class), \E_USER_DEPRECATED); parent::__construct($dispatcher); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index 7ef6455427..13792f2b32 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -42,7 +42,7 @@ class RouterDebugCommand extends ContainerAwareCommand public function __construct($router = null) { if (!$router instanceof RouterInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), \E_USER_DEPRECATED); parent::__construct($router); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index d6a1df8a0a..b7ac3ef8e6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -39,7 +39,7 @@ class RouterMatchCommand extends ContainerAwareCommand public function __construct($router = null) { if (!$router instanceof RouterInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, RouterInterface::class), \E_USER_DEPRECATED); parent::__construct($router); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index 33b9846636..75000e12cd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -52,7 +52,7 @@ class TranslationDebugCommand extends ContainerAwareCommand public function __construct($translator = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null, $defaultTransPath = null, $defaultViewsPath = null) { if (!$translator instanceof TranslatorInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslatorInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslatorInterface::class), \E_USER_DEPRECATED); parent::__construct($translator); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index fcf145cc46..33d5563c8c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -55,7 +55,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand public function __construct($writer = null, TranslationReaderInterface $reader = null, ExtractorInterface $extractor = null, $defaultLocale = null, $defaultTransPath = null, $defaultViewsPath = null) { if (!$writer instanceof TranslationWriterInterface) { - @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslationWriterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('%s() expects an instance of "%s" as first argument since Symfony 3.4. Not passing it is deprecated and will throw a TypeError in 4.0.', __METHOD__, TranslationWriterInterface::class), \E_USER_DEPRECATED); parent::__construct($writer); @@ -209,7 +209,7 @@ EOF $prefix = $input->getOption('prefix'); // @deprecated since version 3.4, to be removed in 4.0 along with the --no-prefix option if ($input->getOption('no-prefix')) { - @trigger_error('The "--no-prefix" option is deprecated since Symfony 3.4 and will be removed in 4.0. Use the "--prefix" option with an empty string as value instead.', E_USER_DEPRECATED); + @trigger_error('The "--no-prefix" option is deprecated since Symfony 3.4 and will be removed in 4.0. Use the "--prefix" option with an empty string as value instead.', \E_USER_DEPRECATED); $prefix = ''; } $this->extractor->setPrefix($prefix); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php index 8baebbfd7d..d00337d09f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php @@ -29,7 +29,7 @@ class XliffLintCommand extends BaseLintCommand public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null) { if (\func_num_args()) { - @trigger_error(sprintf('Passing a constructor argument in "%s()" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a constructor argument in "%s()" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); } if (null === $directoryIteratorProvider) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php index 73dcd05879..fbd847a244 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php @@ -28,7 +28,7 @@ class YamlLintCommand extends BaseLintCommand public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null) { if (\func_num_args()) { - @trigger_error(sprintf('Passing a constructor argument in "%s()" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a constructor argument in "%s()" is deprecated since Symfony 3.4 and will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); } if (null === $directoryIteratorProvider) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index 74d9b0c61a..0427f8e616 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -165,7 +165,7 @@ class JsonDescriptor extends Descriptor { $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0; - $this->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n"); + $this->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n"); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php index 05e39a27a0..dbb69cc5ea 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php @@ -49,7 +49,7 @@ class RedirectController implements ContainerAwareInterface */ public function setContainer(ContainerInterface $container = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject an UrlGeneratorInterface using the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject an UrlGeneratorInterface using the constructor instead.', __METHOD__), \E_USER_DEPRECATED); $this->container = $container; $this->router = $container->get('router'); @@ -120,7 +120,7 @@ class RedirectController implements ContainerAwareInterface $statusCode = $permanent ? 301 : 302; // redirect if the path is a full URL - if (parse_url($path, PHP_URL_SCHEME)) { + if (parse_url($path, \PHP_URL_SCHEME)) { return new RedirectResponse($path, $statusCode); } @@ -142,7 +142,7 @@ class RedirectController implements ContainerAwareInterface if ('http' === $request->getScheme()) { $httpPort = $request->getPort(); } elseif ($this->container && $this->container->hasParameter('request_listener.http_port')) { - @trigger_error(sprintf('Passing the http port as a container parameter is deprecated since Symfony 3.4 and won\'t be possible in 4.0. Pass it to the constructor of the "%s" class instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing the http port as a container parameter is deprecated since Symfony 3.4 and won\'t be possible in 4.0. Pass it to the constructor of the "%s" class instead.', __CLASS__), \E_USER_DEPRECATED); $httpPort = $this->container->getParameter('request_listener.http_port'); } else { $httpPort = $this->httpPort; @@ -157,7 +157,7 @@ class RedirectController implements ContainerAwareInterface if ('https' === $request->getScheme()) { $httpsPort = $request->getPort(); } elseif ($this->container && $this->container->hasParameter('request_listener.https_port')) { - @trigger_error(sprintf('Passing the https port as a container parameter is deprecated since Symfony 3.4 and won\'t be possible in 4.0. Pass it to the constructor of the "%s" class instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing the https port as a container parameter is deprecated since Symfony 3.4 and won\'t be possible in 4.0. Pass it to the constructor of the "%s" class instead.', __CLASS__), \E_USER_DEPRECATED); $httpsPort = $this->container->getParameter('request_listener.https_port'); } else { $httpsPort = $this->httpsPort; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php index 52086ef8dd..f91520e126 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php @@ -45,7 +45,7 @@ class TemplateController implements ContainerAwareInterface */ public function setContainer(ContainerInterface $container = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a Twig Environment or an EngineInterface using the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a Twig Environment or an EngineInterface using the constructor instead.', __METHOD__), \E_USER_DEPRECATED); if ($container->has('templating')) { $this->templating = $container->get('templating'); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php index 4e0570b79b..4802640ebc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', AddCacheClearerPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', AddCacheClearerPass::class), \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheWarmerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheWarmerPass.php index 0301f550f1..f09f29aa5c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheWarmerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheWarmerPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', AddCacheWarmerPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use tagged iterator arguments instead.', AddCacheWarmerPass::class), \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php index 7e261bb1d3..0ef27964b3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('%s is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', AddConsoleCommandPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('%s is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', AddConsoleCommandPass::class), \E_USER_DEPRECATED); use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass as BaseAddConsoleCommandPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConstraintValidatorsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConstraintValidatorsPass.php index a118afb824..b0fc18caa5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConstraintValidatorsPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConstraintValidatorsPass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass as BaseAddConstraintValidatorsPass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', AddConstraintValidatorsPass::class, BaseAddConstraintValidatorsPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', AddConstraintValidatorsPass::class, BaseAddConstraintValidatorsPass::class), \E_USER_DEPRECATED); /** * @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseAddConstraintValidatorsPass} instead diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddValidatorInitializersPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddValidatorInitializersPass.php index 5824de478b..ded0d6d319 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddValidatorInitializersPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddValidatorInitializersPass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass as BaseAddValidatorsInitializerPass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', AddValidatorInitializersPass::class, BaseAddValidatorsInitializerPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', AddValidatorInitializersPass::class, BaseAddValidatorsInitializerPass::class), \E_USER_DEPRECATED); /** * @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseAddValidatorInitializersPass} instead diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php index 45723204e0..7934e170e0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0.', CompilerDebugDumpPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0.', CompilerDebugDumpPass::class), \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ConfigCachePass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ConfigCachePass.php index 567ec19eaa..80bdac80bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ConfigCachePass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ConfigCachePass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\Config\DependencyInjection\ConfigCachePass as BaseConfigCachePass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use tagged iterator arguments instead.', ConfigCachePass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use tagged iterator arguments instead.', ConfigCachePass::class), \E_USER_DEPRECATED); /** * Adds services tagged config_cache.resource_checker to the config_cache_factory service, ordering them by priority. diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php index 11ba453dd3..6d78f8439b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ControllerArgumentValueResolverPass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass as BaseControllerArgumentValueResolverPass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ControllerArgumentValueResolverPass::class, BaseControllerArgumentValueResolverPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ControllerArgumentValueResolverPass::class, BaseControllerArgumentValueResolverPass::class), \E_USER_DEPRECATED); /** * Gathers and configures the argument value resolvers. diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php index 0b8a1fcd63..54f7026792 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Form\DependencyInjection\FormPass instead.', FormPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Form\DependencyInjection\FormPass instead.', FormPass::class), \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php index d6e61cc605..4318081db3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php @@ -32,7 +32,7 @@ class ProfilerPass implements CompilerPassInterface $definition = $container->getDefinition('profiler'); $collectors = new \SplPriorityQueue(); - $order = PHP_INT_MAX; + $order = \PHP_INT_MAX; foreach ($container->findTaggedServiceIds('data_collector', true) as $id => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; $template = null; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php index aa1cd6e576..ef47bc0cda 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass instead.', PropertyInfoPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass instead.', PropertyInfoPass::class), \E_USER_DEPRECATED); use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass as BasePropertyInfoPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RoutingResolverPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RoutingResolverPass.php index 87af59bd0f..f1f50a43d7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RoutingResolverPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RoutingResolverPass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass as BaseRoutingResolverPass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', RoutingResolverPass::class, BaseRoutingResolverPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', RoutingResolverPass::class, BaseRoutingResolverPass::class), \E_USER_DEPRECATED); /** * Adds tagged routing.loader services to routing.resolver service. diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php index 44b546674e..117e9b2f91 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Serializer\DependencyInjection\SerializerPass instead.', SerializerPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\Serializer\DependencyInjection\SerializerPass instead.', SerializerPass::class), \E_USER_DEPRECATED); use Symfony\Component\Serializer\DependencyInjection\SerializerPass as BaseSerializerPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php index 9ddf312bc4..3a7f6865b5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass instead.', TranslationDumperPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass instead.', TranslationDumperPass::class), \E_USER_DEPRECATED); use Symfony\Component\Translation\DependencyInjection\TranslationDumperPass as BaseTranslationDumperPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php index 8de309dc05..510571c133 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass instead.', TranslationExtractorPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass instead.', TranslationExtractorPass::class), \E_USER_DEPRECATED); use Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass as BaseTranslationExtractorPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php index 9f6a0ab9d2..f4c1bffe87 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslatorPass instead.', TranslatorPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\DependencyInjection\TranslatorPass instead.', TranslatorPass::class), \E_USER_DEPRECATED); use Symfony\Component\Translation\DependencyInjection\TranslatorPass as BaseTranslatorPass; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass.php index 4a85e4ed46..5cc14ab50b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler; use Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass as BaseValidateWorkflowsPass; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ValidateWorkflowsPass::class, BaseValidateWorkflowsPass::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ValidateWorkflowsPass::class, BaseValidateWorkflowsPass::class), \E_USER_DEPRECATED); /** * @author Tobias Nyholm diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 400c8a7920..f3e94ac04e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -99,7 +99,7 @@ class Configuration implements ConfigurationInterface } } - return !filter_var($v, FILTER_VALIDATE_IP); + return !filter_var($v, \FILTER_VALIDATE_IP); }) ->thenInvalid('Invalid proxy IP "%s"') ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 6c2bd1e112..2e3c465a35 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -610,7 +610,7 @@ class FrameworkExtension extends Extension foreach ($config['workflows'] as $name => $workflow) { if (!\array_key_exists('type', $workflow)) { $workflow['type'] = 'workflow'; - @trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), E_USER_DEPRECATED); + @trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), \E_USER_DEPRECATED); } $type = $workflow['type']; $workflowId = sprintf('%s.%s', $type, $name); diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php index dc47013b15..68dd2d23fd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php @@ -14,7 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\EventListener; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\SessionListener instead.', SessionListener::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\SessionListener instead.', SessionListener::class), \E_USER_DEPRECATED); /** * Sets the session in the request. diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php index 0e94341e78..e21f474540 100644 --- a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php +++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\EventListener; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\TestSessionListener instead.', TestSessionListener::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\TestSessionListener instead.', TestSessionListener::class), \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener; diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index f8bf78d859..f95157202c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -65,7 +65,7 @@ class FrameworkBundle extends Bundle ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true); if ($this->container->hasParameter('kernel.trusted_proxies')) { - @trigger_error('The "kernel.trusted_proxies" parameter is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED); + @trigger_error('The "kernel.trusted_proxies" parameter is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', \E_USER_DEPRECATED); if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) { Request::setTrustedProxies($trustedProxies, Request::getTrustedHeaderSet()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index a0a77f8d1e..01f5595e9c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -87,7 +87,7 @@ class CodeHelper extends Helper } elseif ('array' === $item[0]) { $formattedValue = sprintf('array(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); } elseif ('string' === $item[0]) { - $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset())); + $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], \ENT_QUOTES, $this->getCharset())); } elseif ('null' === $item[0]) { $formattedValue = 'null'; } elseif ('boolean' === $item[0]) { @@ -95,7 +95,7 @@ class CodeHelper extends Helper } elseif ('resource' === $item[0]) { $formattedValue = 'resource'; } else { - $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES, $this->getCharset()), true)); + $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], \ENT_QUOTES, $this->getCharset()), true)); } $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); @@ -119,7 +119,7 @@ class CodeHelper extends Helper $finfo = new \finfo(); // Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files - if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) { + if ('application/octet-stream' === $finfo->file($file, \FILEINFO_MIME_TYPE)) { return ''; } } @@ -153,7 +153,7 @@ class CodeHelper extends Helper */ public function formatFile($file, $line, $text = null) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; + $flags = \ENT_QUOTES | \ENT_SUBSTITUTE; if (null === $text) { $file = trim($file); diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index d9a008c690..3343680b8b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -243,9 +243,9 @@ class FormHelper extends Helper public function formEncodeCurrency($text, $widget = '') { if ('UTF-8' === $charset = $this->getCharset()) { - $text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + $text = htmlspecialchars($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); } else { - $text = htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + $text = htmlentities($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); $text = iconv('UTF-8', $charset, $text); $widget = iconv('UTF-8', $charset, $widget); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index ccfd3b5b3d..c8822e105b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -72,7 +72,7 @@ class TemplateNameParser extends BaseTemplateNameParser $isAbsolute = (bool) preg_match('#^(?:/|[a-zA-Z]:)#', $file); if ($isAbsolute) { - @trigger_error('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', \E_USER_DEPRECATED); } return $isAbsolute; diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index f46486e17f..5c9a565d2d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -52,7 +52,7 @@ abstract class KernelTestCase extends TestCase */ protected static function getPhpUnitXmlDir() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); if (!isset($_SERVER['argv']) || false === strpos($_SERVER['argv'][0], 'phpunit')) { throw new \RuntimeException('You must override the KernelTestCase::createKernel() method.'); @@ -89,7 +89,7 @@ abstract class KernelTestCase extends TestCase */ private static function getPhpUnitCliConfigArgument() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); $dir = null; $reversedArgs = array_reverse($_SERVER['argv']); @@ -130,7 +130,7 @@ abstract class KernelTestCase extends TestCase return $class; } else { - @trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since Symfony 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since Symfony 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), \E_USER_DEPRECATED); } if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index 248b5396df..70ae1491ea 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -194,9 +194,9 @@ abstract class AbstractDescriptorTest extends TestCase $this->getDescriptor()->describe($output, $describedObject, $options); if ('json' === $this->getFormat()) { - $this->assertEquals(json_encode(json_decode($expectedDescription), JSON_PRETTY_PRINT), json_encode(json_decode($output->fetch()), JSON_PRETTY_PRINT)); + $this->assertEquals(json_encode(json_decode($expectedDescription), \JSON_PRETTY_PRINT), json_encode(json_decode($output->fetch()), \JSON_PRETTY_PRINT)); } else { - $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch()))); + $this->assertEquals(trim($expectedDescription), trim(str_replace(\PHP_EOL, "\n", $output->fetch()))); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index f71c4c8cae..dcbd49c624 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -168,7 +168,7 @@ abstract class ControllerTraitTest extends TestCase $response = $controller->json([], 200, [], ['json_encode_options' => 0, 'other' => 'context']); $this->assertInstanceOf(JsonResponse::class, $response); $this->assertEquals('[]', $response->getContent()); - $response->setEncodingOptions(JSON_FORCE_OBJECT); + $response->setEncodingOptions(\JSON_FORCE_OBJECT); $this->assertEquals('{}', $response->getContent()); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index 35bda9ded0..9ef4518e5b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Translation; use Symfony\Component\Translation\Extractor\PhpExtractor as NewPhpExtractor; -@trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', PhpExtractor::class, NewPhpExtractor::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', PhpExtractor::class, NewPhpExtractor::class), \E_USER_DEPRECATED); /** * @deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\Extractor\PhpExtractor instead diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php index 02fd4b56ae..02c800997e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Translation; -@trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', PhpStringTokenParser::class, \Symfony\Component\Translation\Extractor\PhpStringTokenParser::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', PhpStringTokenParser::class, \Symfony\Component\Translation\Extractor\PhpStringTokenParser::class), \E_USER_DEPRECATED); /** * @deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\Translation\Extractor\PhpStringTokenParser instead diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php index 1fe0197ab9..4511be87cc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php @@ -21,7 +21,7 @@ class TranslationLoader extends TranslationReader { public function __construct() { - @trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', self::class, TranslationReader::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use "%s" instead. ', self::class, TranslationReader::class), \E_USER_DEPRECATED); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index b76a221c83..a3e43a836c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -75,7 +75,7 @@ class Translator extends BaseTranslator implements WarmableInterface $options = $loaderIds; $loaderIds = $defaultLocale; $defaultLocale = $container->getParameter('kernel.default_locale'); - @trigger_error(sprintf('The "%s()" method takes the default locale as the 3rd argument since Symfony 3.3. Not passing it is deprecated and will trigger an error in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method takes the default locale as the 3rd argument since Symfony 3.3. Not passing it is deprecated and will trigger an error in 4.0.', __METHOD__), \E_USER_DEPRECATED); } $this->container = $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php index b862de487a..9b5f5adc8c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php +++ b/src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php @@ -18,7 +18,7 @@ use Symfony\Component\Validator\ContainerConstraintValidatorFactory; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\ValidatorException; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ConstraintValidatorFactory::class, ContainerConstraintValidatorFactory::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s instead.', ConstraintValidatorFactory::class, ContainerConstraintValidatorFactory::class), \E_USER_DEPRECATED); /** * Uses a service container to create constraint validators. diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index b92addaa8a..99ded63a5d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Security\Acl\Dbal\Schema; -@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\Command\InitAclCommand instead.', InitAclCommand::class), E_USER_DEPRECATED); +@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\Command\InitAclCommand instead.', InitAclCommand::class), \E_USER_DEPRECATED); /** * Installs the tables required by the ACL system. diff --git a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php index 49492e01dd..57b452829c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Command; -@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\Command\SetAclCommand instead.', SetAclCommand::class), E_USER_DEPRECATED); +@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\Command\SetAclCommand instead.', SetAclCommand::class), \E_USER_DEPRECATED); use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Exception\InvalidArgumentException; diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index 3f33624432..7aa6b7082d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -42,7 +42,7 @@ class UserPasswordEncoderCommand extends ContainerAwareCommand public function __construct(EncoderFactoryInterface $encoderFactory = null, array $userClasses = []) { if (null === $encoderFactory) { - @trigger_error(sprintf('Passing null as the first argument of "%s()" is deprecated since Symfony 3.3 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing null as the first argument of "%s()" is deprecated since Symfony 3.3 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED); } $this->encoderFactory = $encoderFactory; @@ -140,7 +140,7 @@ EOF if ($input->isInteractive() && !$emptySalt) { $emptySalt = true; - $errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.'); + $errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.'); if ($errorIo->confirm('Confirm salt generation ?')) { $salt = $this->generateSalt(); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php index b0171266bb..b90a42e5e0 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php @@ -46,7 +46,7 @@ class AddSecurityVotersPass implements CompilerPassInterface $class = $container->getParameterBag()->resolveValue($definition->getClass()); if (!is_a($class, VoterInterface::class, true)) { - @trigger_error(sprintf('Using a "security.voter" tag on a class without implementing the "%s" is deprecated as of 3.4 and will throw an exception in 4.0. Implement the interface instead.', VoterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using a "security.voter" tag on a class without implementing the "%s" is deprecated as of 3.4 and will throw an exception in 4.0. Implement the interface instead.', VoterInterface::class), \E_USER_DEPRECATED); } if (!method_exists($class, 'vote')) { diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php index fd318b0bb2..c4a1a84805 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php @@ -28,7 +28,7 @@ class HttpDigestFactory implements SecurityFactoryInterface public function __construct($triggerDeprecation = true) { if ($triggerDeprecation) { - @trigger_error(sprintf('The "%s" class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index ca858f1204..b51f4099d8 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -383,7 +383,7 @@ class SecurityExtension extends Extension } if (!$logoutOnUserChange = $firewall['logout_on_user_change']) { - @trigger_error(sprintf('Not setting "logout_on_user_change" to true on firewall "%s" is deprecated as of 3.4, it will always be true in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('Not setting "logout_on_user_change" to true on firewall "%s" is deprecated as of 3.4, it will always be true in 4.0.', $id), \E_USER_DEPRECATED); } if (isset($this->logoutOnUserChangeByContextKey[$contextKey]) && $this->logoutOnUserChangeByContextKey[$contextKey][1] !== $logoutOnUserChange) { @@ -733,7 +733,7 @@ class SecurityExtension extends Extension // in 4.0, ignore the `switch_user.stateless` key if $stateless is `true` if ($stateless && false === $config['stateless']) { - @trigger_error(sprintf('Firewall "%s" is configured as "stateless" but the "switch_user.stateless" key is set to false. Both should have the same value, the firewall\'s "stateless" value will be used as default value for the "switch_user.stateless" key in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('Firewall "%s" is configured as "stateless" but the "switch_user.stateless" key is set to false. Both should have the same value, the firewall\'s "stateless" value will be used as default value for the "switch_user.stateless" key in 4.0.', $id), \E_USER_DEPRECATED); } $switchUserListenerId = 'security.authentication.switchuser_listener.'.$id; @@ -837,7 +837,7 @@ class SecurityExtension extends Extension */ private function getFirstProvider($firewallName, $listenerName, array $providerIds) { - @trigger_error(sprintf('Listener "%s" on firewall "%s" has no "provider" set but multiple providers exist. Using the first configured provider (%s) is deprecated since Symfony 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.', $listenerName, $firewallName, $first = array_keys($providerIds)[0]), E_USER_DEPRECATED); + @trigger_error(sprintf('Listener "%s" on firewall "%s" has no "provider" set but multiple providers exist. Using the first configured provider (%s) is deprecated since Symfony 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.', $listenerName, $firewallName, $first = array_keys($providerIds)[0]), \E_USER_DEPRECATED); return $providerIds[$first]; } diff --git a/src/Symfony/Bundle/SecurityBundle/EventListener/AclSchemaListener.php b/src/Symfony/Bundle/SecurityBundle/EventListener/AclSchemaListener.php index 9f401679c7..2f8535f3ce 100644 --- a/src/Symfony/Bundle/SecurityBundle/EventListener/AclSchemaListener.php +++ b/src/Symfony/Bundle/SecurityBundle/EventListener/AclSchemaListener.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\EventListener; -@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\EventListener\AclSchemaListener instead.', AclSchemaListener::class), E_USER_DEPRECATED); +@trigger_error(sprintf('Class "%s" is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bundle\AclBundle\EventListener\AclSchemaListener instead.', AclSchemaListener::class), \E_USER_DEPRECATED); use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; use Symfony\Component\Security\Acl\Dbal\Schema; diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php index 20fb7d9d1e..9d4b7c2a00 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php @@ -55,7 +55,7 @@ class FirewallContext */ public function getContext() { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::getListeners/getExceptionListener() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::getListeners/getExceptionListener() instead.', __METHOD__, __CLASS__), \E_USER_DEPRECATED); return [$this->getListeners(), $this->getExceptionListener(), $this->getLogoutListener()]; } diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php index 9e20f4e527..85b9b10720 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php @@ -47,7 +47,7 @@ class FirewallMap extends _FirewallMap implements FirewallMapInterface public function __get($name) { if ('map' === $name || 'container' === $name) { - @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), \E_USER_DEPRECATED); if ('map' === $name && $this->map instanceof \Traversable) { $this->map = iterator_to_array($this->map); @@ -63,7 +63,7 @@ class FirewallMap extends _FirewallMap implements FirewallMapInterface public function __set($name, $value) { if ('map' === $name || 'container' === $name) { - @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), \E_USER_DEPRECATED); $set = \Closure::bind(function ($name, $value) { $this->$name = $value; }, $this, parent::class); $set($name, $value); @@ -78,7 +78,7 @@ class FirewallMap extends _FirewallMap implements FirewallMapInterface public function __isset($name) { if ('map' === $name || 'container' === $name) { - @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), \E_USER_DEPRECATED); } return isset($this->$name); @@ -90,7 +90,7 @@ class FirewallMap extends _FirewallMap implements FirewallMapInterface public function __unset($name) { if ('map' === $name || 'container' === $name) { - @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "%s::$%s" property is deprecated since Symfony 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), \E_USER_DEPRECATED); $unset = \Closure::bind(function ($name) { unset($this->$name); }, $this, parent::class); $unset($name); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php index 0e69963922..d06ed5682f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -38,7 +38,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase 'user-class' => 'Symfony\Component\Security\Core\User\User', '--empty-salt' => true, ], ['decorated' => false]); - $expected = str_replace("\n", PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt')); + $expected = str_replace("\n", \PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt')); $this->assertEquals($expected, $this->passwordEncoderCommandTester->getDisplay()); } @@ -245,7 +245,7 @@ EOTXT protected function setUp() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode']); $kernel->boot(); @@ -263,7 +263,7 @@ EOTXT private function setupArgon2i() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml']); $kernel->boot(); diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index a51037dcb9..329e018c2b 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -40,7 +40,7 @@ class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInte $this->container = $container; } elseif ($container instanceof Environment) { $this->twig = $container; - @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', Environment::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', Environment::class, __CLASS__, ContainerInterface::class), \E_USER_DEPRECATED); } else { throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__)); } diff --git a/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php b/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php index 107eece304..c04a28a9f3 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\TwigBundle\Command; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bridge\Twig\Command\DebugCommand instead.', DebugCommand::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Bridge\Twig\Command\DebugCommand instead.', DebugCommand::class), \E_USER_DEPRECATED); use Symfony\Bridge\Twig\Command\DebugCommand as BaseDebugCommand; use Symfony\Component\DependencyInjection\ContainerAwareInterface; diff --git a/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php b/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php index 7595f5674a..47ec9a961f 100644 --- a/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php +++ b/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\TwigBundle; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Twig\RuntimeLoader\ContainerRuntimeLoader class instead.', ContainerAwareRuntimeLoader::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Twig\RuntimeLoader\ContainerRuntimeLoader class instead.', ContainerAwareRuntimeLoader::class), \E_USER_DEPRECATED); use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php index 0d0acde360..ee998ce095 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php @@ -116,7 +116,7 @@ class WebProfilerExtension extends ProfilerExtension */ public function dumpValue($value) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use the dumpData() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use the dumpData() method instead.', __METHOD__), \E_USER_DEPRECATED); if (null === $this->valueExporter) { $this->valueExporter = new ValueExporter(); diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/router.php b/src/Symfony/Bundle/WebServerBundle/Resources/router.php index d93ffef70c..ae2fa298c5 100644 --- a/src/Symfony/Bundle/WebServerBundle/Resources/router.php +++ b/src/Symfony/Bundle/WebServerBundle/Resources/router.php @@ -26,18 +26,18 @@ if (ini_get('auto_prepend_file') && !in_array(realpath(ini_get('auto_prepend_fil require ini_get('auto_prepend_file'); } -if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) { +if (is_file($_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) { return false; } $script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php'; $_SERVER = array_merge($_SERVER, $_ENV); -$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script; +$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].\DIRECTORY_SEPARATOR.$script; // Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly -$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.$script; -$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.$script; +$_SERVER['SCRIPT_NAME'] = \DIRECTORY_SEPARATOR.$script; +$_SERVER['PHP_SELF'] = \DIRECTORY_SEPARATOR.$script; require $script; diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index f2d43f6648..4d171f9459 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -286,12 +286,12 @@ abstract class Client $server = array_merge($this->server, $server); - if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, PHP_URL_HOST)) { + if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, \PHP_URL_HOST)) { $uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri); } - if (isset($server['HTTPS']) && null === parse_url($originalUri, PHP_URL_SCHEME)) { - $uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri); + if (isset($server['HTTPS']) && null === parse_url($originalUri, \PHP_URL_SCHEME)) { + $uri = preg_replace('{^'.parse_url($uri, \PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri); } if (!isset($server['HTTP_REFERER']) && !$this->history->isEmpty()) { @@ -302,7 +302,7 @@ abstract class Client $server['HTTP_HOST'] = $this->extractHost($uri); } - $server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME); + $server['HTTPS'] = 'https' == parse_url($uri, \PHP_URL_SCHEME); $this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content); @@ -362,9 +362,9 @@ abstract class Client foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) { if ($deprecation[0]) { // unsilenced on purpose - trigger_error($deprecation[1], E_USER_DEPRECATED); + trigger_error($deprecation[1], \E_USER_DEPRECATED); } else { - @trigger_error($deprecation[1], E_USER_DEPRECATED); + @trigger_error($deprecation[1], \E_USER_DEPRECATED); } } } @@ -569,7 +569,7 @@ abstract class Client // protocol relative URL if (0 === strpos($uri, '//')) { - return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri; + return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri; } // anchor or query string parameters? @@ -578,7 +578,7 @@ abstract class Client } if ('/' !== $uri[0]) { - $path = parse_url($currentUri, PHP_URL_PATH); + $path = parse_url($currentUri, \PHP_URL_PATH); if ('/' !== substr($path, -1)) { $path = substr($path, 0, strrpos($path, '/') + 1); @@ -606,7 +606,7 @@ abstract class Client private function updateServerFromUri($server, $uri) { $server['HTTP_HOST'] = $this->extractHost($uri); - $scheme = parse_url($uri, PHP_URL_SCHEME); + $scheme = parse_url($uri, \PHP_URL_SCHEME); $server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme; unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']); @@ -615,9 +615,9 @@ abstract class Client private function extractHost($uri) { - $host = parse_url($uri, PHP_URL_HOST); + $host = parse_url($uri, \PHP_URL_HOST); - if ($port = parse_url($uri, PHP_URL_PORT)) { + if ($port = parse_url($uri, \PHP_URL_PORT)) { return $host.':'.$port; } diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 4022307284..ab7dc9607f 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -116,7 +116,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface if (null !== $logger) { $fs->setLogger($logger); } - if (!self::$apcuSupported || (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { + if (!self::$apcuSupported || (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { return $fs; } diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 7e97875435..33f55a869f 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -114,7 +114,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable $expiry = $item["\0*\0expiry"]; if (0 === $expiry) { - $expiry = PHP_INT_MAX; + $expiry = \PHP_INT_MAX; } if (null !== $expiry && $expiry <= time()) { @@ -137,7 +137,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable } $this->values[$key] = $value; - $this->expiries[$key] = null !== $expiry ? $expiry : PHP_INT_MAX; + $this->expiries[$key] = null !== $expiry ? $expiry : \PHP_INT_MAX; return true; } diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php index 2bf89bcf96..fdb28846f1 100644 --- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php @@ -46,7 +46,7 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn if (!$adapter instanceof CacheItemPoolInterface) { throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', \get_class($adapter), CacheItemPoolInterface::class)); } - if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $adapter instanceof ApcuAdapter && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { + if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $adapter instanceof ApcuAdapter && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { continue; // skip putting APCu in the chain when the backend is disabled } diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index b4f6a13342..47a259c136 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -40,7 +40,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl { $this->file = $file; $this->pool = $fallbackPool; - $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); $this->createCacheItem = \Closure::bind( static function ($key, $value, $isHit) { $item = new CacheItem(); diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 1012148a96..b56143c2c4 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -36,6 +36,6 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface $e = new \Exception(); $this->includeHandler = function () use ($e) { throw $e; }; - $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); } } diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index e802c30729..7ae6568c27 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -186,7 +186,7 @@ final class CacheItem implements CacheItemInterface $replace['{'.$k.'}'] = $v; } } - @trigger_error(strtr($message, $replace), E_USER_WARNING); + @trigger_error(strtr($message, $replace), \E_USER_WARNING); } } } diff --git a/src/Symfony/Component/Cache/Simple/ArrayCache.php b/src/Symfony/Component/Cache/Simple/ArrayCache.php index f0b650107d..6013f0ad20 100644 --- a/src/Symfony/Component/Cache/Simple/ArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/ArrayCache.php @@ -121,7 +121,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte } } } - $expiry = 0 < $ttl ? time() + $ttl : PHP_INT_MAX; + $expiry = 0 < $ttl ? time() + $ttl : \PHP_INT_MAX; foreach ($valuesArray as $key => $value) { $this->values[$key] = $value; diff --git a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php index 5c00d91ffb..7bb25ff80e 100644 --- a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php @@ -36,7 +36,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt { $this->file = $file; $this->pool = $fallbackPool; - $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); } /** diff --git a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php index cdbcdd8856..50c19034a8 100644 --- a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php @@ -36,6 +36,6 @@ class PhpFilesCache extends AbstractCache implements PruneableInterface $e = new \Exception(); $this->includeHandler = function () use ($e) { throw $e; }; - $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN); + $this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), \FILTER_VALIDATE_BOOLEAN); } } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php index 2f35ef0c7c..f55a1b9b8e 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php @@ -24,10 +24,10 @@ class ApcuAdapterTest extends AdapterTestCase public function createCachePool($defaultLifetime = 0) { - if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN)) { + if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('APCu extension is required.'); } - if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { + if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { if ('testWithCliSapi' !== $this->getName()) { $this->markTestSkipped('apc.enable_cli=1 is required.'); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php index c89aa5188a..a9a397dd4e 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php @@ -141,7 +141,7 @@ class MemcachedAdapterTest extends AdapterTestCase 'localhost', 11222, ]; - if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { yield [ 'memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', @@ -158,7 +158,7 @@ class MemcachedAdapterTest extends AdapterTestCase '/var/local/run/memcached.socket', 0, ]; - if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { yield [ 'memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', diff --git a/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php index f37b95a093..fad0c04324 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php @@ -23,7 +23,7 @@ class ApcuCacheTest extends CacheTestCase public function createSimpleCache($defaultLifetime = 0) { - if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) || ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { + if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) || ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { $this->markTestSkipped('APCu extension is required.'); } if ('\\' === \DIRECTORY_SEPARATOR) { diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php index b24289f6a6..6df682e9ff 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php @@ -150,7 +150,7 @@ class MemcachedCacheTest extends CacheTestCase 'localhost', 11222, ]; - if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { yield [ 'memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', @@ -167,7 +167,7 @@ class MemcachedCacheTest extends CacheTestCase '/var/local/run/memcached.socket', 0, ]; - if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('memcached.use_sasl'), \FILTER_VALIDATE_BOOLEAN)) { yield [ 'memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', diff --git a/src/Symfony/Component/Cache/Traits/AbstractTrait.php b/src/Symfony/Component/Cache/Traits/AbstractTrait.php index 70cdcc89f3..dc291e103f 100644 --- a/src/Symfony/Component/Cache/Traits/AbstractTrait.php +++ b/src/Symfony/Component/Cache/Traits/AbstractTrait.php @@ -224,7 +224,7 @@ trait AbstractTrait } throw new \DomainException('Failed to unserialize cached value.'); } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); + throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } finally { ini_set('unserialize_callback_func', $unserializeCallbackHandler); } diff --git a/src/Symfony/Component/Cache/Traits/ApcuTrait.php b/src/Symfony/Component/Cache/Traits/ApcuTrait.php index b6c64ec0f3..2f47f8e6d6 100644 --- a/src/Symfony/Component/Cache/Traits/ApcuTrait.php +++ b/src/Symfony/Component/Cache/Traits/ApcuTrait.php @@ -23,7 +23,7 @@ trait ApcuTrait { public static function isSupported() { - return \function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN); + return \function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN); } private function init($namespace, $defaultLifetime, $version) @@ -58,7 +58,7 @@ trait ApcuTrait } } } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); + throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } } @@ -75,8 +75,8 @@ trait ApcuTrait */ protected function doClear($namespace) { - return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) - ? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY)) + return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) + ? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), \APC_ITER_KEY)) : apcu_clear_cache(); } diff --git a/src/Symfony/Component/Cache/Traits/DoctrineTrait.php b/src/Symfony/Component/Cache/Traits/DoctrineTrait.php index c87ecabafc..48623e67c0 100644 --- a/src/Symfony/Component/Cache/Traits/DoctrineTrait.php +++ b/src/Symfony/Component/Cache/Traits/DoctrineTrait.php @@ -45,7 +45,7 @@ trait DoctrineTrait case 'unserialize': case 'apcu_fetch': case 'apc_fetch': - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); + throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } } diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php index 3ff28d25b3..34d0208efb 100644 --- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php +++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php @@ -131,7 +131,7 @@ trait MemcachedTrait // set client's options unset($options['persistent_id'], $options['username'], $options['password'], $options['weight'], $options['lazy']); - $options = array_change_key_case($options, CASE_UPPER); + $options = array_change_key_case($options, \CASE_UPPER); $client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); $client->setOption(\Memcached::OPT_NO_BLOCK, true); $client->setOption(\Memcached::OPT_TCP_NODELAY, true); @@ -225,7 +225,7 @@ trait MemcachedTrait return $result; } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); + throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } finally { ini_set('unserialize_callback_func', $unserializeCallbackHandler); } diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index d6b9bead5e..2668b26c10 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -30,7 +30,7 @@ trait PhpFilesTrait public static function isSupported() { - return \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN); + return \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN); } /** @@ -40,7 +40,7 @@ trait PhpFilesTrait { $time = time(); $pruned = true; - $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); + $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN); set_error_handler($this->includeHandler); try { @@ -118,8 +118,8 @@ trait PhpFilesTrait protected function doSave(array $values, $lifetime) { $ok = true; - $data = [$lifetime ? time() + $lifetime : PHP_INT_MAX, '']; - $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN); + $data = [$lifetime ? time() + $lifetime : \PHP_INT_MAX, '']; + $allowCompile = 'cli' !== \PHP_SAPI || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN); foreach ($values as $key => $value) { if (null === $value || \is_object($value)) { diff --git a/src/Symfony/Component/ClassLoader/ApcClassLoader.php b/src/Symfony/Component/ClassLoader/ApcClassLoader.php index 57d22bfa35..54d6861f40 100644 --- a/src/Symfony/Component/ClassLoader/ApcClassLoader.php +++ b/src/Symfony/Component/ClassLoader/ApcClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED); /** * ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3. diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 3ed8cd94c2..db04ea51ec 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -12,7 +12,7 @@ namespace Symfony\Component\ClassLoader; if (\PHP_VERSION_ID >= 70000) { - @trigger_error('The '.__NAMESPACE__.'\ClassCollectionLoader class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('The '.__NAMESPACE__.'\ClassCollectionLoader class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); } /** @@ -216,7 +216,7 @@ REGEX; $inNamespace = false; $tokens = token_get_all($source); - $nsTokens = [T_WHITESPACE => true, T_NS_SEPARATOR => true, T_STRING => true]; + $nsTokens = [\T_WHITESPACE => true, \T_NS_SEPARATOR => true, \T_STRING => true]; if (\defined('T_NAME_QUALIFIED')) { $nsTokens[T_NAME_QUALIFIED] = true; } @@ -225,10 +225,10 @@ REGEX; $token = $tokens[$i]; if (!isset($token[1]) || 'b"' === $token) { $rawChunk .= $token; - } elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { + } elseif (\in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT])) { // strip comments continue; - } elseif (T_NAMESPACE === $token[0]) { + } elseif (\T_NAMESPACE === $token[0]) { if ($inNamespace) { $rawChunk .= "}\n"; } @@ -245,15 +245,15 @@ REGEX; $rawChunk = rtrim($rawChunk)."\n{"; $inNamespace = true; } - } elseif (T_START_HEREDOC === $token[0]) { + } elseif (\T_START_HEREDOC === $token[0]) { $output .= self::compressCode($rawChunk).$token[1]; do { $token = $tokens[++$i]; $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token; - } while (T_END_HEREDOC !== $token[0]); + } while (\T_END_HEREDOC !== $token[0]); $output .= "\n"; $rawChunk = ''; - } elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) { + } elseif (\T_CONSTANT_ENCAPSED_STRING === $token[0]) { $output .= self::compressCode($rawChunk).$token[1]; $rawChunk = ''; } else { diff --git a/src/Symfony/Component/ClassLoader/ClassLoader.php b/src/Symfony/Component/ClassLoader/ClassLoader.php index 277aa523df..349c4a9b6e 100644 --- a/src/Symfony/Component/ClassLoader/ClassLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED); /** * ClassLoader implements an PSR-0 class loader. diff --git a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php index eb0bb10389..740d37ef69 100644 --- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\ClassMapGenerator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ClassMapGenerator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED); /** * ClassMapGenerator. @@ -62,7 +62,7 @@ class ClassMapGenerator $path = $file->getRealPath() ?: $file->getPathname(); - if ('php' !== pathinfo($path, PATHINFO_EXTENSION)) { + if ('php' !== pathinfo($path, \PATHINFO_EXTENSION)) { continue; } @@ -93,7 +93,7 @@ class ClassMapGenerator $contents = file_get_contents($path); $tokens = token_get_all($contents); - $nsTokens = [T_STRING => true, T_NS_SEPARATOR => true]; + $nsTokens = [\T_STRING => true, \T_NS_SEPARATOR => true]; if (\defined('T_NAME_QUALIFIED')) { $nsTokens[T_NAME_QUALIFIED] = true; } @@ -111,7 +111,7 @@ class ClassMapGenerator $class = ''; switch ($token[0]) { - case T_NAMESPACE: + case \T_NAMESPACE: $namespace = ''; // If there is a namespace, extract it while (isset($tokens[++$i][1])) { @@ -121,9 +121,9 @@ class ClassMapGenerator } $namespace .= '\\'; break; - case T_CLASS: - case T_INTERFACE: - case T_TRAIT: + case \T_CLASS: + case \T_INTERFACE: + case \T_TRAIT: // Skip usage of ::class constant $isClassConstant = false; for ($j = $i - 1; $j > 0; --$j) { @@ -131,10 +131,10 @@ class ClassMapGenerator break; } - if (T_DOUBLE_COLON === $tokens[$j][0]) { + if (\T_DOUBLE_COLON === $tokens[$j][0]) { $isClassConstant = true; break; - } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) { + } elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) { break; } } @@ -146,9 +146,9 @@ class ClassMapGenerator // Find the classname while (isset($tokens[++$i][1])) { $t = $tokens[$i]; - if (T_STRING === $t[0]) { + if (\T_STRING === $t[0]) { $class .= $t[1]; - } elseif ('' !== $class && T_WHITESPACE === $t[0]) { + } elseif ('' !== $class && \T_WHITESPACE === $t[0]) { break; } } diff --git a/src/Symfony/Component/ClassLoader/MapClassLoader.php b/src/Symfony/Component/ClassLoader/MapClassLoader.php index e6b89e5143..41f07cb024 100644 --- a/src/Symfony/Component/ClassLoader/MapClassLoader.php +++ b/src/Symfony/Component/ClassLoader/MapClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\MapClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\MapClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED); /** * A class loader that uses a mapping file to look up paths. diff --git a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php index f4e79cab62..09c456b560 100644 --- a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php +++ b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\Psr4ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\Psr4ClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use Composer instead.', \E_USER_DEPRECATED); /** * A PSR-4 compatible class loader. diff --git a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php index 6706acbd36..82eb9aab8a 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php @@ -22,7 +22,7 @@ class ApcClassLoaderTest extends TestCase { protected function setUp() { - if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { + if (!(filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { $this->markTestSkipped('The apc extension is not enabled.'); } else { apcu_clear_cache(); @@ -31,7 +31,7 @@ class ApcClassLoaderTest extends TestCase protected function tearDown() { - if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { apcu_clear_cache(); } } diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php index af8a94bdbd..8de9e24e4f 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php @@ -124,7 +124,7 @@ class ClassLoaderTest extends TestCase $loader->setUseIncludePath(true); $this->assertTrue($loader->getUseIncludePath()); - set_include_path(__DIR__.'/Fixtures/includepath'.PATH_SEPARATOR.$includePath); + set_include_path(__DIR__.'/Fixtures/includepath'.\PATH_SEPARATOR.$includePath); $this->assertEquals(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'includepath'.\DIRECTORY_SEPARATOR.'Foo.php', $loader->findFile('Foo')); diff --git a/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php b/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php index 374608bb87..025750ac4c 100644 --- a/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php +++ b/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\WinCacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\WinCacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED); /** * WinCacheClassLoader implements a wrapping autoloader cached in WinCache. diff --git a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php index d236bb4f07..0897ea9e5a 100644 --- a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php +++ b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ClassLoader; -@trigger_error('The '.__NAMESPACE__.'\XcacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\XcacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', \E_USER_DEPRECATED); /** * XcacheClassLoader implements a wrapping autoloader cached in XCache for PHP 5.3. diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 83bab205ec..59a0af8794 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -235,7 +235,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface } if ($child->isDeprecated()) { - @trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED); + @trigger_error($child->getDeprecationMessage($name, $this->getPath()), \E_USER_DEPRECATED); } try { diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 29d1e154fc..da4ebf6273 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -413,7 +413,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition } if (false === $this->allowEmptyValue) { - @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), E_USER_DEPRECATED); + @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), \E_USER_DEPRECATED); } if (true === $this->atLeastOne) { @@ -476,7 +476,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition } if (false === $this->allowEmptyValue) { - @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), E_USER_DEPRECATED); + @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), \E_USER_DEPRECATED); } if (true === $this->atLeastOne) { diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php index 744f15fd81..7f8639908d 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php @@ -193,7 +193,7 @@ class XmlReferenceDumper $commentDepth = $depth + 4 + \strlen($attrName) + 2; $commentLines = explode("\n", $comment); $multiline = (\count($commentLines) > 1); - $comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); + $comment = implode(\PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); if ($multiline) { $this->writeLine(' diff --git a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php index 4413baf3c7..ac2d9376f0 100644 --- a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php @@ -54,7 +54,7 @@ class ScalarNodeTest extends TestCase $deprecationTriggered = 0; $deprecationHandler = function ($level, $message, $file, $line) use (&$prevErrorHandler, &$deprecationTriggered) { - if (E_USER_DEPRECATED === $level) { + if (\E_USER_DEPRECATED === $level) { return ++$deprecationTriggered; } diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php index 35a911ef3a..79ddf00f6b 100644 --- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php @@ -107,7 +107,7 @@ class ProjectLoader1 extends Loader public function supports($resource, $type = null) { - return \is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); + return \is_string($resource) && 'foo' === pathinfo($resource, \PATHINFO_EXTENSION); } public function getType() diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index a82e939d91..f0b77ae6f6 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -199,7 +199,7 @@ class XmlUtilsTest extends TestCase // test for issue https://github.com/symfony/symfony/issues/9731 public function testLoadWrongEmptyXMLWithErrorHandler() { - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $originalDisableEntities = libxml_disable_entity_loader(false); } $errorReporting = error_reporting(-1); @@ -221,7 +221,7 @@ class XmlUtilsTest extends TestCase error_reporting($errorReporting); } - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); libxml_disable_entity_loader($disableEntities); diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 203741ad11..d833c428ef 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -51,15 +51,15 @@ class XmlUtils } $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } libxml_clear_errors(); $dom = new \DOMDocument(); $dom->validateOnParse = true; - if (!$dom->loadXML($content, LIBXML_NONET | (\defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - if (LIBXML_VERSION < 20900) { + if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -69,12 +69,12 @@ class XmlUtils $dom->normalizeDocument(); libxml_use_internal_errors($internalErrors); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } foreach ($dom->childNodes as $child) { - if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { + if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) { throw new XmlParsingException('Document types are not allowed.'); } } @@ -267,7 +267,7 @@ class XmlUtils $errors = []; foreach (libxml_get_errors() as $error) { $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', + \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), $error->file ?: 'n/a', diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 320d53919e..e9e3defa1c 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -121,7 +121,7 @@ class Application $renderException = function ($e) use ($output) { if (!$e instanceof \Exception) { - $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); + $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); } if ($output instanceof ConsoleOutputInterface) { $this->renderException($e, $output->getErrorOutput()); @@ -139,7 +139,7 @@ class Application } if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) { - @trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED); + @trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), \E_USER_DEPRECATED); } $this->configureIO($input, $output); @@ -784,7 +784,7 @@ class Application $len = 0; } - $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX; + $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX; // HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327 if (\defined('HHVM_VERSION') && $width > 1 << 31) { $width = 1 << 31; @@ -853,7 +853,7 @@ class Application */ protected function getTerminalWidth() { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED); return $this->terminal->getWidth(); } @@ -867,7 +867,7 @@ class Application */ protected function getTerminalHeight() { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED); return $this->terminal->getHeight(); } @@ -881,7 +881,7 @@ class Application */ public function getTerminalDimensions() { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED); return [$this->terminal->getWidth(), $this->terminal->getHeight()]; } @@ -900,7 +900,7 @@ class Application */ public function setTerminalDimensions($width, $height) { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), \E_USER_DEPRECATED); putenv('COLUMNS='.$width); putenv('LINES='.$height); @@ -1173,7 +1173,7 @@ class Application } $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); - ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE); + ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); return array_keys($alternatives); } diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index e39cc3ba41..d896f67fd0 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -223,7 +223,7 @@ class Command if (null !== $this->processTitle) { if (\function_exists('cli_set_process_title')) { if (!@cli_set_process_title($this->processTitle)) { - if ('Darwin' === PHP_OS) { + if ('Darwin' === \PHP_OS) { $output->writeln('Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.', OutputInterface::VERBOSITY_VERY_VERBOSE); } else { cli_set_process_title($this->processTitle); diff --git a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php index d1af3bab2a..e51c31db58 100644 --- a/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php @@ -110,7 +110,7 @@ class JsonDescriptor extends Descriptor 'is_required' => $argument->isRequired(), 'is_array' => $argument->isArray(), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()), - 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(), + 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(), ]; } @@ -126,7 +126,7 @@ class JsonDescriptor extends Descriptor 'is_value_required' => $option->isValueRequired(), 'is_multiple' => $option->isArray(), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()), - 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(), + 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(), ]; } diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index 9600559079..9ca56ce9de 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -276,7 +276,7 @@ class TextDescriptor extends Descriptor */ private function formatDefaultValue($default) { - if (INF === $default) { + if (\INF === $default) { return 'INF'; } @@ -290,7 +290,7 @@ class TextDescriptor extends Descriptor } } - return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); } /** diff --git a/src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php b/src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php index 0adfaf9ac9..845119ee29 100644 --- a/src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Console\Event; -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), \E_USER_DEPRECATED); use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 3202fc176e..abc85398e5 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -134,7 +134,7 @@ class OutputFormatter implements OutputFormatterInterface $offset = 0; $output = ''; $tagRegex = '[a-z][a-z0-9,_=;-]*+'; - preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE); + preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE); foreach ($matches[0] as $i => $match) { $pos = $match[1]; $text = $match[0]; @@ -196,7 +196,7 @@ class OutputFormatter implements OutputFormatterInterface return $this->styles[$string]; } - if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) { + if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) { return false; } @@ -216,7 +216,7 @@ class OutputFormatter implements OutputFormatterInterface try { $style->setOption($option); } catch (\InvalidArgumentException $e) { - @trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED); + @trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), \E_USER_DEPRECATED); return false; } diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php index 1725655141..4ee4912f68 100644 --- a/src/Symfony/Component/Console/Helper/ProgressBar.php +++ b/src/Symfony/Component/Console/Helper/ProgressBar.php @@ -475,7 +475,7 @@ final class ProgressBar $message = "\x0D\x1B[2K$message"; } } elseif ($this->step > 0) { - $message = PHP_EOL.$message; + $message = \PHP_EOL.$message; } $this->firstRun = false; @@ -544,7 +544,7 @@ final class ProgressBar return Helper::formatMemory(memory_get_usage(true)); }, 'current' => function (self $bar) { - return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); + return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT); }, 'max' => function (self $bar) { return $bar->getMaxSteps(); diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index ee6d4b6642..15d4549dad 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -102,7 +102,7 @@ class QuestionHelper extends Helper */ public function setInputStream($stream) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED); if (!\is_resource($stream)) { throw new InvalidArgumentException('Input stream must be a valid resource.'); @@ -122,7 +122,7 @@ class QuestionHelper extends Helper public function getInputStream() { if (0 === \func_num_args() || func_get_arg(0)) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED); } return $this->inputStream; @@ -155,7 +155,7 @@ class QuestionHelper extends Helper { $this->writePrompt($output, $question); - $inputStream = $this->inputStream ?: STDIN; + $inputStream = $this->inputStream ?: \STDIN; $autocomplete = $question->getAutocompleterValues(); if (\function_exists('sapi_windows_cp_set')) { diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php index 7cd050fee1..86bebd9d75 100644 --- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php @@ -41,7 +41,7 @@ class SymfonyQuestionHelper extends QuestionHelper } else { // make required if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) { - @trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED); + @trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', \E_USER_DEPRECATED); throw new LogicException('A value is required.'); } diff --git a/src/Symfony/Component/Console/Helper/TableStyle.php b/src/Symfony/Component/Console/Helper/TableStyle.php index 4213297f5f..98d8847f44 100644 --- a/src/Symfony/Component/Console/Helper/TableStyle.php +++ b/src/Symfony/Component/Console/Helper/TableStyle.php @@ -30,7 +30,7 @@ class TableStyle private $cellRowFormat = '%s'; private $cellRowContentFormat = ' %s '; private $borderFormat = '%s'; - private $padType = STR_PAD_RIGHT; + private $padType = \STR_PAD_RIGHT; /** * Sets padding character, used for cell padding. @@ -237,7 +237,7 @@ class TableStyle */ public function setPadType($padType) { - if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { + if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); } diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index 53f41d73f5..d953f9bba4 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -171,7 +171,7 @@ class InputDefinition */ public function getArgumentCount() { - return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments); + return $this->hasAnArrayArgument ? \PHP_INT_MAX : \count($this->arguments); } /** diff --git a/src/Symfony/Component/Console/Output/BufferedOutput.php b/src/Symfony/Component/Console/Output/BufferedOutput.php index 8afc8931ed..fefaac2717 100644 --- a/src/Symfony/Component/Console/Output/BufferedOutput.php +++ b/src/Symfony/Component/Console/Output/BufferedOutput.php @@ -39,7 +39,7 @@ class BufferedOutput extends Output $this->buffer .= $message; if ($newline) { - $this->buffer .= PHP_EOL; + $this->buffer .= \PHP_EOL; } } } diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php index 61dc7cbdca..21a108fcab 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php @@ -124,7 +124,7 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface $checks = [ \function_exists('php_uname') ? php_uname('s') : '', getenv('OSTYPE'), - PHP_OS, + \PHP_OS, ]; return false !== stripos(implode(';', $checks), 'OS400'); diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 74b9b54e86..451051df8d 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -70,7 +70,7 @@ class StreamOutput extends Output protected function doWrite($message, $newline) { if ($newline) { - $message .= PHP_EOL; + $message .= \PHP_EOL; } @fwrite($this->stream, $message); diff --git a/src/Symfony/Component/Console/Style/OutputStyle.php b/src/Symfony/Component/Console/Style/OutputStyle.php index b1262b55de..14d2d60b22 100644 --- a/src/Symfony/Component/Console/Style/OutputStyle.php +++ b/src/Symfony/Component/Console/Style/OutputStyle.php @@ -35,7 +35,7 @@ abstract class OutputStyle implements OutputInterface, StyleInterface */ public function newLine($count = 1) { - $this->output->write(str_repeat(PHP_EOL, $count)); + $this->output->write(str_repeat(\PHP_EOL, $count)); } /** diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 02e9b471b8..4d83779c54 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -352,7 +352,7 @@ class SymfonyStyle extends OutputStyle private function autoPrependBlock() { - $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); + $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); if (!isset($chars[0])) { $this->newLine(); //empty history, so we should start with a new line. @@ -399,7 +399,7 @@ class SymfonyStyle extends OutputStyle $message = OutputFormatter::escape($message); } - $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true))); + $lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true))); if (\count($messages) > 1 && $key < \count($messages) - 1) { $lines[] = ''; diff --git a/src/Symfony/Component/Console/Tester/ApplicationTester.php b/src/Symfony/Component/Console/Tester/ApplicationTester.php index dc970182ec..355b07b164 100644 --- a/src/Symfony/Component/Console/Tester/ApplicationTester.php +++ b/src/Symfony/Component/Console/Tester/ApplicationTester.php @@ -114,7 +114,7 @@ class ApplicationTester $display = stream_get_contents($this->output->getStream()); if ($normalize) { - $display = str_replace(PHP_EOL, "\n", $display); + $display = str_replace(\PHP_EOL, "\n", $display); } return $display; @@ -138,7 +138,7 @@ class ApplicationTester $display = stream_get_contents($this->output->getErrorOutput()->getStream()); if ($normalize) { - $display = str_replace(PHP_EOL, "\n", $display); + $display = str_replace(\PHP_EOL, "\n", $display); } return $display; diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index a1d8ad70a1..1229894888 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -96,7 +96,7 @@ class CommandTester $display = stream_get_contents($this->output->getStream()); if ($normalize) { - $display = str_replace(PHP_EOL, "\n", $display); + $display = str_replace(\PHP_EOL, "\n", $display); } return $display; @@ -152,7 +152,7 @@ class CommandTester $stream = fopen('php://memory', 'r+', false); foreach ($inputs as $input) { - fwrite($stream, $input.PHP_EOL); + fwrite($stream, $input.\PHP_EOL); } rewind($stream); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 212379a7c3..16d856c460 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -79,7 +79,7 @@ class ApplicationTest extends TestCase protected function normalizeLineBreaks($text) { - return str_replace(PHP_EOL, "\n", $text); + return str_replace(\PHP_EOL, "\n", $text); } /** @@ -902,10 +902,10 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo:bar', '--no-interaction' => true], ['decorated' => false]); - $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); + $this->assertSame('called'.\PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); $tester->run(['command' => 'foo:bar', '-n' => true], ['decorated' => false]); - $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); + $this->assertSame('called'.\PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); } public function testRunWithGlobalOptionAndNoCommand() @@ -1202,7 +1202,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo']); - $this->assertEquals('before.foo.after.'.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('before.foo.after.'.\PHP_EOL, $tester->getDisplay()); } public function testRunWithExceptionAndDispatcher() @@ -1546,7 +1546,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run([], ['interactive' => false]); - $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + $this->assertEquals('called'.\PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); $application = new CustomDefaultCommandApplication(); $application->setAutoExit(false); @@ -1554,7 +1554,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run([], ['interactive' => false]); - $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + $this->assertEquals('called'.\PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); } public function testSetRunCustomDefaultCommandWithOption() @@ -1569,7 +1569,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['--fooopt' => 'opt'], ['interactive' => false]); - $this->assertEquals('called'.PHP_EOL.'opt'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + $this->assertEquals('called'.\PHP_EOL.'opt'.\PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); } public function testSetRunCustomSingleCommand() diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 207302fdf9..7421c09dbc 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -271,7 +271,7 @@ class CommandTest extends TestCase $tester->execute([], ['interactive' => true]); - $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); + $this->assertEquals('interact called'.\PHP_EOL.'execute called'.\PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); } public function testRunNonInteractive() @@ -280,7 +280,7 @@ class CommandTest extends TestCase $tester->execute([], ['interactive' => false]); - $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); + $this->assertEquals('execute called'.\PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); } public function testExecuteMethodNeedsToBeOverridden() @@ -337,7 +337,7 @@ class CommandTest extends TestCase $command->setProcessTitle('foo'); $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); if (\function_exists('cli_set_process_title')) { - if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) { + if (null === @cli_get_process_title() && 'Darwin' === \PHP_OS) { $this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); } $this->assertEquals('foo', cli_get_process_title()); @@ -353,7 +353,7 @@ class CommandTest extends TestCase $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); $tester->execute([]); - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('interact called'.\PHP_EOL.'from the code...'.\PHP_EOL, $tester->getDisplay()); } public function getSetCodeBindToClosureTests() @@ -378,7 +378,7 @@ class CommandTest extends TestCase $command->setCode($code); $tester = new CommandTester($command); $tester->execute([]); - $this->assertEquals('interact called'.PHP_EOL.$expected.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('interact called'.\PHP_EOL.$expected.\PHP_EOL, $tester->getDisplay()); } public function testSetCodeWithStaticClosure() @@ -390,10 +390,10 @@ class CommandTest extends TestCase if (\PHP_VERSION_ID < 70000) { // Cannot bind static closures in PHP 5 - $this->assertEquals('interact called'.PHP_EOL.'not bound'.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('interact called'.\PHP_EOL.'not bound'.\PHP_EOL, $tester->getDisplay()); } else { // Can bind static closures in PHP 7 - $this->assertEquals('interact called'.PHP_EOL.'bound'.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('interact called'.\PHP_EOL.'bound'.\PHP_EOL, $tester->getDisplay()); } } @@ -411,7 +411,7 @@ class CommandTest extends TestCase $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); $tester->execute([]); - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); + $this->assertEquals('interact called'.\PHP_EOL.'from the code...'.\PHP_EOL, $tester->getDisplay()); } public function callableMethodCommand(InputInterface $input, OutputInterface $output) diff --git a/src/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php index 320a4fb9f4..5d9257fbed 100644 --- a/src/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php @@ -102,6 +102,6 @@ abstract class AbstractDescriptorTest extends TestCase { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]); - $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch()))); + $this->assertEquals(trim($expectedDescription), trim(str_replace(\PHP_EOL, "\n", $output->fetch()))); } } diff --git a/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php b/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php index fb596b8d7a..d3f962fea0 100644 --- a/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php +++ b/src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php @@ -30,6 +30,6 @@ class JsonDescriptorTest extends AbstractDescriptorTest { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]); - $this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(PHP_EOL, "\n", $output->fetch())), true)); + $this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(\PHP_EOL, "\n", $output->fetch())), true)); } } diff --git a/src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php b/src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php index d46d6f18ba..ccd4c3b071 100644 --- a/src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php @@ -32,7 +32,7 @@ class ObjectsProvider 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), 'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"), 'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'style'), - 'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF), + 'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', \INF), ]; } @@ -47,7 +47,7 @@ class ObjectsProvider 'input_option_6' => new InputOption('option_name', ['o', 'O'], InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'), 'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', 'style'), 'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', ['Hello', 'world']), - 'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF), + 'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', \INF), ]; } diff --git a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php index 044c690d6d..a765947f8c 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php @@ -96,9 +96,9 @@ EOT; ['', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null], [$syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null], [$syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null], - [$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage], - [$syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage], - [$syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage], + [$errorMessage.\PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage], + [$syntaxErrorOutputVerbose.$errorMessage.\PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage], + [$syntaxErrorOutputDebug.$errorMessage.\PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage], [$successOutputProcessDebug, ['php', '-r', 'echo 42;'], StreamOutput::VERBOSITY_DEBUG, null], [$successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null], ]; diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php index a0be9b8a6d..e35cd9023a 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php @@ -477,16 +477,16 @@ class ProgressBarTest extends TestCase rewind($output->getStream()); $this->assertEquals( - ' 0/200 [>---------------------------] 0%'.PHP_EOL. - ' 20/200 [==>-------------------------] 10%'.PHP_EOL. - ' 40/200 [=====>----------------------] 20%'.PHP_EOL. - ' 60/200 [========>-------------------] 30%'.PHP_EOL. - ' 80/200 [===========>----------------] 40%'.PHP_EOL. - ' 100/200 [==============>-------------] 50%'.PHP_EOL. - ' 120/200 [================>-----------] 60%'.PHP_EOL. - ' 140/200 [===================>--------] 70%'.PHP_EOL. - ' 160/200 [======================>-----] 80%'.PHP_EOL. - ' 180/200 [=========================>--] 90%'.PHP_EOL. + ' 0/200 [>---------------------------] 0%'.\PHP_EOL. + ' 20/200 [==>-------------------------] 10%'.\PHP_EOL. + ' 40/200 [=====>----------------------] 20%'.\PHP_EOL. + ' 60/200 [========>-------------------] 30%'.\PHP_EOL. + ' 80/200 [===========>----------------] 40%'.\PHP_EOL. + ' 100/200 [==============>-------------] 50%'.\PHP_EOL. + ' 120/200 [================>-----------] 60%'.\PHP_EOL. + ' 140/200 [===================>--------] 70%'.\PHP_EOL. + ' 160/200 [======================>-----] 80%'.\PHP_EOL. + ' 180/200 [=========================>--] 90%'.\PHP_EOL. ' 200/200 [============================] 100%', stream_get_contents($output->getStream()) ); @@ -503,8 +503,8 @@ class ProgressBarTest extends TestCase rewind($output->getStream()); $this->assertEquals( - ' 0/50 [>---------------------------] 0%'.PHP_EOL. - ' 25/50 [==============>-------------] 50%'.PHP_EOL. + ' 0/50 [>---------------------------] 0%'.\PHP_EOL. + ' 25/50 [==============>-------------] 50%'.\PHP_EOL. ' 50/50 [============================] 100%', stream_get_contents($output->getStream()) ); @@ -518,7 +518,7 @@ class ProgressBarTest extends TestCase rewind($output->getStream()); $this->assertEquals( - ' 0 [>---------------------------]'.PHP_EOL. + ' 0 [>---------------------------]'.\PHP_EOL. ' 1 [->--------------------------]', stream_get_contents($output->getStream()) ); diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php index 1428cf5e97..5ae2bc6b03 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php @@ -46,11 +46,11 @@ class ProgressIndicatorTest extends TestCase $this->generateOutput(' \\ Advancing...'). $this->generateOutput(' | Advancing...'). $this->generateOutput(' | Done...'). - PHP_EOL. + \PHP_EOL. $this->generateOutput(' - Starting Again...'). $this->generateOutput(' \\ Starting Again...'). $this->generateOutput(' \\ Done Again...'). - PHP_EOL, + \PHP_EOL, stream_get_contents($output->getStream()) ); } @@ -70,9 +70,9 @@ class ProgressIndicatorTest extends TestCase rewind($output->getStream()); $this->assertEquals( - ' Starting...'.PHP_EOL. - ' Midway...'.PHP_EOL. - ' Done...'.PHP_EOL.PHP_EOL, + ' Starting...'.\PHP_EOL. + ' Midway...'.\PHP_EOL. + ' Done...'.\PHP_EOL.\PHP_EOL, stream_get_contents($output->getStream()) ); } diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php index 467f38b6d4..06f20e2b1b 100644 --- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -206,7 +206,7 @@ EOT $stream = stream_get_contents($output->getStream()); if ($normalize) { - $stream = str_replace(PHP_EOL, "\n", $stream); + $stream = str_replace(\PHP_EOL, "\n", $stream); } $this->assertStringContainsString($expected, $stream); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 7e2bd81013..54bb4378c2 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -707,7 +707,7 @@ TABLE; ]); $style = new TableStyle(); - $style->setPadType(STR_PAD_LEFT); + $style->setPadType(\STR_PAD_LEFT); $table->setColumnStyle(3, $style); $table->render(); @@ -753,7 +753,7 @@ TABLE; ->setColumnWidth(3, 10); $style = new TableStyle(); - $style->setPadType(STR_PAD_LEFT); + $style->setPadType(\STR_PAD_LEFT); $table->setColumnStyle(3, $style); $table->render(); @@ -784,7 +784,7 @@ TABLE; ->setColumnWidths([15, 0, -1, 10]); $style = new TableStyle(); - $style->setPadType(STR_PAD_LEFT); + $style->setPadType(\STR_PAD_LEFT); $table->setColumnStyle(3, $style); $table->render(); @@ -863,6 +863,6 @@ TABLE; { rewind($output->getStream()); - return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream())); + return str_replace(\PHP_EOL, "\n", stream_get_contents($output->getStream())); } } diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index f1bbb61c5f..54546e4f5f 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -70,7 +70,7 @@ class ConsoleLoggerTest extends TestCase $logger = new ConsoleLogger($out, $addVerbosityLevelMap); $logger->log($logLevel, 'foo bar'); $logs = $out->fetch(); - $this->assertEquals($isOutput ? "[$logLevel] foo bar".PHP_EOL : '', $logs); + $this->assertEquals($isOutput ? "[$logLevel] foo bar".\PHP_EOL : '', $logs); } public function provideOutputMappingParams() diff --git a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php index 86d5038066..ad9eef1aee 100644 --- a/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php +++ b/src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php @@ -54,7 +54,7 @@ class StreamOutputTest extends TestCase $output = new StreamOutput($this->stream); $output->writeln('foo'); rewind($output->getStream()); - $this->assertEquals('foo'.PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream'); + $this->assertEquals('foo'.\PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream'); } public function testDoWriteOnFailure() diff --git a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php index 74c3562001..9011706cd0 100644 --- a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php +++ b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php @@ -55,12 +55,12 @@ class ApplicationTesterTest extends TestCase public function testGetOutput() { rewind($this->tester->getOutput()->getStream()); - $this->assertEquals('foo'.PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance'); + $this->assertEquals('foo'.\PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance'); } public function testGetDisplay() { - $this->assertEquals('foo'.PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); + $this->assertEquals('foo'.\PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); } public function testGetStatusCode() diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php index 1fa8292365..1a9226e18e 100644 --- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php +++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php @@ -59,12 +59,12 @@ class CommandTesterTest extends TestCase public function testGetOutput() { rewind($this->tester->getOutput()->getStream()); - $this->assertEquals('foo'.PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance'); + $this->assertEquals('foo'.\PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()), '->getOutput() returns the current output instance'); } public function testGetDisplay() { - $this->assertEquals('foo'.PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); + $this->assertEquals('foo'.\PHP_EOL, $this->tester->getDisplay(), '->getDisplay() returns the display of the last execution'); } public function testGetStatusCode() diff --git a/src/Symfony/Component/Debug/Debug.php b/src/Symfony/Component/Debug/Debug.php index 498d30935c..746f3290c8 100644 --- a/src/Symfony/Component/Debug/Debug.php +++ b/src/Symfony/Component/Debug/Debug.php @@ -28,7 +28,7 @@ class Debug * @param int $errorReportingLevel The level of error reporting you want * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) */ - public static function enable($errorReportingLevel = E_ALL, $displayErrors = true) + public static function enable($errorReportingLevel = \E_ALL, $displayErrors = true) { if (static::$enabled) { return; @@ -39,13 +39,13 @@ class Debug if (null !== $errorReportingLevel) { error_reporting($errorReportingLevel); } else { - error_reporting(E_ALL); + error_reporting(\E_ALL); } if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { ini_set('display_errors', 0); ExceptionHandler::register(); - } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) { + } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), \FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) { // CLI - display errors only if they're not already logged to STDERR ini_set('display_errors', 1); } diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index b0174187af..f54d07af07 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -56,7 +56,7 @@ class DebugClassLoader } elseif (substr($test, -\strlen($file)) === $file) { // filesystem is case insensitive and realpath() normalizes the case of characters self::$caseCheck = 1; - } elseif (false !== stripos(PHP_OS, 'darwin')) { + } elseif (false !== stripos(\PHP_OS, 'darwin')) { // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters self::$caseCheck = 2; } else { @@ -141,7 +141,7 @@ class DebugClassLoader */ public function loadClass($class) { - $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); + $e = error_reporting(error_reporting() | \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR); try { if ($this->isFinder && !isset($this->loaded[$class])) { @@ -197,7 +197,7 @@ class DebugClassLoader } foreach ($deprecations as $message) { - @trigger_error($message, E_USER_DEPRECATED); + @trigger_error($message, \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 1e60b5ca98..b8ec09e805 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -49,39 +49,39 @@ use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; class ErrorHandler { private $levels = [ - E_DEPRECATED => 'Deprecated', - E_USER_DEPRECATED => 'User Deprecated', - E_NOTICE => 'Notice', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_WARNING => 'Warning', - E_USER_WARNING => 'User Warning', - E_COMPILE_WARNING => 'Compile Warning', - E_CORE_WARNING => 'Core Warning', - E_USER_ERROR => 'User Error', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - E_COMPILE_ERROR => 'Compile Error', - E_PARSE => 'Parse Error', - E_ERROR => 'Error', - E_CORE_ERROR => 'Core Error', + \E_DEPRECATED => 'Deprecated', + \E_USER_DEPRECATED => 'User Deprecated', + \E_NOTICE => 'Notice', + \E_USER_NOTICE => 'User Notice', + \E_STRICT => 'Runtime Notice', + \E_WARNING => 'Warning', + \E_USER_WARNING => 'User Warning', + \E_COMPILE_WARNING => 'Compile Warning', + \E_CORE_WARNING => 'Core Warning', + \E_USER_ERROR => 'User Error', + \E_RECOVERABLE_ERROR => 'Catchable Fatal Error', + \E_COMPILE_ERROR => 'Compile Error', + \E_PARSE => 'Parse Error', + \E_ERROR => 'Error', + \E_CORE_ERROR => 'Core Error', ]; private $loggers = [ - E_DEPRECATED => [null, LogLevel::INFO], - E_USER_DEPRECATED => [null, LogLevel::INFO], - E_NOTICE => [null, LogLevel::WARNING], - E_USER_NOTICE => [null, LogLevel::WARNING], - E_STRICT => [null, LogLevel::WARNING], - E_WARNING => [null, LogLevel::WARNING], - E_USER_WARNING => [null, LogLevel::WARNING], - E_COMPILE_WARNING => [null, LogLevel::WARNING], - E_CORE_WARNING => [null, LogLevel::WARNING], - E_USER_ERROR => [null, LogLevel::CRITICAL], - E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], - E_COMPILE_ERROR => [null, LogLevel::CRITICAL], - E_PARSE => [null, LogLevel::CRITICAL], - E_ERROR => [null, LogLevel::CRITICAL], - E_CORE_ERROR => [null, LogLevel::CRITICAL], + \E_DEPRECATED => [null, LogLevel::INFO], + \E_USER_DEPRECATED => [null, LogLevel::INFO], + \E_NOTICE => [null, LogLevel::WARNING], + \E_USER_NOTICE => [null, LogLevel::WARNING], + \E_STRICT => [null, LogLevel::WARNING], + \E_WARNING => [null, LogLevel::WARNING], + \E_USER_WARNING => [null, LogLevel::WARNING], + \E_COMPILE_WARNING => [null, LogLevel::WARNING], + \E_CORE_WARNING => [null, LogLevel::WARNING], + \E_USER_ERROR => [null, LogLevel::CRITICAL], + \E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + \E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + \E_PARSE => [null, LogLevel::CRITICAL], + \E_ERROR => [null, LogLevel::CRITICAL], + \E_CORE_ERROR => [null, LogLevel::CRITICAL], ]; private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED @@ -154,7 +154,7 @@ class ErrorHandler $handler->setExceptionHandler($prev); } - $handler->throwAt(E_ALL & $handler->thrownErrors, true); + $handler->throwAt(\E_ALL & $handler->thrownErrors, true); return $handler; } @@ -176,7 +176,7 @@ class ErrorHandler * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants * @param bool $replace Whether to replace or not any existing logger */ - public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) + public function setDefaultLogger(LoggerInterface $logger, $levels = \E_ALL, $replace = false) { $loggers = []; @@ -188,7 +188,7 @@ class ErrorHandler } } else { if (null === $levels) { - $levels = E_ALL; + $levels = \E_ALL; } foreach ($this->loggers as $type => $log) { if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) { @@ -242,7 +242,7 @@ class ErrorHandler if ($flush) { foreach ($this->bootstrappingLogger->cleanLogs() as $log) { - $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : E_ERROR; + $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : \E_ERROR; if (!isset($flush[$type])) { $this->bootstrappingLogger->log($log[0], $log[1], $log[2]); } elseif ($this->loggers[$type][0]) { @@ -280,7 +280,7 @@ class ErrorHandler public function throwAt($levels, $replace = false) { $prev = $this->thrownErrors; - $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; + $this->thrownErrors = ($levels | \E_RECOVERABLE_ERROR | \E_USER_ERROR) & ~\E_USER_DEPRECATED & ~\E_DEPRECATED; if (!$replace) { $this->thrownErrors |= $prev; } @@ -382,15 +382,15 @@ class ErrorHandler */ public function handleError($type, $message, $file, $line) { - if (\PHP_VERSION_ID >= 70300 && E_WARNING === $type && '"' === $message[0] && false !== strpos($message, '" targeting switch is equivalent to "break')) { - $type = E_DEPRECATED; + if (\PHP_VERSION_ID >= 70300 && \E_WARNING === $type && '"' === $message[0] && false !== strpos($message, '" targeting switch is equivalent to "break')) { + $type = \E_DEPRECATED; } // Level is the current error reporting level to manage silent error. $level = error_reporting(); $silenced = 0 === ($level & $type); // Strong errors are not authorized to be silenced. - $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; + $level |= \E_RECOVERABLE_ERROR | \E_USER_ERROR | \E_DEPRECATED | \E_USER_DEPRECATED; $log = $this->loggedErrors & $type; $throw = $this->thrownErrors & $type & $level; $type &= $level | $this->screamedErrors; @@ -414,7 +414,7 @@ class ErrorHandler $context = $e; } - if (null !== $backtrace && $type & E_ERROR) { + if (null !== $backtrace && $type & \E_ERROR) { // E_ERROR fatal errors are triggered on HHVM when // hhvm.error_handling.call_user_handler_on_fatals=1 // which is the way to get their backtrace. @@ -430,7 +430,7 @@ class ErrorHandler self::$toStringException = null; } elseif (!$throw && !($type & $level)) { if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) { - $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : []; + $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : []; $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace); } elseif (isset(self::$silencedErrorCache[$id][$message])) { $lightTrace = null; @@ -469,7 +469,7 @@ class ErrorHandler } if ($throw) { - if (\PHP_VERSION_ID < 70400 && E_USER_ERROR & $type) { + if (\PHP_VERSION_ID < 70400 && \E_USER_ERROR & $type) { for ($i = 1; isset($backtrace[$i]); ++$i) { if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function']) && '__toString' === $backtrace[$i]['function'] @@ -558,7 +558,7 @@ class ErrorHandler if (!$exception instanceof \Exception) { $exception = new FatalThrowableError($exception); } - $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; + $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : \E_ERROR; $handlerException = null; if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { @@ -674,7 +674,7 @@ class ErrorHandler // Handled below } - if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { + if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) { // Let's not throw anymore but keep logging $handler->throwAt(0, true); $trace = isset($error['backtrace']) ? $error['backtrace'] : null; @@ -716,9 +716,9 @@ class ErrorHandler */ public static function stackErrors() { - @trigger_error('Support for stacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Support for stacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); - self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); + self::$stackedErrorLevels[] = error_reporting(error_reporting() | \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR); } /** @@ -728,13 +728,13 @@ class ErrorHandler */ public static function unstackErrors() { - @trigger_error('Support for unstacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Support for unstacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); $level = array_pop(self::$stackedErrorLevels); if (null !== $level) { $errorReportingLevel = error_reporting($level); - if ($errorReportingLevel !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) { + if ($errorReportingLevel !== ($level | \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR)) { // If the user changed the error level, do not overwrite it error_reporting($errorReportingLevel); } diff --git a/src/Symfony/Component/Debug/Exception/ContextErrorException.php b/src/Symfony/Component/Debug/Exception/ContextErrorException.php index 930f377763..4b49f0afbc 100644 --- a/src/Symfony/Component/Debug/Exception/ContextErrorException.php +++ b/src/Symfony/Component/Debug/Exception/ContextErrorException.php @@ -33,7 +33,7 @@ class ContextErrorException extends \ErrorException */ public function getContext() { - @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); return $this->context; } diff --git a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php index fafc92263e..a44f65f08e 100644 --- a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php +++ b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php @@ -22,13 +22,13 @@ class FatalThrowableError extends FatalErrorException { if ($e instanceof \ParseError) { $message = 'Parse error: '.$e->getMessage(); - $severity = E_PARSE; + $severity = \E_PARSE; } elseif ($e instanceof \TypeError) { $message = 'Type error: '.$e->getMessage(); - $severity = E_RECOVERABLE_ERROR; + $severity = \E_RECOVERABLE_ERROR; } else { $message = $e->getMessage(); - $severity = E_ERROR; + $severity = \E_ERROR; } \ErrorException::__construct( diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index b79e83ea2c..7cf3f2a6af 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -377,7 +377,7 @@ EOF; if (\is_string($fmt)) { $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, \PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; isset($fmt[$i]); ++$i) { if (0 === strpos($path, $k = $fmt[$i++])) { @@ -434,7 +434,7 @@ EOF; */ private function escapeHtml($str) { - return htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); + return htmlspecialchars($str, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); } private function getSymfonyGhostAsSvg() diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index cfd7c31122..05f24a24ca 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -73,12 +73,12 @@ class ErrorHandlerTest extends TestCase $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger); - $handler->screamAt(E_ALL); + $handler->screamAt(\E_ALL); try { - @trigger_error('Hello', E_USER_WARNING); + @trigger_error('Hello', \E_USER_WARNING); $expected = [ - 'type' => E_USER_WARNING, + 'type' => \E_USER_WARNING, 'message' => 'Hello', 'file' => __FILE__, 'line' => __LINE__ - 5, @@ -102,10 +102,10 @@ class ErrorHandlerTest extends TestCase } catch (\ErrorException $exception) { // if an exception is thrown, the test passed if (\PHP_VERSION_ID < 80000) { - $this->assertEquals(E_NOTICE, $exception->getSeverity()); + $this->assertEquals(\E_NOTICE, $exception->getSeverity()); $this->assertMatchesRegularExpression('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage()); } else { - $this->assertEquals(E_WARNING, $exception->getSeverity()); + $this->assertEquals(\E_WARNING, $exception->getSeverity()); $this->assertMatchesRegularExpression('/^Warning: Undefined variable \$(foo|bar)/', $exception->getMessage()); } $this->assertEquals(__FILE__, $exception->getFile()); @@ -138,7 +138,7 @@ class ErrorHandlerTest extends TestCase try { $handler = ErrorHandler::register(); $handler->throwAt(3, true); - $this->assertEquals(3 | E_RECOVERABLE_ERROR | E_USER_ERROR, $handler->throwAt(0)); + $this->assertEquals(3 | \E_RECOVERABLE_ERROR | \E_USER_ERROR, $handler->throwAt(0)); } finally { restore_error_handler(); restore_exception_handler(); @@ -151,25 +151,25 @@ class ErrorHandlerTest extends TestCase $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]); + $handler->setDefaultLogger($logger, \E_NOTICE); + $handler->setDefaultLogger($logger, [\E_USER_NOTICE => LogLevel::CRITICAL]); $loggers = [ - E_DEPRECATED => [null, LogLevel::INFO], - E_USER_DEPRECATED => [null, LogLevel::INFO], - E_NOTICE => [$logger, LogLevel::WARNING], - E_USER_NOTICE => [$logger, LogLevel::CRITICAL], - E_STRICT => [null, LogLevel::WARNING], - E_WARNING => [null, LogLevel::WARNING], - E_USER_WARNING => [null, LogLevel::WARNING], - E_COMPILE_WARNING => [null, LogLevel::WARNING], - E_CORE_WARNING => [null, LogLevel::WARNING], - E_USER_ERROR => [null, LogLevel::CRITICAL], - E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], - E_COMPILE_ERROR => [null, LogLevel::CRITICAL], - E_PARSE => [null, LogLevel::CRITICAL], - E_ERROR => [null, LogLevel::CRITICAL], - E_CORE_ERROR => [null, LogLevel::CRITICAL], + \E_DEPRECATED => [null, LogLevel::INFO], + \E_USER_DEPRECATED => [null, LogLevel::INFO], + \E_NOTICE => [$logger, LogLevel::WARNING], + \E_USER_NOTICE => [$logger, LogLevel::CRITICAL], + \E_STRICT => [null, LogLevel::WARNING], + \E_WARNING => [null, LogLevel::WARNING], + \E_USER_WARNING => [null, LogLevel::WARNING], + \E_COMPILE_WARNING => [null, LogLevel::WARNING], + \E_CORE_WARNING => [null, LogLevel::WARNING], + \E_USER_ERROR => [null, LogLevel::CRITICAL], + \E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + \E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + \E_PARSE => [null, LogLevel::CRITICAL], + \E_ERROR => [null, LogLevel::CRITICAL], + \E_CORE_ERROR => [null, LogLevel::CRITICAL], ]; $this->assertSame($loggers, $handler->setLoggers([])); } finally { @@ -210,15 +210,15 @@ class ErrorHandlerTest extends TestCase restore_exception_handler(); $handler = ErrorHandler::register(); - $handler->throwAt(E_USER_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); + $handler->throwAt(\E_USER_DEPRECATED, true); + $this->assertFalse($handler->handleError(\E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); $handler = ErrorHandler::register(); - $handler->throwAt(E_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, [])); + $handler->throwAt(\E_DEPRECATED, true); + $this->assertFalse($handler->handleError(\E_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -232,7 +232,7 @@ class ErrorHandlerTest extends TestCase $exception = $context['exception']; $this->assertInstanceOf(\ErrorException::class, $exception); $this->assertSame('User Deprecated: foo', $exception->getMessage()); - $this->assertSame(E_USER_DEPRECATED, $exception->getSeverity()); + $this->assertSame(\E_USER_DEPRECATED, $exception->getSeverity()); }; $logger @@ -242,8 +242,8 @@ class ErrorHandlerTest extends TestCase ; $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_USER_DEPRECATED); - $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); + $handler->setDefaultLogger($logger, \E_USER_DEPRECATED); + $this->assertTrue($handler->handleError(\E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -257,10 +257,10 @@ class ErrorHandlerTest extends TestCase if (\PHP_VERSION_ID < 80000) { $this->assertEquals('Notice: Undefined variable: undefVar', $message); - $this->assertSame(E_NOTICE, $exception->getSeverity()); + $this->assertSame(\E_NOTICE, $exception->getSeverity()); } else { $this->assertEquals('Warning: Undefined variable $undefVar', $message); - $this->assertSame(E_WARNING, $exception->getSeverity()); + $this->assertSame(\E_WARNING, $exception->getSeverity()); } $this->assertInstanceOf(SilencedErrorContext::class, $exception); $this->assertSame(__FILE__, $exception->getFile()); @@ -277,11 +277,11 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandler::register(); if (\PHP_VERSION_ID < 80000) { - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->screamAt(E_NOTICE); + $handler->setDefaultLogger($logger, \E_NOTICE); + $handler->screamAt(\E_NOTICE); } else { - $handler->setDefaultLogger($logger, E_WARNING); - $handler->screamAt(E_WARNING); + $handler->setDefaultLogger($logger, \E_WARNING); + $handler->screamAt(\E_WARNING); } unset($undefVar); $line = __LINE__ + 1; @@ -342,7 +342,7 @@ class ErrorHandlerTest extends TestCase $handler = new ErrorHandler(); $handler->setDefaultLogger($logger); - @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, []); + @$handler->handleError(\E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, []); } /** @@ -368,7 +368,7 @@ class ErrorHandlerTest extends TestCase ->willReturnCallback($logArgCheck) ; - $handler->setDefaultLogger($logger, E_ERROR); + $handler->setDefaultLogger($logger, \E_ERROR); try { $handler->handleException($exception); @@ -395,7 +395,7 @@ class ErrorHandlerTest extends TestCase { try { $handler = ErrorHandler::register(); - $handler->screamAt(E_USER_WARNING); + $handler->screamAt(\E_USER_WARNING); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); @@ -408,10 +408,10 @@ class ErrorHandlerTest extends TestCase ) ; - $handler->setDefaultLogger($logger, [E_USER_WARNING => LogLevel::WARNING]); + $handler->setDefaultLogger($logger, [\E_USER_WARNING => LogLevel::WARNING]); ErrorHandler::stackErrors(); - @trigger_error('Silenced warning', E_USER_WARNING); + @trigger_error('Silenced warning', \E_USER_WARNING); $logger->log(LogLevel::WARNING, 'Dummy log'); ErrorHandler::unstackErrors(); } finally { @@ -426,26 +426,26 @@ class ErrorHandlerTest extends TestCase $handler = new ErrorHandler($bootLogger); $loggers = [ - E_DEPRECATED => [$bootLogger, LogLevel::INFO], - E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO], - E_NOTICE => [$bootLogger, LogLevel::WARNING], - E_USER_NOTICE => [$bootLogger, LogLevel::WARNING], - E_STRICT => [$bootLogger, LogLevel::WARNING], - E_WARNING => [$bootLogger, LogLevel::WARNING], - E_USER_WARNING => [$bootLogger, LogLevel::WARNING], - E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING], - E_CORE_WARNING => [$bootLogger, LogLevel::WARNING], - E_USER_ERROR => [$bootLogger, LogLevel::CRITICAL], - E_RECOVERABLE_ERROR => [$bootLogger, LogLevel::CRITICAL], - E_COMPILE_ERROR => [$bootLogger, LogLevel::CRITICAL], - E_PARSE => [$bootLogger, LogLevel::CRITICAL], - E_ERROR => [$bootLogger, LogLevel::CRITICAL], - E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL], + \E_DEPRECATED => [$bootLogger, LogLevel::INFO], + \E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO], + \E_NOTICE => [$bootLogger, LogLevel::WARNING], + \E_USER_NOTICE => [$bootLogger, LogLevel::WARNING], + \E_STRICT => [$bootLogger, LogLevel::WARNING], + \E_WARNING => [$bootLogger, LogLevel::WARNING], + \E_USER_WARNING => [$bootLogger, LogLevel::WARNING], + \E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING], + \E_CORE_WARNING => [$bootLogger, LogLevel::WARNING], + \E_USER_ERROR => [$bootLogger, LogLevel::CRITICAL], + \E_RECOVERABLE_ERROR => [$bootLogger, LogLevel::CRITICAL], + \E_COMPILE_ERROR => [$bootLogger, LogLevel::CRITICAL], + \E_PARSE => [$bootLogger, LogLevel::CRITICAL], + \E_ERROR => [$bootLogger, LogLevel::CRITICAL], + \E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL], ]; $this->assertSame($loggers, $handler->setLoggers([])); - $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, []); + $handler->handleError(\E_DEPRECATED, 'Foo message', __FILE__, 123, []); $logs = $bootLogger->cleanLogs(); @@ -459,7 +459,7 @@ class ErrorHandlerTest extends TestCase $this->assertSame('Deprecated: Foo message', $exception->getMessage()); $this->assertSame(__FILE__, $exception->getFile()); $this->assertSame(123, $exception->getLine()); - $this->assertSame(E_DEPRECATED, $exception->getSeverity()); + $this->assertSame(\E_DEPRECATED, $exception->getSeverity()); $bootLogger->log(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); @@ -468,7 +468,7 @@ class ErrorHandlerTest extends TestCase ->method('log') ->with(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); - $handler->setLoggers([E_DEPRECATED => [$mockLogger, LogLevel::WARNING]]); + $handler->setLoggers([\E_DEPRECATED => [$mockLogger, LogLevel::WARNING]]); } /** @@ -503,7 +503,7 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandler::register(); $error = [ - 'type' => E_PARSE, + 'type' => \E_PARSE, 'message' => 'foo', 'file' => 'bar', 'line' => 123, @@ -521,7 +521,7 @@ class ErrorHandlerTest extends TestCase ->willReturnCallback($logArgCheck) ; - $handler->setDefaultLogger($logger, E_PARSE); + $handler->setDefaultLogger($logger, \E_PARSE); $handler->handleFatalError($error); @@ -571,10 +571,10 @@ class ErrorHandlerTest extends TestCase ) ; - $handler->setDefaultLogger($logger, E_ERROR); + $handler->setDefaultLogger($logger, \E_ERROR); $error = [ - 'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors + 'type' => \E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors 'message' => 'foo', 'file' => 'bar', 'line' => 123, @@ -623,8 +623,8 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandlerThatUsesThePreviousOne::register(); } - @trigger_error('foo', E_USER_DEPRECATED); - @trigger_error('bar', E_USER_DEPRECATED); + @trigger_error('foo', \E_USER_DEPRECATED); + @trigger_error('bar', \E_USER_DEPRECATED); $this->assertSame([$handler, 'handleError'], set_error_handler('var_dump')); diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 431edb147b..7143e5d710 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -224,8 +224,8 @@ class FlattenExceptionTest extends TestCase 0.0, '0', '', - INF, - NAN, + \INF, + \NAN, ]); $flattened = FlattenException::create($exception); @@ -256,7 +256,7 @@ class FlattenExceptionTest extends TestCase $this->assertSame(['float', 0.0], $array[$i++]); $this->assertSame(['string', '0'], $array[$i++]); $this->assertSame(['string', ''], $array[$i++]); - $this->assertSame(['float', INF], $array[$i++]); + $this->assertSame(['float', \INF], $array[$i++]); // assertEquals() does not like NAN values. $this->assertEquals('float', $array[$i][0]); diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index 7a029e06fe..3ed3cfa572 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -150,7 +150,7 @@ class ExceptionHandlerTest extends TestCase $this->fail('OutOfMemoryException should bypass the handler'); }); - $handler->handle(new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__)); + $handler->handle(new OutOfMemoryException('foo', 0, \E_ERROR, __FILE__, __LINE__)); $this->assertThatTheExceptionWasOutput(ob_get_clean(), OutOfMemoryException::class, 'OutOfMemoryException', 'foo'); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php index 9a4c74d359..6a755025e2 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireExceptionPass.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; -@trigger_error('The '.__NAMESPACE__.'\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', \E_USER_DEPRECATED); use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 0b59ecdce9..b1dae2a4f4 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -52,7 +52,7 @@ class AutowirePass extends AbstractRecursivePass */ public function getAutowiringExceptions() { - @trigger_error('Calling AutowirePass::getAutowiringExceptions() is deprecated since Symfony 3.4 and will be removed in 4.0. Use Definition::getErrors() instead.', E_USER_DEPRECATED); + @trigger_error('Calling AutowirePass::getAutowiringExceptions() is deprecated since Symfony 3.4 and will be removed in 4.0. Use Definition::getErrors() instead.', \E_USER_DEPRECATED); return $this->autowiringExceptions; } @@ -85,7 +85,7 @@ class AutowirePass extends AbstractRecursivePass */ public static function createResourceForClass(\ReflectionClass $reflectionClass) { - @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED); + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); $metadata = []; @@ -304,7 +304,7 @@ class AutowirePass extends AbstractRecursivePass $message .= sprintf(' You should %s the "%s" service to "%s" instead.', isset($this->types[$this->types[$type]]) ? 'alias' : 'rename (or alias)', $this->types[$type], $type); } - @trigger_error($message, E_USER_DEPRECATED); + @trigger_error($message, \E_USER_DEPRECATED); return new TypedReference($this->types[$type], $type); } @@ -444,7 +444,7 @@ class AutowirePass extends AbstractRecursivePass $this->currentId = $currentId; } - @trigger_error(sprintf('Relying on service auto-registration for type "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Create a service named "%s" instead.', $type, $type), E_USER_DEPRECATED); + @trigger_error(sprintf('Relying on service auto-registration for type "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Create a service named "%s" instead.', $type, $type), \E_USER_DEPRECATED); $this->container->log($this, sprintf('Type "%s" has been auto-registered for service "%s".', $type, $this->currentId)); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index c5f698b012..0eb9d03664 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -62,7 +62,7 @@ class Compiler public function getLoggingFormatter() { if (null === $this->loggingFormatter) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED); $this->loggingFormatter = new LoggingFormatter(); } @@ -84,7 +84,7 @@ class Compiler if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); } } @@ -103,7 +103,7 @@ class Compiler */ public function addLogMessage($string) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), \E_USER_DEPRECATED); $this->log[] = $string; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php index bbd857e154..bf5f91578f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php @@ -26,7 +26,7 @@ class DecoratorServicePass implements CompilerPassInterface public function process(ContainerBuilder $container) { $definitions = new \SplPriorityQueue(); - $order = PHP_INT_MAX; + $order = \PHP_INT_MAX; foreach ($container->getDefinitions() as $id => $definition) { if (!$decorated = $definition->getDecoratedService()) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/FactoryReturnTypePass.php b/src/Symfony/Component/DependencyInjection/Compiler/FactoryReturnTypePass.php index 6b1277e26a..67575c03f3 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/FactoryReturnTypePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/FactoryReturnTypePass.php @@ -27,7 +27,7 @@ class FactoryReturnTypePass implements CompilerPassInterface public function __construct(ResolveClassPass $resolveClassPass = null) { if (null === $resolveClassPass) { - @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); } $this->resolveClassPass = $resolveClassPass; } @@ -104,7 +104,7 @@ class FactoryReturnTypePass implements CompilerPassInterface } if (null !== $returnType && (!isset($resolveClassPassChanges[$id]) || $returnType !== $resolveClassPassChanges[$id])) { - @trigger_error(sprintf('Relying on its factory\'s return-type to define the class of service "%s" is deprecated since Symfony 3.3 and won\'t work in 4.0. Set the "class" attribute to "%s" on the service definition instead.', $id, $returnType), E_USER_DEPRECATED); + @trigger_error(sprintf('Relying on its factory\'s return-type to define the class of service "%s" is deprecated since Symfony 3.3 and won\'t work in 4.0. Set the "class" attribute to "%s" on the service definition instead.', $id, $returnType), \E_USER_DEPRECATED); } $definition->setClass($returnType); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 326ee19323..9d8a02e7bd 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -45,7 +45,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe */ public function getInlinedServiceIds() { - @trigger_error('Calling InlineServiceDefinitionsPass::getInlinedServiceIds() is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Calling InlineServiceDefinitionsPass::getInlinedServiceIds() is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); return $this->inlinedServiceIds; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php index b058d26238..0d91f00f7e 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; -@trigger_error('The '.__NAMESPACE__.'\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', \E_USER_DEPRECATED); /** * Used to format logging messages during the compilation. diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index e470cdec2d..d95b21988c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -126,7 +126,7 @@ class PassConfig if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php index d48eff2214..79fca8d5ec 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; -@trigger_error('The '.__NAMESPACE__.'\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', \E_USER_DEPRECATED); class_exists(ResolveChildDefinitionsPass::class); diff --git a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php index 0c3d8f5758..68c1e3f6a2 100644 --- a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php +++ b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection\Config; -@trigger_error('The '.__NAMESPACE__.'\AutowireServiceResource class is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\AutowireServiceResource class is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; use Symfony\Component\DependencyInjection\Compiler\AutowirePass; diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index b9f44b0bf9..e9d53023d9 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -104,7 +104,7 @@ class Container implements ResettableContainerInterface */ public function isFrozen() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), \E_USER_DEPRECATED); return $this->parameterBag instanceof FrozenParameterBag; } @@ -184,16 +184,16 @@ class Container implements ResettableContainerInterface if (!isset($this->privates[$id]) && !isset($this->getRemovedIds()[$id])) { // no-op } elseif (null === $service) { - @trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); unset($this->privates[$id]); } else { - @trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); } } elseif (isset($this->services[$id])) { if (null === $service) { - @trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is already initialized, unsetting it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED); } else { - @trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.', $id), \E_USER_DEPRECATED); } } @@ -221,7 +221,7 @@ class Container implements ResettableContainerInterface { for ($i = 2;;) { if (isset($this->privates[$id])) { - @trigger_error(sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; @@ -245,7 +245,7 @@ class Container implements ResettableContainerInterface // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && method_exists($this, 'get'.strtr($id, $this->underscoreMap).'Service')) { - @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); return true; } @@ -279,7 +279,7 @@ class Container implements ResettableContainerInterface // calling $this->normalizeId($id) unless necessary. for ($i = 2;;) { if (isset($this->privates[$id])) { - @trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), \E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; @@ -311,7 +311,7 @@ class Container implements ResettableContainerInterface } elseif (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && method_exists($this, $method = 'get'.strtr($id, $this->underscoreMap).'Service')) { // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) - @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->{$method}(); } @@ -361,7 +361,7 @@ class Container implements ResettableContainerInterface $id = $this->normalizeId($id); if (isset($this->privates[$id])) { - @trigger_error(sprintf('Checking for the initialization of the "%s" private service is deprecated since Symfony 3.4 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('Checking for the initialization of the "%s" private service is deprecated since Symfony 3.4 and won\'t be supported anymore in Symfony 4.0.', $id), \E_USER_DEPRECATED); } if (isset($this->aliases[$id])) { @@ -395,7 +395,7 @@ class Container implements ResettableContainerInterface if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class) { // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) - @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', E_USER_DEPRECATED); + @trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); foreach (get_class_methods($this) as $method) { if (preg_match('/^get(.+)Service$/', $method, $match)) { @@ -511,7 +511,7 @@ class Container implements ResettableContainerInterface if (isset($this->normalizedIds[$normalizedId = strtolower($id)])) { $normalizedId = $this->normalizedIds[$normalizedId]; if ($id !== $normalizedId) { - @trigger_error(sprintf('Service identifiers will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.3.', $id, $normalizedId), E_USER_DEPRECATED); + @trigger_error(sprintf('Service identifiers will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.3.', $id, $normalizedId), \E_USER_DEPRECATED); } } else { $normalizedId = $this->normalizedIds[$normalizedId] = $id; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index f6568b3ea3..d9115bf8bf 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -334,7 +334,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ public function addClassResource(\ReflectionClass $class) { - @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', E_USER_DEPRECATED); + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', \E_USER_DEPRECATED); return $this->addObjectResource($class->name); } @@ -477,7 +477,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED); } } @@ -582,7 +582,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { if ($this->isCompiled() && isset($this->removedIds[$id = $this->normalizeId($id)])) { - @trigger_error(sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), \E_USER_DEPRECATED); } return $this->doGet($id, $invalidBehavior); @@ -768,7 +768,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName() && (1 > $r->getNumberOfParameters() || 'resolveEnvPlaceholders' !== $r->getParameters()[0]->name)) { - @trigger_error(sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), \E_USER_DEPRECATED); } } $resolveEnvPlaceholders = false; @@ -1124,7 +1124,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface } if ($definition->isDeprecated()) { - @trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED); + @trigger_error($definition->getDeprecationMessage($id), \E_USER_DEPRECATED); } if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) { @@ -1167,7 +1167,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface $r = new \ReflectionClass($factory[0]); if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) { - @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), \E_USER_DEPRECATED); } } } else { @@ -1179,7 +1179,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface $deprecationAllowlist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationAllowlist[$id]) || $deprecationAllowlist[$id] !== $class)) { - @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index c7d2049484..c3a94f5c3c 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -814,7 +814,7 @@ class Definition */ public function setAutowiringTypes(array $types) { - @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); + @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', \E_USER_DEPRECATED); $this->autowiringTypes = []; @@ -861,7 +861,7 @@ class Definition public function getAutowiringTypes(/*$triggerDeprecation = true*/) { if (1 > \func_num_args() || func_get_arg(0)) { - @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); + @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', \E_USER_DEPRECATED); } return array_keys($this->autowiringTypes); @@ -878,7 +878,7 @@ class Definition */ public function addAutowiringType($type) { - @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); $this->autowiringTypes[$type] = true; @@ -896,7 +896,7 @@ class Definition */ public function removeAutowiringType($type) { - @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); unset($this->autowiringTypes[$type]); @@ -914,7 +914,7 @@ class Definition */ public function hasAutowiringType($type) { - @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED); + @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), \E_USER_DEPRECATED); return isset($this->autowiringTypes[$type]); } diff --git a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php index 99af39e89d..4753c2aa93 100644 --- a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php +++ b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection; -@trigger_error('The '.__NAMESPACE__.'\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\Component\DependencyInjection\ChildDefinition class instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\Component\DependencyInjection\ChildDefinition class instead.', \E_USER_DEPRECATED); class_exists(ChildDefinition::class); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index c66c3bcf7c..1d4017f4c2 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -82,7 +82,7 @@ class PhpDumper extends Dumper public function __construct(ContainerBuilder $container) { if (!$container->isCompiled()) { - @trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since Symfony 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', E_USER_DEPRECATED); + @trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since Symfony 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', \E_USER_DEPRECATED); } parent::__construct($container); @@ -1992,7 +1992,7 @@ EOF; private function export($value) { - if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) { + if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) { $suffix = $matches[0][1] + \strlen($matches[0][0]); $matches[0][1] += \strlen($matches[1][0]); $prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : ''; diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php index 6b7ccf2e18..065673dc19 100644 --- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php +++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php @@ -124,7 +124,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface if ('json' === $prefix) { $env = json_decode($env, true); - if (JSON_ERROR_NONE !== json_last_error()) { + if (\JSON_ERROR_NONE !== json_last_error()) { throw new RuntimeException(sprintf('Invalid JSON in env var "%s": ', $name).json_last_error_msg()); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php index 307a3eefbb..6c07c67345 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php @@ -37,7 +37,7 @@ class IniFileLoader extends FileLoader } // real raw parsing - $result = parse_ini_file($path, true, INI_SCANNER_RAW); + $result = parse_ini_file($path, true, \INI_SCANNER_RAW); if (isset($result['parameters']) && \is_array($result['parameters'])) { foreach ($result['parameters'] as $key => $value) { @@ -55,7 +55,7 @@ class IniFileLoader extends FileLoader return false; } - if (null === $type && 'ini' === pathinfo($resource, PATHINFO_EXTENSION)) { + if (null === $type && 'ini' === pathinfo($resource, \PATHINFO_EXTENSION)) { return true; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php index ff8df43f84..ddb671ff26 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -57,7 +57,7 @@ class PhpFileLoader extends FileLoader return false; } - if (null === $type && 'php' === pathinfo($resource, PATHINFO_EXTENSION)) { + if (null === $type && 'php' === pathinfo($resource, \PATHINFO_EXTENSION)) { return true; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 6754f38767..0ff54ee66e 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -76,7 +76,7 @@ class XmlFileLoader extends FileLoader return false; } - if (null === $type && 'xml' === pathinfo($resource, PATHINFO_EXTENSION)) { + if (null === $type && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION)) { return true; } @@ -423,7 +423,7 @@ class XmlFileLoader extends FileLoader // anonymous services "in the wild" if (false !== $nodes = $xpath->query('//container:services/container:service[not(@id)]')) { foreach ($nodes as $node) { - @trigger_error(sprintf('Top-level anonymous services are deprecated since Symfony 3.4, the "id" attribute will be required in version 4.0 in %s at line %d.', $file, $node->getLineNo()), E_USER_DEPRECATED); + @trigger_error(sprintf('Top-level anonymous services are deprecated since Symfony 3.4, the "id" attribute will be required in version 4.0 in %s at line %d.', $file, $node->getLineNo()), \E_USER_DEPRECATED); // give it a unique name $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $node->getAttribute('class')).$suffix); @@ -492,7 +492,7 @@ class XmlFileLoader extends FileLoader throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file)); } if ($arg->hasAttribute('strict')) { - @trigger_error(sprintf('The "strict" attribute used when referencing the "%s" service is deprecated since Symfony 3.3 and will be removed in 4.0.', $arg->getAttribute('id')), E_USER_DEPRECATED); + @trigger_error(sprintf('The "strict" attribute used when referencing the "%s" service is deprecated since Symfony 3.3 and will be removed in 4.0.', $arg->getAttribute('id')), \E_USER_DEPRECATED); } $arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior); @@ -620,7 +620,7 @@ $imports EOF ; - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(false); $valid = @$dom->schemaValidateSource($source); libxml_disable_entity_loader($disableEntities); @@ -644,13 +644,13 @@ EOF { foreach ($alias->attributes as $name => $node) { if (!\in_array($name, ['alias', 'id', 'public'])) { - @trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), \E_USER_DEPRECATED); } } foreach ($alias->childNodes as $child) { if ($child instanceof \DOMElement && self::NS === $child->namespaceURI) { - @trigger_error(sprintf('Using the element "%s" is deprecated for the service "%s" which is defined as an alias in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the element "%s" is deprecated for the service "%s" which is defined as an alias in "%s". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported elements.', $child->localName, $alias->getAttribute('id'), $file), \E_USER_DEPRECATED); } } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 2f9d3dffe7..e598bc4ce4 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -160,7 +160,7 @@ class YamlFileLoader extends FileLoader return false; } - if (null === $type && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yaml', 'yml'], true)) { + if (null === $type && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yaml', 'yml'], true)) { return true; } @@ -328,7 +328,7 @@ class YamlFileLoader extends FileLoader private function parseDefinition($id, $service, $file, array $defaults) { if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) { - @trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML instead.', $id), E_USER_DEPRECATED); + @trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML instead.', $id), \E_USER_DEPRECATED); } if (\is_string($service) && 0 === strpos($service, '@')) { $this->container->setAlias($id, $alias = new Alias(substr($service, 1))); @@ -363,7 +363,7 @@ class YamlFileLoader extends FileLoader foreach ($service as $key => $value) { if (!\in_array($key, ['alias', 'public'])) { - @trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED); + @trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), \E_USER_DEPRECATED); } } @@ -652,7 +652,7 @@ class YamlFileLoader extends FileLoader } $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message; + $message = \E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message; return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; }); @@ -787,7 +787,7 @@ class YamlFileLoader extends FileLoader } if ('=' === substr($value, -1)) { - @trigger_error(sprintf('The "=" suffix that used to disable strict references in Symfony 2.x is deprecated since Symfony 3.3 and will be unsupported in 4.0. Remove it in "%s".', $value), E_USER_DEPRECATED); + @trigger_error(sprintf('The "=" suffix that used to disable strict references in Symfony 2.x is deprecated since Symfony 3.3 and will be unsupported in 4.0. Remove it in "%s".', $value), \E_USER_DEPRECATED); $value = substr($value, 0, -1); } @@ -840,7 +840,7 @@ class YamlFileLoader extends FileLoader throw new InvalidArgumentException(sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".', $key, $id, $file, implode('", "', $keywords))); } - @trigger_error(sprintf('The configuration key "%s" is unsupported for service definition "%s" in "%s". Allowed configuration keys are "%s". The YamlFileLoader object will raise an exception instead in Symfony 4.0 when detecting an unsupported service configuration key.', $key, $id, $file, implode('", "', $keywords)), E_USER_DEPRECATED); + @trigger_error(sprintf('The configuration key "%s" is unsupported for service definition "%s" in "%s". Allowed configuration keys are "%s". The YamlFileLoader object will raise an exception instead in Symfony 4.0 when detecting an unsupported service configuration key.', $key, $id, $file, implode('", "', $keywords)), \E_USER_DEPRECATED); } } } diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index 539d56616d..24dc8035fe 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -296,7 +296,7 @@ class ParameterBag implements ParameterBagInterface if (isset($this->normalizedNames[$normalizedName = strtolower($name)])) { $normalizedName = $this->normalizedNames[$normalizedName]; if ((string) $name !== $normalizedName) { - @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), \E_USER_DEPRECATED); } } else { $normalizedName = $this->normalizedNames[$normalizedName] = (string) $name; diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php index a4f5bf9945..80be44ebaa 100644 --- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php @@ -90,7 +90,7 @@ class ServiceLocator implements PsrContainerInterface return sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $this->formatAlternatives()); } - $class = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $class = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 3); $class = isset($class[2]['object']) ? \get_class($class[2]['object']) : null; $externalId = $this->externalId ?: $class; diff --git a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php index 2830d46a7b..6f0dfd3efc 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php @@ -192,7 +192,7 @@ class EnvVarProcessorTest extends TestCase { return [ ['Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST], - ['E_ERROR', E_ERROR], + ['E_ERROR', \E_ERROR], ]; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php index 3076aab290..ad0a30ba08 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php @@ -76,7 +76,7 @@ class FileLoaderTest extends TestCase ['foo', 'bar'], ], 'mixedcase' => ['MixedCaseKey' => 'value'], - 'constant' => PHP_EOL, + 'constant' => \PHP_EOL, 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index 6f02b9ff61..8f261bfc60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -58,7 +58,7 @@ class IniFileLoaderTest extends TestCase $this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value)); } - $expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED); + $expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, \INI_SCANNER_TYPED); $this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types'); } @@ -74,7 +74,7 @@ class IniFileLoaderTest extends TestCase ['no', false, true], ['none', false, true], ['null', null, true], - ['constant', PHP_VERSION, true], + ['constant', \PHP_VERSION, true], ['12', 12, true], ['12_string', '12', true], ['12_quoted_number', 12, false], // INI_SCANNER_RAW removes the double quotes diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index cf6ac07ce5..c65ebdcfa5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -95,7 +95,7 @@ class XmlFileLoaderTest extends TestCase public function testLoadWithExternalEntitiesDisabled() { - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } @@ -103,7 +103,7 @@ class XmlFileLoaderTest extends TestCase $loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services2.xml'); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -135,7 +135,7 @@ class XmlFileLoaderTest extends TestCase ['foo', 'bar'], ], 'mixedcase' => ['MixedCaseKey' => 'value'], - 'constant' => PHP_EOL, + 'constant' => \PHP_EOL, ]; $this->assertEquals($expected, $actual, '->load() converts XML values to PHP ones'); @@ -171,7 +171,7 @@ class XmlFileLoaderTest extends TestCase ['foo', 'bar'], ], 'mixedcase' => ['MixedCaseKey' => 'value'], - 'constant' => PHP_EOL, + 'constant' => \PHP_EOL, 'bar' => '%foo%', 'imported_from_ini' => true, 'imported_from_yaml' => true, diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index d880d07b0c..3a5cc38058 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -98,7 +98,7 @@ class YamlFileLoaderTest extends TestCase $container = new ContainerBuilder(); $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services2.yml'); - $this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [true, false, 0, 1000.3, PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); + $this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [true, false, 0, 1000.3, \PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); } public function testLoadImports() @@ -116,7 +116,7 @@ class YamlFileLoaderTest extends TestCase $actual = $container->getParameterBag()->all(); $expected = [ 'foo' => 'bar', - 'values' => [true, false, PHP_INT_MAX], + 'values' => [true, false, \PHP_INT_MAX], 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), diff --git a/src/Symfony/Component/DomCrawler/AbstractUriElement.php b/src/Symfony/Component/DomCrawler/AbstractUriElement.php index 7aba8612b5..97604bcf81 100644 --- a/src/Symfony/Component/DomCrawler/AbstractUriElement.php +++ b/src/Symfony/Component/DomCrawler/AbstractUriElement.php @@ -81,7 +81,7 @@ abstract class AbstractUriElement $uri = trim($this->getRawUri()); // absolute URL? - if (null !== parse_url($uri, PHP_URL_SCHEME)) { + if (null !== parse_url($uri, \PHP_URL_SCHEME)) { return $uri; } @@ -114,7 +114,7 @@ abstract class AbstractUriElement } // relative path - $path = parse_url(substr($this->currentUri, \strlen($baseUri)), PHP_URL_PATH); + $path = parse_url(substr($this->currentUri, \strlen($baseUri)), \PHP_URL_PATH); $path = $this->canonicalizePath(substr($path, 0, strrpos($path, '/')).'/'.$uri); return $baseUri.('' === $path || '/' !== $path[0] ? '/' : '').$path; diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 9a0a46e1ca..21f7fab052 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -182,7 +182,7 @@ class Crawler implements \Countable, \IteratorAggregate public function addHtmlContent($content, $charset = 'UTF-8') { $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } @@ -205,7 +205,7 @@ class Crawler implements \Countable, \IteratorAggregate } libxml_use_internal_errors($internalErrors); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -242,7 +242,7 @@ class Crawler implements \Countable, \IteratorAggregate * LIBXML_PARSEHUGE is dangerous, see * http://symfony.com/blog/security-release-symfony-2-0-17-released */ - public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET) + public function addXmlContent($content, $charset = 'UTF-8', $options = \LIBXML_NONET) { // remove the default namespace if it's the only namespace to make XPath expressions simpler if (!preg_match('/xmlns:/', $content)) { @@ -250,7 +250,7 @@ class Crawler implements \Countable, \IteratorAggregate } $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } @@ -262,7 +262,7 @@ class Crawler implements \Countable, \IteratorAggregate } libxml_use_internal_errors($internalErrors); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -497,7 +497,7 @@ class Crawler implements \Countable, \IteratorAggregate $nodes = []; while ($node = $node->parentNode) { - if (XML_ELEMENT_NODE === $node->nodeType) { + if (\XML_ELEMENT_NODE === $node->nodeType) { $nodes[] = $node; } } diff --git a/src/Symfony/Component/DomCrawler/Field/FileFormField.php b/src/Symfony/Component/DomCrawler/Field/FileFormField.php index 61bc7c68ae..3d0b22f07c 100644 --- a/src/Symfony/Component/DomCrawler/Field/FileFormField.php +++ b/src/Symfony/Component/DomCrawler/Field/FileFormField.php @@ -27,7 +27,7 @@ class FileFormField extends FormField */ public function setErrorCode($error) { - $codes = [UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION]; + $codes = [\UPLOAD_ERR_INI_SIZE, \UPLOAD_ERR_FORM_SIZE, \UPLOAD_ERR_PARTIAL, \UPLOAD_ERR_NO_FILE, \UPLOAD_ERR_NO_TMP_DIR, \UPLOAD_ERR_CANT_WRITE, \UPLOAD_ERR_EXTENSION]; if (!\in_array($error, $codes)) { throw new \InvalidArgumentException(sprintf('The error code "%s" is not valid.', $error)); } @@ -53,7 +53,7 @@ class FileFormField extends FormField public function setValue($value) { if (null !== $value && is_readable($value)) { - $error = UPLOAD_ERR_OK; + $error = \UPLOAD_ERR_OK; $size = filesize($value); $info = pathinfo($value); $name = $info['basename']; @@ -69,7 +69,7 @@ class FileFormField extends FormField copy($value, $tmp); $value = $tmp; } else { - $error = UPLOAD_ERR_NO_FILE; + $error = \UPLOAD_ERR_NO_FILE; $size = 0; $name = ''; $value = ''; diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index 8a6e28ca86..7c85ec6d63 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -203,7 +203,7 @@ class Form extends Link implements \ArrayAccess $uri = parent::getUri(); if (!\in_array($this->getMethod(), ['POST', 'PUT', 'DELETE', 'PATCH'])) { - $query = parse_url($uri, PHP_URL_QUERY); + $query = parse_url($uri, \PHP_URL_QUERY); $currentParameters = []; if ($query) { parse_str($query, $currentParameters); diff --git a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php index b14bcc855e..ef216aaab1 100644 --- a/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php @@ -20,7 +20,7 @@ class FileFormFieldTest extends FormFieldTestCase $node = $this->createNode('input', '', ['type' => 'file']); $field = new FileFormField($node); - $this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), '->initialize() sets the value of the field to no file uploaded'); + $this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), '->initialize() sets the value of the field to no file uploaded'); $node = $this->createNode('textarea', ''); try { @@ -48,7 +48,7 @@ class FileFormFieldTest extends FormFieldTestCase $field = new FileFormField($node); $field->$method(null); - $this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), "->$method() clears the uploaded file if the value is null"); + $this->assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), "->$method() clears the uploaded file if the value is null"); $field->$method(__FILE__); $value = $field->getValue(); @@ -91,9 +91,9 @@ class FileFormFieldTest extends FormFieldTestCase $node = $this->createNode('input', '', ['type' => 'file']); $field = new FileFormField($node); - $field->setErrorCode(UPLOAD_ERR_FORM_SIZE); + $field->setErrorCode(\UPLOAD_ERR_FORM_SIZE); $value = $field->getValue(); - $this->assertEquals(UPLOAD_ERR_FORM_SIZE, $value['error'], '->setErrorCode() sets the file input field error code'); + $this->assertEquals(\UPLOAD_ERR_FORM_SIZE, $value['error'], '->setErrorCode() sets the file input field error code'); try { $field->setErrorCode('foobar'); diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 8f53a9d06a..cbb9b12a6a 100644 --- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -47,7 +47,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher $class = get_parent_class($class); } if (__CLASS__ !== $class) { - @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), \E_USER_DEPRECATED); } } @@ -65,7 +65,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher */ public function addListenerService($eventName, $callback, $priority = 0) { - @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), \E_USER_DEPRECATED); if (!\is_array($callback) || 2 !== \count($callback)) { throw new \InvalidArgumentException('Expected an ["service", "method"] argument.'); @@ -147,7 +147,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher */ public function addSubscriberService($serviceId, $class) { - @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), \E_USER_DEPRECATED); foreach ($class::getSubscribedEvents() as $eventName => $params) { if (\is_string($params)) { @@ -164,7 +164,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher public function getContainer() { - @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED); + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', \E_USER_DEPRECATED); return $this->container; } diff --git a/src/Symfony/Component/ExpressionLanguage/Compiler.php b/src/Symfony/Component/ExpressionLanguage/Compiler.php index 282e82dfb8..1ae427b941 100644 --- a/src/Symfony/Component/ExpressionLanguage/Compiler.php +++ b/src/Symfony/Component/ExpressionLanguage/Compiler.php @@ -111,14 +111,14 @@ class Compiler public function repr($value) { if (\is_int($value) || \is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, 0)) { - setlocale(LC_NUMERIC, 'C'); + if (false !== $locale = setlocale(\LC_NUMERIC, 0)) { + setlocale(\LC_NUMERIC, 'C'); } $this->raw($value); if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); + setlocale(\LC_NUMERIC, $locale); } } elseif (null === $value) { $this->raw('null'); diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php index ad06107086..16476669c2 100644 --- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php +++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php @@ -38,7 +38,7 @@ class ExpressionLanguage { if (null !== $cache) { if ($cache instanceof ParserCacheInterface) { - @trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), \E_USER_DEPRECATED); $cache = new ParserCacheAdapter($cache); } elseif (!$cache instanceof CacheItemPoolInterface) { throw new \InvalidArgumentException(sprintf('Cache argument has to implement "%s".', CacheItemPoolInterface::class)); diff --git a/src/Symfony/Component/ExpressionLanguage/Lexer.php b/src/Symfony/Component/ExpressionLanguage/Lexer.php index e534a56ed2..ace847b0d0 100644 --- a/src/Symfony/Component/ExpressionLanguage/Lexer.php +++ b/src/Symfony/Component/ExpressionLanguage/Lexer.php @@ -45,7 +45,7 @@ class Lexer if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, 0, $cursor)) { // numbers $number = (float) $match[0]; // floats - if (preg_match('/^[0-9]+$/', $match[0]) && $number <= PHP_INT_MAX) { + if (preg_match('/^[0-9]+$/', $match[0]) && $number <= \PHP_INT_MAX) { $number = (int) $match[0]; // integers lower than the maximum } $tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1); diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php index 8f9d9f43a1..f009df73b3 100644 --- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php +++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ArrayParserCache.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ExpressionLanguage\ParserCache; -@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', \E_USER_DEPRECATED); use Symfony\Component\ExpressionLanguage\ParsedExpression; diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheInterface.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheInterface.php index ed66b21bf2..98a80edd6e 100644 --- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheInterface.php +++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheInterface.php @@ -11,7 +11,7 @@ namespace Symfony\Component\ExpressionLanguage\ParserCache; -@trigger_error('The '.__NAMESPACE__.'\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ParserCacheInterface interface is deprecated since Symfony 3.2 and will be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead.', \E_USER_DEPRECATED); use Symfony\Component\ExpressionLanguage\ParsedExpression; diff --git a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php index 3340042f0a..a942b8cb7d 100644 --- a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php +++ b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php @@ -22,7 +22,7 @@ class SyntaxError extends \LogicException $message .= '.'; if (null !== $subject && null !== $proposals) { - $minScore = INF; + $minScore = \INF; foreach ($proposals as $proposal) { $distance = levenshtein($subject, $proposal); if ($distance < $minScore) { diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 5ee5c6e76c..97e915ac23 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -104,7 +104,7 @@ class ExpressionLanguageTest extends TestCase public function testConstantFunction() { $expressionLanguage = new ExpressionLanguage(); - $this->assertEquals(PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")')); + $this->assertEquals(\PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")')); $expressionLanguage = new ExpressionLanguage(); $this->assertEquals('\constant("PHP_VERSION")', $expressionLanguage->compile('constant("PHP_VERSION")')); diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index a78d81d723..0dda9f28af 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -47,7 +47,7 @@ class Filesystem $this->mkdir(\dirname($targetFile)); $doCopy = true; - if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { + if (!$overwriteNewerFiles && null === parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) { $doCopy = filemtime($originFile) > filemtime($targetFile); } @@ -118,7 +118,7 @@ class Filesystem */ public function exists($files) { - $maxPathLength = PHP_MAXPATHLEN - 2; + $maxPathLength = \PHP_MAXPATHLEN - 2; foreach ($this->toIterable($files) as $file) { if (\strlen($file) > $maxPathLength) { @@ -301,7 +301,7 @@ class Filesystem */ private function isReadable($filename) { - $maxPathLength = PHP_MAXPATHLEN - 2; + $maxPathLength = \PHP_MAXPATHLEN - 2; if (\strlen($filename) > $maxPathLength) { throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); @@ -446,7 +446,7 @@ class Filesystem public function makePathRelative($endPath, $startPath) { if (!$this->isAbsolutePath($endPath) || !$this->isAbsolutePath($startPath)) { - @trigger_error(sprintf('Support for passing relative paths to %s() is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Support for passing relative paths to %s() is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); } // Normalize separators on Windows @@ -604,7 +604,7 @@ class Filesystem && ':' === $file[1] && strspn($file, '/\\', 2, 1) ) - || null !== parse_url($file, PHP_URL_SCHEME) + || null !== parse_url($file, \PHP_URL_SCHEME) ; } @@ -713,7 +713,7 @@ class Filesystem throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); } - if (false === @file_put_contents($filename, $content, FILE_APPEND)) { + if (false === @file_put_contents($filename, $content, \FILE_APPEND)) { throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename); } } diff --git a/src/Symfony/Component/Filesystem/LockHandler.php b/src/Symfony/Component/Filesystem/LockHandler.php index 8e0eb74121..2aacfa719b 100644 --- a/src/Symfony/Component/Filesystem/LockHandler.php +++ b/src/Symfony/Component/Filesystem/LockHandler.php @@ -15,7 +15,7 @@ use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Lock\Store\FlockStore; use Symfony\Component\Lock\Store\SemaphoreStore; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s or %s instead.', LockHandler::class, SemaphoreStore::class, FlockStore::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s or %s instead.', LockHandler::class, SemaphoreStore::class, FlockStore::class), \E_USER_DEPRECATED); /** * LockHandler class provides a simple abstraction to lock anything by means of @@ -97,7 +97,7 @@ class LockHandler // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 - if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { + if (!flock($this->handle, \LOCK_EX | ($blocking ? 0 : \LOCK_NB))) { fclose($this->handle); $this->handle = null; @@ -113,7 +113,7 @@ class LockHandler public function release() { if ($this->handle) { - flock($this->handle, LOCK_UN | LOCK_NB); + flock($this->handle, \LOCK_UN | \LOCK_NB); fclose($this->handle); $this->handle = null; } diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 5f5dd355bb..14837152b3 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -377,7 +377,7 @@ class FilesystemTest extends FilesystemTestCase $this->markTestSkipped('Long file names are an issue on Windows'); } $basePath = $this->workspace.'\\directory\\'; - $maxPathLength = PHP_MAXPATHLEN - 2; + $maxPathLength = \PHP_MAXPATHLEN - 2; $oldPath = getcwd(); mkdir($basePath); diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php index 6fb9eba733..b7038550d8 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php @@ -144,7 +144,7 @@ class FilesystemTestCase extends TestCase } // https://bugs.php.net/69473 - if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === PHP_ZTS) { + if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === \PHP_ZTS) { $this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions'); } } diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 33a76cc976..3e8a9483ea 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -541,7 +541,7 @@ class Finder implements \IteratorAggregate, \Countable foreach ((array) $dirs as $dir) { if (is_dir($dir)) { $resolvedDirs[] = $this->normalizeDir($dir); - } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) { + } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) { sort($glob); $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob)); } else { @@ -658,7 +658,7 @@ class Finder implements \IteratorAggregate, \Countable } $minDepth = 0; - $maxDepth = PHP_INT_MAX; + $maxDepth = \PHP_INT_MAX; foreach ($this->depths as $comparator) { switch ($comparator->getOperator()) { @@ -693,7 +693,7 @@ class Finder implements \IteratorAggregate, \Countable $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); - if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) { + if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) { $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth); } diff --git a/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php b/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php index ce9d3aa73a..d9bbeb48f1 100644 --- a/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php @@ -25,10 +25,10 @@ class DepthRangeFilterIterator extends FilterIterator * @param int $minDepth The min depth * @param int $maxDepth The max depth */ - public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX) + public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = \PHP_INT_MAX) { $this->minDepth = $minDepth; - $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); + $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); parent::__construct($iterator); } diff --git a/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php index dab9723d7e..5ef2ed41b3 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php @@ -75,8 +75,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase return [ [0, 0, $this->toAbsolute($lessThan1)], [0, 1, $this->toAbsolute($lessThanOrEqualTo1)], - [2, PHP_INT_MAX, []], - [1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)], + [2, \PHP_INT_MAX, []], + [1, \PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)], [1, 1, $this->toAbsolute($equalTo1)], ]; } diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php index 3f8e035f89..7e837ff355 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php @@ -70,7 +70,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($value) && !\is_callable($value)) { $value = new PropertyPath($value); } elseif (\is_string($value) && \is_callable($value)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($value instanceof PropertyPath) { @@ -101,7 +101,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($value) && !\is_callable($value)) { $value = new PropertyPath($value); } elseif (\is_string($value) && \is_callable($value)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($value instanceof PropertyPath) { @@ -137,7 +137,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($label) && !\is_callable($label)) { $label = new PropertyPath($label); } elseif (\is_string($label) && \is_callable($label)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($label instanceof PropertyPath) { @@ -149,7 +149,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($preferredChoices) && !\is_callable($preferredChoices)) { $preferredChoices = new PropertyPath($preferredChoices); } elseif (\is_string($preferredChoices) && \is_callable($preferredChoices)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($preferredChoices instanceof PropertyPath) { @@ -166,7 +166,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($index) && !\is_callable($index)) { $index = new PropertyPath($index); } elseif (\is_string($index) && \is_callable($index)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($index instanceof PropertyPath) { @@ -178,7 +178,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($groupBy) && !\is_callable($groupBy)) { $groupBy = new PropertyPath($groupBy); } elseif (\is_string($groupBy) && \is_callable($groupBy)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($groupBy instanceof PropertyPath) { @@ -195,7 +195,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface if (\is_string($attr) && !\is_callable($attr)) { $attr = new PropertyPath($attr); } elseif (\is_string($attr) && \is_callable($attr)) { - @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED); + @trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED); } if ($attr instanceof PropertyPath) { diff --git a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php index 0fb32734d5..0cf2b55030 100644 --- a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php @@ -77,7 +77,7 @@ class LazyChoiceList implements ChoiceListInterface // We can safely invoke the {@link ChoiceLoaderInterface} assuming it has the list // in cache when the lazy list is already loaded if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getChoices(); @@ -100,7 +100,7 @@ class LazyChoiceList implements ChoiceListInterface if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getValues(); @@ -123,7 +123,7 @@ class LazyChoiceList implements ChoiceListInterface if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getStructuredValues(); @@ -146,7 +146,7 @@ class LazyChoiceList implements ChoiceListInterface if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getOriginalKeys(); @@ -169,7 +169,7 @@ class LazyChoiceList implements ChoiceListInterface if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getChoicesForValues($values); @@ -186,7 +186,7 @@ class LazyChoiceList implements ChoiceListInterface if ($this->loaded) { // Check whether the loader has the same cache if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) { - @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED); } return $this->loadedList->getValuesForChoices($choices); diff --git a/src/Symfony/Component/Form/Command/DebugCommand.php b/src/Symfony/Component/Form/Command/DebugCommand.php index 43ae1d66de..fec129fda3 100644 --- a/src/Symfony/Component/Form/Command/DebugCommand.php +++ b/src/Symfony/Component/Form/Command/DebugCommand.php @@ -196,7 +196,7 @@ EOF $threshold = 1e3; $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); - ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE); + ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); return array_keys($alternatives); } diff --git a/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php index 428586965b..4f14f08e32 100644 --- a/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php @@ -83,7 +83,7 @@ class JsonDescriptor extends Descriptor { $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0; - $this->output->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n"); + $this->output->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n"); } private function sortOptions(array &$options) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index bdd3d2aef2..3b344442c2 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -182,7 +182,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface throw new TransformationFailedException($formatter->getErrorMessage()); } - if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) { + if ($result >= \PHP_INT_MAX || $result <= -\PHP_INT_MAX) { throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.'); } @@ -272,13 +272,13 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface $number = $number > 0 ? floor($number) : ceil($number); break; case self::ROUND_HALF_EVEN: - $number = round($number, 0, PHP_ROUND_HALF_EVEN); + $number = round($number, 0, \PHP_ROUND_HALF_EVEN); break; case self::ROUND_HALF_UP: - $number = round($number, 0, PHP_ROUND_HALF_UP); + $number = round($number, 0, \PHP_ROUND_HALF_UP); break; case self::ROUND_HALF_DOWN: - $number = round($number, 0, PHP_ROUND_HALF_DOWN); + $number = round($number, 0, \PHP_ROUND_HALF_DOWN); break; } diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index db6f82ff8a..8f8f0168b0 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -88,7 +88,7 @@ class ResizeFormListener implements EventSubscriberInterface $data = $event->getData(); if ($data instanceof \Traversable && $data instanceof \ArrayAccess) { - @trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since Symfony 3.1 and will be removed in 4.0. Use an array instead.', E_USER_DEPRECATED); + @trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since Symfony 3.1 and will be removed in 4.0. Use an array instead.', \E_USER_DEPRECATED); } if (!\is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index fccb64b39d..f28c9885b8 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -276,7 +276,7 @@ class ChoiceType extends AbstractType throw new \RuntimeException(sprintf('The "choices_as_values" option of the "%s" should not be used. Remove it and flip the contents of the "choices" option instead.', static::class)); } - @trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED); + @trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', \E_USER_DEPRECATED); return true; }; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php index eab178ede0..ead0279a70 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php @@ -39,7 +39,7 @@ class CountryType extends AbstractType implements ChoiceLoaderInterface $resolver->setDefaults([ 'choice_loader' => function (Options $options) { if ($options['choices']) { - @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED); return null; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php index 31c66f1059..21a7b2c36a 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php @@ -39,7 +39,7 @@ class CurrencyType extends AbstractType implements ChoiceLoaderInterface $resolver->setDefaults([ 'choice_loader' => function (Options $options) { if ($options['choices']) { - @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED); return null; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php index 86f161307b..17a6b92986 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php @@ -145,14 +145,14 @@ class FileType extends AbstractType { $messageParameters = []; - if (UPLOAD_ERR_INI_SIZE === $errorCode) { + if (\UPLOAD_ERR_INI_SIZE === $errorCode) { list($limitAsString, $suffix) = $this->factorizeSizes(0, self::getMaxFilesize()); $messageTemplate = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; $messageParameters = [ '{{ limit }}' => $limitAsString, '{{ suffix }}' => $suffix, ]; - } elseif (UPLOAD_ERR_FORM_SIZE === $errorCode) { + } elseif (\UPLOAD_ERR_FORM_SIZE === $errorCode) { $messageTemplate = 'The file is too large.'; } else { $messageTemplate = 'The file could not be uploaded.'; @@ -179,7 +179,7 @@ class FileType extends AbstractType $iniMax = strtolower(ini_get('upload_max_filesize')); if ('' === $iniMax) { - return PHP_INT_MAX; + return \PHP_INT_MAX; } $max = ltrim($iniMax, '+'); diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php index ecce8a7a3a..96ddfe94b4 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php @@ -39,7 +39,7 @@ class LanguageType extends AbstractType implements ChoiceLoaderInterface $resolver->setDefaults([ 'choice_loader' => function (Options $options) { if ($options['choices']) { - @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED); return null; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php index d53f217988..fd1c35326c 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php @@ -39,7 +39,7 @@ class LocaleType extends AbstractType implements ChoiceLoaderInterface $resolver->setDefaults([ 'choice_loader' => function (Options $options) { if ($options['choices']) { - @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED); return null; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 2fcf200518..a455023c86 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -108,7 +108,7 @@ class TimeType extends AbstractType $hours = $minutes = []; foreach ($options['hours'] as $hour) { - $hours[str_pad($hour, 2, '0', STR_PAD_LEFT)] = $hour; + $hours[str_pad($hour, 2, '0', \STR_PAD_LEFT)] = $hour; } // Only pass a subset of the options to children @@ -118,7 +118,7 @@ class TimeType extends AbstractType if ($options['with_minutes']) { foreach ($options['minutes'] as $minute) { - $minutes[str_pad($minute, 2, '0', STR_PAD_LEFT)] = $minute; + $minutes[str_pad($minute, 2, '0', \STR_PAD_LEFT)] = $minute; } $minuteOptions['choices'] = $minutes; @@ -130,7 +130,7 @@ class TimeType extends AbstractType $seconds = []; foreach ($options['seconds'] as $second) { - $seconds[str_pad($second, 2, '0', STR_PAD_LEFT)] = $second; + $seconds[str_pad($second, 2, '0', \STR_PAD_LEFT)] = $second; } $secondOptions['choices'] = $seconds; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php index 9f92557052..c776962ac6 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php @@ -51,7 +51,7 @@ class TimezoneType extends AbstractType implements ChoiceLoaderInterface $resolver->setDefaults([ 'choice_loader' => function (Options $options) { if ($options['choices']) { - @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED); return null; } @@ -95,7 +95,7 @@ class TimezoneType extends AbstractType implements ChoiceLoaderInterface */ public function loadChoiceList($value = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); if (null !== $this->choiceList) { return $this->choiceList; @@ -111,7 +111,7 @@ class TimezoneType extends AbstractType implements ChoiceLoaderInterface */ public function loadChoicesForValues(array $values, $value = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); // Optimize $values = array_filter($values); @@ -134,7 +134,7 @@ class TimezoneType extends AbstractType implements ChoiceLoaderInterface */ public function loadValuesForChoices(array $choices, $value = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); // Optimize $choices = array_filter($choices); diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php index 75691c26b4..d9b31d859e 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php @@ -29,7 +29,7 @@ class FormDataExtractor implements FormDataExtractorInterface public function __construct(ValueExporter $valueExporter = null, $triggerDeprecationNotice = true) { if (null !== $valueExporter && $triggerDeprecationNotice) { - @trigger_error('Passing a ValueExporter instance to '.__METHOD__.'() is deprecated in version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Passing a ValueExporter instance to '.__METHOD__.'() is deprecated in version 3.2 and will be removed in 4.0.', \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php index 507ee280af..abf0b6ed3d 100644 --- a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php +++ b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php @@ -35,7 +35,7 @@ class DependencyInjectionExtension implements FormExtensionInterface public function __construct(ContainerInterface $typeContainer, array $typeExtensionServices, $guesserServices, array $guesserServiceIds = null) { if (null !== $guesserServiceIds) { - @trigger_error(sprintf('Passing four arguments to the %s::__construct() method is deprecated since Symfony 3.3 and will be disallowed in Symfony 4.0. The new constructor only accepts three arguments.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing four arguments to the %s::__construct() method is deprecated since Symfony 3.3 and will be disallowed in Symfony 4.0. The new constructor only accepts three arguments.', __CLASS__), \E_USER_DEPRECATED); $this->guesserServiceIds = $guesserServiceIds; $this->typeServiceIds = $typeExtensionServices; $typeExtensionServices = $guesserServices; diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 70874a2f90..4c5ffbfb23 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -736,7 +736,7 @@ class Form implements \IteratorAggregate, FormInterface public function isValid() { if (!$this->submitted) { - @trigger_error('Call Form::isValid() with an unsubmitted form is deprecated since Symfony 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead.', E_USER_DEPRECATED); + @trigger_error('Call Form::isValid() with an unsubmitted form is deprecated since Symfony 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead.', \E_USER_DEPRECATED); return false; } diff --git a/src/Symfony/Component/Form/FormRenderer.php b/src/Symfony/Component/Form/FormRenderer.php index 61adc20376..3d883ce339 100644 --- a/src/Symfony/Component/Form/FormRenderer.php +++ b/src/Symfony/Component/Form/FormRenderer.php @@ -291,9 +291,9 @@ class FormRenderer implements FormRendererInterface public function encodeCurrency(Environment $environment, $text, $widget = '') { if ('UTF-8' === $charset = $environment->getCharset()) { - $text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + $text = htmlspecialchars($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); } else { - $text = htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + $text = htmlentities($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); $text = iconv('UTF-8', $charset, $text); $widget = iconv('UTF-8', $charset, $widget); } diff --git a/src/Symfony/Component/Form/NativeRequestHandler.php b/src/Symfony/Component/Form/NativeRequestHandler.php index 69a2a1c728..ddfd94f813 100644 --- a/src/Symfony/Component/Form/NativeRequestHandler.php +++ b/src/Symfony/Component/Form/NativeRequestHandler.php @@ -152,7 +152,7 @@ class NativeRequestHandler implements RequestHandlerInterface return null; } - if (UPLOAD_ERR_OK === $data['error']) { + if (\UPLOAD_ERR_OK === $data['error']) { return null; } @@ -240,7 +240,7 @@ class NativeRequestHandler implements RequestHandlerInterface sort($keys); if (self::$fileKeys === $keys) { - if (UPLOAD_ERR_NO_FILE === $data['error']) { + if (\UPLOAD_ERR_NO_FILE === $data['error']) { return null; } diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php index 776c753eca..616055d67b 100644 --- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php @@ -371,14 +371,14 @@ abstract class AbstractRequestHandlerTest extends TestCase public function uploadFileErrorCodes() { return [ - 'no error' => [UPLOAD_ERR_OK, null], - 'upload_max_filesize ini directive' => [UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_INI_SIZE], - 'MAX_FILE_SIZE from form' => [UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_FORM_SIZE], - 'partially uploaded' => [UPLOAD_ERR_PARTIAL, UPLOAD_ERR_PARTIAL], - 'no file upload' => [UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_FILE], - 'missing temporary directory' => [UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_NO_TMP_DIR], - 'write failure' => [UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_CANT_WRITE], - 'stopped by extension' => [UPLOAD_ERR_EXTENSION, UPLOAD_ERR_EXTENSION], + 'no error' => [\UPLOAD_ERR_OK, null], + 'upload_max_filesize ini directive' => [\UPLOAD_ERR_INI_SIZE, \UPLOAD_ERR_INI_SIZE], + 'MAX_FILE_SIZE from form' => [\UPLOAD_ERR_FORM_SIZE, \UPLOAD_ERR_FORM_SIZE], + 'partially uploaded' => [\UPLOAD_ERR_PARTIAL, \UPLOAD_ERR_PARTIAL], + 'no file upload' => [\UPLOAD_ERR_NO_FILE, \UPLOAD_ERR_NO_FILE], + 'missing temporary directory' => [\UPLOAD_ERR_NO_TMP_DIR, \UPLOAD_ERR_NO_TMP_DIR], + 'write failure' => [\UPLOAD_ERR_CANT_WRITE, \UPLOAD_ERR_CANT_WRITE], + 'stopped by extension' => [\UPLOAD_ERR_EXTENSION, \UPLOAD_ERR_EXTENSION], ]; } diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 8e1b45b9d0..e85d3c9731 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -622,7 +622,7 @@ class CompoundFormTest extends AbstractFormTest $files = [ 'author' => [ - 'error' => ['image' => UPLOAD_ERR_OK], + 'error' => ['image' => \UPLOAD_ERR_OK], 'name' => ['image' => 'upload.png'], 'size' => ['image' => 123], 'tmp_name' => ['image' => $path], @@ -645,7 +645,7 @@ class CompoundFormTest extends AbstractFormTest $form->handleRequest($request); - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, \UPLOAD_ERR_OK); $this->assertEquals('Bernhard', $form['name']->getData()); $this->assertEquals($file, $form['image']->getData()); @@ -668,7 +668,7 @@ class CompoundFormTest extends AbstractFormTest $files = [ 'image' => [ - 'error' => UPLOAD_ERR_OK, + 'error' => \UPLOAD_ERR_OK, 'name' => 'upload.png', 'size' => 123, 'tmp_name' => $path, @@ -691,7 +691,7 @@ class CompoundFormTest extends AbstractFormTest $form->handleRequest($request); - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, \UPLOAD_ERR_OK); $this->assertEquals('Bernhard', $form['name']->getData()); $this->assertEquals($file, $form['image']->getData()); @@ -710,7 +710,7 @@ class CompoundFormTest extends AbstractFormTest $files = [ 'image' => [ - 'error' => UPLOAD_ERR_OK, + 'error' => \UPLOAD_ERR_OK, 'name' => 'upload.png', 'size' => 123, 'tmp_name' => $path, @@ -729,7 +729,7 @@ class CompoundFormTest extends AbstractFormTest $form->handleRequest($request); - $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + $file = new UploadedFile($path, 'upload.png', 'image/png', 123, \UPLOAD_ERR_OK); $this->assertEquals($file, $form->getData()); @@ -1071,7 +1071,7 @@ class CompoundFormTest extends AbstractFormTest $this->form->submit([ 'foo' => 'Foo', - 'bar' => new UploadedFile(__FILE__, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK), + 'bar' => new UploadedFile(__FILE__, 'upload.png', 'image/png', 123, \UPLOAD_ERR_OK), ]); $this->assertSame('Submitted data was expected to be text or number, file upload given.', $this->form->get('bar')->getTransformationFailure()->getMessage()); diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php index 23be3ab1aa..4845bae795 100644 --- a/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -35,9 +35,9 @@ abstract class AbstractDescriptorTest extends TestCase $expectedDescription = $this->getExpectedDescription($fixtureName); if ('json' === $this->getFormat()) { - $this->assertEquals(json_encode(json_decode($expectedDescription), JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), JSON_PRETTY_PRINT)); + $this->assertEquals(json_encode(json_decode($expectedDescription), \JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), \JSON_PRETTY_PRINT)); } else { - $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $describedObject))); + $this->assertEquals(trim($expectedDescription), trim(str_replace(\PHP_EOL, "\n", $describedObject))); } } @@ -48,9 +48,9 @@ abstract class AbstractDescriptorTest extends TestCase $expectedDescription = $this->getExpectedDescription($fixtureName); if ('json' === $this->getFormat()) { - $this->assertEquals(json_encode(json_decode($expectedDescription), JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), JSON_PRETTY_PRINT)); + $this->assertEquals(json_encode(json_decode($expectedDescription), \JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), \JSON_PRETTY_PRINT)); } else { - $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $describedObject))); + $this->assertEquals(trim($expectedDescription), trim(str_replace(\PHP_EOL, "\n", $describedObject))); } } @@ -61,9 +61,9 @@ abstract class AbstractDescriptorTest extends TestCase $expectedDescription = $this->getExpectedDescription($fixtureName); if ('json' === $this->getFormat()) { - $this->assertEquals(json_encode(json_decode($expectedDescription), JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), JSON_PRETTY_PRINT)); + $this->assertEquals(json_encode(json_decode($expectedDescription), \JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), \JSON_PRETTY_PRINT)); } else { - $this->assertStringMatchesFormat(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $describedObject))); + $this->assertStringMatchesFormat(trim($expectedDescription), trim(str_replace(\PHP_EOL, "\n", $describedObject))); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index ad9e099909..77c6c22e24 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -347,7 +347,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase $this->markTestSkipped('intl extension is not loaded'); } - $this->iniSet('intl.error_level', E_WARNING); + $this->iniSet('intl.error_level', \E_WARNING); $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer = new DateTimeToLocalizedStringTransformer(); @@ -374,7 +374,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase } $this->iniSet('intl.use_exceptions', 1); - $this->iniSet('intl.error_level', E_WARNING); + $this->iniSet('intl.error_level', \E_WARNING); $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer = new DateTimeToLocalizedStringTransformer(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php index ee27e2d72e..823eb1727d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php @@ -21,12 +21,12 @@ class MoneyToLocalizedStringTransformerTest extends TestCase protected function setUp() { - $this->previousLocale = setlocale(LC_ALL, '0'); + $this->previousLocale = setlocale(\LC_ALL, '0'); } protected function tearDown() { - setlocale(LC_ALL, $this->previousLocale); + setlocale(\LC_ALL, $this->previousLocale); } public function testTransform() @@ -106,7 +106,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase public function testValidNumericValuesWithNonDotDecimalPointCharacter() { // calling setlocale() here is important as it changes the representation of floats when being cast to strings - setlocale(LC_ALL, 'de_AT.UTF-8'); + setlocale(\LC_ALL, 'de_AT.UTF-8'); $transformer = new MoneyToLocalizedStringTransformer(4, null, null, 100); IntlTestHelper::requireFullIntl($this, false); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index fc76f9b53e..32eae840a1 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -622,7 +622,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase { $transformer = new NumberToLocalizedStringTransformer(null, true); - $this->assertEquals(PHP_INT_MAX - 1, (int) $transformer->reverseTransform((string) (PHP_INT_MAX - 1))); + $this->assertEquals(\PHP_INT_MAX - 1, (int) $transformer->reverseTransform((string) (\PHP_INT_MAX - 1))); } public function testReverseTransformSmallInt() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php index c566786c8c..1cb79ec921 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php @@ -205,7 +205,7 @@ class FileTypeTest extends BaseTypeTest ->getForm(); $form->submit(new UploadedFile(__DIR__.'/../../../Fixtures/foo', 'foo', null, null, $errorCode, true)); - if (UPLOAD_ERR_OK === $errorCode) { + if (\UPLOAD_ERR_OK === $errorCode) { $this->assertTrue($form->isValid()); } else { $this->assertFalse($form->isValid()); @@ -230,7 +230,7 @@ class FileTypeTest extends BaseTypeTest 'size' => 100, ]); - if (UPLOAD_ERR_OK === $errorCode) { + if (\UPLOAD_ERR_OK === $errorCode) { $this->assertTrue($form->isValid()); } else { $this->assertFalse($form->isValid()); @@ -254,7 +254,7 @@ class FileTypeTest extends BaseTypeTest new UploadedFile(__DIR__.'/../../../Fixtures/foo', 'bar', null, null, $errorCode, true), ]); - if (UPLOAD_ERR_OK === $errorCode) { + if (\UPLOAD_ERR_OK === $errorCode) { $this->assertTrue($form->isValid()); } else { $this->assertFalse($form->isValid()); @@ -292,7 +292,7 @@ class FileTypeTest extends BaseTypeTest ], ]); - if (UPLOAD_ERR_OK === $errorCode) { + if (\UPLOAD_ERR_OK === $errorCode) { $this->assertTrue($form->isValid()); } else { $this->assertFalse($form->isValid()); @@ -305,14 +305,14 @@ class FileTypeTest extends BaseTypeTest public function uploadFileErrorCodes() { return [ - 'no error' => [UPLOAD_ERR_OK, null], - 'upload_max_filesize ini directive' => [UPLOAD_ERR_INI_SIZE, 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'], - 'MAX_FILE_SIZE from form' => [UPLOAD_ERR_FORM_SIZE, 'The file is too large.'], - 'partially uploaded' => [UPLOAD_ERR_PARTIAL, 'The file could not be uploaded.'], - 'no file upload' => [UPLOAD_ERR_NO_FILE, 'The file could not be uploaded.'], - 'missing temporary directory' => [UPLOAD_ERR_NO_TMP_DIR, 'The file could not be uploaded.'], - 'write failure' => [UPLOAD_ERR_CANT_WRITE, 'The file could not be uploaded.'], - 'stopped by extension' => [UPLOAD_ERR_EXTENSION, 'The file could not be uploaded.'], + 'no error' => [\UPLOAD_ERR_OK, null], + 'upload_max_filesize ini directive' => [\UPLOAD_ERR_INI_SIZE, 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'], + 'MAX_FILE_SIZE from form' => [\UPLOAD_ERR_FORM_SIZE, 'The file is too large.'], + 'partially uploaded' => [\UPLOAD_ERR_PARTIAL, 'The file could not be uploaded.'], + 'no file upload' => [\UPLOAD_ERR_NO_FILE, 'The file could not be uploaded.'], + 'missing temporary directory' => [\UPLOAD_ERR_NO_TMP_DIR, 'The file could not be uploaded.'], + 'write failure' => [\UPLOAD_ERR_CANT_WRITE, 'The file could not be uploaded.'], + 'stopped by extension' => [\UPLOAD_ERR_EXTENSION, 'The file could not be uploaded.'], ]; } diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php index 66f7a21f4a..d9ac166ab4 100644 --- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php @@ -78,7 +78,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'name' => '', 'type' => '', 'tmp_name' => '', - 'error' => UPLOAD_ERR_NO_FILE, + 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0, ]]); @@ -105,7 +105,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'field' => 'owfdskjasdfsa', ], 'error' => [ - 'field' => UPLOAD_ERR_OK, + 'field' => \UPLOAD_ERR_OK, ], 'size' => [ 'field' => 100, @@ -119,7 +119,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'name' => 'upload.txt', 'type' => 'text/plain', 'tmp_name' => 'owfdskjasdfsa', - 'error' => UPLOAD_ERR_OK, + 'error' => \UPLOAD_ERR_OK, 'size' => 100, ], $fieldForm->getData()); } @@ -143,7 +143,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'field' => ['subfield' => 'owfdskjasdfsa'], ], 'error' => [ - 'field' => ['subfield' => UPLOAD_ERR_OK], + 'field' => ['subfield' => \UPLOAD_ERR_OK], ], 'size' => [ 'field' => ['subfield' => 100], @@ -157,7 +157,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'name' => 'upload.txt', 'type' => 'text/plain', 'tmp_name' => 'owfdskjasdfsa', - 'error' => UPLOAD_ERR_OK, + 'error' => \UPLOAD_ERR_OK, 'size' => 100, ], $subfieldForm->getData()); } @@ -258,7 +258,7 @@ class NativeRequestHandlerTest extends AbstractRequestHandlerTest 'name' => 'upload'.$suffix.'.txt', 'type' => 'text/plain', 'tmp_name' => 'owfdskjasdfsa'.$suffix, - 'error' => UPLOAD_ERR_OK, + 'error' => \UPLOAD_ERR_OK, 'size' => 100, ]; } diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeader.php b/src/Symfony/Component/HttpFoundation/AcceptHeader.php index 968b71f5d2..daf7f1f4b1 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeader.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeader.php @@ -57,7 +57,7 @@ class AcceptHeader $item->setIndex($index++); return $item; - }, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE))); + }, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE))); } /** diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php index 96bb0c4432..9eb74490bc 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php @@ -43,7 +43,7 @@ class AcceptHeaderItem */ public static function fromString($itemValue) { - $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); $value = array_shift($bits); $attributes = []; diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index fa4c962d7d..99aa44f9d3 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -60,7 +60,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface return null; } - if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { + if (!$finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) { return null; } $mimeType = $finfo->file($path); diff --git a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php index 5206156032..99132d1416 100644 --- a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -60,10 +60,10 @@ class UploadedFile extends File $this->originalName = $this->getName($originalName); $this->mimeType = $mimeType ?: 'application/octet-stream'; $this->size = $size; - $this->error = $error ?: UPLOAD_ERR_OK; + $this->error = $error ?: \UPLOAD_ERR_OK; $this->test = (bool) $test; - parent::__construct($path, UPLOAD_ERR_OK === $this->error); + parent::__construct($path, \UPLOAD_ERR_OK === $this->error); } /** @@ -89,7 +89,7 @@ class UploadedFile extends File */ public function getClientOriginalExtension() { - return pathinfo($this->originalName, PATHINFO_EXTENSION); + return pathinfo($this->originalName, \PATHINFO_EXTENSION); } /** @@ -168,7 +168,7 @@ class UploadedFile extends File */ public function isValid() { - $isOk = UPLOAD_ERR_OK === $this->error; + $isOk = \UPLOAD_ERR_OK === $this->error; return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); } @@ -217,7 +217,7 @@ class UploadedFile extends File $sizePostMax = self::parseFilesize(ini_get('post_max_size')); $sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize')); - return min($sizePostMax ?: PHP_INT_MAX, $sizeUploadMax ?: PHP_INT_MAX); + return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX); } /** @@ -263,17 +263,17 @@ class UploadedFile extends File public function getErrorMessage() { static $errors = [ - UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', - UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', - UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', - UPLOAD_ERR_NO_FILE => 'No file was uploaded.', - UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', - UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', - UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', + \UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', + \UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', + \UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', + \UPLOAD_ERR_NO_FILE => 'No file was uploaded.', + \UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', + \UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', + \UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', ]; $errorCode = $this->error; - $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; + $maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.'; return sprintf($message, $this->getClientOriginalName(), $maxFilesize); diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 024fadf203..e2acca4ea3 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -81,7 +81,7 @@ class FileBag extends ParameterBag sort($keys); if ($keys == self::$fileKeys) { - if (UPLOAD_ERR_NO_FILE == $file['error']) { + if (\UPLOAD_ERR_NO_FILE == $file['error']) { $file = null; } else { $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index 0b19faec51..301ec9cf53 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -224,7 +224,7 @@ class HeaderBag implements \IteratorAggregate, \Countable return $default; } - if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) { + if (false === $date = \DateTime::createFromFormat(\DATE_RFC2822, $value)) { throw new \RuntimeException(sprintf('The "%s" HTTP header is not parseable (%s).', $key, $value)); } @@ -329,7 +329,7 @@ class HeaderBag implements \IteratorAggregate, \Countable protected function parseCacheControl($header) { $cacheControl = []; - preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); + preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, \PREG_SET_ORDER); foreach ($matches as $match) { $cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true); } diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index 67d13e57aa..a83d32493f 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -68,7 +68,7 @@ class IpUtils return self::$checkedIps[$cacheKey]; } - if (!filter_var($requestIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + if (!filter_var($requestIp, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) { return self::$checkedIps[$cacheKey] = false; } @@ -76,7 +76,7 @@ class IpUtils list($address, $netmask) = explode('/', $ip, 2); if ('0' === $netmask) { - return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); + return self::$checkedIps[$cacheKey] = filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4); } if ($netmask < 0 || $netmask > 32) { diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index b0e7651675..1a23a9335c 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -173,13 +173,13 @@ class JsonResponse extends Response throw $e; } - if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) { + if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $this->encodingOptions)) { return $this->setJson($data); } } } - if (JSON_ERROR_NONE !== json_last_error()) { + if (\JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException(json_last_error_msg()); } diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 194ba2c6c5..5f2d9293dc 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -154,7 +154,7 @@ class ParameterBag implements \IteratorAggregate, \Countable public function getDigits($key, $default = '') { // we need to remove - and + because they're allowed in the filter - return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); + return str_replace(['-', '+'], '', $this->filter($key, $default, \FILTER_SANITIZE_NUMBER_INT)); } /** @@ -180,7 +180,7 @@ class ParameterBag implements \IteratorAggregate, \Countable */ public function getBoolean($key, $default = false) { - return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN); + return $this->filter($key, $default, \FILTER_VALIDATE_BOOLEAN); } /** @@ -195,7 +195,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @return mixed */ - public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = []) + public function filter($key, $default = null, $filter = \FILTER_DEFAULT, $options = []) { $value = $this->get($key, $default); @@ -206,7 +206,7 @@ class ParameterBag implements \IteratorAggregate, \Countable // Add a convenience check for arrays. if (\is_array($value) && !isset($options['flags'])) { - $options['flags'] = FILTER_REQUIRE_ARRAY; + $options['flags'] = \FILTER_REQUIRE_ARRAY; } return filter_var($value, $filter, $options); diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index 71ba9f8251..9ef9059f0c 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -42,7 +42,7 @@ class RedirectResponse extends Response throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); } - if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) { + if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) { $this->headers->remove('cache-control'); } } @@ -100,7 +100,7 @@ class RedirectResponse extends Response Redirecting to %1$s. -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); +', htmlspecialchars($url, \ENT_QUOTES, 'UTF-8'))); $this->headers->set('Location', $url); diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 3fc7b71e6e..c9bf0a261b 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -532,7 +532,7 @@ class Request throw $e; } - return trigger_error($e, E_USER_ERROR); + return trigger_error($e, \E_USER_ERROR); } $cookieHeader = ''; @@ -603,7 +603,7 @@ class Request self::$trustedProxies = $proxies; if (2 > \func_num_args()) { - @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since Symfony 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since Symfony 3.3. Defining it will be required in 4.0. ', __METHOD__), \E_USER_DEPRECATED); return; } @@ -683,7 +683,7 @@ class Request */ public static function setTrustedHeaderName($key, $value) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), \E_USER_DEPRECATED); if ('forwarded' === $key) { $key = self::HEADER_FORWARDED; @@ -723,7 +723,7 @@ class Request public static function getTrustedHeaderName($key) { if (2 > \func_num_args() || func_get_arg(1)) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), \E_USER_DEPRECATED); } if (!\array_key_exists($key, self::$trustedHeaders)) { @@ -771,7 +771,7 @@ class Request $order[] = urldecode($keyValuePair[0]); } - array_multisort($order, SORT_ASC, $parts); + array_multisort($order, \SORT_ASC, $parts); return implode('&', $parts); } @@ -1584,7 +1584,7 @@ class Request if (!\func_num_args() || func_get_arg(0)) { // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature) // then setting $andCacheable to false should be deprecated in 4.1 - @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); + @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', \E_USER_DEPRECATED); return \in_array($this->getMethod(), ['GET', 'HEAD']); } @@ -1695,7 +1695,7 @@ class Request */ public function getETags() { - return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); + return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, \PREG_SPLIT_NO_EMPTY); } /** @@ -2175,7 +2175,7 @@ class Request $clientIps[$key] = $clientIp = substr($clientIp, 1, $i - 1); } - if (!filter_var($clientIp, FILTER_VALIDATE_IP)) { + if (!filter_var($clientIp, \FILTER_VALIDATE_IP)) { unset($clientIps[$key]); continue; diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 0f361bac3d..9544a671e2 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -738,7 +738,7 @@ class Response return $this->headers->getDate('Expires'); } catch (\RuntimeException $e) { // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past - return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); + return \DateTime::createFromFormat(\DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); } } @@ -1283,7 +1283,7 @@ class Response $status = ob_get_status(true); $level = \count($status); // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3 - $flags = \defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; + $flags = \defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? \PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? \PHP_OUTPUT_HANDLER_FLUSHABLE : \PHP_OUTPUT_HANDLER_CLEANABLE) : -1; while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) { if ($flush) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index c80da20466..455ced8ce5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -73,7 +73,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess if (\PHP_VERSION_ID < 70317 || (70400 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70405)) { // work around https://bugs.php.net/79413 - foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { + foreach (debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { if (!isset($frame['class']) && isset($frame['function']) && \in_array($frame['function'], ['session_regenerate_id', 'session_create_id'], true)) { return '' === $this->prefetchData; } @@ -142,7 +142,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess if (\PHP_VERSION_ID < 70000) { $this->prefetchData = null; } - if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) { + if (!headers_sent() && filter_var(ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN)) { if (!$this->sessionName) { throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class)); } @@ -157,7 +157,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess */ if (null === $cookie || isset($_COOKIE[$this->sessionName])) { if (\PHP_VERSION_ID < 70300) { - setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN)); + setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), \FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), \FILTER_VALIDATE_BOOLEAN)); } else { $params = session_get_cookie_params(); unset($params['lifetime']); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index d4b68ae8b8..ed74ce8048 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; -@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), \E_USER_DEPRECATED); /** * @author Drak diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index d84f2e9d0c..52dc15de83 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -70,7 +70,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler public function __construct($mongo, array $options) { if ($mongo instanceof \MongoClient || $mongo instanceof \Mongo) { - @trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), \E_USER_DEPRECATED); } if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php index 5159b1e359..280d0d6eea 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php @@ -19,6 +19,6 @@ class NativeSessionHandler extends \SessionHandler { public function __construct() { - @trigger_error('The '.__NAMESPACE__.'\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.', E_USER_DEPRECATED); + @trigger_error('The '.__NAMESPACE__.'\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.', \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index d1cf622bdd..db32d549b6 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -637,7 +637,7 @@ class PdoSessionHandler extends AbstractSessionHandler throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.'); } - if (!filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + if (!filter_var(ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { // In strict mode, session fixation is not possible: new sessions always start with a unique // random id, so that concurrency is not possible and this code path can be skipped. // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php index 127e47f210..d1e5c14072 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php @@ -29,7 +29,7 @@ class WriteCheckSessionHandler implements \SessionHandlerInterface public function __construct(\SessionHandlerInterface $wrappedSessionHandler) { - @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', self::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', self::class), \E_USER_DEPRECATED); $this->wrappedSessionHandler = $wrappedSessionHandler; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 1f5a3322e1..be84c6dcf9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -142,11 +142,11 @@ class NativeSessionStorage implements SessionStorageInterface return true; } - if (PHP_SESSION_ACTIVE === session_status()) { + if (\PHP_SESSION_ACTIVE === session_status()) { throw new \RuntimeException('Failed to start the session: already started by PHP.'); } - if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) { + if (filter_var(ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) { throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); } @@ -205,7 +205,7 @@ class NativeSessionStorage implements SessionStorageInterface public function regenerate($destroy = false, $lifetime = null) { // Cannot regenerate the session ID for non-active sessions. - if (PHP_SESSION_ACTIVE !== session_status()) { + if (\PHP_SESSION_ACTIVE !== session_status()) { return false; } @@ -254,7 +254,7 @@ class NativeSessionStorage implements SessionStorageInterface // Register error handler to add information about the current save handler $previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) { - if (E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) { + if (\E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) { $handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler; $msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler)); } @@ -363,7 +363,7 @@ class NativeSessionStorage implements SessionStorageInterface */ public function setOptions(array $options) { - if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) { + if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { return; } @@ -429,7 +429,7 @@ class NativeSessionStorage implements SessionStorageInterface } $this->saveHandler = $saveHandler; - if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) { + if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { return; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index b9c2682b3c..9e1c94ddf6 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -65,7 +65,7 @@ abstract class AbstractProxy */ public function isActive() { - return PHP_SESSION_ACTIVE === session_status(); + return \PHP_SESSION_ACTIVE === session_status(); } /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index 082eed143e..9d94ba97a9 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; -@trigger_error('The '.__NAMESPACE__.'\NativeProxy class is deprecated since Symfony 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\NativeProxy class is deprecated since Symfony 3.4 and will be removed in 4.0. Use your session handler implementation directly.', \E_USER_DEPRECATED); /** * This proxy is built-in session handlers in PHP 5.3.x. diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index 4a8d2bb14a..2ca309963c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -41,7 +41,7 @@ class UploadedFileTest extends TestCase 'original.gif', null, filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK + \UPLOAD_ERR_OK ); $this->assertEquals('application/octet-stream', $file->getClientMimeType()); @@ -58,7 +58,7 @@ class UploadedFileTest extends TestCase 'original.gif', null, filesize(__DIR__.'/Fixtures/.unknownextension'), - UPLOAD_ERR_OK + \UPLOAD_ERR_OK ); $this->assertEquals('application/octet-stream', $file->getClientMimeType()); @@ -113,7 +113,7 @@ class UploadedFileTest extends TestCase null ); - $this->assertEquals(UPLOAD_ERR_OK, $file->getError()); + $this->assertEquals(\UPLOAD_ERR_OK, $file->getError()); } public function testGetClientOriginalName() @@ -150,7 +150,7 @@ class UploadedFileTest extends TestCase 'original.gif', 'image/gif', filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK + \UPLOAD_ERR_OK ); $file->move(__DIR__.'/Fixtures/directory'); @@ -170,7 +170,7 @@ class UploadedFileTest extends TestCase 'original.gif', 'image/gif', filesize($path), - UPLOAD_ERR_OK, + \UPLOAD_ERR_OK, true ); @@ -235,7 +235,7 @@ class UploadedFileTest extends TestCase 'original.gif', null, filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK, + \UPLOAD_ERR_OK, true ); @@ -261,11 +261,11 @@ class UploadedFileTest extends TestCase public function uploadedFileErrorProvider() { return [ - [UPLOAD_ERR_INI_SIZE], - [UPLOAD_ERR_FORM_SIZE], - [UPLOAD_ERR_PARTIAL], - [UPLOAD_ERR_NO_TMP_DIR], - [UPLOAD_ERR_EXTENSION], + [\UPLOAD_ERR_INI_SIZE], + [\UPLOAD_ERR_FORM_SIZE], + [\UPLOAD_ERR_PARTIAL], + [\UPLOAD_ERR_NO_TMP_DIR], + [\UPLOAD_ERR_EXTENSION], ]; } @@ -276,7 +276,7 @@ class UploadedFileTest extends TestCase 'original.gif', null, filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK + \UPLOAD_ERR_OK ); $this->assertFalse($file->isValid()); @@ -290,9 +290,9 @@ class UploadedFileTest extends TestCase $this->assertGreaterThan(0, $size); if (0 === (int) ini_get('post_max_size') && 0 === (int) ini_get('upload_max_filesize')) { - $this->assertSame(PHP_INT_MAX, $size); + $this->assertSame(\PHP_INT_MAX, $size); } else { - $this->assertLessThan(PHP_INT_MAX, $size); + $this->assertLessThan(\PHP_INT_MAX, $size); } } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php index a3882bc865..8eaf168a2d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php @@ -51,7 +51,7 @@ class FileBagTest extends TestCase 'name' => '', 'type' => '', 'tmp_name' => '', - 'error' => UPLOAD_ERR_NO_FILE, + 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0, ]]); @@ -64,7 +64,7 @@ class FileBagTest extends TestCase 'name' => [''], 'type' => [''], 'tmp_name' => [''], - 'error' => [UPLOAD_ERR_NO_FILE], + 'error' => [\UPLOAD_ERR_NO_FILE], 'size' => [0], ]]); @@ -77,7 +77,7 @@ class FileBagTest extends TestCase 'name' => ['file1' => ''], 'type' => ['file1' => ''], 'tmp_name' => ['file1' => ''], - 'error' => ['file1' => UPLOAD_ERR_NO_FILE], + 'error' => ['file1' => \UPLOAD_ERR_NO_FILE], 'size' => ['file1' => 0], ]]); diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 9642dc28d3..2ad7ae1005 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -195,7 +195,7 @@ class JsonResponseTest extends TestCase { $response = new JsonResponse(); - $this->assertEquals(JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, $response->getEncodingOptions()); + $this->assertEquals(\JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT, $response->getEncodingOptions()); } public function testSetEncodingOptions() @@ -205,7 +205,7 @@ class JsonResponseTest extends TestCase $this->assertEquals('[[1,2,3]]', $response->getContent()); - $response->setEncodingOptions(JSON_FORCE_OBJECT); + $response->setEncodingOptions(\JSON_FORCE_OBJECT); $this->assertEquals('{"0":{"0":1,"1":2,"2":3}}', $response->getContent()); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index d2a5c991cc..685e74a640 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -138,22 +138,22 @@ class ParameterBagTest extends TestCase $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found'); - $this->assertEquals('0123', $bag->filter('digits', '', FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters'); + $this->assertEquals('0123', $bag->filter('digits', '', \FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters'); - $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email'); + $this->assertEquals('example@example.com', $bag->filter('email', '', \FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email'); - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, ['flags' => FILTER_FLAG_PATH_REQUIRED]), '->filter() gets a value of parameter as URL with a path'); + $this->assertEquals('http://example.com/foo', $bag->filter('url', '', \FILTER_VALIDATE_URL, ['flags' => \FILTER_FLAG_PATH_REQUIRED]), '->filter() gets a value of parameter as URL with a path'); // This test is repeated for code-coverage - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path'); + $this->assertEquals('http://example.com/foo', $bag->filter('url', '', \FILTER_VALIDATE_URL, \FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path'); - $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, [ - 'flags' => FILTER_FLAG_ALLOW_HEX, + $this->assertFalse($bag->filter('dec', '', \FILTER_VALIDATE_INT, [ + 'flags' => \FILTER_FLAG_ALLOW_HEX, 'options' => ['min_range' => 1, 'max_range' => 0xff], ]), '->filter() gets a value of parameter as integer between boundaries'); - $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, [ - 'flags' => FILTER_FLAG_ALLOW_HEX, + $this->assertFalse($bag->filter('hex', '', \FILTER_VALIDATE_INT, [ + 'flags' => \FILTER_FLAG_ALLOW_HEX, 'options' => ['min_range' => 1, 'max_range' => 0xff], ]), '->filter() gets a value of parameter as integer between boundaries'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php index 3d3e696c75..c908b1b993 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php @@ -52,7 +52,7 @@ class ResponseFunctionalTest extends TestCase public function provideCookie() { foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) { - yield [pathinfo($file, PATHINFO_FILENAME)]; + yield [pathinfo($file, \PATHINFO_FILENAME)]; } } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index f133d493a1..3b1c86133f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -253,7 +253,7 @@ class ResponseTest extends ResponseTestCase public function testIsValidateable() { - $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); + $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(\DATE_RFC2822)]); $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present'); $response = new Response('', 200, ['ETag' => '"12345"']); @@ -266,7 +266,7 @@ class ResponseTest extends ResponseTestCase public function testGetDate() { $oneHourAgo = $this->createDateTimeOneHourAgo(); - $response = new Response('', 200, ['Date' => $oneHourAgo->format(DATE_RFC2822)]); + $response = new Response('', 200, ['Date' => $oneHourAgo->format(\DATE_RFC2822)]); $date = $response->getDate(); $this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present'); @@ -274,9 +274,9 @@ class ResponseTest extends ResponseTestCase $date = $response->getDate(); $this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present'); - $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); + $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(\DATE_RFC2822)]); $now = $this->createDateTimeNow(); - $response->headers->set('Date', $now->format(DATE_RFC2822)); + $response->headers->set('Date', $now->format(\DATE_RFC2822)); $date = $response->getDate(); $this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the date when the header has been modified'); @@ -299,13 +299,13 @@ class ResponseTest extends ResponseTestCase $response = new Response(); $response->headers->set('Cache-Control', 'must-revalidate'); - $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822)); + $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(\DATE_RFC2822)); $this->assertEquals(3600, $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present'); $response = new Response(); $response->headers->set('Cache-Control', 'must-revalidate'); $response->headers->set('Expires', -1); - $this->assertEquals('Sat, 01 Jan 00 00:00:00 +0000', $response->getExpires()->format(DATE_RFC822)); + $this->assertEquals('Sat, 01 Jan 00 00:00:00 +0000', $response->getExpires()->format(\DATE_RFC822)); $response = new Response(); $this->assertNull($response->getMaxAge(), '->getMaxAge() returns null if no freshness information available'); @@ -364,7 +364,7 @@ class ResponseTest extends ResponseTestCase $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired'); $response = new Response(); - $response->headers->set('Expires', date(DATE_RFC2822, time() + 600)); + $response->headers->set('Expires', date(\DATE_RFC2822, time() + 600)); $response->expire(); $this->assertNull($response->headers->get('Expires'), '->expire() removes the Expires header when the response is fresh'); } @@ -381,15 +381,15 @@ class ResponseTest extends ResponseTestCase $this->assertNull($response->getTtl(), '->getTtl() returns null when no Expires or Cache-Control headers are present'); $response = new Response(); - $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822)); + $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(\DATE_RFC2822)); $this->assertEquals(3600, $response->getTtl(), '->getTtl() uses the Expires header when no max-age is present'); $response = new Response(); - $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)); + $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(\DATE_RFC2822)); $this->assertLessThan(0, $response->getTtl(), '->getTtl() returns negative values when Expires is in past'); $response = new Response(); - $response->headers->set('Expires', $response->getDate()->format(DATE_RFC2822)); + $response->headers->set('Expires', $response->getDate()->format(\DATE_RFC2822)); $response->headers->set('Age', 0); $this->assertSame(0, $response->getTtl(), '->getTtl() correctly handles zero'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php index 98bc67bcab..b4db12bae1 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php @@ -55,7 +55,7 @@ class AbstractSessionHandlerTest extends TestCase public function provideSession() { foreach (glob(__DIR__.'/Fixtures/*.php') as $file) { - yield [pathinfo($file, PATHINFO_FILENAME)]; + yield [pathinfo($file, \PATHINFO_FILENAME)]; } } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index e710dca92c..9cbe654d05 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -154,7 +154,7 @@ class PdoSessionHandlerTest extends TestCase if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } - if (filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN)) { + if (filter_var(ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('Strict mode needs no locking for new sessions.'); } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 530a2749d1..d0f9811e97 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -171,7 +171,7 @@ abstract class Bundle implements BundleInterface } $r = new \ReflectionClass($class); if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { - @trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), E_USER_DEPRECATED); + @trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), \E_USER_DEPRECATED); $application->add($r->newInstance()); } diff --git a/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php b/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php index f82ada5c4b..a71cc4056a 100644 --- a/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php +++ b/src/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php @@ -49,7 +49,7 @@ class ChainCacheClearer implements CacheClearerInterface */ public function add(CacheClearerInterface $clearer) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED); $this->clearers[] = $clearer; } diff --git a/src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php b/src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php index 4b4aafa163..4271e0f88a 100644 --- a/src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php +++ b/src/Symfony/Component/HttpKernel/CacheClearer/Psr6CacheClearer.php @@ -27,7 +27,7 @@ class Psr6CacheClearer implements CacheClearerInterface public function addPool(CacheItemPoolInterface $pool) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), \E_USER_DEPRECATED); $this->pools[] = $pool; } diff --git a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php index eca4e6aede..010a3998c6 100644 --- a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php +++ b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php @@ -68,7 +68,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface */ public function setWarmers(array $warmers) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED); $this->warmers = []; foreach ($warmers as $warmer) { @@ -82,7 +82,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface public function add(CacheWarmerInterface $warmer) { if ($this->triggerDeprecation) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED); } $this->warmers[] = $warmer; diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 958c4c81f9..14794727f3 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -170,7 +170,7 @@ EOF; $value->getClientOriginalName(), $value->getClientMimeType(), 0, - UPLOAD_ERR_INI_SIZE, + \UPLOAD_ERR_INI_SIZE, true ); } else { diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 8ed79ff7b2..6248be1814 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -101,7 +101,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve */ public function getArguments(Request $request, $controller) { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), \E_USER_DEPRECATED); if (\is_array($controller)) { $r = new \ReflectionMethod($controller[0], $controller[1]); @@ -125,7 +125,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve */ protected function doGetArguments(Request $request, $controller, array $parameters) { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), \E_USER_DEPRECATED); $attributes = $request->attributes->all(); $arguments = []; diff --git a/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php index 6f39f81d2a..09701cfe04 100644 --- a/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php @@ -60,7 +60,7 @@ class TraceableControllerResolver implements ControllerResolverInterface, Argume */ public function getArguments(Request $request, $controller) { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), \E_USER_DEPRECATED); $ret = $this->argumentResolver->getArguments($request, $controller); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 5895ef37d7..8ad6279e5f 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -63,13 +63,13 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', - 'php_version' => PHP_VERSION, + 'php_version' => \PHP_VERSION, 'php_architecture' => \PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), - 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), - 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), + 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN), + 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN), 'bundles' => [], 'sapi_name' => \PHP_SAPI, ]; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 94307cf56c..7119545b68 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -45,7 +45,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable public function serialize() { - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object']; return $isCalledFromOverridingMethod ? $this->data : serialize($this->data); @@ -77,7 +77,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable $this->cloner->setMaxItems(-1); $this->cloner->addCasters($this->getCasters()); } else { - @trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since Symfony 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since Symfony 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), \E_USER_DEPRECATED); $this->cloner = false; } } @@ -103,7 +103,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable */ protected function varToString($var) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), \E_USER_DEPRECATED); if (null === $this->valueExporter) { $this->valueExporter = new ValueExporter(); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 280e1ddd08..e5c276de6c 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -71,7 +71,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $this->isCollected = false; } - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7); + $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; $line = $trace[0]['line']; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php index 78e9e29198..e3f8576cdc 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php @@ -28,7 +28,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter public function __construct(EventDispatcherInterface $dispatcher = null) { if ($dispatcher instanceof TraceableEventDispatcherInterface && !method_exists($dispatcher, 'reset')) { - @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), E_USER_DEPRECATED); + @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), \E_USER_DEPRECATED); } $this->dispatcher = $dispatcher; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 9c05daa36f..c2c337a017 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -30,7 +30,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte { if (null !== $logger && $logger instanceof DebugLoggerInterface) { if (!method_exists($logger, 'clear')) { - @trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), E_USER_DEPRECATED); + @trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), \E_USER_DEPRECATED); } $this->logger = $logger; @@ -148,7 +148,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte } $logs = []; - foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) { + foreach (file($file, \FILE_IGNORE_NEW_LINES) as $log) { $log = explode(': ', $log, 2); if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) { $log = ['Unknown Compiler Pass', implode(': ', $log)]; @@ -221,7 +221,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte return true; } - if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) { + if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [\E_DEPRECATED, \E_USER_DEPRECATED], true)) { return true; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 246c0c7f6f..41372a5654 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -62,8 +62,8 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter if ($request->hasSession()) { $session = $request->getSession(); if ($session->isStarted()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); + $sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated()); + $sessionMetadata['Last used'] = date(\DATE_RFC822, $session->getMetadataBag()->getLastUsed()); $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); $sessionAttributes = $session->all(); $flashes = $session->getFlashBag()->peekAll(); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php index 36570b4d5f..f84aeeae59 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\DataCollector\Util; -@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', \E_USER_DEPRECATED); /** * @author Bernhard Schussek diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php index e7347d4902..63ae6e6aab 100644 --- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php +++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php @@ -36,7 +36,7 @@ class FileLinkFormatter implements \Serializable $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); if ($fileLinkFormat && !\is_array($fileLinkFormat)) { $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, \PREG_SPLIT_DELIM_CAPTURE); } $this->fileLinkFormat = $fileLinkFormat; diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php index 8ae78e0d84..8b3dcb7f61 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; -@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); /** * Sets the classes to compile in the cache for the container. diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php index ec69392e53..55a4759dbf 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php @@ -33,7 +33,7 @@ abstract class Extension extends BaseExtension public function getClassesToCompile() { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED); } return $this->classes; @@ -59,7 +59,7 @@ abstract class Extension extends BaseExtension public function addClassesToCompile(array $classes) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED); } $this->classes = array_merge($this->classes, $classes); diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php b/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php index 1722ef58b1..4deaaf0d1a 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php @@ -51,7 +51,7 @@ class LazyLoadingFragmentHandler extends FragmentHandler */ public function addRendererService($name, $renderer) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); $this->rendererIds[$name] = $renderer; } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index d021c6ee8a..c7d3d279a4 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -89,7 +89,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface } foreach (['action', 'argument', 'id'] as $k) { if (!isset($attributes[$k][0])) { - throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id)); + throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id)); } } if (!isset($methods[$action = strtolower($attributes['action'])])) { diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index 957a3cdb0f..5f530631e6 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -49,12 +49,12 @@ class DebugHandlersListener implements EventSubscriberInterface * @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files * @param bool $scope Enables/disables scoping mode */ - public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null, $scope = true) + public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, $throwAt = \E_ALL, $scream = true, $fileLinkFormat = null, $scope = true) { $this->exceptionHandler = $exceptionHandler; $this->logger = $logger; - $this->levels = null === $levels ? E_ALL : $levels; - $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null)); + $this->levels = null === $levels ? \E_ALL : $levels; + $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null)); $this->scream = (bool) $scream; $this->fileLinkFormat = $fileLinkFormat; $this->scope = (bool) $scope; @@ -93,7 +93,7 @@ class DebugHandlersListener implements EventSubscriberInterface $handler->screamAt($levels); } if ($this->scope) { - $handler->scopeAt($levels & ~E_USER_DEPRECATED & ~E_DEPRECATED); + $handler->scopeAt($levels & ~\E_USER_DEPRECATED & ~\E_DEPRECATED); } else { $handler->scopeAt(0, true); } diff --git a/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php index 430486e549..3d050c8852 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php @@ -63,7 +63,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere { if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { - @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); + @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', \E_USER_DEPRECATED); } return $this->inlineStrategy->render($uri, $request, $options); diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php index 4850e589da..ed0188c5b2 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php @@ -109,7 +109,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer } $renderedAttributes = ''; if (\count($attributes) > 0) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; + $flags = \ENT_QUOTES | \ENT_SUBSTITUTE; foreach ($attributes as $attribute => $value) { $renderedAttributes .= sprintf( ' %s="%s"', diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php index 96e6ca4bfe..3d461a7fe3 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php @@ -80,13 +80,13 @@ class Esi extends AbstractSurrogate $content = preg_replace('#.*?#s', '', $content); $content = preg_replace('#]+>#s', '', $content); - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); + $chunks = preg_split('##', $content, -1, \PREG_SPLIT_DELIM_CAPTURE); $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); $i = 1; while (isset($chunks[$i])) { $options = []; - preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); + preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php b/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php index 40aac64f2a..6dba4e11df 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php @@ -65,13 +65,13 @@ class Ssi extends AbstractSurrogate // we don't use a proper XML parser here as we can have SSI tags in a plain text response $content = $response->getContent(); - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); + $chunks = preg_split('##', $content, -1, \PREG_SPLIT_DELIM_CAPTURE); $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); $i = 1; while (isset($chunks[$i])) { $options = []; - preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); + preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 72793f582d..0a93eb0eee 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -50,7 +50,7 @@ class Store implements StoreInterface { // unlock everything foreach ($this->locks as $lock) { - flock($lock, LOCK_UN); + flock($lock, \LOCK_UN); fclose($lock); } @@ -72,7 +72,7 @@ class Store implements StoreInterface return $path; } $h = fopen($path, 'cb'); - if (!flock($h, LOCK_EX | LOCK_NB)) { + if (!flock($h, \LOCK_EX | \LOCK_NB)) { fclose($h); return $path; @@ -94,7 +94,7 @@ class Store implements StoreInterface $key = $this->getCacheKey($request); if (isset($this->locks[$key])) { - flock($this->locks[$key], LOCK_UN); + flock($this->locks[$key], \LOCK_UN); fclose($this->locks[$key]); unset($this->locks[$key]); @@ -117,8 +117,8 @@ class Store implements StoreInterface } $h = fopen($path, 'rb'); - flock($h, LOCK_EX | LOCK_NB, $wouldBlock); - flock($h, LOCK_UN); // release the lock we just acquired + flock($h, \LOCK_EX | \LOCK_NB, $wouldBlock); + flock($h, \LOCK_UN); // release the lock we just acquired fclose($h); return (bool) $wouldBlock; @@ -340,7 +340,7 @@ class Store implements StoreInterface { $key = $this->getCacheKey(Request::create($url)); if (isset($this->locks[$key])) { - flock($this->locks[$key], LOCK_UN); + flock($this->locks[$key], \LOCK_UN); fclose($this->locks[$key]); unset($this->locks[$key]); } diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php index 9769d5e802..8c20695d8c 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -51,7 +51,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface $this->argumentResolver = $argumentResolver; if (null === $this->argumentResolver) { - @trigger_error(sprintf('As of 3.1 an %s is used to resolve arguments. In 4.0 the $argumentResolver becomes the %s if no other is provided instead of using the $resolver argument.', ArgumentResolverInterface::class, ArgumentResolver::class), E_USER_DEPRECATED); + @trigger_error(sprintf('As of 3.1 an %s is used to resolve arguments. In 4.0 the $argumentResolver becomes the %s if no other is provided instead of using the $resolver argument.', ArgumentResolverInterface::class, ArgumentResolver::class), \E_USER_DEPRECATED); // fallback in case of deprecations $this->argumentResolver = $resolver; } @@ -239,7 +239,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface // the developer asked for a specific status code if ($response->headers->has('X-Status-Code')) { - @trigger_error(sprintf('Using the X-Status-Code header is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Using the X-Status-Code header is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), \E_USER_DEPRECATED); $response->setStatusCode($response->headers->get('X-Status-Code')); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4c52d2e18e..de9025061a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -232,7 +232,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl } if (!$first && !$noDeprecation) { - @trigger_error(sprintf('Passing "false" as the second argument to "%s()" is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing "false" as the second argument to "%s()" is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); } if (!isset($this->bundleMap[$name])) { @@ -397,7 +397,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl public function loadClassCache($name = 'classes', $extension = '.php') { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED); } $this->loadClassCache = [$name, $extension]; @@ -411,7 +411,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl public function setClassCache(array $classes) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED); } file_put_contents(($this->warmupDir ?: $this->getCacheDir()).'/classes.map', sprintf('debug && null !== $this->startTime ? $this->startTime : -INF; + return $this->debug && null !== $this->startTime ? $this->startTime : -\INF; } /** @@ -463,7 +463,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl protected function doLoadClassCache($name, $extension) { if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED); } $cacheDir = $this->warmupDir ?: $this->getCacheDir(); @@ -498,7 +498,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $this->bundles[$name] = $bundle; if ($parentName = $bundle->getParent()) { - @trigger_error('Bundle inheritance is deprecated as of 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('Bundle inheritance is deprecated as of 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); if (isset($directChildren[$parentName])) { throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); @@ -583,7 +583,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $oldContainer = null; if ($fresh = $cache->isFresh()) { // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors - $errorLevel = error_reporting(E_ALL ^ E_WARNING); + $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); $fresh = $oldContainer = false; try { if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) { @@ -605,7 +605,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) { $collectedLogs = []; $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { + if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type) { return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; } @@ -615,7 +615,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl return null; } - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 3); // Clean the trace by removing first frames added by the error handler itself. for ($i = 0; isset($backtrace[$i]); ++$i) { if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { @@ -651,7 +651,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl } if (null === $oldContainer && file_exists($cache->getPath())) { - $errorLevel = error_reporting(E_ALL ^ E_WARNING); + $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); try { $oldContainer = include $cache->getPath(); } catch (\Throwable $e) { @@ -673,7 +673,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl static $legacyContainers = []; $oldContainerDir = \dirname($oldContainer->getFileName()); $legacyContainers[$oldContainerDir.'.legacy'] = true; - foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy', GLOB_NOSORT) as $legacyContainer) { + foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy', \GLOB_NOSORT) as $legacyContainer) { if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) { (new Filesystem())->remove(substr($legacyContainer, 0, -7)); } @@ -736,13 +736,13 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl protected function getEnvParameters() { if (0 === \func_num_args() || func_get_arg(0)) { - @trigger_error(sprintf('The "%s()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), \E_USER_DEPRECATED); } $parameters = []; foreach ($_SERVER as $key => $value) { if (0 === strpos($key, 'SYMFONY__')) { - @trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax instead to get the value of environment variables in configuration files.', $key), E_USER_DEPRECATED); + @trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax instead to get the value of environment variables in configuration files.', $key), \E_USER_DEPRECATED); $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; } } @@ -921,14 +921,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $token = $tokens[$i]; if (!isset($token[1]) || 'b"' === $token) { $rawChunk .= $token; - } elseif (T_START_HEREDOC === $token[0]) { + } elseif (\T_START_HEREDOC === $token[0]) { $output .= $rawChunk.$token[1]; do { $token = $tokens[++$i]; $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token; - } while (T_END_HEREDOC !== $token[0]); + } while (\T_END_HEREDOC !== $token[0]); $rawChunk = ''; - } elseif (T_WHITESPACE === $token[0]) { + } elseif (\T_WHITESPACE === $token[0]) { if ($ignoreSpace) { $ignoreSpace = false; @@ -937,13 +937,13 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl // replace multiple new lines with a single newline $rawChunk .= preg_replace(['/\n{2,}/S'], "\n", $token[1]); - } elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { + } elseif (\in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT])) { $ignoreSpace = true; } else { $rawChunk .= $token[1]; // The PHP-open tag already has a new-line - if (T_OPEN_TAG === $token[0]) { + if (\T_OPEN_TAG === $token[0]) { $ignoreSpace = true; } } diff --git a/src/Symfony/Component/HttpKernel/Log/Logger.php b/src/Symfony/Component/HttpKernel/Log/Logger.php index bbdd101d7d..509d1e293b 100644 --- a/src/Symfony/Component/HttpKernel/Log/Logger.php +++ b/src/Symfony/Component/HttpKernel/Log/Logger.php @@ -109,7 +109,7 @@ class Logger extends AbstractLogger $message = strtr($message, $replacements); } - $log = sprintf('[%s] %s', $level, $message).PHP_EOL; + $log = sprintf('[%s] %s', $level, $message).\PHP_EOL; if ($prefixDate) { $log = date(\DateTime::RFC3339).' '.$log; } diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 8589b96f57..c70830ae2f 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -58,7 +58,7 @@ class FileProfilerStorage implements ProfilerStorageInterface } $file = fopen($file, 'r'); - fseek($file, 0, SEEK_END); + fseek($file, 0, \SEEK_END); $result = []; while (\count($result) < $limit && $line = $this->readLineFromFile($file)) { @@ -251,7 +251,7 @@ class FileProfilerStorage implements ProfilerStorageInterface $position += $upTo; $line = substr($buffer, $upTo + 1).$line; - fseek($file, max(0, $position), SEEK_SET); + fseek($file, max(0, $position), \SEEK_SET); if ('' !== $line) { break; diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php index c510afa3e0..5cca92d765 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -212,7 +212,7 @@ class Profiler public function add(DataCollectorInterface $collector) { if (!method_exists($collector, 'reset')) { - @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DataCollectorInterface::class, \get_class($collector)), E_USER_DEPRECATED); + @trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DataCollectorInterface::class, \get_class($collector)), \E_USER_DEPRECATED); } $this->collectors[$collector->getName()] = $collector; diff --git a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php index b141c16d64..4cae90e919 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php @@ -100,8 +100,8 @@ class ClientTest extends TestCase $client = new Client($kernel); $files = [ - ['tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => UPLOAD_ERR_OK], - new UploadedFile($source, 'original', 'mime/original', 1, UPLOAD_ERR_OK, true), + ['tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => \UPLOAD_ERR_OK], + new UploadedFile($source, 'original', 'mime/original', 1, \UPLOAD_ERR_OK, true), ]; $file = null; @@ -131,7 +131,7 @@ class ClientTest extends TestCase $kernel = new TestHttpKernel(); $client = new Client($kernel); - $file = ['tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE]; + $file = ['tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => \UPLOAD_ERR_NO_FILE]; $client->request('POST', '/', [], ['foo' => $file]); @@ -150,14 +150,14 @@ class ClientTest extends TestCase $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->setConstructorArgs([$source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true]) + ->setConstructorArgs([$source, 'original', 'mime/original', 123, \UPLOAD_ERR_OK, true]) ->setMethods(['getSize']) ->getMock() ; $file->expects($this->once()) ->method('getSize') - ->willReturn(INF) + ->willReturn(\INF) ; $client->request('POST', '/', [], [$file]); @@ -169,7 +169,7 @@ class ClientTest extends TestCase $file = $files[0]; $this->assertFalse($file->isValid()); - $this->assertEquals(UPLOAD_ERR_INI_SIZE, $file->getError()); + $this->assertEquals(\UPLOAD_ERR_INI_SIZE, $file->getError()); $this->assertEquals('mime/original', $file->getClientMimeType()); $this->assertEquals('original', $file->getClientOriginalName()); $this->assertEquals(0, $file->getClientSize()); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index dc455915fa..3cfeed418c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -31,16 +31,16 @@ class ConfigDataCollectorTest extends TestCase $this->assertTrue($c->isDebug()); $this->assertSame('config', $c->getName()); $this->assertSame('testkernel', $c->getAppName()); - $this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION); - $this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION); + $this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', \PHP_VERSION); + $this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', \PHP_VERSION); $this->assertSame(\PHP_INT_SIZE * 8, $c->getPhpArchitecture()); $this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale()); $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); $this->assertNull($c->getToken()); $this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug()); - $this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache()); - $this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), $c->hasApcu()); + $this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache()); + $this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN), $c->hasApcu()); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php index b46357ed55..d6d230ef2f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -113,14 +113,14 @@ class LoggerDataCollectorTest extends TestCase yield 'logs with some deprecations' => [ 1, [ - ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => 'foo', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => 'foo2', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, \E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => new \ErrorException('deprecated', 0, \E_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo2', 'context' => ['exception' => new \ErrorException('deprecated', 0, \E_USER_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], ], [ - ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => 'foo', 'context' => ['exception' => ['deprecated', E_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], - ['message' => 'foo2', 'context' => ['exception' => ['deprecated', E_USER_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ['message' => 'foo3', 'context' => ['exception' => ['warning', \E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => ['deprecated', \E_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ['message' => 'foo2', 'context' => ['exception' => ['deprecated', \E_USER_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], ], 2, 0, @@ -130,14 +130,14 @@ class LoggerDataCollectorTest extends TestCase yield 'logs with some silent errors' => [ 1, [ - ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => '0', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, \E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(\E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => '0', 'context' => ['exception' => new SilencedErrorContext(\E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], ], [ - ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], - ['message' => 'foo3', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], - ['message' => '0', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], + ['message' => 'foo3', 'context' => ['exception' => ['warning', \E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => [\E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], + ['message' => '0', 'context' => ['exception' => [\E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], ], 0, 2, diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php index 44af0149f7..03cb14bddf 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -60,8 +60,8 @@ class DebugHandlersListenerTest extends TestCase $loggers = $eHandler->setLoggers([]); - $this->assertArrayHasKey(E_DEPRECATED, $loggers); - $this->assertSame([$logger, LogLevel::INFO], $loggers[E_DEPRECATED]); + $this->assertArrayHasKey(\E_DEPRECATED, $loggers); + $this->assertSame([$logger, LogLevel::INFO], $loggers[\E_DEPRECATED]); } public function testConfigureForHttpKernelWithNoTerminateWithException() diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 444db71a3e..d080598fe8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -129,8 +129,8 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'], 'Hello World'); - $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(\DATE_RFC2822), 'Content-Type' => 'text/plain'], 'Hello World'); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(\DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); @@ -161,24 +161,24 @@ class HttpCacheTest extends HttpCacheTestCase $this->setNextResponse(200, [], '', function ($request, $response) use ($time) { $response->setStatusCode(200); $response->headers->set('ETag', '12345'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); + $response->headers->set('Last-Modified', $time->format(\DATE_RFC2822)); $response->headers->set('Content-Type', 'text/plain'); $response->setContent('Hello World'); }); // only ETag matches $t = \DateTime::createFromFormat('U', time() - 3600); - $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(\DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // only Last-Modified matches - $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(\DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // Both matches - $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(\DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); } @@ -257,7 +257,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(\DATE_RFC2822)]); $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertHttpKernelIsCalled(); @@ -393,7 +393,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testFetchesResponseFromBackendWhenCacheMisses() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(\DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -405,7 +405,7 @@ class HttpCacheTest extends HttpCacheTestCase { foreach (array_merge(range(201, 202), range(204, 206), range(303, 305), range(400, 403), range(405, 409), range(411, 417), range(500, 505)) as $code) { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse($code, ['Expires' => $time->format(DATE_RFC2822)]); + $this->setNextResponse($code, ['Expires' => $time->format(\DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals($code, $this->response->getStatusCode()); @@ -417,7 +417,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheResponsesWithExplicitNoStoreDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store']); + $this->setNextResponse(200, ['Expires' => $time->format(\DATE_RFC2822), 'Cache-Control' => 'no-store']); $this->request('GET', '/'); $this->assertTraceNotContains('store'); @@ -436,7 +436,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithExplicitNoCacheDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache']); + $this->setNextResponse(200, ['Expires' => $time->format(\DATE_RFC2822), 'Cache-Control' => 'public, no-cache']); $this->request('GET', '/'); $this->assertTraceContains('store'); @@ -462,7 +462,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithAnExpirationHeader() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(\DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -511,7 +511,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(\DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -535,7 +535,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time1 = \DateTime::createFromFormat('U', time() - 5); $time2 = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Date' => $time1->format(\DATE_RFC2822), 'Expires' => $time2->format(\DATE_RFC2822)]); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -559,7 +559,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testHitsCachedResponseWithMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10']); + $this->setNextResponse(200, ['Date' => $time->format(\DATE_RFC2822), 'Cache-Control' => 'public, max-age=10']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -623,7 +623,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testHitsCachedResponseWithSMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0']); + $this->setNextResponse(200, ['Date' => $time->format(\DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -691,7 +691,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertCount(1, $values); $tmp = unserialize($values[0]); $time = \DateTime::createFromFormat('U', time() - 5); - $tmp[0][1]['date'] = $time->format(DATE_RFC2822); + $tmp[0][1]['date'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); $m->setAccessible(true); @@ -741,7 +741,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertCount(1, $values); $tmp = unserialize($values[0]); $time = \DateTime::createFromFormat('U', time() - 5); - $tmp[0][1]['date'] = $time->format(DATE_RFC2822); + $tmp[0][1]['date'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); $m->setAccessible(true); @@ -783,7 +783,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(\DATE_RFC2822)]); // build initial request $this->request('GET', '/'); @@ -801,7 +801,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertCount(1, $values); $tmp = unserialize($values[0]); $time = \DateTime::createFromFormat('U', time()); - $tmp[0][1]['expires'] = $time->format(DATE_RFC2822); + $tmp[0][1]['expires'] = $time->format(\DATE_RFC2822); $r = new \ReflectionObject($this->store); $m = $r->getMethod('save'); $m->setAccessible(true); @@ -825,8 +825,8 @@ class HttpCacheTest extends HttpCacheTestCase $time = \DateTime::createFromFormat('U', time()); $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { + $response->headers->set('Last-Modified', $time->format(\DATE_RFC2822)); + if ($time->format(\DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { $response->setStatusCode(304); $response->setContent(''); } @@ -914,7 +914,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->setNextResponse(200, [], 'Hello World', function (Request $request, Response $response) use ($time) { $response->setSharedMaxAge(10); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); + $response->headers->set('Last-Modified', $time->format(\DATE_RFC2822)); }); // prime the cache @@ -931,7 +931,7 @@ class HttpCacheTest extends HttpCacheTestCase sleep(15); // expire the cache $this->setNextResponse(304, [], '', function (Request $request, Response $response) use ($time) { - $this->assertEquals($time->format(DATE_RFC2822), $request->headers->get('IF_MODIFIED_SINCE')); + $this->assertEquals($time->format(\DATE_RFC2822), $request->headers->get('IF_MODIFIED_SINCE')); }); $this->request('GET', '/'); @@ -947,7 +947,7 @@ class HttpCacheTest extends HttpCacheTestCase $time = \DateTime::createFromFormat('U', time()); $count = 0; $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time, &$count) { - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); + $response->headers->set('Last-Modified', $time->format(\DATE_RFC2822)); $response->headers->set('Cache-Control', 'public'); switch (++$count) { case 1: @@ -1019,14 +1019,14 @@ class HttpCacheTest extends HttpCacheTestCase $time = \DateTime::createFromFormat('U', time()); $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public, max-age=10'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); + $response->headers->set('Last-Modified', $time->format(\DATE_RFC2822)); }); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); $this->assertEquals('Hello World', $this->response->getContent()); - $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(\DATE_RFC2822)]); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(304, $this->response->getStatusCode()); $this->assertEquals('', $this->response->getContent()); @@ -1427,7 +1427,7 @@ class HttpCacheTest extends HttpCacheTestCase 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', - 'Last-Modified' => $time->format(DATE_RFC2822), + 'Last-Modified' => $time->format(\DATE_RFC2822), ], ], [ @@ -1455,7 +1455,7 @@ class HttpCacheTest extends HttpCacheTestCase 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', - 'Last-Modified' => $time->format(DATE_RFC2822), + 'Last-Modified' => $time->format(\DATE_RFC2822), ], ], [ diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 79039c1c97..fd304579e1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -59,7 +59,7 @@ class LoggerTest extends TestCase */ public function getLogs() { - return file($this->tmpFile, FILE_IGNORE_NEW_LINES); + return file($this->tmpFile, \FILE_IGNORE_NEW_LINES); } public function testImplements() @@ -186,7 +186,7 @@ class LoggerTest extends TestCase public function testFormatter() { $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { - return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).PHP_EOL; + return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL; }); $this->logger->error('An error', ['foo' => 'bar']); diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 4e23f13b02..5d817acee2 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -329,7 +329,7 @@ class FileProfilerStorageTest extends TestCase $h = tmpfile(); fwrite($h, "line1\n\n\nline2\n"); - fseek($h, 0, SEEK_END); + fseek($h, 0, \SEEK_END); $this->assertEquals('line2', $r->invoke($this->storage, $h)); $this->assertEquals('line1', $r->invoke($this->storage, $h)); diff --git a/src/Symfony/Component/HttpKernel/UriSigner.php b/src/Symfony/Component/HttpKernel/UriSigner.php index ffe31a2121..3927f10114 100644 --- a/src/Symfony/Component/HttpKernel/UriSigner.php +++ b/src/Symfony/Component/HttpKernel/UriSigner.php @@ -89,7 +89,7 @@ class UriSigner private function buildUrl(array $url, array $params = []) { - ksort($params, SORT_STRING); + ksort($params, \SORT_STRING); $url['query'] = http_build_query($params, '', '&'); $scheme = isset($url['scheme']) ? $url['scheme'].'://' : ''; diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php index d72fa77144..a9557ec482 100644 --- a/src/Symfony/Component/Intl/Collator/Collator.php +++ b/src/Symfony/Component/Intl/Collator/Collator.php @@ -109,9 +109,9 @@ class Collator public function asort(&$array, $sortFlag = self::SORT_REGULAR) { $intlToPlainFlagMap = [ - self::SORT_REGULAR => SORT_REGULAR, - self::SORT_NUMERIC => SORT_NUMERIC, - self::SORT_STRING => SORT_STRING, + self::SORT_REGULAR => \SORT_REGULAR, + self::SORT_NUMERIC => \SORT_NUMERIC, + self::SORT_STRING => \SORT_STRING, ]; $plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR; diff --git a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php index f3df769e13..ffd194c457 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php @@ -35,7 +35,7 @@ class JsonBundleWriter implements BundleWriterInterface } }); - $contents = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n"; + $contents = json_encode($data, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE)."\n"; file_put_contents($path.'/'.$locale.'.json', $contents); } diff --git a/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php b/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php index 259358d9e9..e5fa8b1717 100644 --- a/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php +++ b/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php @@ -42,7 +42,7 @@ class LocaleScanner */ public function scanLocales($sourceDir) { - $locales = glob($sourceDir.'/*.txt', GLOB_NOSORT); + $locales = glob($sourceDir.'/*.txt', \GLOB_NOSORT); // Remove file extension and sort array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); }); diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php index d61fa4d013..de6e60f4b7 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/Transformer.php @@ -60,6 +60,6 @@ abstract class Transformer */ protected function padLeft($value, $length) { - return str_pad($value, $length, '0', STR_PAD_LEFT); + return str_pad($value, $length, '0', \STR_PAD_LEFT); } } diff --git a/src/Symfony/Component/Intl/Intl.php b/src/Symfony/Component/Intl/Intl.php index 6ee12f9515..55cb42096f 100644 --- a/src/Symfony/Component/Intl/Intl.php +++ b/src/Symfony/Component/Intl/Intl.php @@ -195,7 +195,7 @@ final class Intl if (!self::isExtensionLoaded()) { self::$icuVersion = self::getIcuStubVersion(); } elseif (\defined('INTL_ICU_VERSION')) { - self::$icuVersion = INTL_ICU_VERSION; + self::$icuVersion = \INTL_ICU_VERSION; } else { try { $reflector = new \ReflectionExtension('intl'); diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index f562c3dbea..72a110bf2a 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -201,9 +201,9 @@ class NumberFormatter * @see https://php.net/round */ private static $phpRoundingMap = [ - self::ROUND_HALFDOWN => PHP_ROUND_HALF_DOWN, - self::ROUND_HALFEVEN => PHP_ROUND_HALF_EVEN, - self::ROUND_HALFUP => PHP_ROUND_HALF_UP, + self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN, + self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN, + self::ROUND_HALFUP => \PHP_ROUND_HALF_UP, ]; /** @@ -357,7 +357,7 @@ class NumberFormatter // The original NumberFormatter does not support this format type if (self::TYPE_CURRENCY === $type) { - trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING); + trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); return false; } @@ -513,7 +513,7 @@ class NumberFormatter $type = (int) $type; if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) { - trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING); + trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); return false; } diff --git a/src/Symfony/Component/Intl/Resources/bin/common.php b/src/Symfony/Component/Intl/Resources/bin/common.php index 5a93e40487..1ed762fee4 100644 --- a/src/Symfony/Component/Intl/Resources/bin/common.php +++ b/src/Symfony/Component/Intl/Resources/bin/common.php @@ -68,7 +68,7 @@ function get_icu_version_from_genrb($genrb) return $matches[1]; } -error_reporting(E_ALL); +error_reporting(\E_ALL); set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php index 0700f6ec58..99319fe775 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php @@ -72,7 +72,7 @@ class Adapter implements AdapterInterface $value = ldap_escape($subject, $ignore, $flags); // Per RFC 4514, leading/trailing spaces should be encoded in DNs, as well as carriage returns. - if ((int) $flags & LDAP_ESCAPE_DN) { + if ((int) $flags & \LDAP_ESCAPE_DN) { if (!empty($value) && ' ' === $value[0]) { $value = '\\20'.substr($value, 1); } diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index 42175d8534..10b3d3b14a 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Ldap; -@trigger_error('The '.__NAMESPACE__.'\LdapClient class is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Ldap class directly instead.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\LdapClient class is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Ldap class directly instead.', \E_USER_DEPRECATED); /** * @author Grégoire Pineau @@ -60,7 +60,7 @@ final class LdapClient implements LdapClientInterface */ public function find($dn, $query, $filter = '*') { - @trigger_error('The "find" method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the "query" method instead.', E_USER_DEPRECATED); + @trigger_error('The "find" method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the "query" method instead.', \E_USER_DEPRECATED); $query = $this->ldap->query($dn, $query, ['filter' => $filter]); $entries = $query->execute(); diff --git a/src/Symfony/Component/Lock/Store/FlockStore.php b/src/Symfony/Component/Lock/Store/FlockStore.php index 4d55b539e3..dc197a1624 100644 --- a/src/Symfony/Component/Lock/Store/FlockStore.php +++ b/src/Symfony/Component/Lock/Store/FlockStore.php @@ -95,7 +95,7 @@ class FlockStore implements StoreInterface // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 - if (!flock($handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { + if (!flock($handle, \LOCK_EX | ($blocking ? 0 : \LOCK_NB))) { fclose($handle); throw new LockConflictedException(); } @@ -123,7 +123,7 @@ class FlockStore implements StoreInterface $handle = $key->getState(__CLASS__); - flock($handle, LOCK_UN | LOCK_NB); + flock($handle, \LOCK_UN | \LOCK_NB); fclose($handle); $key->removeState(__CLASS__); diff --git a/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php b/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php index 1ee988eadd..6cf7e4e481 100644 --- a/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php +++ b/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php @@ -37,7 +37,7 @@ class RetryTillSaveStore implements StoreInterface, LoggerAwareInterface * @param int $retrySleep Duration in ms between 2 retry * @param int $retryCount Maximum amount of retry */ - public function __construct(StoreInterface $decorated, $retrySleep = 100, $retryCount = PHP_INT_MAX) + public function __construct(StoreInterface $decorated, $retrySleep = 100, $retryCount = \PHP_INT_MAX) { $this->decorated = $decorated; $this->retrySleep = $retrySleep; diff --git a/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php index 361b45b71a..57e20078aa 100644 --- a/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php +++ b/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php @@ -55,11 +55,11 @@ trait BlockingStoreTestTrait $parentPID = posix_getpid(); // Block SIGHUP signal - pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]); + pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]); if ($childPID = pcntl_fork()) { // Wait the start of the child - pcntl_sigwaitinfo([SIGHUP], $info); + pcntl_sigwaitinfo([\SIGHUP], $info); try { // This call should failed given the lock should already by acquired by the child @@ -69,7 +69,7 @@ trait BlockingStoreTestTrait } // send the ready signal to the child - posix_kill($childPID, SIGHUP); + posix_kill($childPID, \SIGHUP); // This call should be blocked by the child #1 $store->waitAndSave($key); @@ -81,14 +81,14 @@ trait BlockingStoreTestTrait $this->assertSame(0, pcntl_wexitstatus($status1), 'The child process couldn\'t lock the resource'); } else { // Block SIGHUP signal - pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]); + pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]); try { $store->save($key); // send the ready signal to the parent - posix_kill($parentPID, SIGHUP); + posix_kill($parentPID, \SIGHUP); // Wait for the parent to be ready - pcntl_sigwaitinfo([SIGHUP], $info); + pcntl_sigwaitinfo([\SIGHUP], $info); // Wait ClockDelay to let parent assert to finish usleep($clockDelay); diff --git a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php index 16263fa43a..1a8422e6fb 100644 --- a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php @@ -50,22 +50,22 @@ class SemaphoreStoreTest extends AbstractStoreTest private function getOpenedSemaphores() { - if ('Darwin' === PHP_OS) { - $lines = explode(PHP_EOL, trim(shell_exec('ipcs -s'))); + if ('Darwin' === \PHP_OS) { + $lines = explode(\PHP_EOL, trim(shell_exec('ipcs -s'))); if (-1 === $start = array_search('Semaphores:', $lines)) { - throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines)); + throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(\PHP_EOL, $lines)); } return \count(\array_slice($lines, ++$start)); } - $lines = explode(PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su'))); + $lines = explode(\PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su'))); if ('------ Semaphore Status --------' !== $lines[0]) { - throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines)); + throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(\PHP_EOL, $lines)); } list($key, $value) = explode(' = ', $lines[1]); if ('used arrays' !== $key) { - throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(PHP_EOL, $lines)); + throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(\PHP_EOL, $lines)); } return (int) $value; diff --git a/src/Symfony/Component/Process/ExecutableFinder.php b/src/Symfony/Component/Process/ExecutableFinder.php index cb4345e7bb..ff68ed3319 100644 --- a/src/Symfony/Component/Process/ExecutableFinder.php +++ b/src/Symfony/Component/Process/ExecutableFinder.php @@ -51,7 +51,7 @@ class ExecutableFinder public function find($name, $default = null, array $extraDirs = []) { if (ini_get('open_basedir')) { - $searchPath = array_merge(explode(PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs); + $searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs); $dirs = []; foreach ($searchPath as $path) { // Silencing against https://bugs.php.net/69240 @@ -65,7 +65,7 @@ class ExecutableFinder } } else { $dirs = array_merge( - explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), + explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), $extraDirs ); } @@ -73,7 +73,7 @@ class ExecutableFinder $suffixes = ['']; if ('\\' === \DIRECTORY_SEPARATOR) { $pathExt = getenv('PATHEXT'); - $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); + $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); } foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { diff --git a/src/Symfony/Component/Process/PhpExecutableFinder.php b/src/Symfony/Component/Process/PhpExecutableFinder.php index a97aa12cbf..b9a8015655 100644 --- a/src/Symfony/Component/Process/PhpExecutableFinder.php +++ b/src/Symfony/Component/Process/PhpExecutableFinder.php @@ -40,12 +40,12 @@ class PhpExecutableFinder // HHVM support if (\defined('HHVM_VERSION')) { - return (getenv('PHP_BINARY') ?: PHP_BINARY).$args; + return (getenv('PHP_BINARY') ?: \PHP_BINARY).$args; } // PHP_BINARY return the current sapi executable - if (PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) { - return PHP_BINARY.$args; + if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) { + return \PHP_BINARY.$args; } if ($php = getenv('PHP_PATH')) { @@ -62,11 +62,11 @@ class PhpExecutableFinder } } - if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { + if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { return $php; } - $dirs = [PHP_BINDIR]; + $dirs = [\PHP_BINDIR]; if ('\\' === \DIRECTORY_SEPARATOR) { $dirs[] = 'C:\xampp\php\\'; } diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index f0c47b285a..a29c0db287 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -47,7 +47,7 @@ class PhpProcess extends Process $script = null; } if (null !== $options) { - @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); } parent::__construct($php, $cwd, $env, $script, $timeout, $options); diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 8973f58bee..36ea57e5bc 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -62,17 +62,17 @@ class WindowsPipes extends AbstractPipes restore_error_handler(); throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError); } - if (!flock($h, LOCK_EX | LOCK_NB)) { + if (!flock($h, \LOCK_EX | \LOCK_NB)) { continue 2; } if (isset($this->lockHandles[$pipe])) { - flock($this->lockHandles[$pipe], LOCK_UN); + flock($this->lockHandles[$pipe], \LOCK_UN); fclose($this->lockHandles[$pipe]); } $this->lockHandles[$pipe] = $h; if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) { - flock($this->lockHandles[$pipe], LOCK_UN); + flock($this->lockHandles[$pipe], \LOCK_UN); fclose($this->lockHandles[$pipe]); unset($this->lockHandles[$pipe]); continue 2; @@ -152,7 +152,7 @@ class WindowsPipes extends AbstractPipes if ($close) { ftruncate($fileHandle, 0); fclose($fileHandle); - flock($this->lockHandles[$type], LOCK_UN); + flock($this->lockHandles[$type], \LOCK_UN); fclose($this->lockHandles[$type]); unset($this->fileHandles[$type], $this->lockHandles[$type]); } @@ -186,7 +186,7 @@ class WindowsPipes extends AbstractPipes foreach ($this->fileHandles as $type => $handle) { ftruncate($handle, 0); fclose($handle); - flock($this->lockHandles[$type], LOCK_UN); + flock($this->lockHandles[$type], \LOCK_UN); fclose($this->lockHandles[$type]); } $this->fileHandles = $this->lockHandles = []; diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 68d52512ed..91ce2c4987 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -167,7 +167,7 @@ class Process implements \IteratorAggregate $this->pty = false; $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); if (null !== $options) { - @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); $this->options = array_replace($this->options, $options); } } @@ -268,7 +268,7 @@ class Process implements \IteratorAggregate if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[1]->name)) { - @trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), \E_USER_DEPRECATED); } } $env = null; @@ -302,7 +302,7 @@ class Process implements \IteratorAggregate if (null !== $env && $inheritEnv) { $env += $this->getDefaultEnv(); } elseif (null !== $env) { - @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', E_USER_DEPRECATED); + @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', \E_USER_DEPRECATED); } else { $env = $this->getDefaultEnv(); } @@ -333,7 +333,7 @@ class Process implements \IteratorAggregate } if (!is_dir($this->cwd)) { - @trigger_error('The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); + @trigger_error('The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); } $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); @@ -906,7 +906,7 @@ class Process implements \IteratorAggregate { $this->lastOutputTime = microtime(true); - fseek($this->stdout, 0, SEEK_END); + fseek($this->stdout, 0, \SEEK_END); fwrite($this->stdout, $line); fseek($this->stdout, $this->incrementalOutputOffset); } @@ -922,7 +922,7 @@ class Process implements \IteratorAggregate { $this->lastOutputTime = microtime(true); - fseek($this->stderr, 0, SEEK_END); + fseek($this->stderr, 0, \SEEK_END); fwrite($this->stderr, $line); fseek($this->stderr, $this->incrementalErrorOutputOffset); } @@ -1185,7 +1185,7 @@ class Process implements \IteratorAggregate */ public function getOptions() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); return $this->options; } @@ -1201,7 +1201,7 @@ class Process implements \IteratorAggregate */ public function setOptions(array $options) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); $this->options = $options; @@ -1219,7 +1219,7 @@ class Process implements \IteratorAggregate */ public function getEnhanceWindowsCompatibility() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); return $this->enhanceWindowsCompatibility; } @@ -1235,7 +1235,7 @@ class Process implements \IteratorAggregate */ public function setEnhanceWindowsCompatibility($enhance) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); $this->enhanceWindowsCompatibility = (bool) $enhance; @@ -1251,7 +1251,7 @@ class Process implements \IteratorAggregate */ public function getEnhanceSigchildCompatibility() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); return $this->enhanceSigchildCompatibility; } @@ -1271,7 +1271,7 @@ class Process implements \IteratorAggregate */ public function setEnhanceSigchildCompatibility($enhance) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); $this->enhanceSigchildCompatibility = (bool) $enhance; @@ -1288,7 +1288,7 @@ class Process implements \IteratorAggregate public function inheritEnvironmentVariables($inheritEnv = true) { if (!$inheritEnv) { - @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', E_USER_DEPRECATED); + @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', \E_USER_DEPRECATED); } $this->inheritEnv = (bool) $inheritEnv; @@ -1305,7 +1305,7 @@ class Process implements \IteratorAggregate */ public function areEnvironmentVariablesInherited() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Environment variables will always be inherited.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Environment variables will always be inherited.', __METHOD__), \E_USER_DEPRECATED); return $this->inheritEnv; } @@ -1452,7 +1452,7 @@ class Process implements \IteratorAggregate } ob_start(); - phpinfo(INFO_GENERAL); + phpinfo(\INFO_GENERAL); return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild'); } diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index 69d13c3f1b..6a8e1ef83d 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Process; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), \E_USER_DEPRECATED); use Symfony\Component\Process\Exception\InvalidArgumentException; use Symfony\Component\Process\Exception\LogicException; diff --git a/src/Symfony/Component/Process/ProcessUtils.php b/src/Symfony/Component/Process/ProcessUtils.php index 74f2d8654a..1c02768845 100644 --- a/src/Symfony/Component/Process/ProcessUtils.php +++ b/src/Symfony/Component/Process/ProcessUtils.php @@ -40,7 +40,7 @@ class ProcessUtils */ public static function escapeArgument($argument) { - @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use a command line array or give env vars to the Process::start/run() method instead.', E_USER_DEPRECATED); + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use a command line array or give env vars to the Process::start/run() method instead.', \E_USER_DEPRECATED); //Fix for PHP bug #43784 escapeshellarg removes % from given string //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows @@ -53,7 +53,7 @@ class ProcessUtils $escapedArgument = ''; $quote = false; - foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { + foreach (preg_split('/(")/', $argument, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE) as $part) { if ('"' === $part) { $escapedArgument .= '\\"'; } elseif (self::isSurroundedBy($part, '%')) { diff --git a/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php b/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php index c37aeb5c8f..37c1e65846 100755 --- a/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php +++ b/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php @@ -25,12 +25,12 @@ try { while (false === strpos($process->getOutput(), 'ready')) { usleep(1000); } - $process->signal(SIGSTOP); + $process->signal(\SIGSTOP); $process->wait(); return $process->getExitCode(); } catch (ProcessTimedOutException $t) { - echo $t->getMessage().PHP_EOL; + echo $t->getMessage().\PHP_EOL; return 1; } diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php index 2942695af3..72e6ff6ea3 100644 --- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php @@ -41,12 +41,12 @@ class ExecutableFinderTest extends TestCase $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->setPath(\dirname(PHP_BINARY)); + $this->setPath(\dirname(\PHP_BINARY)); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); - $this->assertSamePath(PHP_BINARY, $result); + $this->assertSamePath(\PHP_BINARY, $result); } public function testFindWithDefault() @@ -88,12 +88,12 @@ class ExecutableFinderTest extends TestCase $this->setPath(''); - $extraDirs = [\dirname(PHP_BINARY)]; + $extraDirs = [\dirname(\PHP_BINARY)]; $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), null, $extraDirs); - $this->assertSamePath(PHP_BINARY, $result); + $this->assertSamePath(\PHP_BINARY, $result); } public function testFindWithOpenBaseDir() @@ -106,12 +106,12 @@ class ExecutableFinderTest extends TestCase $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->iniSet('open_basedir', \dirname(PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', \dirname(\PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? \PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); - $this->assertSamePath(PHP_BINARY, $result); + $this->assertSamePath(\PHP_BINARY, $result); } public function testFindProcessInOpenBasedir() @@ -124,12 +124,12 @@ class ExecutableFinderTest extends TestCase } $this->setPath(''); - $this->iniSet('open_basedir', PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', \PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? \PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), false); - $this->assertSamePath(PHP_BINARY, $result); + $this->assertSamePath(\PHP_BINARY, $result); } public function testFindBatchExecutableOnWindows() @@ -170,6 +170,6 @@ class ExecutableFinderTest extends TestCase private function getPhpBinaryName() { - return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : ''); + return basename(\PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : ''); } } diff --git a/src/Symfony/Component/Process/Tests/NonStopableProcess.php b/src/Symfony/Component/Process/Tests/NonStopableProcess.php index 5643259657..c695f544d2 100644 --- a/src/Symfony/Component/Process/Tests/NonStopableProcess.php +++ b/src/Symfony/Component/Process/Tests/NonStopableProcess.php @@ -19,10 +19,10 @@ function handleSignal($signal) { switch ($signal) { - case SIGTERM: + case \SIGTERM: $name = 'SIGTERM'; break; - case SIGINT: + case \SIGINT: $name = 'SIGINT'; break; default: @@ -33,8 +33,8 @@ function handleSignal($signal) echo "signal $name\n"; } -pcntl_signal(SIGTERM, 'handleSignal'); -pcntl_signal(SIGINT, 'handleSignal'); +pcntl_signal(\SIGTERM, 'handleSignal'); +pcntl_signal(\SIGINT, 'handleSignal'); echo 'received '; diff --git a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php index bf4d81a41b..731e9b1215 100644 --- a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php @@ -30,7 +30,7 @@ class PhpExecutableFinderTest extends TestCase $f = new PhpExecutableFinder(); - $current = PHP_BINARY; + $current = \PHP_BINARY; $args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : ''; $this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP'); @@ -48,7 +48,7 @@ class PhpExecutableFinderTest extends TestCase $f = new PhpExecutableFinder(); - $current = getenv('PHP_BINARY') ?: PHP_BINARY; + $current = getenv('PHP_BINARY') ?: \PHP_BINARY; $this->assertEquals($current.' --php', $f->find(), '::find() returns the executable PHP'); $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP'); diff --git a/src/Symfony/Component/Process/Tests/PhpProcessTest.php b/src/Symfony/Component/Process/Tests/PhpProcessTest.php index d34e84222c..c76ace7909 100644 --- a/src/Symfony/Component/Process/Tests/PhpProcessTest.php +++ b/src/Symfony/Component/Process/Tests/PhpProcessTest.php @@ -43,6 +43,6 @@ PHP $process->wait(); $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); - $this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput()); + $this->assertSame(\PHP_VERSION.\PHP_SAPI, $process->getOutput()); } } diff --git a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php index 2e7716de7f..a206d2b8e0 100644 --- a/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php +++ b/src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -14,12 +14,12 @@ define('ERR_TIMEOUT', 2); define('ERR_READ_FAILED', 3); define('ERR_WRITE_FAILED', 4); -$read = [STDIN]; -$write = [STDOUT, STDERR]; +$read = [\STDIN]; +$write = [\STDOUT, \STDERR]; -stream_set_blocking(STDIN, 0); -stream_set_blocking(STDOUT, 0); -stream_set_blocking(STDERR, 0); +stream_set_blocking(\STDIN, 0); +stream_set_blocking(\STDOUT, 0); +stream_set_blocking(\STDERR, 0); $out = $err = ''; while ($read || $write) { @@ -34,37 +34,37 @@ while ($read || $write) { exit(ERR_TIMEOUT); } - if (in_array(STDOUT, $w) && strlen($out) > 0) { - $written = fwrite(STDOUT, (string) $out, 32768); + if (in_array(\STDOUT, $w) && strlen($out) > 0) { + $written = fwrite(\STDOUT, (string) $out, 32768); if (false === $written) { exit(ERR_WRITE_FAILED); } $out = (string) substr($out, $written); } if (null === $read && '' === $out) { - $write = array_diff($write, [STDOUT]); + $write = array_diff($write, [\STDOUT]); } - if (in_array(STDERR, $w) && strlen($err) > 0) { - $written = fwrite(STDERR, (string) $err, 32768); + if (in_array(\STDERR, $w) && strlen($err) > 0) { + $written = fwrite(\STDERR, (string) $err, 32768); if (false === $written) { exit(ERR_WRITE_FAILED); } $err = (string) substr($err, $written); } if (null === $read && '' === $err) { - $write = array_diff($write, [STDERR]); + $write = array_diff($write, [\STDERR]); } if ($r) { - $str = fread(STDIN, 32768); + $str = fread(\STDIN, 32768); if (false !== $str) { $out .= $str; $err .= $str; } - if (false === $str || feof(STDIN)) { + if (false === $str || feof(\STDIN)) { $read = null; - if (!feof(STDIN)) { + if (!feof(\STDIN)) { exit(ERR_READ_FAILED); } } diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 2a58852351..cbb5f70f2a 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -36,7 +36,7 @@ class ProcessTest extends TestCase self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find()); ob_start(); - phpinfo(INFO_GENERAL); + phpinfo(\INFO_GENERAL); self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild'); } @@ -71,12 +71,12 @@ class ProcessTest extends TestCase if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test is transient on Windows'); } - @trigger_error('Test Error', E_USER_NOTICE); + @trigger_error('Test Error', \E_USER_NOTICE); $process = $this->getProcessForCode('sleep(3)'); $process->run(); $actualError = error_get_last(); $this->assertEquals('Test Error', $actualError['message']); - $this->assertEquals(E_USER_NOTICE, $actualError['type']); + $this->assertEquals(\E_USER_NOTICE, $actualError['type']); } public function testNegativeTimeoutFromConstructor() @@ -166,7 +166,7 @@ class ProcessTest extends TestCase $process->wait(); - $this->assertSame('foo'.PHP_EOL, $data); + $this->assertSame('foo'.\PHP_EOL, $data); } /** @@ -371,7 +371,7 @@ class ProcessTest extends TestCase $p = $this->getProcessForCode('file_put_contents($s = \''.$uri.'\', \'foo\'); flock(fopen('.var_export($lock, true).', \'r\'), LOCK_EX); file_put_contents($s, \'bar\');'); $h = fopen($lock, 'w'); - flock($h, LOCK_EX); + flock($h, \LOCK_EX); $p->start(); @@ -383,7 +383,7 @@ class ProcessTest extends TestCase $this->assertSame($s, $p->$getIncrementalOutput()); $this->assertSame('', $p->$getIncrementalOutput()); - flock($h, LOCK_UN); + flock($h, \LOCK_UN); } fclose($h); @@ -512,7 +512,7 @@ class ProcessTest extends TestCase $process = $this->getProcess('echo foo'); $this->assertSame($process, $process->mustRun()); - $this->assertEquals('foo'.PHP_EOL, $process->getOutput()); + $this->assertEquals('foo'.\PHP_EOL, $process->getOutput()); } public function testSuccessfulMustRunHasCorrectExitCode() @@ -893,7 +893,7 @@ class ProcessTest extends TestCase while (false === strpos($process->getOutput(), 'Caught')) { usleep(1000); } - $process->signal(SIGUSR1); + $process->signal(\SIGUSR1); $process->wait(); $this->assertEquals('Caught SIGUSR1', $process->getOutput()); @@ -908,7 +908,7 @@ class ProcessTest extends TestCase $process = $this->getProcess('sleep 4'); $process->start(); - $process->signal(SIGKILL); + $process->signal(\SIGKILL); while ($process->isRunning()) { usleep(10000); @@ -1386,7 +1386,7 @@ class ProcessTest extends TestCase $process->run(); - $this->assertSame('hello'.PHP_EOL, $process->getOutput()); + $this->assertSame('hello'.\PHP_EOL, $process->getOutput()); $this->assertSame('', $process->getErrorOutput()); } diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index 9e30ce3bbb..618be74050 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -pcntl_signal(SIGUSR1, function () { echo 'SIGUSR1'; exit; }); +pcntl_signal(\SIGUSR1, function () { echo 'SIGUSR1'; exit; }); echo 'Caught '; diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 07e0204cd2..d3599c758d 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -246,7 +246,7 @@ class PropertyAccessor implements PropertyAccessorInterface */ public static function handleError($type, $message, $file, $line, $context = []) { - if (E_RECOVERABLE_ERROR === $type) { + if (\E_RECOVERABLE_ERROR === $type) { self::throwInvalidArgumentException($message, debug_backtrace(false), 1); } @@ -961,7 +961,7 @@ class PropertyAccessor implements PropertyAccessorInterface } $apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version); - if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { + if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { $apcu->setLogger(new NullLogger()); } elseif (null !== $logger) { $apcu->setLogger($logger); diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index 02e598f709..733d091e80 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -44,7 +44,7 @@ class StringUtil */ public static function singularify($plural) { - @trigger_error('StringUtil::singularify() is deprecated since Symfony 3.1 and will be removed in 4.0. Use Symfony\Component\Inflector\Inflector::singularize instead.', E_USER_DEPRECATED); + @trigger_error('StringUtil::singularify() is deprecated since Symfony 3.1 and will be removed in 4.0. Use Symfony\Component\Inflector\Inflector::singularize instead.', \E_USER_DEPRECATED); return Inflector::singularize($plural); } diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 42c6349227..89893140af 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -260,7 +260,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt unset($extra['_fragment']); } - if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) { + if ($extra && $query = http_build_query($extra, '', '&', \PHP_QUERY_RFC3986)) { // "/" and "?" can be left decoded for better user experience, see // http://tools.ietf.org/html/rfc3986#section-3.4 $url .= '?'.strtr($query, ['%2F' => '/']); diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 6ced874c11..33d310503d 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -77,7 +77,7 @@ class AnnotationFileLoader extends FileLoader */ public function supports($resource, $type = null) { - return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); + return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); } /** @@ -93,11 +93,11 @@ class AnnotationFileLoader extends FileLoader $namespace = false; $tokens = token_get_all(file_get_contents($file)); - if (1 === \count($tokens) && T_INLINE_HTML === $tokens[0][0]) { + if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the " true, T_STRING => true]; + $nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true]; if (\defined('T_NAME_QUALIFIED')) { $nsTokens[T_NAME_QUALIFIED] = true; } @@ -109,7 +109,7 @@ class AnnotationFileLoader extends FileLoader continue; } - if (true === $class && T_STRING === $token[0]) { + if (true === $class && \T_STRING === $token[0]) { return $namespace.'\\'.$token[1]; } @@ -121,7 +121,7 @@ class AnnotationFileLoader extends FileLoader $token = $tokens[$i]; } - if (T_CLASS === $token[0]) { + if (\T_CLASS === $token[0]) { // Skip usage of ::class constant and anonymous classes $skipClassToken = false; for ($j = $i - 1; $j > 0; --$j) { @@ -129,10 +129,10 @@ class AnnotationFileLoader extends FileLoader break; } - if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) { + if (\T_DOUBLE_COLON === $tokens[$j][0] || \T_NEW === $tokens[$j][0]) { $skipClassToken = true; break; - } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) { + } elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) { break; } } @@ -142,7 +142,7 @@ class AnnotationFileLoader extends FileLoader } } - if (T_NAMESPACE === $token[0]) { + if (\T_NAMESPACE === $token[0]) { $namespace = true; } } diff --git a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php index d9ba59d51e..8acb9258b3 100644 --- a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php @@ -63,7 +63,7 @@ class PhpFileLoader extends FileLoader */ public function supports($resource, $type = null) { - return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); + return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'php' === $type); } } diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index a9a9d09e08..43112dff98 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -93,7 +93,7 @@ class XmlFileLoader extends FileLoader */ public function supports($resource, $type = null) { - return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); + return \is_string($resource) && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'xml' === $type); } /** @@ -111,8 +111,8 @@ class XmlFileLoader extends FileLoader throw new \InvalidArgumentException(sprintf('The element in file "%s" must have an "id" and a "path" attribute.', $path)); } - $schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY); - $methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY); + $schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY); + $methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY); list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); @@ -139,8 +139,8 @@ class XmlFileLoader extends FileLoader $type = $node->getAttribute('type'); $prefix = $node->getAttribute('prefix'); $host = $node->hasAttribute('host') ? $node->getAttribute('host') : null; - $schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null; - $methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null; + $schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY) : null; + $methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY) : null; list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index f527c755b7..caed47bdc1 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -58,7 +58,7 @@ class YamlFileLoader extends FileLoader } $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message; + $message = \E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message; return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; }); @@ -102,7 +102,7 @@ class YamlFileLoader extends FileLoader */ public function supports($resource, $type = null) { - return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type); + return \is_string($resource) && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type); } /** diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index 40fc6d9fef..abff010340 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -104,7 +104,7 @@ class RouteCompiler implements RouteCompilerInterface if (!$needsUtf8 && $useUtf8 && preg_match('/[\x80-\xFF]/', $pattern)) { $needsUtf8 = true; - @trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), E_USER_DEPRECATED); + @trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), \E_USER_DEPRECATED); } if (!$useUtf8 && $needsUtf8) { throw new \LogicException(sprintf('Cannot mix UTF-8 requirements with non-UTF-8 pattern "%s".', $pattern)); @@ -112,7 +112,7 @@ class RouteCompiler implements RouteCompilerInterface // Match all variables enclosed in "{}" and iterate over them. But we only want to match the innermost variable // in case of nested "{}", e.g. {foo{bar}}. This in ensured because \w does not match "{" or "}" itself. - preg_match_all('#\{\w+\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + preg_match_all('#\{\w+\}#', $pattern, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER); foreach ($matches as $match) { $varName = substr($match[0][0], 1, -1); // get all static text preceding the current variable @@ -177,7 +177,7 @@ class RouteCompiler implements RouteCompilerInterface $useUtf8 = false; } elseif (!$needsUtf8 && preg_match('/[\x80-\xFF]|(?= 0; --$i) { $token = $tokens[$i]; diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index 20f99da9bc..8a03d264a1 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -233,7 +233,7 @@ abstract class AbstractToken implements TokenInterface protected function doSerialize($serialized, $isCalledFromOverridingMethod) { if (null === $isCalledFromOverridingMethod) { - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); + $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); $isCalledFromOverridingMethod = isset($trace[2]['function'], $trace[2]['object']) && 'serialize' === $trace[2]['function'] && $this === $trace[2]['object']; } diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php index 95627ca4a6..937f6026d5 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php @@ -62,7 +62,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface */ public function setVoters(array $voters) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the voters to the constructor instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the voters to the constructor instead.', __METHOD__), \E_USER_DEPRECATED); $this->voters = $voters; } @@ -191,7 +191,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface } if (method_exists($voter, 'vote')) { - @trigger_error(sprintf('Calling vote() on an voter without %1$s is deprecated as of 3.4 and will be removed in 4.0. Implement the %1$s on your voter.', VoterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling vote() on an voter without %1$s is deprecated as of 3.4 and will be removed in 4.0. Implement the %1$s on your voter.', VoterInterface::class), \E_USER_DEPRECATED); // making the assumption that the signature matches return $voter->vote($token, $subject, $attributes); diff --git a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php index 81cdfd766a..d5dda6abce 100644 --- a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php @@ -67,7 +67,7 @@ class TraceableAccessDecisionManager implements AccessDecisionManagerInterface */ public function setVoters(array $voters) { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead.', __METHOD__), \E_USER_DEPRECATED); if (!method_exists($this->manager, 'setVoters')) { return; diff --git a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php index e812cd25b1..99738365ad 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php @@ -26,7 +26,7 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE return true; } - return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); + return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>='); } /** @@ -79,15 +79,15 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE private function encodePasswordNative($raw) { - return password_hash($raw, PASSWORD_ARGON2I); + return password_hash($raw, \PASSWORD_ARGON2I); } private function encodePasswordSodiumFunction($raw) { $hash = sodium_crypto_pwhash_str( $raw, - SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, - SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE + \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, + \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE ); sodium_memzero($raw); diff --git a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php index 1a7be2b4d2..8db2564606 100644 --- a/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php @@ -71,7 +71,7 @@ class BCryptPasswordEncoder extends BasePasswordEncoder implements SelfSaltingEn // Ignore $salt, the auto-generated one is always the best } - return password_hash($raw, PASSWORD_BCRYPT, $options); + return password_hash($raw, \PASSWORD_BCRYPT, $options); } /** diff --git a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php index b34f7d72b9..fa86be3f30 100644 --- a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php @@ -60,7 +60,7 @@ class AuthenticationException extends \RuntimeException implements \Serializable protected function doSerialize($serialized, $isCalledFromOverridingMethod) { if (null === $isCalledFromOverridingMethod) { - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); + $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); $isCalledFromOverridingMethod = isset($trace[2]['function'], $trace[2]['object']) && 'serialize' === $trace[2]['function'] && $this === $trace[2]['object']; } diff --git a/src/Symfony/Component/Security/Core/Exception/NonceExpiredException.php b/src/Symfony/Component/Security/Core/Exception/NonceExpiredException.php index 9e748725da..aa7c8af880 100644 --- a/src/Symfony/Component/Security/Core/Exception/NonceExpiredException.php +++ b/src/Symfony/Component/Security/Core/Exception/NonceExpiredException.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Security\Core\Exception; -@trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', NonceExpiredException::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', NonceExpiredException::class), \E_USER_DEPRECATED); /** * NonceExpiredException is thrown when an authentication is rejected because diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 05f30b4533..584fcb9337 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -47,11 +47,11 @@ class NativeSessionTokenStorageTest extends TestCase { session_id('foobar'); - $this->assertSame(PHP_SESSION_NONE, session_status()); + $this->assertSame(\PHP_SESSION_NONE, session_status()); $this->storage->setToken('token_id', 'TOKEN'); - $this->assertSame(PHP_SESSION_ACTIVE, session_status()); + $this->assertSame(\PHP_SESSION_ACTIVE, session_status()); $this->assertSame([self::SESSION_NAMESPACE => ['token_id' => 'TOKEN']], $_SESSION); } diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php index 26fa73304a..434ac6d2c6 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php @@ -112,7 +112,7 @@ class NativeSessionTokenStorage implements ClearableTokenStorageInterface private function startSession() { - if (PHP_SESSION_NONE === session_status()) { + if (\PHP_SESSION_NONE === session_status()) { session_start(); } diff --git a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php index f905b2f6b3..5e90059f5b 100644 --- a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php @@ -27,7 +27,7 @@ abstract class AbstractGuardAuthenticator implements AuthenticatorInterface */ public function supports(Request $request) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.', __METHOD__, AuthenticatorInterface::class, static::class), \E_USER_DEPRECATED); return true; } diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index 60f5a36797..9a7c0b841c 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -61,7 +61,7 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { - @trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', static::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', static::class), \E_USER_DEPRECATED); if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) { throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in "%s".', static::class)); diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index dc0da956a4..11bda3cd18 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -132,7 +132,7 @@ class GuardAuthenticationListener implements ListenerInterface } if ($guardAuthenticator instanceof AbstractGuardAuthenticator) { - @trigger_error(sprintf('Returning null from "%1$s::getCredentials()" is deprecated since Symfony 3.4 and will throw an \UnexpectedValueException in 4.0. Return false from "%1$s::supports()" instead.', \get_class($guardAuthenticator)), E_USER_DEPRECATED); + @trigger_error(sprintf('Returning null from "%1$s::getCredentials()" is deprecated since Symfony 3.4 and will throw an \UnexpectedValueException in 4.0. Return false from "%1$s::supports()" instead.', \get_class($guardAuthenticator)), \E_USER_DEPRECATED); return; } diff --git a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php index 160cd927a6..e4a2f54834 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php @@ -33,7 +33,7 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac public function __construct($realmName, $secret, $nonceValiditySeconds = 300, LoggerInterface $logger = null) { - @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); $this->realmName = $realmName; $this->secret = $secret; diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index af912c446c..174c3c0541 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -196,7 +196,7 @@ class ContextListener implements ListenerInterface continue; } - @trigger_error('Refreshing a deauthenticated user is deprecated as of 3.4 and will trigger a logout in 4.0.', E_USER_DEPRECATED); + @trigger_error('Refreshing a deauthenticated user is deprecated as of 3.4 and will trigger a logout in 4.0.', \E_USER_DEPRECATED); } $token->setUser($refreshedUser); diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index 2308896e85..4499546acc 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -44,7 +44,7 @@ class DigestAuthenticationListener implements ListenerInterface public function __construct(TokenStorageInterface $tokenStorage, UserProviderInterface $provider, $providerKey, DigestAuthenticationEntryPoint $authenticationEntryPoint, LoggerInterface $logger = null) { - @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); if (empty($providerKey)) { throw new \InvalidArgumentException('$providerKey must not be empty.'); @@ -175,10 +175,10 @@ class DigestData public function __construct($header) { - @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The %s class and the whole HTTP digest authentication system is deprecated since Symfony 3.4 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); $this->header = $header; - preg_match_all('/(\w+)=("((?:[^"\\\\]|\\\\.)+)"|([^\s,$]+))/', $header, $matches, PREG_SET_ORDER); + preg_match_all('/(\w+)=("((?:[^"\\\\]|\\\\.)+)"|([^\s,$]+))/', $header, $matches, \PREG_SET_ORDER); foreach ($matches as $match) { if (isset($match[1]) && isset($match[3])) { $this->elements[$match[1]] = isset($match[4]) ? $match[4] : $match[3]; diff --git a/src/Symfony/Component/Security/Http/HttpUtils.php b/src/Symfony/Component/Security/Http/HttpUtils.php index 0ed28f49b0..460c95efc5 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -162,7 +162,7 @@ class HttpUtils // fortunately, they all are, so we have to remove entire query string $position = strpos($url, '?'); if (false !== $position) { - $fragment = parse_url($url, PHP_URL_FRAGMENT); + $fragment = parse_url($url, \PHP_URL_FRAGMENT); $url = substr($url, 0, $position); // fragment must be preserved if ($fragment) { diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index b00d34f90f..74341d5603 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -55,7 +55,7 @@ class LogoutUrlGenerator if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a 6th `string $context = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a 6th `string $context = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index e4f6795a6a..790fbc44e5 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -78,11 +78,11 @@ class JsonDecode implements DecoderInterface throw new NotEncodableValueException($e->getMessage(), 0, $e); } - if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $options)) { + if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $options)) { return $decodedData; } - if (JSON_ERROR_NONE !== json_last_error()) { + if (\JSON_ERROR_NONE !== json_last_error()) { throw new NotEncodableValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php index 71f6950394..955c92d8e7 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncode.php @@ -43,11 +43,11 @@ class JsonEncode implements EncoderInterface throw new NotEncodableValueException($e->getMessage(), 0, $e); } - if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $options)) { + if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $options)) { return $encodedJson; } - if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & JSON_PARTIAL_OUTPUT_ON_ERROR))) { + if (\JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & \JSON_PARTIAL_OUTPUT_ON_ERROR))) { throw new NotEncodableValueException(json_last_error_msg()); } diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 412dbb2f37..1cf8ee126f 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -44,7 +44,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec public function __construct($rootNodeName = 'response', $loadOptions = null) { $this->rootNodeName = $rootNodeName; - $this->loadOptions = null !== $loadOptions ? $loadOptions : LIBXML_NONET | LIBXML_NOBLANKS; + $this->loadOptions = null !== $loadOptions ? $loadOptions : \LIBXML_NONET | \LIBXML_NOBLANKS; } /** @@ -83,7 +83,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec } $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } libxml_clear_errors(); @@ -92,7 +92,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec $dom->loadXML($data, $this->loadOptions); libxml_use_internal_errors($internalErrors); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -104,10 +104,10 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec $rootNode = null; foreach ($dom->childNodes as $child) { - if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { + if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) { throw new NotEncodableValueException('Document types are not allowed.'); } - if (!$rootNode && XML_PI_NODE !== $child->nodeType) { + if (!$rootNode && \XML_PI_NODE !== $child->nodeType) { $rootNode = $child; } } @@ -310,7 +310,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec continue; } - if (false !== $val = filter_var($attr->nodeValue, FILTER_VALIDATE_INT)) { + if (false !== $val = filter_var($attr->nodeValue, \FILTER_VALIDATE_INT)) { $data['@'.$attr->nodeName] = $val; continue; @@ -333,14 +333,14 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec return $node->nodeValue; } - if (1 === $node->childNodes->length && \in_array($node->firstChild->nodeType, [XML_TEXT_NODE, XML_CDATA_SECTION_NODE])) { + if (1 === $node->childNodes->length && \in_array($node->firstChild->nodeType, [\XML_TEXT_NODE, \XML_CDATA_SECTION_NODE])) { return $node->firstChild->nodeValue; } $value = []; foreach ($node->childNodes as $subnode) { - if (XML_PI_NODE === $subnode->nodeType) { + if (\XML_PI_NODE === $subnode->nodeType) { continue; } diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php index 294dfd9e36..7e01131e6f 100644 --- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php +++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php @@ -35,7 +35,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface $this->cache = $cache; if (null !== $cache) { - @trigger_error(sprintf('Passing a Doctrine Cache instance as 2nd parameter of the "%s" constructor is deprecated since Symfony 3.1. This parameter will be removed in Symfony 4.0. Use the "%s" class instead.', __CLASS__, CacheClassMetadataFactory::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a Doctrine Cache instance as 2nd parameter of the "%s" constructor is deprecated since Symfony 3.1. This parameter will be removed in Symfony 4.0. Use the "%s" class instead.', __CLASS__, CacheClassMetadataFactory::class), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index e88b5a2110..ca0490d1ae 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -307,7 +307,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', static::class, __FUNCTION__), E_USER_DEPRECATED); + @trigger_error(sprintf('Method %s::%s() will have a 6th `string $format = null` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', static::class, __FUNCTION__), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 87b32a6ca5..1d885ee9d1 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -196,7 +196,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), \E_USER_DEPRECATED); } } @@ -217,7 +217,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), \E_USER_DEPRECATED); } } @@ -295,7 +295,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), \E_USER_DEPRECATED); } } @@ -316,7 +316,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), \E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php index 1a3d7c8675..266acc6a6e 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php @@ -45,7 +45,7 @@ class JsonEncodeTest extends TestCase { return [ [[], '[]', []], - [[], '{}', ['json_encode_options' => JSON_FORCE_OBJECT]], + [[], '{}', ['json_encode_options' => \JSON_FORCE_OBJECT]], ]; } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php index 191e8dc35d..30a80444a6 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php @@ -48,7 +48,7 @@ class JsonEncoderTest extends TestCase public function testOptions() { - $context = ['json_encode_options' => JSON_NUMERIC_CHECK]; + $context = ['json_encode_options' => \JSON_NUMERIC_CHECK]; $arr = []; $arr['foo'] = '3'; @@ -78,7 +78,7 @@ class JsonEncoderTest extends TestCase public function testEncodeNotUtf8WithPartialOnError() { - $context = ['json_encode_options' => JSON_PARTIAL_OUTPUT_ON_ERROR]; + $context = ['json_encode_options' => \JSON_PARTIAL_OUTPUT_ON_ERROR]; $arr = [ 'utf8' => 'Hello World!', @@ -88,16 +88,16 @@ class JsonEncoderTest extends TestCase $result = $this->encoder->encode($arr, 'json', $context); $jsonLastError = json_last_error(); - $this->assertSame(JSON_ERROR_UTF8, $jsonLastError); + $this->assertSame(\JSON_ERROR_UTF8, $jsonLastError); $this->assertEquals('{"utf8":"Hello World!","notUtf8":null}', $result); - $this->assertEquals('0', $this->serializer->serialize(NAN, 'json', $context)); + $this->assertEquals('0', $this->serializer->serialize(\NAN, 'json', $context)); } public function testDecodeFalseString() { $result = $this->encoder->decode('false', 'json'); - $this->assertSame(JSON_ERROR_NONE, json_last_error()); + $this->assertSame(\JSON_ERROR_NONE, json_last_error()); $this->assertFalse($result); } diff --git a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php index 016018cf1b..776442f055 100644 --- a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php @@ -106,7 +106,7 @@ class FilesystemLoader extends Loader && ':' == $file[1] && ('\\' == $file[2] || '/' == $file[2]) ) - || null !== parse_url($file, PHP_URL_SCHEME) + || null !== parse_url($file, \PHP_URL_SCHEME) ) { return true; } diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index dd0874fb62..4fde144f11 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -143,7 +143,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess // the view variable is exposed to the require file below $view = $this; if ($this->evalTemplate instanceof FileStorage) { - extract($this->evalParameters, EXTR_SKIP); + extract($this->evalParameters, \EXTR_SKIP); $this->evalParameters = null; ob_start(); @@ -153,7 +153,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess return ob_get_clean(); } elseif ($this->evalTemplate instanceof StringStorage) { - extract($this->evalParameters, EXTR_SKIP); + extract($this->evalParameters, \EXTR_SKIP); $this->evalParameters = null; ob_start(); @@ -417,7 +417,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess */ protected function initializeEscapers() { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; + $flags = \ENT_QUOTES | \ENT_SUBSTITUTE; $this->escapers = [ 'html' => diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 6b1976dc6b..65d5a0e54c 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -180,7 +180,7 @@ EOF } }); - $io->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); return min($errors, 1); } @@ -207,13 +207,13 @@ EOF */ private function getStdin() { - if (0 !== ftell(STDIN)) { + if (0 !== ftell(\STDIN)) { return null; } $inputs = ''; - while (!feof(STDIN)) { - $inputs .= fread(STDIN, 1024); + while (!feof(\STDIN)) { + $inputs .= fread(\STDIN, 1024); } return $inputs; diff --git a/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php b/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php index 373a556ea4..5cad19ce58 100644 --- a/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php +++ b/src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php @@ -27,7 +27,7 @@ class TranslatorPass implements CompilerPassInterface public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update') { if ('translation.loader' === $readerServiceId && 2 > \func_num_args()) { - @trigger_error(sprintf('The default value for $readerServiceId in "%s()" will change in 4.0 to "translation.reader".', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The default value for $readerServiceId in "%s()" will change in 4.0 to "translation.reader".', __METHOD__), \E_USER_DEPRECATED); } $this->translatorServiceId = $translatorServiceId; diff --git a/src/Symfony/Component/Translation/Dumper/FileDumper.php b/src/Symfony/Component/Translation/Dumper/FileDumper.php index 62a6caa4d0..eebb932e02 100644 --- a/src/Symfony/Component/Translation/Dumper/FileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/FileDumper.php @@ -75,7 +75,7 @@ abstract class FileDumper implements DumperInterface $fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale()); if (file_exists($fullpath)) { if ($this->backup) { - @trigger_error('Creating a backup while dumping a message catalogue is deprecated since Symfony 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED); + @trigger_error('Creating a backup while dumping a message catalogue is deprecated since Symfony 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', \E_USER_DEPRECATED); copy($fullpath, $fullpath.'~'); } } else { diff --git a/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php b/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php index 15e065acec..78e10f26e2 100644 --- a/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/JsonFileDumper.php @@ -28,7 +28,7 @@ class JsonFileDumper extends FileDumper if (isset($options['json_encoding'])) { $flags = $options['json_encoding']; } else { - $flags = JSON_PRETTY_PRINT; + $flags = \JSON_PRETTY_PRINT; } return json_encode($messages->all($domain), $flags); diff --git a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php index ec2445d951..e46bedbd81 100644 --- a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php @@ -121,7 +121,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); - if (T_WHITESPACE !== $t[0]) { + if (\T_WHITESPACE !== $t[0]) { break; } } @@ -169,23 +169,23 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface } switch ($t[0]) { - case T_START_HEREDOC: + case \T_START_HEREDOC: $docToken = $t[1]; break; - case T_ENCAPSED_AND_WHITESPACE: - case T_CONSTANT_ENCAPSED_STRING: + case \T_ENCAPSED_AND_WHITESPACE: + case \T_CONSTANT_ENCAPSED_STRING: if ('' === $docToken) { $message .= PhpStringTokenParser::parse($t[1]); } else { $docPart = $t[1]; } break; - case T_END_HEREDOC: + case \T_END_HEREDOC: $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); $docToken = ''; $docPart = ''; break; - case T_WHITESPACE: + case \T_WHITESPACE: break; default: break 2; @@ -253,7 +253,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface */ protected function canBeExtracted($file) { - return $this->isFile($file) && 'php' === pathinfo($file, PATHINFO_EXTENSION); + return $this->isFile($file) && 'php' === pathinfo($file, \PATHINFO_EXTENSION); } /** diff --git a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php index a02732e8d8..14d00d794c 100644 --- a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php @@ -47,15 +47,15 @@ class JsonFileLoader extends FileLoader private function getJSONErrorMessage($errorCode) { switch ($errorCode) { - case JSON_ERROR_DEPTH: + case \JSON_ERROR_DEPTH: return 'Maximum stack depth exceeded'; - case JSON_ERROR_STATE_MISMATCH: + case \JSON_ERROR_STATE_MISMATCH: return 'Underflow or the modes mismatch'; - case JSON_ERROR_CTRL_CHAR: + case \JSON_ERROR_CTRL_CHAR: return 'Unexpected control character found'; - case JSON_ERROR_SYNTAX: + case \JSON_ERROR_SYNTAX: return 'Syntax error, malformed JSON'; - case JSON_ERROR_UTF8: + case \JSON_ERROR_UTF8: return 'Malformed UTF-8 characters, possibly incorrectly encoded'; default: return 'Unknown error'; diff --git a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php index 0991c3d3a2..c361d5293c 100644 --- a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php @@ -25,7 +25,7 @@ class PhpFileLoader extends FileLoader */ protected function loadResource($resource) { - if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { + if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { self::$cache = null; } diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 00b56f9d56..b728e70bad 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -189,7 +189,7 @@ class XliffFileLoader implements LoaderInterface { $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(false); $isValid = @$dom->schemaValidateSource($schema); libxml_disable_entity_loader($disableEntities); @@ -264,7 +264,7 @@ class XliffFileLoader implements LoaderInterface $errors = []; foreach (libxml_get_errors() as $error) { $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', + \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), $error->file ?: 'n/a', diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index b867c2113e..4040b2dfa6 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -39,7 +39,7 @@ class YamlFileLoader extends FileLoader } $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($resource, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message; + $message = \E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message; return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; }); diff --git a/src/Symfony/Component/Translation/Resources/bin/translation-status.php b/src/Symfony/Component/Translation/Resources/bin/translation-status.php index 44918c92ec..e3e6449630 100644 --- a/src/Symfony/Component/Translation/Resources/bin/translation-status.php +++ b/src/Symfony/Component/Translation/Resources/bin/translation-status.php @@ -61,7 +61,7 @@ foreach (array_slice($argv, 1) as $argumentOrOption) { foreach ($config['original_files'] as $originalFilePath) { if (!file_exists($originalFilePath)) { - echo sprintf('The following file does not exist. Make sure that you execute this command at the root dir of the Symfony code repository.%s %s', PHP_EOL, $originalFilePath); + echo sprintf('The following file does not exist. Make sure that you execute this command at the root dir of the Symfony code repository.%s %s', \PHP_EOL, $originalFilePath); exit(1); } } @@ -89,7 +89,7 @@ function findTranslationFiles($originalFilePath, $localeToAnalyze) $originalFileName = basename($originalFilePath); $translationFileNamePattern = str_replace('.en.', '.*.', $originalFileName); - $translationFiles = glob($translationsDir.'/'.$translationFileNamePattern, GLOB_NOSORT); + $translationFiles = glob($translationsDir.'/'.$translationFileNamePattern, \GLOB_NOSORT); sort($translationFiles); foreach ($translationFiles as $filePath) { $locale = extractLocaleFromFilePath($filePath); @@ -127,7 +127,7 @@ function printTranslationStatus($originalFilePath, $translationStatus, $verboseO { printTitle($originalFilePath); printTable($translationStatus, $verboseOutput); - echo PHP_EOL.PHP_EOL; + echo \PHP_EOL.\PHP_EOL; } function extractLocaleFromFilePath($filePath) @@ -154,8 +154,8 @@ function extractTranslationKeys($filePath) function printTitle($title) { - echo $title.PHP_EOL; - echo str_repeat('=', strlen($title)).PHP_EOL.PHP_EOL; + echo $title.\PHP_EOL; + echo str_repeat('=', strlen($title)).\PHP_EOL.\PHP_EOL; } function printTable($translations, $verboseOutput) @@ -174,19 +174,19 @@ function printTable($translations, $verboseOutput) textColorGreen(); } - echo sprintf('| Locale: %-'.$longestLocaleNameLength.'s | Translated: %d/%d', $locale, $translation['translated'], $translation['total']).PHP_EOL; + echo sprintf('| Locale: %-'.$longestLocaleNameLength.'s | Translated: %d/%d', $locale, $translation['translated'], $translation['total']).\PHP_EOL; textColorNormal(); if (true === $verboseOutput && count($translation['missingKeys']) > 0) { - echo str_repeat('-', 80).PHP_EOL; - echo '| Missing Translations:'.PHP_EOL; + echo str_repeat('-', 80).\PHP_EOL; + echo '| Missing Translations:'.\PHP_EOL; foreach ($translation['missingKeys'] as $id => $content) { - echo sprintf('| (id=%s) %s', $id, $content).PHP_EOL; + echo sprintf('| (id=%s) %s', $id, $content).\PHP_EOL; } - echo str_repeat('-', 80).PHP_EOL; + echo str_repeat('-', 80).\PHP_EOL; } } } diff --git a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php index 04e3d86bec..e353f85d99 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php @@ -34,6 +34,6 @@ class JsonFileDumperTest extends TestCase $dumper = new JsonFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => JSON_HEX_QUOT])); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => \JSON_HEX_QUOT])); } } diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php index ffec907537..dca013b5d8 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php @@ -49,7 +49,7 @@ class XliffFileLoaderTest extends TestCase public function testLoadWithExternalEntitiesDisabled() { - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } @@ -57,7 +57,7 @@ class XliffFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.xlf'; $catalogue = $loader->load($resource, 'en', 'domain1'); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 131459c6e3..06c0aa2e2a 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -87,7 +87,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface if ($formatter instanceof MessageSelector) { $formatter = new MessageFormatter($formatter); - @trigger_error(sprintf('Passing a "%s" instance into the "%s()" method as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a "%s" instance into the "%s()" method as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), \E_USER_DEPRECATED); } elseif (null === $formatter) { $formatter = new MessageFormatter(); } diff --git a/src/Symfony/Component/Translation/Writer/TranslationWriter.php b/src/Symfony/Component/Translation/Writer/TranslationWriter.php index 4b56484842..0cad1105d8 100644 --- a/src/Symfony/Component/Translation/Writer/TranslationWriter.php +++ b/src/Symfony/Component/Translation/Writer/TranslationWriter.php @@ -97,7 +97,7 @@ class TranslationWriter implements TranslationWriterInterface */ public function writeTranslations(MessageCatalogue $catalogue, $format, $options = []) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), \E_USER_DEPRECATED); $this->write($catalogue, $format, $options); } } diff --git a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 4a6114dcb3..3bd1ae4a55 100644 --- a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -59,7 +59,7 @@ class ChoiceValidator extends ConstraintValidator } if (true !== $constraint->strict) { - @trigger_error('Not setting the strict option of the Choice constraint to true is deprecated since Symfony 3.4 and will throw an exception in 4.0.', E_USER_DEPRECATED); + @trigger_error('Not setting the strict option of the Choice constraint to true is deprecated since Symfony 3.4 and will throw an exception in 4.0.', \E_USER_DEPRECATED); } if ($constraint->multiple) { diff --git a/src/Symfony/Component/Validator/Constraints/FileValidator.php b/src/Symfony/Component/Validator/Constraints/FileValidator.php index 199d7676a6..354eed6605 100644 --- a/src/Symfony/Component/Validator/Constraints/FileValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FileValidator.php @@ -50,7 +50,7 @@ class FileValidator extends ConstraintValidator if ($value instanceof UploadedFile && !$value->isValid()) { switch ($value->getError()) { - case UPLOAD_ERR_INI_SIZE: + case \UPLOAD_ERR_INI_SIZE: $iniLimitSize = UploadedFile::getMaxFilesize(); if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { $limitInBytes = $constraint->maxSize; @@ -64,43 +64,43 @@ class FileValidator extends ConstraintValidator $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) - ->setCode(UPLOAD_ERR_INI_SIZE) + ->setCode(\UPLOAD_ERR_INI_SIZE) ->addViolation(); return; - case UPLOAD_ERR_FORM_SIZE: + case \UPLOAD_ERR_FORM_SIZE: $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) - ->setCode(UPLOAD_ERR_FORM_SIZE) + ->setCode(\UPLOAD_ERR_FORM_SIZE) ->addViolation(); return; - case UPLOAD_ERR_PARTIAL: + case \UPLOAD_ERR_PARTIAL: $this->context->buildViolation($constraint->uploadPartialErrorMessage) - ->setCode(UPLOAD_ERR_PARTIAL) + ->setCode(\UPLOAD_ERR_PARTIAL) ->addViolation(); return; - case UPLOAD_ERR_NO_FILE: + case \UPLOAD_ERR_NO_FILE: $this->context->buildViolation($constraint->uploadNoFileErrorMessage) - ->setCode(UPLOAD_ERR_NO_FILE) + ->setCode(\UPLOAD_ERR_NO_FILE) ->addViolation(); return; - case UPLOAD_ERR_NO_TMP_DIR: + case \UPLOAD_ERR_NO_TMP_DIR: $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) - ->setCode(UPLOAD_ERR_NO_TMP_DIR) + ->setCode(\UPLOAD_ERR_NO_TMP_DIR) ->addViolation(); return; - case UPLOAD_ERR_CANT_WRITE: + case \UPLOAD_ERR_CANT_WRITE: $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) - ->setCode(UPLOAD_ERR_CANT_WRITE) + ->setCode(\UPLOAD_ERR_CANT_WRITE) ->addViolation(); return; - case UPLOAD_ERR_EXTENSION: + case \UPLOAD_ERR_EXTENSION: $this->context->buildViolation($constraint->uploadExtensionErrorMessage) - ->setCode(UPLOAD_ERR_EXTENSION) + ->setCode(\UPLOAD_ERR_EXTENSION) ->addViolation(); return; diff --git a/src/Symfony/Component/Validator/Constraints/IpValidator.php b/src/Symfony/Component/Validator/Constraints/IpValidator.php index b978d1daae..33ef5f0228 100644 --- a/src/Symfony/Component/Validator/Constraints/IpValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IpValidator.php @@ -44,47 +44,47 @@ class IpValidator extends ConstraintValidator switch ($constraint->version) { case Ip::V4: - $flag = FILTER_FLAG_IPV4; + $flag = \FILTER_FLAG_IPV4; break; case Ip::V6: - $flag = FILTER_FLAG_IPV6; + $flag = \FILTER_FLAG_IPV6; break; case Ip::V4_NO_PRIV: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V6_NO_PRIV: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::ALL_NO_PRIV: - $flag = FILTER_FLAG_NO_PRIV_RANGE; + $flag = \FILTER_FLAG_NO_PRIV_RANGE; break; case Ip::V4_NO_RES: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_NO_RES: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_NO_RES: - $flag = FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_NO_RES_RANGE; break; case Ip::V4_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; break; case Ip::V6_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; break; case Ip::ALL_ONLY_PUBLIC: - $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + $flag = \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; break; default: @@ -92,7 +92,7 @@ class IpValidator extends ConstraintValidator break; } - if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { + if (!filter_var($value, \FILTER_VALIDATE_IP, $flag)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Ip::INVALID_IP_ERROR) diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index 97a0545075..ee72584233 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -76,7 +76,7 @@ class UrlValidator extends ConstraintValidator // backwards compatibility if (true === $constraint->checkDNS) { $constraint->checkDNS = Url::CHECK_DNS_TYPE_ANY; - @trigger_error(sprintf('Use of the boolean TRUE for the "checkDNS" option in %s is deprecated. Use Url::CHECK_DNS_TYPE_ANY instead.', Url::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Use of the boolean TRUE for the "checkDNS" option in %s is deprecated. Use Url::CHECK_DNS_TYPE_ANY instead.', Url::class), \E_USER_DEPRECATED); } if (!\in_array($constraint->checkDNS, [ @@ -96,7 +96,7 @@ class UrlValidator extends ConstraintValidator throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint "%s".', \get_class($constraint)), ['checkDNS']); } - $host = parse_url($value, PHP_URL_HOST); + $host = parse_url($value, \PHP_URL_HOST); if (!\is_string($host) || !checkdnsrr($host, $constraint->checkDNS)) { $this->context->buildViolation($constraint->dnsMessage) diff --git a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index d317ecf9e9..e43112c851 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -116,7 +116,7 @@ class YamlFileLoader extends FileLoader private function parseFile($path) { $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($path, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$path.'"$0', $message) : $message; + $message = \E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$path.'"$0', $message) : $message; return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; }); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index c0c89398ce..ae2f2b53a8 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -158,7 +158,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase */ public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix) { - fseek($this->file, $bytesWritten - 1, SEEK_SET); + fseek($this->file, $bytesWritten - 1, \SEEK_SET); fwrite($this->file, '0'); fclose($this->file); @@ -206,7 +206,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase */ public function testMaxSizeNotExceeded($bytesWritten, $limit) { - fseek($this->file, $bytesWritten - 1, SEEK_SET); + fseek($this->file, $bytesWritten - 1, \SEEK_SET); fwrite($this->file, '0'); fclose($this->file); @@ -257,7 +257,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase */ public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsString, $limitAsString, $suffix) { - fseek($this->file, $bytesWritten - 1, SEEK_SET); + fseek($this->file, $bytesWritten - 1, \SEEK_SET); fwrite($this->file, '0'); fclose($this->file); @@ -425,23 +425,23 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase public function uploadedFileErrorProvider() { $tests = [ - [UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'], - [UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'], - [UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'], - [UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'], - [UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'], - [UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'], + [\UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'], + [\UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'], + [\UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'], + [\UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'], + [\UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'], + [\UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'], ]; if (class_exists('Symfony\Component\HttpFoundation\File\UploadedFile')) { // when no maxSize is specified on constraint, it should use the ini value - $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ + $tests[] = [\UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, '{{ suffix }}' => 'MiB', ]]; // it should use the smaller limitation (maxSize option in this case) - $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ + $tests[] = [\UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => 1, '{{ suffix }}' => 'bytes', ], '1']; @@ -454,14 +454,14 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value - $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ + $tests[] = [\UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => $limit, '{{ suffix }}' => $suffix, ], '1000M']; // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value - $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ + $tests[] = [\UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => '0.1', '{{ suffix }}' => 'MB', ], '100K']; diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php index f81868b5b8..57033884d7 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -132,7 +132,7 @@ class YamlFileLoaderTest extends TestCase $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->addPropertyConstraint('firstName', new Range(['max' => PHP_INT_MAX])); + $expected->addPropertyConstraint('firstName', new Range(['max' => \PHP_INT_MAX])); $this->assertEquals($expected, $metadata); } diff --git a/src/Symfony/Component/Validator/Validator/TraceableValidator.php b/src/Symfony/Component/Validator/Validator/TraceableValidator.php index f1b514d61f..a332a714f1 100644 --- a/src/Symfony/Component/Validator/Validator/TraceableValidator.php +++ b/src/Symfony/Component/Validator/Validator/TraceableValidator.php @@ -64,7 +64,7 @@ class TraceableValidator implements ValidatorInterface { $violations = $this->validator->validate($value, $constraints, $groups); - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 7); + $trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 7); $file = $trace[0]['file']; $line = $trace[0]['line']; diff --git a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php index 19bdc29525..dc7a6414fc 100644 --- a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php @@ -21,27 +21,27 @@ use Symfony\Component\VarDumper\Cloner\Stub; class AmqpCaster { private static $flags = [ - AMQP_DURABLE => 'AMQP_DURABLE', - AMQP_PASSIVE => 'AMQP_PASSIVE', - AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE', - AMQP_AUTODELETE => 'AMQP_AUTODELETE', - AMQP_INTERNAL => 'AMQP_INTERNAL', - AMQP_NOLOCAL => 'AMQP_NOLOCAL', - AMQP_AUTOACK => 'AMQP_AUTOACK', - AMQP_IFEMPTY => 'AMQP_IFEMPTY', - AMQP_IFUNUSED => 'AMQP_IFUNUSED', - AMQP_MANDATORY => 'AMQP_MANDATORY', - AMQP_IMMEDIATE => 'AMQP_IMMEDIATE', - AMQP_MULTIPLE => 'AMQP_MULTIPLE', - AMQP_NOWAIT => 'AMQP_NOWAIT', - AMQP_REQUEUE => 'AMQP_REQUEUE', + \AMQP_DURABLE => 'AMQP_DURABLE', + \AMQP_PASSIVE => 'AMQP_PASSIVE', + \AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE', + \AMQP_AUTODELETE => 'AMQP_AUTODELETE', + \AMQP_INTERNAL => 'AMQP_INTERNAL', + \AMQP_NOLOCAL => 'AMQP_NOLOCAL', + \AMQP_AUTOACK => 'AMQP_AUTOACK', + \AMQP_IFEMPTY => 'AMQP_IFEMPTY', + \AMQP_IFUNUSED => 'AMQP_IFUNUSED', + \AMQP_MANDATORY => 'AMQP_MANDATORY', + \AMQP_IMMEDIATE => 'AMQP_IMMEDIATE', + \AMQP_MULTIPLE => 'AMQP_MULTIPLE', + \AMQP_NOWAIT => 'AMQP_NOWAIT', + \AMQP_REQUEUE => 'AMQP_REQUEUE', ]; private static $exchangeTypes = [ - AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT', - AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT', - AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC', - AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', + \AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT', + \AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT', + \AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC', + \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', ]; public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested) diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index a78410f2f7..a6ebc25bdd 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -49,7 +49,7 @@ class Caster public static function castObject($obj, $class, $hasDebugInfo = false, $debugClass = null) { if ($class instanceof \ReflectionClass) { - @trigger_error(sprintf('Passing a ReflectionClass to "%s()" is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a ReflectionClass to "%s()" is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), \E_USER_DEPRECATED); $hasDebugInfo = $class->hasMethod('__debugInfo'); $class = $class->name; } diff --git a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php index 65151b4f4f..fef3d432a7 100644 --- a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php @@ -21,44 +21,44 @@ use Symfony\Component\VarDumper\Cloner\Stub; class DOMCaster { private static $errorCodes = [ - DOM_PHP_ERR => 'DOM_PHP_ERR', - DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', - DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', - DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', - DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR', - DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR', - DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR', - DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR', - DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR', - DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR', - DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR', - DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR', - DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR', - DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR', - DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR', - DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR', - DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR', + \DOM_PHP_ERR => 'DOM_PHP_ERR', + \DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', + \DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', + \DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', + \DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR', + \DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR', + \DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR', + \DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR', + \DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR', + \DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR', + \DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR', + \DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR', + \DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR', + \DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR', + \DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR', + \DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR', + \DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR', ]; private static $nodeTypes = [ - XML_ELEMENT_NODE => 'XML_ELEMENT_NODE', - XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE', - XML_TEXT_NODE => 'XML_TEXT_NODE', - XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE', - XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE', - XML_ENTITY_NODE => 'XML_ENTITY_NODE', - XML_PI_NODE => 'XML_PI_NODE', - XML_COMMENT_NODE => 'XML_COMMENT_NODE', - XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE', - XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE', - XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE', - XML_NOTATION_NODE => 'XML_NOTATION_NODE', - XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE', - XML_DTD_NODE => 'XML_DTD_NODE', - XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE', - XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE', - XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE', - XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', + \XML_ELEMENT_NODE => 'XML_ELEMENT_NODE', + \XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE', + \XML_TEXT_NODE => 'XML_TEXT_NODE', + \XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE', + \XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE', + \XML_ENTITY_NODE => 'XML_ENTITY_NODE', + \XML_PI_NODE => 'XML_PI_NODE', + \XML_COMMENT_NODE => 'XML_COMMENT_NODE', + \XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE', + \XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE', + \XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE', + \XML_NOTATION_NODE => 'XML_NOTATION_NODE', + \XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE', + \XML_DTD_NODE => 'XML_DTD_NODE', + \XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE', + \XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE', + \XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE', + \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', ]; public static function castException(\DOMException $e, array $a, Stub $stub, $isNested) diff --git a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php index e0acbe39df..62b57402f8 100644 --- a/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php @@ -25,21 +25,21 @@ class ExceptionCaster public static $srcContext = 1; public static $traceArgs = true; public static $errorTypes = [ - E_DEPRECATED => 'E_DEPRECATED', - E_USER_DEPRECATED => 'E_USER_DEPRECATED', - E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', - E_ERROR => 'E_ERROR', - E_WARNING => 'E_WARNING', - E_PARSE => 'E_PARSE', - E_NOTICE => 'E_NOTICE', - E_CORE_ERROR => 'E_CORE_ERROR', - E_CORE_WARNING => 'E_CORE_WARNING', - E_COMPILE_ERROR => 'E_COMPILE_ERROR', - E_COMPILE_WARNING => 'E_COMPILE_WARNING', - E_USER_ERROR => 'E_USER_ERROR', - E_USER_WARNING => 'E_USER_WARNING', - E_USER_NOTICE => 'E_USER_NOTICE', - E_STRICT => 'E_STRICT', + \E_DEPRECATED => 'E_DEPRECATED', + \E_USER_DEPRECATED => 'E_USER_DEPRECATED', + \E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', + \E_ERROR => 'E_ERROR', + \E_WARNING => 'E_WARNING', + \E_PARSE => 'E_PARSE', + \E_NOTICE => 'E_NOTICE', + \E_CORE_ERROR => 'E_CORE_ERROR', + \E_CORE_WARNING => 'E_CORE_WARNING', + \E_COMPILE_ERROR => 'E_COMPILE_ERROR', + \E_COMPILE_WARNING => 'E_COMPILE_WARNING', + \E_USER_ERROR => 'E_USER_ERROR', + \E_USER_WARNING => 'E_USER_WARNING', + \E_USER_NOTICE => 'E_USER_NOTICE', + \E_STRICT => 'E_STRICT', ]; private static $framesCache = []; diff --git a/src/Symfony/Component/VarDumper/Caster/MongoCaster.php b/src/Symfony/Component/VarDumper/Caster/MongoCaster.php index 3b8fb338e5..98f1b8e25d 100644 --- a/src/Symfony/Component/VarDumper/Caster/MongoCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/MongoCaster.php @@ -13,7 +13,7 @@ namespace Symfony\Component\VarDumper\Caster; use Symfony\Component\VarDumper\Cloner\Stub; -@trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); +@trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); /** * Casts classes from the MongoDb extension to array representation. diff --git a/src/Symfony/Component/VarDumper/Caster/PgSqlCaster.php b/src/Symfony/Component/VarDumper/Caster/PgSqlCaster.php index cd6bf5b5fe..fe1f0cc8d9 100644 --- a/src/Symfony/Component/VarDumper/Caster/PgSqlCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/PgSqlCaster.php @@ -34,37 +34,37 @@ class PgSqlCaster ]; private static $transactionStatus = [ - PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', - PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', - PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', - PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', - PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', + \PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', + \PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', + \PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', + \PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', + \PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', ]; private static $resultStatus = [ - PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', - PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', - PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', - PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', - PGSQL_COPY_IN => 'PGSQL_COPY_IN', - PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', - PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', - PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', + \PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', + \PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', + \PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', + \PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', + \PGSQL_COPY_IN => 'PGSQL_COPY_IN', + \PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', + \PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', + \PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', ]; private static $diagCodes = [ - 'severity' => PGSQL_DIAG_SEVERITY, - 'sqlstate' => PGSQL_DIAG_SQLSTATE, - 'message' => PGSQL_DIAG_MESSAGE_PRIMARY, - 'detail' => PGSQL_DIAG_MESSAGE_DETAIL, - 'hint' => PGSQL_DIAG_MESSAGE_HINT, - 'statement position' => PGSQL_DIAG_STATEMENT_POSITION, - 'internal position' => PGSQL_DIAG_INTERNAL_POSITION, - 'internal query' => PGSQL_DIAG_INTERNAL_QUERY, - 'context' => PGSQL_DIAG_CONTEXT, - 'file' => PGSQL_DIAG_SOURCE_FILE, - 'line' => PGSQL_DIAG_SOURCE_LINE, - 'function' => PGSQL_DIAG_SOURCE_FUNCTION, + 'severity' => \PGSQL_DIAG_SEVERITY, + 'sqlstate' => \PGSQL_DIAG_SQLSTATE, + 'message' => \PGSQL_DIAG_MESSAGE_PRIMARY, + 'detail' => \PGSQL_DIAG_MESSAGE_DETAIL, + 'hint' => \PGSQL_DIAG_MESSAGE_HINT, + 'statement position' => \PGSQL_DIAG_STATEMENT_POSITION, + 'internal position' => \PGSQL_DIAG_INTERNAL_POSITION, + 'internal query' => \PGSQL_DIAG_INTERNAL_QUERY, + 'context' => \PGSQL_DIAG_CONTEXT, + 'file' => \PGSQL_DIAG_SOURCE_FILE, + 'line' => \PGSQL_DIAG_SOURCE_LINE, + 'function' => \PGSQL_DIAG_SOURCE_FUNCTION, ]; public static function castLargeObject($lo, array $a, Stub $stub, $isNested) @@ -77,7 +77,7 @@ class PgSqlCaster public static function castLink($link, array $a, Stub $stub, $isNested) { $a['status'] = pg_connection_status($link); - $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); + $a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); $a['busy'] = pg_connection_busy($link); $a['transaction'] = pg_transaction_status($link); @@ -113,7 +113,7 @@ class PgSqlCaster if (isset(self::$resultStatus[$a['status']])) { $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']); } - $a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING); + $a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING); if (-1 === $a['num rows']) { foreach (self::$diagCodes as $k => $v) { diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 31de78e961..f19886172a 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -114,7 +114,7 @@ class ReflectionCaster 'file' => $c->getExecutingFile(), 'line' => $c->getExecutingLine(), ]; - if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) { + if ($trace = $c->getTrace(\DEBUG_BACKTRACE_IGNORE_ARGS)) { $function = new \ReflectionGenerator($c->getExecutingGenerator()); array_unshift($trace, [ 'function' => 'yield', diff --git a/src/Symfony/Component/VarDumper/Caster/XmlResourceCaster.php b/src/Symfony/Component/VarDumper/Caster/XmlResourceCaster.php index 117138c784..99c1486483 100644 --- a/src/Symfony/Component/VarDumper/Caster/XmlResourceCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/XmlResourceCaster.php @@ -21,28 +21,28 @@ use Symfony\Component\VarDumper\Cloner\Stub; class XmlResourceCaster { private static $xmlErrors = [ - XML_ERROR_NONE => 'XML_ERROR_NONE', - XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', - XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', - XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', - XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', - XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', - XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', - XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', - XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', - XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', - XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', - XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', - XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', - XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', - XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', - XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', - XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', - XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', - XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', - XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', - XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', + \XML_ERROR_NONE => 'XML_ERROR_NONE', + \XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', + \XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', + \XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', + \XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', + \XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', + \XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', + \XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', + \XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', + \XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', + \XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', + \XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', + \XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', + \XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', + \XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', + \XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', + \XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', + \XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', + \XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', + \XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', + \XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', + \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', ]; public static function castXml($h, array $a, Stub $stub, $isNested) diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 2e1af1d776..76b55b478b 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -218,7 +218,7 @@ abstract class AbstractCloner implements ClonerInterface public function cloneVar($var, $filter = 0) { $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) { - if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { + if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) { // Cloner never dies throw new \ErrorException($msg, 0, $type, $file, $line); } diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index 42742d852d..3973720794 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -306,7 +306,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate } } elseif (Stub::TYPE_REF === $item->type) { if ($item->handle) { - if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) { + if (!isset($refs[$r = $item->handle - (\PHP_INT_MAX >> 1)])) { $cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0]; } else { $firstSeen = false; diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index e69e44407c..a0e2f3824f 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -317,7 +317,7 @@ class VarCloner extends AbstractCloner } else { // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below $obFuncs = ['ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush']; - foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { + foreach (debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) { $frame['line'] = 0; break; diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 87195bb6a1..5ea6294f3d 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -126,8 +126,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface $this->decimalPoint = localeconv(); $this->decimalPoint = $this->decimalPoint['decimal_point']; - if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) { - setlocale(LC_NUMERIC, 'C'); + if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) { + setlocale(\LC_NUMERIC, 'C'); } if ($returnDump = true === $output) { @@ -151,7 +151,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface $this->setOutput($prevOutput); } if ($locale) { - setlocale(LC_NUMERIC, $locale); + setlocale(\LC_NUMERIC, $locale); } } diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 76737a499f..4c48ab7cc8 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -131,8 +131,8 @@ class CliDumper extends AbstractDumper $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; - case -INF === $value: $value = '-INF'; break; + case \INF === $value: $value = 'INF'; break; + case -\INF === $value: $value = '-INF'; break; case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index b2f6ee7012..ccbdc96f23 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -128,7 +128,7 @@ class HtmlDumper extends CliDumper return $this->dumpHeader; } - $line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML' + $line = str_replace('{$options}', json_encode($this->displayOptions, \JSON_FORCE_OBJECT), <<<'EOHTML'