From c90cf3301ae18ba9b18f3f5e9ff527c54dca3320 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Dec 2019 16:06:53 +0100 Subject: [PATCH] Fix CS --- .../AbstractDoctrineExtension.php | 6 +----- .../Doctrine/Security/User/EntityUserProvider.php | 6 +----- .../Compiler/CheckDefinitionValidityPass.php | 15 ++------------- .../Loader/Configurator/ContainerConfigurator.php | 8 +------- .../Serializer/Normalizer/DateTimeNormalizer.php | 8 +------- 5 files changed, 6 insertions(+), 37 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index d8dfab3b2b..8dab9c8a3e 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -239,11 +239,7 @@ abstract class AbstractDoctrineExtension extends Extension } if (!\in_array($mappingConfig['type'], ['xml', 'yml', 'annotation', 'php', 'staticphp'])) { - throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '. - '"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '. - 'You can register them by adding a new driver to the '. - '"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver') - )); + throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or "staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. You can register them by adding a new driver to the "%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver'))); } } diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 7c630b4e98..502d471d4e 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -83,11 +83,7 @@ class EntityUserProvider implements UserProviderInterface // That's the case when the user has been changed by a form with // validation errors. if (!$id = $this->getClassMetadata()->getIdentifierValues($user)) { - throw new \InvalidArgumentException('You cannot refresh a user '. - 'from the EntityUserProvider that does not contain an identifier. '. - 'The user object has to be serialized with its own identifier '. - 'mapped by Doctrine.' - ); + throw new \InvalidArgumentException('You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine.'); } $refreshedUser = $repository->find($id); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php index 0e9005415a..4b6d277fe9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php @@ -49,21 +49,10 @@ class CheckDefinitionValidityPass implements CompilerPassInterface } if (class_exists($id) || interface_exists($id, false)) { if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { - throw new RuntimeException(sprintf( - 'The definition for "%s" has no class attribute, and appears to reference a class or interface. ' - .'Please specify the class attribute explicitly or remove the leading backslash by renaming ' - .'the service to "%s" to get rid of this error.', - $id, substr($id, 1) - )); + throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "%s" to get rid of this error.', $id, substr($id, 1))); } - throw new RuntimeException(sprintf( - 'The definition for "%s" has no class attribute, and appears to reference a ' - .'class or interface in the global namespace. Leaving out the "class" attribute ' - .'is only allowed for namespaced classes. Please specify the class attribute ' - .'explicitly to get rid of this error.', - $id - )); + throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface in the global namespace. Leaving out the "class" attribute is only allowed for namespaced classes. Please specify the class attribute explicitly to get rid of this error.', $id)); } throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php index 3b4b2a4830..828d4071da 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php @@ -45,13 +45,7 @@ class ContainerConfigurator extends AbstractConfigurator { if (!$this->container->hasExtension($namespace)) { $extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $namespace, - $this->file, - $namespace, - $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $this->file, $namespace, $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none')); } $this->container->loadFromExtension($namespace, static::processValue($config)); diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index 39c31f00f1..d9d5a586e1 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -101,13 +101,7 @@ class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface $dateTimeErrors = \DateTime::class === $type ? \DateTime::getLastErrors() : \DateTimeImmutable::getLastErrors(); - throw new NotNormalizableValueException(sprintf( - 'Parsing datetime string "%s" using format "%s" resulted in %d errors:'."\n".'%s', - $data, - $dateTimeFormat, - $dateTimeErrors['error_count'], - implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors'])) - )); + throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors:'."\n".'%s', $data, $dateTimeFormat, $dateTimeErrors['error_count'], implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors'])))); } try {