diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index d6b9d0a9a2..4dccb29765 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -68,7 +68,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface $connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections); foreach ($connections as $con) { if (!isset($this->connections[$con])) { - throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections)))); + throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections)))); } $this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]); @@ -91,7 +91,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface $connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections); foreach ($connections as $con) { if (!isset($this->connections[$con])) { - throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections)))); + throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections)))); } if ($lazy = !empty($tag['lazy'])) { diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php index 16ca723223..0999be3445 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -125,7 +125,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface $this->driverPattern = $driverPattern; $this->enabledParameter = $enabledParameter; if (\count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) { - throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias'); + throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias.'); } $this->configurationPattern = $configurationPattern; $this->registerAliasMethodName = $registerAliasMethodName; @@ -222,7 +222,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface } } - throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s"', implode('", "', $this->managerParameters))); + throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s".', implode('", "', $this->managerParameters))); } /** diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index 0079940bd5..fc60d12d7b 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -96,7 +96,7 @@ class DbalSessionHandler implements \SessionHandlerInterface $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $stmt->execute(); } catch (\Exception $e) { - throw new \RuntimeException(sprintf('Exception was thrown when trying to delete a session: %s', $e->getMessage()), 0, $e); + throw new \RuntimeException(sprintf('Exception was thrown when trying to delete a session: %s.', $e->getMessage()), 0, $e); } return true; @@ -115,7 +115,7 @@ class DbalSessionHandler implements \SessionHandlerInterface $stmt->bindValue(':time', time() - $maxlifetime, \PDO::PARAM_INT); $stmt->execute(); } catch (\Exception $e) { - throw new \RuntimeException(sprintf('Exception was thrown when trying to delete expired sessions: %s', $e->getMessage()), 0, $e); + throw new \RuntimeException(sprintf('Exception was thrown when trying to delete expired sessions: %s.', $e->getMessage()), 0, $e); } return true; @@ -142,7 +142,7 @@ class DbalSessionHandler implements \SessionHandlerInterface return ''; } catch (\Exception $e) { - throw new \RuntimeException(sprintf('Exception was thrown when trying to read the session data: %s', $e->getMessage()), 0, $e); + throw new \RuntimeException(sprintf('Exception was thrown when trying to read the session data: %s.', $e->getMessage()), 0, $e); } } @@ -212,7 +212,7 @@ class DbalSessionHandler implements \SessionHandlerInterface } } } catch (\Exception $e) { - throw new \RuntimeException(sprintf('Exception was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); + throw new \RuntimeException(sprintf('Exception was thrown when trying to write the session data: %s.', $e->getMessage()), 0, $e); } return true; diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 94b7480930..1fe8a5c53a 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -92,7 +92,7 @@ class EntityUserProvider implements UserProviderInterface $refreshedUser = $repository->find($id); if (null === $refreshedUser) { - throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id))); + throw new UsernameNotFoundException(sprintf('User with id %s not found.', json_encode($id))); } } diff --git a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php index c912614a2a..03cea01352 100644 --- a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php @@ -83,7 +83,7 @@ class SwiftMailerHandler extends BaseSwiftMailerHandler } if (null === $this->transport) { - throw new \Exception('No transport available to flush mail queue'); + throw new \Exception('No transport available to flush mail queue.'); } $spool->flushQueue($this->transport); diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php index 1d9432f622..d4ce682594 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php @@ -32,7 +32,7 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator $newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body); if ($body === $newBody) { - throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct()', $originalClass->name)); + throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct().', $originalClass->name)); } $destructor->setBody($newBody); diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 17c62aaf3c..da06aae9b5 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -239,7 +239,7 @@ EOF } elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) { $refl = new \ReflectionMethod($m[1], $m[2]); } else { - throw new \UnexpectedValueException('Unsupported callback type'); + throw new \UnexpectedValueException('Unsupported callback type.'); } $args = $refl->getParameters(); diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index dc47dd8cfb..c4343d60b7 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -157,7 +157,7 @@ EOF return Finder::create()->files()->in($filename)->name('*.twig'); } - throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename)); + throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } private function validate($template, $file) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index c038133975..9f512ae20a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -112,11 +112,11 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand public function validateConfiguration(ExtensionInterface $extension, $configuration) { if (!$configuration) { - throw new \LogicException(sprintf('The extension with alias "%s" does not have its getConfiguration() method setup', $extension->getAlias())); + throw new \LogicException(sprintf('The extension with alias "%s" does not have its getConfiguration() method setup.', $extension->getAlias())); } if (!$configuration instanceof ConfigurationInterface) { - throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable', \get_class($configuration))); + throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable.', \get_class($configuration))); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 969ac030bb..af1e16cad5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -104,7 +104,7 @@ EOF $fs->remove($oldCacheDir); if (!is_writable($realCacheDir)) { - throw new RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir)); + throw new RuntimeException(sprintf('Unable to write in the "%s" directory.', $realCacheDir)); } $io->comment(sprintf('Clearing the cache for the %s environment with debug %s', $kernel->getEnvironment(), var_export($kernel->isDebug(), true))); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index 9919e4657d..adea7dbdbf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -140,7 +140,7 @@ EOF foreach ($steps as $step) { if (!\array_key_exists($step, $config)) { - throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path)); + throw new LogicException(sprintf('Unable to find configuration for "%s.%s".', $alias, $path)); } $config = $config[$step]; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php index 357c079c4a..d6e61cc605 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php @@ -39,7 +39,7 @@ class ProfilerPass implements CompilerPassInterface if (isset($attributes[0]['template'])) { if (!isset($attributes[0]['id'])) { - throw new InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template', $id)); + throw new InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template.', $id)); } $template = [$attributes[0]['id'], $attributes[0]['template']]; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 1762112a49..afad1629d3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1201,7 +1201,7 @@ class FrameworkExtension extends Extension if ($container->fileExists($dir)) { $dirs[] = $dir; } else { - throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir)); + throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory.', $dir)); } } @@ -1629,7 +1629,7 @@ class FrameworkExtension extends Extension $storeDefinition = new Reference($storeDefinitionId); break; default: - throw new InvalidArgumentException(sprintf('Lock store DSN "%s" is not valid in resource "%s"', $storeDsn, $resourceName)); + throw new InvalidArgumentException(sprintf('Lock store DSN "%s" is not valid in resource "%s".', $storeDsn, $resourceName)); } $storeDefinitions[] = $storeDefinition; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php index 2964cd35b5..8f2a21a681 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php @@ -43,6 +43,6 @@ class StopwatchHelper extends Helper return \call_user_func_array([$this->stopwatch, $method], $arguments); } - throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method)); + throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist.', $method)); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php index 74d99194ad..8513856066 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php @@ -39,7 +39,7 @@ abstract class WebTestCase extends KernelTestCase if (class_exists(Client::class)) { throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.'); } - throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit"'); + throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit".'); } $client->setServerParameters($server); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php index ff63db630b..07b2eaeed0 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php @@ -38,7 +38,7 @@ class AddSecurityVotersPass implements CompilerPassInterface $voters = $this->findAndSortTaggedServices('security.voter', $container); if (!$voters) { - throw new LogicException('No security voters found. You need to tag at least one with "security.voter"'); + throw new LogicException('No security voters found. You need to tag at least one with "security.voter".'); } foreach ($voters as $voter) { diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php index 8384c42da7..3e4c76c8ce 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php @@ -115,6 +115,6 @@ class GuardAuthenticationFactory implements SecurityFactoryInterface } // we have multiple entry points - we must ask them to configure one - throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s)', implode(', ', $authenticatorIds))); + throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s).', implode(', ', $authenticatorIds))); } } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 19e9beb1e3..fce4bd9538 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -387,7 +387,7 @@ class SecurityExtension extends Extension } if (isset($this->logoutOnUserChangeByContextKey[$contextKey]) && $this->logoutOnUserChangeByContextKey[$contextKey][1] !== $logoutOnUserChange) { - throw new InvalidConfigurationException(sprintf('Firewalls "%s" and "%s" need to have the same value for option "logout_on_user_change" as they are sharing the context "%s"', $this->logoutOnUserChangeByContextKey[$contextKey][0], $id, $contextKey)); + throw new InvalidConfigurationException(sprintf('Firewalls "%s" and "%s" need to have the same value for option "logout_on_user_change" as they are sharing the context "%s".', $this->logoutOnUserChangeByContextKey[$contextKey][0], $id, $contextKey)); } $this->logoutOnUserChangeByContextKey[$contextKey] = [$id, $logoutOnUserChange]; @@ -701,7 +701,7 @@ class SecurityExtension extends Extension return $name; } - throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name)); + throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider.', $name)); } private function getUserProviderId($name) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php index 51b6d9b4f0..bd0c606a86 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php @@ -39,7 +39,7 @@ class TwigLoaderPass implements CompilerPassInterface } if (!$found) { - throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader"'); + throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader".'); } if (1 === $found) { diff --git a/src/Symfony/Component/Asset/UrlPackage.php b/src/Symfony/Component/Asset/UrlPackage.php index 23809a55fd..e9ea35175d 100644 --- a/src/Symfony/Component/Asset/UrlPackage.php +++ b/src/Symfony/Component/Asset/UrlPackage.php @@ -130,7 +130,7 @@ class UrlPackage extends Package if ('https://' === substr($url, 0, 8) || '//' === substr($url, 0, 2)) { $sslUrls[] = $url; } elseif ('http://' !== substr($url, 0, 7)) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid URL', $url)); + throw new InvalidArgumentException(sprintf('"%s" is not a valid URL.', $url)); } } diff --git a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php index 378ad54346..2ab686a561 100644 --- a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php +++ b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php @@ -59,7 +59,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface $this->manifestData = json_decode(file_get_contents($this->manifestPath), true); if (0 < json_last_error()) { - throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s" - %s', $this->manifestPath, json_last_error_msg())); + throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s" - %s.', $this->manifestPath, json_last_error_msg())); } } diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 4caad676ae..2e641e884a 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -370,7 +370,7 @@ abstract class Client } if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) { - throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput())); + throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s.', $process->getOutput(), $process->getErrorOutput())); } return unserialize($process->getOutput()); diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 62e102e993..f356a92950 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -46,7 +46,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface { $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR; if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { - throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace)); + throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); } $this->createCacheItem = \Closure::bind( static function ($key, $value, $isHit) use ($defaultLifetime) { diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 9ab870534f..1012148a96 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -29,7 +29,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) { if (!static::isSupported()) { - throw new CacheException('OPcache is not enabled'); + throw new CacheException('OPcache is not enabled.'); } parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index d7edb7f80a..b16ad0faf7 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -78,7 +78,7 @@ final class CacheItem implements CacheItemInterface } elseif ($expiration instanceof \DateTimeInterface) { $this->expiry = (int) $expiration->format('U'); } else { - throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration))); + throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration))); } return $this; @@ -98,7 +98,7 @@ final class CacheItem implements CacheItemInterface } elseif (\is_int($time)) { $this->expiry = $time + time(); } else { - throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($time) ? \get_class($time) : \gettype($time))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($time) ? \get_class($time) : \gettype($time))); } return $this; @@ -120,16 +120,16 @@ final class CacheItem implements CacheItemInterface } foreach ($tags as $tag) { if (!\is_string($tag)) { - throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given', \is_object($tag) ? \get_class($tag) : \gettype($tag))); + throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given.', \is_object($tag) ? \get_class($tag) : \gettype($tag))); } if (isset($this->tags[$tag])) { continue; } if ('' === $tag) { - throw new InvalidArgumentException('Cache tag length must be greater than zero'); + throw new InvalidArgumentException('Cache tag length must be greater than zero.'); } if (false !== strpbrk($tag, '{}()/\@:')) { - throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:', $tag)); + throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:.', $tag)); } $this->tags[$tag] = $tag; } @@ -159,13 +159,13 @@ final class CacheItem implements CacheItemInterface public static function validateKey($key) { if (!\is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key))); + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); } if ('' === $key) { - throw new InvalidArgumentException('Cache key length must be greater than zero'); + throw new InvalidArgumentException('Cache key length must be greater than zero.'); } if (false !== strpbrk($key, '{}()/\@:')) { - throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); + throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:.', $key)); } return $key; diff --git a/src/Symfony/Component/Cache/Simple/AbstractCache.php b/src/Symfony/Component/Cache/Simple/AbstractCache.php index 23b401c54b..baedb73747 100644 --- a/src/Symfony/Component/Cache/Simple/AbstractCache.php +++ b/src/Symfony/Component/Cache/Simple/AbstractCache.php @@ -45,7 +45,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re $this->defaultLifetime = max(0, (int) $defaultLifetime); $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':'; if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { - throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace)); + throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); } } @@ -85,7 +85,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } $ids = []; @@ -109,7 +109,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re public function setMultiple($values, $ttl = null) { if (!\is_array($values) && !$values instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); } $valuesById = []; @@ -147,7 +147,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } return $this->deleteItems($keys); @@ -165,7 +165,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re return 0 < $ttl ? $ttl : false; } - throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); } private function generateValues($values, &$keys, $default) diff --git a/src/Symfony/Component/Cache/Simple/ArrayCache.php b/src/Symfony/Component/Cache/Simple/ArrayCache.php index 9c8f6d8e3c..f0b650107d 100644 --- a/src/Symfony/Component/Cache/Simple/ArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/ArrayCache.php @@ -58,7 +58,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { CacheItem::validateKey($key); @@ -73,7 +73,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte public function deleteMultiple($keys) { if (!\is_array($keys) && !$keys instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { $this->delete($key); @@ -98,7 +98,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte public function setMultiple($values, $ttl = null) { if (!\is_array($values) && !$values instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); } $valuesArray = []; @@ -143,6 +143,6 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte return 0 < $ttl ? $ttl : false; } - throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl))); } } diff --git a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php index 5ded7ee741..5c00d91ffb 100644 --- a/src/Symfony/Component/Cache/Simple/PhpArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpArrayCache.php @@ -100,7 +100,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { if (!\is_string($key)) { @@ -150,7 +150,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt public function deleteMultiple($keys) { if (!\is_array($keys) && !$keys instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } $deleted = true; @@ -199,7 +199,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt public function setMultiple($values, $ttl = null) { if (!\is_array($values) && !$values instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); } $saved = true; diff --git a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php index 9587f17bed..cdbcdd8856 100644 --- a/src/Symfony/Component/Cache/Simple/PhpFilesCache.php +++ b/src/Symfony/Component/Cache/Simple/PhpFilesCache.php @@ -29,7 +29,7 @@ class PhpFilesCache extends AbstractCache implements PruneableInterface public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) { if (!static::isSupported()) { - throw new CacheException('OPcache is not enabled'); + throw new CacheException('OPcache is not enabled.'); } parent::__construct('', $defaultLifetime); $this->init($namespace, $directory); diff --git a/src/Symfony/Component/Cache/Simple/Psr6Cache.php b/src/Symfony/Component/Cache/Simple/Psr6Cache.php index aab41f722d..6b3de20599 100644 --- a/src/Symfony/Component/Cache/Simple/Psr6Cache.php +++ b/src/Symfony/Component/Cache/Simple/Psr6Cache.php @@ -135,7 +135,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } try { @@ -161,7 +161,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa { $valuesIsArray = \is_array($values); if (!$valuesIsArray && !$values instanceof \Traversable) { - throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values))); } $items = []; @@ -213,7 +213,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } try { diff --git a/src/Symfony/Component/Cache/Traits/AbstractTrait.php b/src/Symfony/Component/Cache/Traits/AbstractTrait.php index cd1f204139..70cdcc89f3 100644 --- a/src/Symfony/Component/Cache/Traits/AbstractTrait.php +++ b/src/Symfony/Component/Cache/Traits/AbstractTrait.php @@ -222,7 +222,7 @@ trait AbstractTrait if (false !== $value = unserialize($value)) { return $value; } - throw new \DomainException('Failed to unserialize cached value'); + throw new \DomainException('Failed to unserialize cached value.'); } catch (\Error $e) { throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } finally { diff --git a/src/Symfony/Component/Cache/Traits/ApcuTrait.php b/src/Symfony/Component/Cache/Traits/ApcuTrait.php index 88dd22a91e..b6c64ec0f3 100644 --- a/src/Symfony/Component/Cache/Traits/ApcuTrait.php +++ b/src/Symfony/Component/Cache/Traits/ApcuTrait.php @@ -29,7 +29,7 @@ trait ApcuTrait private function init($namespace, $defaultLifetime, $version) { if (!static::isSupported()) { - throw new CacheException('APCu is not enabled'); + throw new CacheException('APCu is not enabled.'); } if ('cli' === \PHP_SAPI) { ini_set('apc.use_request_time', 0); diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php index 5510898b80..8071a382bb 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php @@ -42,7 +42,7 @@ trait FilesystemCommonTrait $directory .= \DIRECTORY_SEPARATOR; // On Windows the whole path is limited to 258 chars if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) { - throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory)); + throw new InvalidArgumentException(sprintf('Cache directory too long (%s).', $directory)); } $this->directory = $directory; diff --git a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php index 3e0dc86bd1..9d7f55784a 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php @@ -99,7 +99,7 @@ trait FilesystemTrait } if (!$ok && !is_writable($this->directory)) { - throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory)); + throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); } return $ok; diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php index 28046e475b..b62dc53c19 100644 --- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php +++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php @@ -40,7 +40,7 @@ trait MemcachedTrait private function init(\Memcached $client, $namespace, $defaultLifetime) { if (!static::isSupported()) { - throw new CacheException('Memcached >= 2.2.0 is required'); + throw new CacheException('Memcached >= 2.2.0 is required.'); } if ('Memcached' === \get_class($client)) { $opt = $client->getOption(\Memcached::OPT_SERIALIZER); @@ -81,7 +81,7 @@ trait MemcachedTrait throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers))); } if (!static::isSupported()) { - throw new CacheException('Memcached >= 2.2.0 is required'); + throw new CacheException('Memcached >= 2.2.0 is required.'); } set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); }); try { @@ -96,7 +96,7 @@ trait MemcachedTrait continue; } if (0 !== strpos($dsn, 'memcached://')) { - throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached://"', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached://".', $dsn)); } $params = preg_replace_callback('#^memcached://(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) { if (!empty($m[1])) { @@ -106,10 +106,10 @@ trait MemcachedTrait return 'file://'; }, $dsn); if (false === $params = parse_url($params)) { - throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn)); } if (!isset($params['host']) && !isset($params['path'])) { - throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn)); } if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { $params['weight'] = $m[1]; diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php index b190fef8b5..ab9054b38d 100644 --- a/src/Symfony/Component/Cache/Traits/PdoTrait.php +++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php @@ -44,7 +44,7 @@ trait PdoTrait if ($connOrDsn instanceof \PDO) { if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); + throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__)); } $this->conn = $connOrDsn; diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index 3cc02b2428..5a41afbbcb 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -150,7 +150,7 @@ trait PhpFilesTrait } if (!$ok && !is_writable($this->directory)) { - throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory)); + throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); } return $ok; diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index c4b12b64bb..ef6c4292e0 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -48,7 +48,7 @@ trait RedisTrait throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); } if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy) { - throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); + throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); } $this->redis = $redisClient; } @@ -73,7 +73,7 @@ trait RedisTrait public static function createConnection($dsn, array $options = []) { if (0 !== strpos($dsn, 'redis://')) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis://"', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis://".', $dsn)); } $params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) { if (isset($m[1])) { @@ -83,10 +83,10 @@ trait RedisTrait return 'file://'; }, $dsn); if (false === $params = parse_url($params)) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn)); } if (!isset($params['host']) && !isset($params['path'])) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); + throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn)); } if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { $params['dbindex'] = $m[1]; @@ -108,7 +108,7 @@ trait RedisTrait } $params += $options + self::$defaultConnectionOptions; if (null === $params['class'] && !\extension_loaded('redis') && !class_exists(\Predis\Client::class)) { - throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: %s', $dsn)); + throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: %s.', $dsn)); } $class = null === $params['class'] ? (\extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class']; @@ -120,7 +120,7 @@ trait RedisTrait try { @$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']); } catch (\RedisException $e) { - throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn)); + throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e->getMessage(), $dsn)); } set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); @@ -128,7 +128,7 @@ trait RedisTrait restore_error_handler(); if (!$isConnected) { $error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : ''; - throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s', $error, $dsn)); + throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s.', $error, $dsn)); } if ((null !== $auth && !$redis->auth($auth)) @@ -136,7 +136,7 @@ trait RedisTrait || ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout'])) ) { $e = preg_replace('/^ERR /', '', $redis->getLastError()); - throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn)); + throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e, $dsn)); } return true; @@ -153,9 +153,9 @@ trait RedisTrait $params['password'] = $auth; $redis = new $class((new Factory())->create($params)); } elseif (class_exists($class, false)) { - throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\Client"', $class)); + throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\Client".', $class)); } else { - throw new InvalidArgumentException(sprintf('Class "%s" does not exist', $class)); + throw new InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); } return $redis; diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 5edab01cbd..61175debd4 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -63,7 +63,7 @@ class ClassCollectionLoader // cache the core classes if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) { - throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); + throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s".', $cacheDir)); } $cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.\DIRECTORY_SEPARATOR); $cache = $cacheDir.'/'.$name.$extension; @@ -133,7 +133,7 @@ class ClassCollectionLoader // cache the core classes $cacheDir = \dirname($cache); if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) { - throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); + throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s".', $cacheDir)); } $spacesRegex = '(?:\s*+(?:(?:\#|//)[^\n]*+\n|/\*(?:(?getPath(), json_encode($value))); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); } foreach ($this->children as $name => $child) { diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index 2b10bffa78..bf57a9fa17 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -335,7 +335,7 @@ abstract class BaseNode implements NodeInterface } catch (Exception $e) { throw $e; } catch (\Exception $e) { - throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s', $this->getPath(), $e->getMessage()), $e->getCode(), $e); + throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s.', $this->getPath(), $e->getMessage()), $e->getCode(), $e); } } diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 115054a24f..29d1e154fc 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -472,7 +472,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition $path = $node->getPath(); if (null !== $this->key) { - throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path)); } if (false === $this->allowEmptyValue) { @@ -480,15 +480,15 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition } if (true === $this->atLeastOne) { - throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path)); } if ($this->default) { - throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path)); } if (false !== $this->addDefaultChildren) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path)); } } @@ -502,20 +502,20 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition $path = $node->getPath(); if ($this->addDefaults) { - throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path)); } if (false !== $this->addDefaultChildren) { if ($this->default) { - throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path)); } if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path)); } if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path)); } } } diff --git a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php index 05949d2b5a..5db229dcca 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -200,7 +200,7 @@ class ExprBuilder */ public function thenUnset() { - $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); }; + $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key.'); }; return $this; } diff --git a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php index 0d0207ca4f..390b113656 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php @@ -35,7 +35,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition public function max($max) { if (isset($this->min) && $this->min > $max) { - throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s)', $max, $this->min)); + throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); } $this->max = $max; @@ -54,7 +54,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition public function min($min) { if (isset($this->max) && $this->max < $min) { - throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s)', $min, $this->max)); + throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); } $this->min = $min; diff --git a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php index 5b216d897a..ba35539460 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php @@ -39,7 +39,7 @@ class YamlReferenceDumper foreach (explode('.', $path) as $step) { if (!$node instanceof ArrayNode) { - throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path)); + throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); } /** @var NodeInterface[] $children */ @@ -53,7 +53,7 @@ class YamlReferenceDumper } } - throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path)); + throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); } return $this->dumpNode($node); diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 7b64d842aa..d36b9a440f 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -185,7 +185,7 @@ class PrototypedArrayNode extends ArrayNode protected function finalizeValue($value) { if (false === $value) { - throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); } foreach ($value as $k => $v) { diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index b5637277e8..c576ec050a 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -576,7 +576,7 @@ class Application $exact = \in_array($namespace, $namespaces, true); if (\count($namespaces) > 1 && !$exact) { - throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces)); + throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces)); } return $exact ? $namespace : reset($namespaces); @@ -681,7 +681,7 @@ class Application }, array_values($commands)); $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs)); - throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $name, $suggestions), array_values($commands)); + throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands)); } return $this->get($exact ? $name : reset($commands)); diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 0574cb7388..311fdb6a14 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -563,7 +563,7 @@ class Command public function setAliases($aliases) { if (!\is_array($aliases) && !$aliases instanceof \Traversable) { - throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); + throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.'); } foreach ($aliases as $alias) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index adfcdc8750..99e0ac1e91 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -119,7 +119,7 @@ class OutputFormatter implements OutputFormatterInterface public function getStyle($name) { if (!$this->hasStyle($name)) { - throw new InvalidArgumentException(sprintf('Undefined style: %s', $name)); + throw new InvalidArgumentException(sprintf('Undefined style: %s.', $name)); } return $this->styles[strtolower($name)]; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index 477bd87f0c..7075c72110 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -86,7 +86,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } if (!isset(static::$availableForegroundColors[$color])) { - throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); + throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableForegroundColors)))); } $this->foreground = static::$availableForegroundColors[$color]; @@ -104,7 +104,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } if (!isset(static::$availableBackgroundColors[$color])) { - throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); + throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); } $this->background = static::$availableBackgroundColors[$color]; @@ -116,7 +116,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface public function setOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions)))); } if (!\in_array(static::$availableOptions[$option], $this->options)) { @@ -130,7 +130,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface public function unsetOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions)))); } $pos = array_search(static::$availableOptions[$option], $this->options); diff --git a/src/Symfony/Component/Console/Helper/TableStyle.php b/src/Symfony/Component/Console/Helper/TableStyle.php index bc9c7e94db..4213297f5f 100644 --- a/src/Symfony/Component/Console/Helper/TableStyle.php +++ b/src/Symfony/Component/Console/Helper/TableStyle.php @@ -42,7 +42,7 @@ class TableStyle public function setPaddingChar($paddingChar) { if (!$paddingChar) { - throw new LogicException('The padding char must not be empty'); + throw new LogicException('The padding char must not be empty.'); } $this->paddingChar = $paddingChar; diff --git a/src/Symfony/Component/Console/Input/StringInput.php b/src/Symfony/Component/Console/Input/StringInput.php index 32d270faf1..5032b340a1 100644 --- a/src/Symfony/Component/Console/Input/StringInput.php +++ b/src/Symfony/Component/Console/Input/StringInput.php @@ -61,7 +61,7 @@ class StringInput extends ArgvInput $tokens[] = stripcslashes($match[1]); } else { // should never happen - throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10))); + throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10))); } $cursor += \strlen($match[0]); diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index c5c2daed25..940818930f 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -199,7 +199,7 @@ class OutputFormatterTest extends TestCase /** * @group legacy * @dataProvider provideInlineStyleTagsWithUnknownOptions - * @expectedDeprecation Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "Invalid option specified: "%s". Expected one of (bold, underscore, blink, reverse, conceal)". + * @expectedDeprecation Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "Invalid option specified: "%s". Expected one of (bold, underscore, blink, reverse, conceal).". */ public function testInlineStyleOptionsUnknownAreDeprecated($tag, $option) { diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index 2b8aa6a192..103b6a5f9c 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -58,7 +58,7 @@ class FunctionExtension extends AbstractExtension try { list($a, $b) = Parser::parseSeries($function->getArguments()); } catch (SyntaxErrorException $e) { - throw new ExpressionErrorException(sprintf('Invalid series: %s', implode(', ', $function->getArguments())), 0, $e); + throw new ExpressionErrorException(sprintf('Invalid series: %s.', implode(', ', $function->getArguments())), 0, $e); } $xpath->addStarPrefix(); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 1b39fab5ca..dfd63b85c8 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -223,14 +223,14 @@ class ErrorHandler if (!\is_array($log)) { $log = [$log]; } elseif (!\array_key_exists(0, $log)) { - throw new \InvalidArgumentException('No logger provided'); + throw new \InvalidArgumentException('No logger provided.'); } if (null === $log[0]) { $this->loggedErrors &= ~$type; } elseif ($log[0] instanceof LoggerInterface) { $this->loggedErrors |= $type; } else { - throw new \InvalidArgumentException('Invalid logger provided'); + throw new \InvalidArgumentException('Invalid logger provided.'); } $this->loggers[$type] = $log + $prev[$type]; diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index c8250a71cf..81d15c9771 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -213,7 +213,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface return $this->extensionsByNs[$name]; } - throw new LogicException(sprintf('Container extension "%s" is not registered', $name)); + throw new LogicException(sprintf('Container extension "%s" is not registered.', $name)); } /** @@ -866,7 +866,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface $alias = $this->normalizeId($alias); if ('' === $alias || '\\' === substr($alias, -1) || \strlen($alias) !== strcspn($alias, "\0\r\n'")) { - throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias)); + throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias)); } if (\is_string($id)) { @@ -1017,13 +1017,13 @@ class ContainerBuilder extends Container implements TaggedContainerInterface public function setDefinition($id, Definition $definition) { if ($this->isCompiled()) { - throw new BadMethodCallException('Adding definition to a compiled container is not allowed'); + throw new BadMethodCallException('Adding definition to a compiled container is not allowed.'); } $id = $this->normalizeId($id); if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) { - throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id)); + throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id)); } unset($this->aliasDefinitions[$id], $this->removedIds[$id]); @@ -1152,7 +1152,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (\is_array($factory)) { $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]]; } elseif (!\is_string($factory)) { - throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id)); + throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id)); } } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 4dd4475cbe..cbe3c53ae6 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -895,7 +895,7 @@ EOTXT $callable = $definition->getFactory(); if (\is_array($callable)) { if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) { - throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $callable[1] ?: 'n/a')); + throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a')); } if ($callable[0] instanceof Reference @@ -1701,7 +1701,7 @@ EOF; if (\is_array($factory)) { if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $factory[1])) { - throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $factory[1] ?: 'n/a')); + throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $factory[1] ?: 'n/a')); } $class = $this->dumpValue($factory[0]); @@ -1722,7 +1722,7 @@ EOF; } } - throw new RuntimeException('Cannot dump definition because of invalid factory'); + throw new RuntimeException('Cannot dump definition because of invalid factory.'); } $class = $value->getClass(); @@ -1785,7 +1785,7 @@ EOF; return sprintf('${($_ = %s) && false ?: "_"}', $class); } if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) { - throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a')); + throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a')); } $class = substr(str_replace('\\\\', '\\', $class), 1, -1); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php index 5b3e704c25..059e3c3a2c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php @@ -31,7 +31,7 @@ abstract class AbstractConfigurator return \call_user_func_array([$this, 'set'.$method], $args); } - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method)); + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s().', static::class, $method)); } /** diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php index 828d4071da..99759f3b2d 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php @@ -45,7 +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/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index 0a800f01c3..fd86aa87ce 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -129,7 +129,7 @@ abstract class FileLoader extends BaseFileLoader $prefixLen = \strlen($resource->getPrefix()); if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) { - throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $namespace, $excludePattern, $pattern)); + throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern)); } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index bd2902f856..b7d3c03a07 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -378,7 +378,7 @@ class XmlFileLoader extends FileLoader try { $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); } catch (\InvalidArgumentException $e) { - throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e); + throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s.', $file, $e->getMessage()), $e->getCode(), $e); } $this->validateExtensions($dom, $file); @@ -577,7 +577,7 @@ class XmlFileLoader extends FileLoader $path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]); if (!is_file($path)) { - throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', \get_class($extension), $path)); + throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".', \get_class($extension), $path)); } $schemaLocations[$items[$i]] = $path; @@ -668,7 +668,7 @@ EOF // can it be handled by an extension? if (!$this->container->hasExtension($node->namespaceURI)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $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', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 891689bc16..91d8a032ae 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -660,7 +660,7 @@ class YamlFileLoader extends FileLoader try { $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS); } catch (ParseException $e) { - throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e); + throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s.', $file, $e->getMessage()), 0, $e); } finally { restore_error_handler(); } @@ -695,7 +695,7 @@ class YamlFileLoader extends FileLoader if (!$this->container->hasExtension($namespace)) { $extensionNamespaces = 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, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : '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, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php index cbcc699517..9fe075d8f1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php @@ -219,7 +219,7 @@ class FileLoaderTest extends TestCase ); } catch (InvalidArgumentException $e) { $this->assertEquals( - sprintf('Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $excludePattern, $resourcePattern), + sprintf('Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $excludePattern, $resourcePattern), $e->getMessage() ); } diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php index 3bbcfa7473..af8bcfbac3 100644 --- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php +++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php @@ -81,7 +81,7 @@ class FormFieldRegistry while ($segments) { $path = array_shift($segments); if (!\is_array($target) || !\array_key_exists($path, $target)) { - throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path)); + throw new \InvalidArgumentException(sprintf('Unreachable field "%s".', $path)); } $target = &$target[$path]; } diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 18f1b4f8c3..8f53a9d06a 100644 --- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -68,7 +68,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher @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'); + throw new \InvalidArgumentException('Expected an ["service", "method"] argument.'); } $this->listenerIds[$eventName][] = [$callback[0], $callback[1], $priority]; diff --git a/src/Symfony/Component/ExpressionLanguage/Lexer.php b/src/Symfony/Component/ExpressionLanguage/Lexer.php index 01ca293018..e534a56ed2 100644 --- a/src/Symfony/Component/ExpressionLanguage/Lexer.php +++ b/src/Symfony/Component/ExpressionLanguage/Lexer.php @@ -59,12 +59,12 @@ class Lexer } elseif (false !== strpos(')]}', $expression[$cursor])) { // closing bracket if (empty($brackets)) { - throw new SyntaxError(sprintf('Unexpected "%s"', $expression[$cursor]), $cursor, $expression); + throw new SyntaxError(sprintf('Unexpected "%s".', $expression[$cursor]), $cursor, $expression); } list($expect, $cur) = array_pop($brackets); if ($expression[$cursor] != strtr($expect, '([{', ')]}')) { - throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur, $expression); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression); } $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); @@ -87,7 +87,7 @@ class Lexer $cursor += \strlen($match[0]); } else { // unlexable - throw new SyntaxError(sprintf('Unexpected character "%s"', $expression[$cursor]), $cursor, $expression); + throw new SyntaxError(sprintf('Unexpected character "%s".', $expression[$cursor]), $cursor, $expression); } } @@ -95,7 +95,7 @@ class Lexer if (!empty($brackets)) { list($expect, $cur) = array_pop($brackets); - throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur, $expression); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression); } return new TokenStream($tokens, $expression); diff --git a/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php b/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php index bbfe393d0d..549161b372 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php @@ -148,13 +148,13 @@ class BinaryNode extends Node return $left * $right; case '/': if (0 == $right) { - throw new \DivisionByZeroError('Division by zero'); + throw new \DivisionByZeroError('Division by zero.'); } return $left / $right; case '%': if (0 == $right) { - throw new \DivisionByZeroError('Modulo by zero'); + throw new \DivisionByZeroError('Modulo by zero.'); } return $left % $right; diff --git a/src/Symfony/Component/ExpressionLanguage/Parser.php b/src/Symfony/Component/ExpressionLanguage/Parser.php index 0930bac2ef..bfc24395e1 100644 --- a/src/Symfony/Component/ExpressionLanguage/Parser.php +++ b/src/Symfony/Component/ExpressionLanguage/Parser.php @@ -99,7 +99,7 @@ class Parser $node = $this->parseExpression(); if (!$stream->isEOF()) { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression()); + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression()); } return $node; @@ -195,13 +195,13 @@ class Parser default: if ('(' === $this->stream->current->value) { if (false === isset($this->functions[$token->value])) { - throw new SyntaxError(sprintf('The function "%s" does not exist', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, array_keys($this->functions)); + throw new SyntaxError(sprintf('The function "%s" does not exist.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, array_keys($this->functions)); } $node = new Node\FunctionNode($token->value, $this->parseArguments()); } else { if (!\in_array($token->value, $this->names, true)) { - throw new SyntaxError(sprintf('Variable "%s" is not valid', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names); + throw new SyntaxError(sprintf('Variable "%s" is not valid.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names); } // is the name used in the compiled code different @@ -227,7 +227,7 @@ class Parser } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { $node = $this->parseHashExpression(); } else { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $token->type, $token->value), $token->cursor, $this->stream->getExpression()); + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $token->type, $token->value), $token->cursor, $this->stream->getExpression()); } } @@ -289,7 +289,7 @@ class Parser } else { $current = $this->stream->current; - throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', $current->type, $current->value), $current->cursor, $this->stream->getExpression()); + throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', $current->type, $current->value), $current->cursor, $this->stream->getExpression()); } $this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); @@ -327,7 +327,7 @@ class Parser // As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown. (Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value)) ) { - throw new SyntaxError('Expected name', $token->cursor, $this->stream->getExpression()); + throw new SyntaxError('Expected name.', $token->cursor, $this->stream->getExpression()); } $arg = new Node\ConstantNode($token->value, true); diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php index 38ce6590b9..b9b448dd8e 100644 --- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php +++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php @@ -67,7 +67,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function getItems(array $keys = []) { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -75,7 +75,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function hasItem($key) { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -83,7 +83,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function clear() { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -91,7 +91,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function deleteItem($key) { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -99,7 +99,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function deleteItems(array $keys) { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -107,7 +107,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function saveDeferred(CacheItemInterface $item) { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } /** @@ -115,6 +115,6 @@ class ParserCacheAdapter implements CacheItemPoolInterface */ public function commit() { - throw new \BadMethodCallException('Not implemented'); + throw new \BadMethodCallException('Not implemented.'); } } diff --git a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php index 12348e6830..3340042f0a 100644 --- a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php +++ b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php @@ -15,7 +15,7 @@ class SyntaxError extends \LogicException { public function __construct($message, $cursor = 0, $expression = '', $subject = null, array $proposals = null) { - $message = sprintf('%s around position %d', $message, $cursor); + $message = sprintf('%s around position %d', rtrim($message, '.'), $cursor); if ($expression) { $message = sprintf('%s for expression `%s`', $message, $expression); } diff --git a/src/Symfony/Component/ExpressionLanguage/TokenStream.php b/src/Symfony/Component/ExpressionLanguage/TokenStream.php index 9096b183ff..09d3854e8e 100644 --- a/src/Symfony/Component/ExpressionLanguage/TokenStream.php +++ b/src/Symfony/Component/ExpressionLanguage/TokenStream.php @@ -53,7 +53,7 @@ class TokenStream ++$this->position; if (!isset($this->tokens[$this->position])) { - throw new SyntaxError('Unexpected end of expression', $this->current->cursor, $this->expression); + throw new SyntaxError('Unexpected end of expression.', $this->current->cursor, $this->expression); } $this->current = $this->tokens[$this->position]; @@ -70,7 +70,7 @@ class TokenStream { $token = $this->current; if (!$token->test($type, $value)) { - throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression); + throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression); } $this->next(); } diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 7d7301c3a1..d5cb54ae98 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -103,7 +103,7 @@ class Filesystem if (self::$lastError) { throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); } - throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); + throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir); } } } @@ -362,7 +362,7 @@ class Filesystem } if (!is_file($originFile)) { - throw new FileNotFoundException(sprintf('Origin file "%s" is not a file', $originFile)); + throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile)); } foreach ($this->toIterable($targetFiles) as $targetFile) { diff --git a/src/Symfony/Component/Form/AbstractExtension.php b/src/Symfony/Component/Form/AbstractExtension.php index 22b8ae3854..1635bf8020 100644 --- a/src/Symfony/Component/Form/AbstractExtension.php +++ b/src/Symfony/Component/Form/AbstractExtension.php @@ -57,7 +57,7 @@ abstract class AbstractExtension implements FormExtensionInterface } if (!isset($this->types[$name])) { - throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name)); + throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension.', $name)); } return $this->types[$name]; diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index 50acb8db0c..aa981a0125 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -105,7 +105,7 @@ class Button implements \IteratorAggregate, FormInterface public function setParent(FormInterface $parent = null) { if ($this->submitted) { - throw new AlreadySubmittedException('You cannot set the parent of a submitted button'); + throw new AlreadySubmittedException('You cannot set the parent of a submitted button.'); } $this->parent = $parent; @@ -381,7 +381,7 @@ class Button implements \IteratorAggregate, FormInterface public function submit($submittedData, $clearMissing = true) { if ($this->submitted) { - throw new AlreadySubmittedException('A form can only be submitted once'); + throw new AlreadySubmittedException('A form can only be submitted once.'); } $this->submitted = true; diff --git a/src/Symfony/Component/Form/Command/DebugCommand.php b/src/Symfony/Component/Form/Command/DebugCommand.php index 49b2f1fe12..43ae1d66de 100644 --- a/src/Symfony/Component/Form/Command/DebugCommand.php +++ b/src/Symfony/Component/Form/Command/DebugCommand.php @@ -166,7 +166,7 @@ EOF return $classes[0]; } if (!$input->isInteractive()) { - throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s", $shortClassName, implode("\n ", $classes))); + throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s.", $shortClassName, implode("\n ", $classes))); } return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php index b073a123cf..f79920971c 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php @@ -76,7 +76,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface return null; } - throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys))); + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys))); } return $result; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php index cad078285f..e1feafe62e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php @@ -45,7 +45,7 @@ class ChoiceToValueTransformer implements DataTransformerInterface return null; } - throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value)); + throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique.', $value)); } return current($choices); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php index ac2108f0c4..6c9e4fe9dc 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php @@ -65,7 +65,7 @@ class ChoicesToValuesTransformer implements DataTransformerInterface $choices = $this->choiceList->getChoicesForValues($array); if (\count($choices) !== \count($array)) { - throw new TransformationFailedException('Could not find all matching choices for the given values'); + throw new TransformationFailedException('Could not find all matching choices for the given values.'); } return $choices; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php index 65e535d979..a910cfdda4 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php @@ -129,14 +129,14 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface } } if (\count($emptyFields) > 0) { - throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); + throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields))); } if (isset($value['invert']) && !\is_bool($value['invert'])) { - throw new TransformationFailedException('The value of "invert" must be boolean'); + throw new TransformationFailedException('The value of "invert" must be boolean.'); } foreach (self::$availableFields as $field => $char) { if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) { - throw new TransformationFailedException(sprintf('This amount of "%s" is invalid', $field)); + throw new TransformationFailedException(sprintf('This amount of "%s" is invalid.', $field)); } } try { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php index aaefdfac9d..821761f227 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -79,7 +79,7 @@ class DateIntervalToStringTransformer implements DataTransformerInterface return null; } if (!$this->isISO8601($value)) { - throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet'); + throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet.'); } $valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/'; if (!preg_match($valuePattern, $value)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php index ca934614cd..9c061a86dd 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -134,35 +134,35 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer } if (\count($emptyFields) > 0) { - throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); + throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields))); } if (isset($value['month']) && !ctype_digit((string) $value['month'])) { - throw new TransformationFailedException('This month is invalid'); + throw new TransformationFailedException('This month is invalid.'); } if (isset($value['day']) && !ctype_digit((string) $value['day'])) { - throw new TransformationFailedException('This day is invalid'); + throw new TransformationFailedException('This day is invalid.'); } if (isset($value['year']) && !ctype_digit((string) $value['year'])) { - throw new TransformationFailedException('This year is invalid'); + throw new TransformationFailedException('This year is invalid.'); } if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) { - throw new TransformationFailedException('This is an invalid date'); + throw new TransformationFailedException('This is an invalid date.'); } if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) { - throw new TransformationFailedException('This hour is invalid'); + throw new TransformationFailedException('This hour is invalid.'); } if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) { - throw new TransformationFailedException('This minute is invalid'); + throw new TransformationFailedException('This minute is invalid.'); } if (isset($value['second']) && !ctype_digit((string) $value['second'])) { - throw new TransformationFailedException('This second is invalid'); + throw new TransformationFailedException('This second is invalid.'); } try { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index fe9002fe47..a480b8312b 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -152,7 +152,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface } if (\in_array($value, ['NaN', 'NAN', 'nan'], true)) { - throw new TransformationFailedException('"NaN" is not a valid number'); + throw new TransformationFailedException('"NaN" is not a valid number.'); } $position = 0; @@ -183,7 +183,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface } if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) { - throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like'); + throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.'); } $result = $this->castParsedValue($result); @@ -204,7 +204,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); if ('' !== $remainder) { - throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder)); + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder)); } } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index 7aacb29e0d..5de0656164 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -162,7 +162,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); if ('' !== $remainder) { - throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder)); + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder)); } } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index c1944cb9bf..4f04645eb7 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -64,7 +64,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface foreach ($this->keys as $key) { if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && [] !== $array[$key]) { if ($array[$key] !== $result) { - throw new TransformationFailedException('All values in the array should be the same'); + throw new TransformationFailedException('All values in the array should be the same.'); } } else { $emptyKeys[] = $key; @@ -77,7 +77,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface return null; } - throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys))); + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys))); } return $result; diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php index 54de667cd1..1b67982788 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php @@ -163,7 +163,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface public function getElement($index) { if (!isset($this->elements[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index)); } return $this->elements[$index]; @@ -175,7 +175,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface public function isProperty($index) { if (!isset($this->isIndex[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index)); } return !$this->isIndex[$index]; @@ -187,7 +187,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface public function isIndex($index) { if (!isset($this->isIndex[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index)); } return $this->isIndex[$index]; @@ -212,7 +212,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface public function mapsForm($index) { if (!isset($this->mapsForm[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index)); } return $this->mapsForm[$index]; diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index b25afe3a9e..0403ba1049 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -163,7 +163,7 @@ class Form implements \IteratorAggregate, FormInterface // `setData` and `add` will not lead to the correct population of // the child forms. if ($config->getCompound() && !$config->getDataMapper()) { - throw new LogicException('Compound forms need a data mapper'); + throw new LogicException('Compound forms need a data mapper.'); } // If the form inherits the data from its parent, it is not necessary @@ -260,7 +260,7 @@ class Form implements \IteratorAggregate, FormInterface public function setParent(FormInterface $parent = null) { if ($this->submitted) { - throw new AlreadySubmittedException('You cannot set the parent of a submitted form'); + throw new AlreadySubmittedException('You cannot set the parent of a submitted form.'); } if (null !== $parent && '' === $this->name) { @@ -495,7 +495,7 @@ class Form implements \IteratorAggregate, FormInterface public function submit($submittedData, $clearMissing = true) { if ($this->submitted) { - throw new AlreadySubmittedException('A form can only be submitted once'); + throw new AlreadySubmittedException('A form can only be submitted once.'); } // Initialize errors in the very beginning so we're sure @@ -810,7 +810,7 @@ class Form implements \IteratorAggregate, FormInterface public function add($child, $type = null, array $options = []) { if ($this->submitted) { - throw new AlreadySubmittedException('You cannot add children to a submitted form'); + throw new AlreadySubmittedException('You cannot add children to a submitted form.'); } if (!$this->config->getCompound()) { @@ -879,7 +879,7 @@ class Form implements \IteratorAggregate, FormInterface public function remove($name) { if ($this->submitted) { - throw new AlreadySubmittedException('You cannot remove children from a submitted form'); + throw new AlreadySubmittedException('You cannot remove children from a submitted form.'); } if (isset($this->children[$name])) { diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index 0d1310b22d..6393c2d237 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -132,7 +132,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ public function offsetSet($name, $value) { - throw new BadMethodCallException('Not supported'); + throw new BadMethodCallException('Not supported.'); } /** diff --git a/src/Symfony/Component/Form/PreloadedExtension.php b/src/Symfony/Component/Form/PreloadedExtension.php index 759ae9ad17..310b70f596 100644 --- a/src/Symfony/Component/Form/PreloadedExtension.php +++ b/src/Symfony/Component/Form/PreloadedExtension.php @@ -47,7 +47,7 @@ class PreloadedExtension implements FormExtensionInterface public function getType($name) { if (!isset($this->types[$name])) { - throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name)); + throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension.', $name)); } return $this->types[$name]; diff --git a/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php b/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php index 46bd8b7e57..670382619d 100644 --- a/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php +++ b/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php @@ -30,11 +30,11 @@ trait ValidatorExtensionTrait protected function getValidatorExtension() { if (!interface_exists(ValidatorInterface::class)) { - throw new \Exception('In order to use the "ValidatorExtensionTrait", the symfony/validator component must be installed'); + throw new \Exception('In order to use the "ValidatorExtensionTrait", the symfony/validator component must be installed.'); } if (!$this instanceof TypeTestCase) { - throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s', TypeTestCase::class)); + throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s.', TypeTestCase::class)); } $this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock(); diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index 19ec4fc7d2..45b9e26c01 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -112,7 +112,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable public function offsetGet($key) { if (!isset($this->elements[$key])) { - throw new \OutOfBoundsException('The offset "'.$key.'" does not exist.'); + throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key)); } return $this->elements[$key]; diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index 34220588a4..309339e5cf 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -97,7 +97,7 @@ class File extends \SplFileInfo $renamed = rename($this->getPathname(), $target); restore_error_handler(); if (!$renamed) { - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); + throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error))); } @chmod($target, 0666 & ~umask()); @@ -109,10 +109,10 @@ class File extends \SplFileInfo { if (!is_dir($directory)) { if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) { - throw new FileException(sprintf('Unable to create the "%s" directory', $directory)); + throw new FileException(sprintf('Unable to create the "%s" directory.', $directory)); } } elseif (!is_writable($directory)) { - throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); + throw new FileException(sprintf('Unable to write in the "%s" directory.', $directory)); } $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index e05269fc80..8d971ed677 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -127,7 +127,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface } if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) { - throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)'); + throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?).'); } return null; diff --git a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php index 86153ed49c..5b75dd84fc 100644 --- a/src/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/src/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -196,7 +196,7 @@ class UploadedFile extends File $moved = move_uploaded_file($this->getPathname(), $target); restore_error_handler(); if (!$moved) { - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); + throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error))); } @chmod($target, 0666 & ~umask()); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index 3abc33caa5..d4b68ae8b8 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -47,7 +47,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface public function __construct(\Memcache $memcache, array $options = []) { if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) { - throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff))); } $this->memcache = $memcache; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index a399be5fd8..6711e0a55f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -47,7 +47,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler $this->memcached = $memcached; if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) { - throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff))); } $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 1dd7240669..d84f2e9d0c 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -74,11 +74,11 @@ class MongoDbSessionHandler extends AbstractSessionHandler } if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { - throw new \InvalidArgumentException('MongoClient or Mongo instance required'); + throw new \InvalidArgumentException('MongoClient or Mongo instance required.'); } if (!isset($options['database']) || !isset($options['collection'])) { - throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler'); + throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler.'); } $this->mongo = $mongo; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php index 8b7615ec10..f24271fbf5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -38,7 +38,7 @@ class NativeFileSessionHandler extends NativeSessionHandler if ($count = substr_count($savePath, ';')) { if ($count > 2) { - throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath)); + throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'.', $savePath)); } // characters after last ';' are the path @@ -46,7 +46,7 @@ class NativeFileSessionHandler extends NativeSessionHandler } if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) { - throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir)); + throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $baseDir)); } ini_set('session.save_path', $savePath); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 653ca6917b..d1cf622bdd 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -173,7 +173,7 @@ class PdoSessionHandler extends AbstractSessionHandler { if ($pdoOrDsn instanceof \PDO) { if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); + throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__)); } $this->pdo = $pdoOrDsn; @@ -465,7 +465,7 @@ class PdoSessionHandler extends AbstractSessionHandler } if (!isset($params['scheme'])) { - throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler'); + throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler.'); } $driverAliasMap = [ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index c1e7523c5e..969f272fb3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -152,7 +152,7 @@ class MockArraySessionStorage implements SessionStorageInterface public function save() { if (!$this->started || $this->closed) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); + throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.'); } // nothing to do since we don't persist the session data $this->closed = false; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 9bbd1baf2c..c5b1d1a360 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -38,7 +38,7 @@ class MockFileSessionStorage extends MockArraySessionStorage } if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) { - throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $savePath)); + throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $savePath)); } $this->savePath = $savePath; @@ -88,7 +88,7 @@ class MockFileSessionStorage extends MockArraySessionStorage public function save() { if (!$this->started) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); + throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.'); } $data = $this->data; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 7502897a44..33a146553f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -152,7 +152,7 @@ class NativeSessionStorage implements SessionStorageInterface // ok to try and start the session if (!session_start()) { - throw new \RuntimeException('Failed to start the session'); + throw new \RuntimeException('Failed to start the session.'); } if (null !== $this->emulateSameSite) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index cd0635a168..b9c2682b3c 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -88,7 +88,7 @@ abstract class AbstractProxy public function setId($id) { if ($this->isActive()) { - throw new \LogicException('Cannot change the ID of an active session'); + throw new \LogicException('Cannot change the ID of an active session.'); } session_id($id); @@ -114,7 +114,7 @@ abstract class AbstractProxy public function setName($name) { if ($this->isActive()) { - throw new \LogicException('Cannot change the name of an active session'); + throw new \LogicException('Cannot change the name of an active session.'); } session_name($name); diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 619628b5c7..4e11ac640b 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -88,7 +88,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve try { $callable = $this->createController($controller); } catch (\InvalidArgumentException $e) { - throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()), 0, $e); + throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s.', $request->getPathInfo(), $e->getMessage()), 0, $e); } return $callable; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 4266b22fec..7c32ec1001 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -217,7 +217,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $dumper = new HtmlDumper($data, $this->charset); $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { - throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format)); + throw new \InvalidArgumentException(sprintf('Invalid dump format: %s.', $format)); } $dumps = []; diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php index f94a5c0760..4850e589da 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php @@ -57,7 +57,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer public function setTemplating($templating) { if (null !== $templating && !$templating instanceof EngineInterface && !$templating instanceof Environment) { - throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface'); + throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface.'); } $this->templating = $templating; diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4ef763e486..a73788e1ec 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -493,7 +493,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl foreach ($this->registerBundles() as $bundle) { $name = $bundle->getName(); if (isset($this->bundles[$name])) { - throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); + throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name)); } $this->bundles[$name] = $bundle; @@ -762,10 +762,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) { if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); + throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n.", $name, $dir)); } } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); + throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n.", $name, $dir)); } } diff --git a/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php b/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php index 3383a0a76a..7e1fa23ca5 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php @@ -37,7 +37,7 @@ class GenrbCompiler implements BundleCompilerInterface exec('which '.$genrb, $output, $status); if (0 !== $status) { - throw new RuntimeException(sprintf('The command "%s" is not installed', $genrb)); + throw new RuntimeException(sprintf('The command "%s" is not installed.', $genrb)); } $this->genrb = ($envVars ? $envVars.' ' : '').$genrb; diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php index 5c41c40439..a56fd6af1c 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php @@ -46,7 +46,7 @@ class JsonBundleReader implements BundleReaderInterface $data = json_decode(file_get_contents($fileName), true); if (null === $data) { - throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s', $fileName, json_last_error_msg())); + throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s.', $fileName, json_last_error_msg())); } return $data; diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index dff4ab18b3..0f50617955 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -160,7 +160,7 @@ class LocaleDataGenerator extends AbstractDataGenerator // i.e. in de_AT, "AT" is the region if ($region = \Locale::getRegion($locale)) { if (!RegionDataGenerator::isValidCountryCode($region)) { - throw new MissingResourceException('Skipping "'.$locale.'" due an invalid country.'); + throw new MissingResourceException(sprintf('Skipping "%s" due an invalid country.', $locale)); } $extras[] = str_replace(['(', ')'], ['[', ']'], $reader->readEntry($tempDir.'/region', $displayLocale, ['Countries', $region])); diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php index 696f38fe1d..a6afb0b2c2 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php @@ -121,7 +121,7 @@ class FullTransformer // handle unimplemented characters if (false !== strpos($this->notImplementedChars, $dateChars[0])) { - throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern)); + throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s".', $dateChars[0], $this->pattern)); } return null; diff --git a/src/Symfony/Component/Intl/Globals/IntlGlobals.php b/src/Symfony/Component/Intl/Globals/IntlGlobals.php index 0dd25382f6..6268107ec0 100644 --- a/src/Symfony/Component/Intl/Globals/IntlGlobals.php +++ b/src/Symfony/Component/Intl/Globals/IntlGlobals.php @@ -118,7 +118,7 @@ abstract class IntlGlobals public static function setError($code, $message = '') { if (!isset(self::$errorCodes[$code])) { - throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code)); + throw new \InvalidArgumentException(sprintf('No such error code: "%s".', $code)); } self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code]; diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index 13bffbd453..f9ad71eb92 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -363,7 +363,7 @@ class NumberFormatter } if (self::CURRENCY === $this->style) { - throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE)); + throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s.', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE)); } // Only the default type is supported. diff --git a/src/Symfony/Component/Ldap/Ldap.php b/src/Symfony/Component/Ldap/Ldap.php index fd4955ef5d..bc1543e4c1 100644 --- a/src/Symfony/Component/Ldap/Ldap.php +++ b/src/Symfony/Component/Ldap/Ldap.php @@ -73,7 +73,7 @@ final class Ldap implements LdapInterface public static function create($adapter, array $config = []) { if (!isset(self::$adapterMap[$adapter])) { - throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s', $adapter, implode(', ', self::$adapterMap))); + throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s.', $adapter, implode(', ', self::$adapterMap))); } $class = self::$adapterMap[$adapter]; diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index 7ff893d58f..ebe6973133 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -42,7 +42,7 @@ class MemcachedStore implements StoreInterface public function __construct(\Memcached $memcached, $initialTtl = 300) { if (!static::isSupported()) { - throw new InvalidArgumentException('Memcached extension is required'); + throw new InvalidArgumentException('Memcached extension is required.'); } if ($initialTtl < 1) { diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index 56a91d7f06..d0c8abf119 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -37,7 +37,7 @@ class RedisStore implements StoreInterface public function __construct($redisClient, $initialTtl = 300.0) { if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) { - throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); + throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient))); } if ($initialTtl <= 0) { @@ -143,7 +143,7 @@ class RedisStore implements StoreInterface return \call_user_func_array([$this->redis, 'eval'], array_merge([$script, 1, $resource], $args)); } - throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis))); + throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given.', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis))); } /** diff --git a/src/Symfony/Component/Lock/Store/SemaphoreStore.php b/src/Symfony/Component/Lock/Store/SemaphoreStore.php index fb72ff828d..ea13c5fff9 100644 --- a/src/Symfony/Component/Lock/Store/SemaphoreStore.php +++ b/src/Symfony/Component/Lock/Store/SemaphoreStore.php @@ -49,7 +49,7 @@ class SemaphoreStore implements StoreInterface public function __construct() { if (!static::isSupported()) { - throw new InvalidArgumentException('Semaphore extension (sysvsem) is required'); + throw new InvalidArgumentException('Semaphore extension (sysvsem) is required.'); } } diff --git a/src/Symfony/Component/Process/InputStream.php b/src/Symfony/Component/Process/InputStream.php index 757d629455..82dbdb223d 100644 --- a/src/Symfony/Component/Process/InputStream.php +++ b/src/Symfony/Component/Process/InputStream.php @@ -45,7 +45,7 @@ class InputStream implements \IteratorAggregate return; } if ($this->isClosed()) { - throw new RuntimeException(sprintf('%s is closed', static::class)); + throw new RuntimeException(sprintf('%s is closed.', static::class)); } $this->input[] = ProcessUtils::validateInput(__METHOD__, $input); } diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 9dd415d5c9..b84b4f084c 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -107,7 +107,7 @@ abstract class AbstractPipes implements PipesInterface } elseif (!isset($this->inputBuffer[0])) { if (!\is_string($input)) { if (!is_scalar($input)) { - throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', \get_class($this->input), \gettype($input))); + throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported.', \get_class($this->input), \gettype($input))); } $input = (string) $input; } diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index e8e6f139e5..44056d54cf 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -57,7 +57,7 @@ class WindowsPipes extends AbstractPipes if (!$h = fopen($file.'.lock', 'w')) { restore_error_handler(); - throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError)); + throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s.', $lastError)); } if (!flock($h, LOCK_EX | LOCK_NB)) { continue 2; diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index c0c1fdaf69..4b5f27934a 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -260,7 +260,7 @@ class Process implements \IteratorAggregate public function start(callable $callback = null/*, array $env = [*/) { if ($this->isRunning()) { - throw new RuntimeException('Process is already running'); + throw new RuntimeException('Process is already running.'); } if (2 <= \func_num_args()) { $env = func_get_arg(1); @@ -375,7 +375,7 @@ class Process implements \IteratorAggregate public function restart(callable $callback = null/*, array $env = []*/) { if ($this->isRunning()) { - throw new RuntimeException('Process is already running'); + throw new RuntimeException('Process is already running.'); } $env = 1 < \func_num_args() ? func_get_arg(1) : null; @@ -409,7 +409,7 @@ class Process implements \IteratorAggregate if (null !== $callback) { if (!$this->processPipes->haveReadSupport()) { $this->stop(0); - throw new \LogicException('Pass the callback to the Process::start method or enableOutput to use a callback with Process::wait'); + throw new \LogicException('Pass the callback to the Process::start method or enableOutput to use a callback with Process::wait.'); } $this->callback = $this->buildCallback($callback); } diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 7aff347134..371c6c23d5 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -267,7 +267,7 @@ class PropertyAccessor implements PropertyAccessorInterface $type = substr($message, 2 + $j, strpos($message, ' given', $j) - $j - 2); $message = substr($message, $pos, $j - $pos); - throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given', $message, 'NULL' === $type ? 'null' : $type), 0, $previous); + throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given.', $message, 'NULL' === $type ? 'null' : $type), 0, $previous); } } @@ -591,7 +591,7 @@ class PropertyAccessor implements PropertyAccessorInterface private function writeIndex($zval, $index, $value) { if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { - throw new NoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess', $index, \get_class($zval[self::VALUE]))); + throw new NoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, \get_class($zval[self::VALUE]))); } $zval[self::REF][$index] = $value; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPath.php b/src/Symfony/Component/PropertyAccess/PropertyPath.php index 899cf55df8..ffbd9e1a97 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPath.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPath.php @@ -77,7 +77,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface return; } if (!\is_string($propertyPath)) { - throw new InvalidArgumentException(sprintf('The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "%s"', \is_object($propertyPath) ? \get_class($propertyPath) : \gettype($propertyPath))); + throw new InvalidArgumentException(sprintf('The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "%s".', \is_object($propertyPath) ? \get_class($propertyPath) : \gettype($propertyPath))); } if ('' === $propertyPath) { @@ -108,7 +108,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface } if ('' !== $remaining) { - throw new InvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d', $propertyPath, $remaining[0], $position)); + throw new InvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position)); } $this->length = \count($this->elements); @@ -173,7 +173,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface public function getElement($index) { if (!isset($this->elements[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index)); } return $this->elements[$index]; @@ -185,7 +185,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface public function isProperty($index) { if (!isset($this->isIndex[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index)); } return !$this->isIndex[$index]; @@ -197,7 +197,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface public function isIndex($index) { if (!isset($this->isIndex[$index])) { - throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index)); + throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index)); } return $this->isIndex[$index]; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php index d09a14b3fc..3dbfa7afcc 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php @@ -94,7 +94,7 @@ class PropertyPathBuilder public function remove($offset, $length = 1) { if (!isset($this->elements[$offset])) { - throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset)); + throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset)); } $this->resize($offset, $length, 0); @@ -149,7 +149,7 @@ class PropertyPathBuilder public function replaceByIndex($offset, $name = null) { if (!isset($this->elements[$offset])) { - throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset)); + throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset)); } if (null !== $name) { @@ -170,7 +170,7 @@ class PropertyPathBuilder public function replaceByProperty($offset, $name = null) { if (!isset($this->elements[$offset])) { - throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset)); + throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset)); } if (null !== $name) { diff --git a/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php b/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php index b5fa1ccede..e066d6f24f 100644 --- a/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php +++ b/src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php @@ -46,7 +46,7 @@ abstract class ObjectRouteLoader extends Loader { $parts = explode(':', $resource); if (2 != \count($parts)) { - throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource)); + throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName".', $resource)); } $serviceString = $parts[0]; @@ -55,11 +55,11 @@ abstract class ObjectRouteLoader extends Loader $loaderObject = $this->getServiceObject($serviceString); if (!\is_object($loaderObject)) { - throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', static::class, \gettype($loaderObject))); + throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned.', static::class, \gettype($loaderObject))); } if (!method_exists($loaderObject, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource)); + throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s".', $method, \get_class($loaderObject), $resource)); } $routeCollection = \call_user_func([$loaderObject, $method], $this); @@ -67,7 +67,7 @@ abstract class ObjectRouteLoader extends Loader if (!$routeCollection instanceof RouteCollection) { $type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection); - throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type)); + throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned.', \get_class($loaderObject), $method, $type)); } // make the service file tracked so that if it changes, the cache rebuilds diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php index b7aa35a8f9..00092c4313 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php @@ -68,7 +68,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider protected function retrieveUser($username, UsernamePasswordToken $token) { if (AuthenticationProviderInterface::USERNAME_NONE_PROVIDED === $username) { - throw new UsernameNotFoundException('Username can not be null'); + throw new UsernameNotFoundException('Username can not be null.'); } return $this->userProvider->loadUserByUsername($username); diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index 18413a7dc9..1d3a9804ee 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -81,7 +81,7 @@ class LdapUserProvider implements UserProviderInterface } if ($count > 1) { - throw new UsernameNotFoundException('More than one user found'); + throw new UsernameNotFoundException('More than one user found.'); } $entry = $entries[0]; diff --git a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php index ddc8c50297..5023c31eca 100644 --- a/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php @@ -101,7 +101,7 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface $user = $guardAuthenticator->getUser($token->getCredentials(), $this->userProvider); if (null === $user) { - throw new UsernameNotFoundException(sprintf('Null returned from %s::getUser()', \get_class($guardAuthenticator))); + throw new UsernameNotFoundException(sprintf('Null returned from %s::getUser().', \get_class($guardAuthenticator))); } if (!$user instanceof UserInterface) { diff --git a/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php b/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php index 1d03e23a85..4456cff9ab 100644 --- a/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php @@ -64,7 +64,7 @@ class SimpleAuthenticationHandler implements AuthenticationFailureHandlerInterfa } if (null !== $response) { - throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object', \get_class($this->simpleAuthenticator))); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object.', \get_class($this->simpleAuthenticator))); } } @@ -91,7 +91,7 @@ class SimpleAuthenticationHandler implements AuthenticationFailureHandlerInterfa } if (null !== $response) { - throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object', \get_class($this->simpleAuthenticator))); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object.', \get_class($this->simpleAuthenticator))); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index 693dbcd586..2308896e85 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -94,7 +94,7 @@ class DigestAuthenticationListener implements ListenerInterface $user = $this->provider->loadUserByUsername($digestAuth->getUsername()); if (null === $user) { - throw new AuthenticationServiceException('Digest User provider returned null, which is an interface contract violation'); + throw new AuthenticationServiceException('Digest User provider returned null, which is an interface contract violation.'); } $serverDigestMd5 = $digestAuth->calculateServerDigest($user->getPassword(), $request->getMethod()); @@ -199,11 +199,11 @@ class DigestData public function validateAndDecode($entryPointKey, $expectedRealm) { if ($keys = array_diff(['username', 'realm', 'nonce', 'uri', 'response'], array_keys($this->elements))) { - throw new BadCredentialsException(sprintf('Missing mandatory digest value; received header "%s" (%s)', $this->header, implode(', ', $keys))); + throw new BadCredentialsException(sprintf('Missing mandatory digest value; received header "%s" (%s).', $this->header, implode(', ', $keys))); } if ('auth' === $this->elements['qop'] && !isset($this->elements['nc'], $this->elements['cnonce'])) { - throw new BadCredentialsException(sprintf('Missing mandatory digest value; received header "%s"', $this->header)); + throw new BadCredentialsException(sprintf('Missing mandatory digest value; received header "%s".', $this->header)); } if ($expectedRealm !== $this->elements['realm']) { diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index b1259d116f..21e45516ea 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -212,7 +212,7 @@ class ExceptionListener if (!$response instanceof Response) { $given = \is_object($response) ? \get_class($response) : \gettype($response); - throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned)', \get_class($this->authenticationEntryPoint), $given)); + throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned).', \get_class($this->authenticationEntryPoint), $given)); } return $response; diff --git a/src/Symfony/Component/Security/Http/Firewall/RemoteUserAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/RemoteUserAuthenticationListener.php index fbba95db70..ea18b22d5d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RemoteUserAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RemoteUserAuthenticationListener.php @@ -41,7 +41,7 @@ class RemoteUserAuthenticationListener extends AbstractPreAuthenticatedListener protected function getPreAuthenticatedData(Request $request) { if (!$request->server->has($this->userKey)) { - throw new BadCredentialsException(sprintf('User key was not found: %s', $this->userKey)); + throw new BadCredentialsException(sprintf('User key was not found: %s.', $this->userKey)); } return [$request->server->get($this->userKey), null]; diff --git a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php index b21a50d56d..010f057406 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php @@ -54,7 +54,7 @@ class SimpleFormAuthenticationListener extends AbstractAuthenticationListener public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfTokenManagerInterface $csrfTokenManager = null, SimpleFormAuthenticatorInterface $simpleAuthenticator = null) { if (!$simpleAuthenticator) { - throw new \InvalidArgumentException('Missing simple authenticator'); + throw new \InvalidArgumentException('Missing simple authenticator.'); } $this->simpleAuthenticator = $simpleAuthenticator; diff --git a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php index 7e376f5ef0..d5163ae030 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php @@ -120,7 +120,7 @@ class SimplePreAuthenticationListener implements ListenerInterface if ($response instanceof Response) { $event->setResponse($response); } elseif (null !== $response) { - throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object', \get_class($this->simpleAuthenticator))); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object.', \get_class($this->simpleAuthenticator))); } } @@ -132,7 +132,7 @@ class SimplePreAuthenticationListener implements ListenerInterface if ($response instanceof Response) { $event->setResponse($response); } elseif (null !== $response) { - throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object', \get_class($this->simpleAuthenticator))); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object.', \get_class($this->simpleAuthenticator))); } } } diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index a5d077fb31..7fe6b33f23 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -100,7 +100,7 @@ class SwitchUserListener implements ListenerInterface try { $this->tokenStorage->setToken($this->attemptSwitchUser($request, $username)); } catch (AuthenticationException $e) { - throw new \LogicException(sprintf('Switch User failed: "%s"', $e->getMessage())); + throw new \LogicException(sprintf('Switch User failed: "%s".', $e->getMessage())); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php index e3cfb9d80e..8adf56796e 100644 --- a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php @@ -52,7 +52,7 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener } if (null === $user) { - throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s', $this->userKey, $this->credentialKey)); + throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s.', $this->userKey, $this->credentialKey)); } return [$user, $request->server->get($this->credentialKey, '')]; diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index e47e181221..fba79fba87 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -265,7 +265,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface { foreach ($cookieParts as $cookiePart) { if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) { - throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s"', self::COOKIE_DELIMITER)); + throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s".', self::COOKIE_DELIMITER)); } } diff --git a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php index a04a9afcca..3a886afc49 100644 --- a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php +++ b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php @@ -59,7 +59,7 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte return; default: - throw new \RuntimeException(sprintf('Invalid session authentication strategy "%s"', $this->strategy)); + throw new \RuntimeException(sprintf('Invalid session authentication strategy "%s".', $this->strategy)); } } } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php index aff73429ae..10c9b57b92 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php @@ -86,7 +86,7 @@ class ExceptionListenerTest extends TestCase $listener->onKernelException($event); // the exception has been replaced by our LogicException $this->assertInstanceOf('LogicException', $event->getException()); - $this->assertStringEndsWith('start() method must return a Response object (string returned)', $event->getException()->getMessage()); + $this->assertStringEndsWith('start() method must return a Response object (string returned).', $event->getException()->getMessage()); } /** diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index dada438e29..bd6b8f1565 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -431,7 +431,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec return $this->appendNode($parentNode, $data, 'data'); } - throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); + throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); } /** diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php index 5c58476383..9baa969da4 100644 --- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php +++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php @@ -42,7 +42,7 @@ trait ClassResolverTrait } if (!\is_object($value)) { - throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s"', \gettype($value))); + throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value))); } return \get_class($value); diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php index d1b0dee93e..be3b8984a0 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php @@ -30,11 +30,11 @@ abstract class FileLoader implements LoaderInterface public function __construct($file) { if (!is_file($file)) { - throw new MappingException(sprintf('The mapping file %s does not exist', $file)); + throw new MappingException(sprintf('The mapping file %s does not exist.', $file)); } if (!is_readable($file)) { - throw new MappingException(sprintf('The mapping file %s is not readable', $file)); + throw new MappingException(sprintf('The mapping file %s is not readable.', $file)); } $this->file = $file; diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php index 1890a9d84c..7f90c84048 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/LoaderChain.php @@ -40,7 +40,7 @@ class LoaderChain implements LoaderInterface { foreach ($loaders as $loader) { if (!$loader instanceof LoaderInterface) { - throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', \get_class($loader))); + throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface.', \get_class($loader))); } } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index b2b4604e35..55bf43b0d3 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -185,7 +185,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N return \call_user_func($this->circularReferenceHandler, $object); } - throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', \get_class($object), $this->circularReferenceLimit)); + throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d).', \get_class($object), $this->circularReferenceLimit)); } /** @@ -388,7 +388,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N try { if (null !== $parameter->getClass()) { if (!$this->serializer instanceof DenormalizerInterface) { - throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $parameter->getClass(), static::class)); + throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer.', $parameter->getClass(), static::class)); } $parameterClass = $parameter->getClass()->getName(); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 6cb6ec5013..56dc3c590e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -91,7 +91,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer foreach ($stack as $attribute => $attributeValue) { if (!$this->serializer instanceof NormalizerInterface) { - throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer', $attribute)); + throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer.', $attribute)); } $data = $this->updateData($data, $attribute, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attribute, $format))); @@ -268,7 +268,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer if (Type::BUILTIN_TYPE_OBJECT === $builtinType) { if (!$this->serializer instanceof DenormalizerInterface) { - throw new LogicException(sprintf('Cannot denormalize attribute "%s" for class "%s" because injected serializer is not a denormalizer', $attribute, $class)); + throw new LogicException(sprintf('Cannot denormalize attribute "%s" for class "%s" because injected serializer is not a denormalizer.', $attribute, $class)); } $childContext = $this->createChildContext($context, $attribute, $format); diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index d9d5a586e1..3217bc38be 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -101,7 +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 { diff --git a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php index f4080e524c..85e6e1c8b6 100644 --- a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php @@ -35,7 +35,7 @@ class JsonSerializableNormalizer extends AbstractNormalizer } if (!$this->serializer instanceof NormalizerInterface) { - throw new LogicException('Cannot normalize object because injected serializer is not a normalizer'); + throw new LogicException('Cannot normalize object because injected serializer is not a normalizer.'); } return $this->serializer->normalize($object->jsonSerialize(), $format, $context); diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 0e2143e93a..95a2d96136 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -109,7 +109,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz final public function serialize($data, $format, array $context = []) { if (!$this->supportsEncoding($format, $context)) { - throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format)); + throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format)); } if ($this->encoder->needsNormalization($format, $context)) { @@ -125,7 +125,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz final public function deserialize($data, $type, $format, array $context = []) { if (!$this->supportsDecoding($format, $context)) { - throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format)); + throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported.', $format)); } $data = $this->decode($data, $format, $context); @@ -164,7 +164,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data))); } - throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); + throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data)))); } /** diff --git a/src/Symfony/Component/Stopwatch/StopwatchEvent.php b/src/Symfony/Component/Stopwatch/StopwatchEvent.php index e6739469de..2ef1defc59 100644 --- a/src/Symfony/Component/Stopwatch/StopwatchEvent.php +++ b/src/Symfony/Component/Stopwatch/StopwatchEvent.php @@ -238,7 +238,7 @@ class StopwatchEvent private function formatTime($time) { if (!is_numeric($time)) { - throw new \InvalidArgumentException('The time must be a numerical value'); + throw new \InvalidArgumentException('The time must be a numerical value.'); } return round($time, 1); diff --git a/src/Symfony/Component/Templating/Loader/CacheLoader.php b/src/Symfony/Component/Templating/Loader/CacheLoader.php index 251c3292d3..9f99f6d1d6 100644 --- a/src/Symfony/Component/Templating/Loader/CacheLoader.php +++ b/src/Symfony/Component/Templating/Loader/CacheLoader.php @@ -66,7 +66,7 @@ class CacheLoader extends Loader $content = $storage->getContent(); if (!is_dir($dir) && !@mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new \RuntimeException(sprintf('Cache Loader was not able to create directory "%s"', $dir)); + throw new \RuntimeException(sprintf('Cache Loader was not able to create directory "%s".', $dir)); } file_put_contents($path, $content); diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index 3049212bdc..dd0874fb62 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -134,10 +134,10 @@ class PhpEngine implements EngineInterface, \ArrayAccess unset($template, $parameters); if (isset($this->evalParameters['this'])) { - throw new \InvalidArgumentException('Invalid parameter (this)'); + throw new \InvalidArgumentException('Invalid parameter (this).'); } if (isset($this->evalParameters['view'])) { - throw new \InvalidArgumentException('Invalid parameter (view)'); + throw new \InvalidArgumentException('Invalid parameter (view).'); } // the view variable is exposed to the require file below diff --git a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php index 83b5043d35..7d15aecb6e 100644 --- a/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IcuDatFileLoader.php @@ -44,7 +44,7 @@ class IcuDatFileLoader extends IcuResFileLoader } if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); + throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); } elseif (intl_is_failure($rb->getErrorCode())) { throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); } diff --git a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php index b59c021469..d5fe99603b 100644 --- a/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IcuResFileLoader.php @@ -44,7 +44,7 @@ class IcuResFileLoader implements LoaderInterface } if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource)); + throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); } elseif (intl_is_failure($rb->getErrorCode())) { throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); } diff --git a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php index 526721277d..5ab2e989e7 100644 --- a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php @@ -30,7 +30,7 @@ class JsonFileLoader extends FileLoader $messages = json_decode($data, true); if (0 < $errorCode = json_last_error()) { - throw new InvalidResourceException(sprintf('Error parsing JSON - %s', $this->getJSONErrorMessage($errorCode))); + throw new InvalidResourceException(sprintf('Error parsing JSON - %s.', $this->getJSONErrorMessage($errorCode))); } } diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 9d7a83ab84..b5333f1e4e 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -53,7 +53,7 @@ class XliffFileLoader implements LoaderInterface try { $dom = XmlUtils::loadFile($resource); } catch (\InvalidArgumentException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s": %s', $resource, $e->getMessage()), $e->getCode(), $e); + throw new InvalidResourceException(sprintf('Unable to load "%s": %s.', $resource, $e->getMessage()), $e->getCode(), $e); } $xliffVersion = $this->getVersionNumber($dom); @@ -194,7 +194,7 @@ class XliffFileLoader implements LoaderInterface if (!@$dom->schemaValidateSource($schema)) { libxml_disable_entity_loader($disableEntities); - throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors)))); + throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s.', $file, implode("\n", $this->getXmlErrors($internalErrors)))); } libxml_disable_entity_loader($disableEntities); @@ -297,7 +297,7 @@ class XliffFileLoader implements LoaderInterface $namespace = $xliff->attributes->getNamedItem('xmlns'); if ($namespace) { if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) { - throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s"', $namespace)); + throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s".', $namespace)); } return substr($namespace, 34); diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index 8d9aa6f72a..41700df24b 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -47,7 +47,7 @@ class YamlFileLoader extends FileLoader try { $messages = $this->yamlParser->parseFile($resource); } catch (ParseException $e) { - throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e); + throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s".', $resource), 0, $e); } finally { restore_error_handler(); } diff --git a/src/Symfony/Component/Translation/MessageCatalogue.php b/src/Symfony/Component/Translation/MessageCatalogue.php index cc4a0bfaba..a9a24b12a2 100644 --- a/src/Symfony/Component/Translation/MessageCatalogue.php +++ b/src/Symfony/Component/Translation/MessageCatalogue.php @@ -142,7 +142,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf public function addCatalogue(MessageCatalogueInterface $catalogue) { if ($catalogue->getLocale() !== $this->locale) { - throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s"', $catalogue->getLocale(), $this->locale)); + throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s".', $catalogue->getLocale(), $this->locale)); } foreach ($catalogue->all() as $domain => $messages) { diff --git a/src/Symfony/Component/Translation/Writer/TranslationWriter.php b/src/Symfony/Component/Translation/Writer/TranslationWriter.php index aad6aad3e8..4b56484842 100644 --- a/src/Symfony/Component/Translation/Writer/TranslationWriter.php +++ b/src/Symfony/Component/Translation/Writer/TranslationWriter.php @@ -77,7 +77,7 @@ class TranslationWriter implements TranslationWriterInterface $dumper = $this->dumpers[$format]; if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0777, true) && !is_dir($options['path'])) { - throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s"', $options['path'])); + throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s".', $options['path'])); } // save diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php index f04db3cc2d..c084084548 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php @@ -55,7 +55,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator try { $comparedValue = $this->getPropertyAccessor()->getValue($object, $path); } catch (NoSuchPropertyException $e) { - throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, \get_class($constraint), $e->getMessage()), 0, $e); + throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s.', $path, \get_class($constraint), $e->getMessage()), 0, $e); } } else { $comparedValue = $constraint->value; diff --git a/src/Symfony/Component/Validator/Constraints/CallbackValidator.php b/src/Symfony/Component/Validator/Constraints/CallbackValidator.php index 5b51869ab1..f919954255 100644 --- a/src/Symfony/Component/Validator/Constraints/CallbackValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CallbackValidator.php @@ -40,13 +40,13 @@ class CallbackValidator extends ConstraintValidator if (isset($method[0]) && \is_object($method[0])) { $method[0] = \get_class($method[0]); } - throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method))); + throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable.', json_encode($method))); } \call_user_func($method, $object, $this->context, $constraint->payload); } elseif (null !== $object) { if (!method_exists($object, $method)) { - throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object))); + throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s.', $method, \get_class($object))); } $reflMethod = new \ReflectionMethod($object, $method); diff --git a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 9ec0fc6703..4a6114dcb3 100644 --- a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -35,7 +35,7 @@ class ChoiceValidator extends ConstraintValidator } if (!\is_array($constraint->choices) && !$constraint->callback) { - throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); + throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice.'); } if (null === $value) { @@ -51,7 +51,7 @@ class ChoiceValidator extends ConstraintValidator && !\is_callable($choices = [$this->context->getClassName(), $constraint->callback]) && !\is_callable($choices = $constraint->callback) ) { - throw new ConstraintDefinitionException('The Choice constraint expects a valid callback'); + throw new ConstraintDefinitionException('The Choice constraint expects a valid callback.'); } $choices = \call_user_func($choices); } else { diff --git a/src/Symfony/Component/Validator/Constraints/Collection.php b/src/Symfony/Component/Validator/Constraints/Collection.php index 86418690b8..dcd6f35361 100644 --- a/src/Symfony/Component/Validator/Constraints/Collection.php +++ b/src/Symfony/Component/Validator/Constraints/Collection.php @@ -57,7 +57,7 @@ class Collection extends Composite parent::initializeNestedConstraints(); if (!\is_array($this->fields)) { - throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s', __CLASS__)); + throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s.', __CLASS__)); } foreach ($this->fields as $fieldName => $field) { diff --git a/src/Symfony/Component/Validator/Constraints/Composite.php b/src/Symfony/Component/Validator/Constraints/Composite.php index 9c423b0dc3..ead61bb69b 100644 --- a/src/Symfony/Component/Validator/Constraints/Composite.php +++ b/src/Symfony/Component/Validator/Constraints/Composite.php @@ -71,7 +71,7 @@ abstract class Composite extends Constraint $constraint = \get_class($constraint); } - throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, static::class)); + throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s.', $constraint, static::class)); } if ($constraint instanceof Valid) { @@ -99,7 +99,7 @@ abstract class Composite extends Constraint $excessGroups = array_diff($constraint->groups, $this->groups); if (\count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), static::class)); + throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s.', implode('", "', $excessGroups), \get_class($constraint), static::class)); } } else { $constraint->groups = $this->groups; diff --git a/src/Symfony/Component/Validator/Constraints/Count.php b/src/Symfony/Component/Validator/Constraints/Count.php index b11f994f58..227590f958 100644 --- a/src/Symfony/Component/Validator/Constraints/Count.php +++ b/src/Symfony/Component/Validator/Constraints/Count.php @@ -51,7 +51,7 @@ class Count extends Constraint parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']); } } } diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 1eb6a98bb8..d0eaa45402 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -58,7 +58,7 @@ class EmailValidator extends ConstraintValidator if ($constraint->strict) { if (!class_exists('\Egulias\EmailValidator\EmailValidator')) { - throw new RuntimeException('Strict email validation requires egulias/email-validator ~1.2|~2.0'); + throw new RuntimeException('Strict email validation requires egulias/email-validator ~1.2|~2.0.'); } $strictValidator = new \Egulias\EmailValidator\EmailValidator(); diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php index c70db0a74c..7a620f6a2a 100644 --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php @@ -114,7 +114,7 @@ class File extends Constraint $this->maxSize = $matches[1] * $factors[$unit = strtolower($matches[2])]; $this->binaryFormat = null === $this->binaryFormat ? 2 === \strlen($unit) : $this->binaryFormat; } else { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $this->maxSize)); } } } diff --git a/src/Symfony/Component/Validator/Constraints/ImageValidator.php b/src/Symfony/Component/Validator/Constraints/ImageValidator.php index 7ca0cd32b3..9b4ecfd973 100644 --- a/src/Symfony/Component/Validator/Constraints/ImageValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ImageValidator.php @@ -100,7 +100,7 @@ class ImageValidator extends FileValidator if ($constraint->minHeight) { if (!ctype_digit((string) $constraint->minHeight)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height', $constraint->minHeight)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height.', $constraint->minHeight)); } if ($height < $constraint->minHeight) { @@ -116,7 +116,7 @@ class ImageValidator extends FileValidator if ($constraint->maxHeight) { if (!ctype_digit((string) $constraint->maxHeight)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height', $constraint->maxHeight)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight)); } if ($height > $constraint->maxHeight) { @@ -132,7 +132,7 @@ class ImageValidator extends FileValidator if (null !== $constraint->minPixels) { if (!ctype_digit((string) $constraint->minPixels)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels', $constraint->minPixels)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels)); } if ($pixels < $constraint->minPixels) { @@ -148,7 +148,7 @@ class ImageValidator extends FileValidator if (null !== $constraint->maxPixels) { if (!ctype_digit((string) $constraint->maxPixels)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels', $constraint->maxPixels)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels)); } if ($pixels > $constraint->maxPixels) { @@ -166,7 +166,7 @@ class ImageValidator extends FileValidator if (null !== $constraint->minRatio) { if (!is_numeric((string) $constraint->minRatio)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio', $constraint->minRatio)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio.', $constraint->minRatio)); } if ($ratio < $constraint->minRatio) { @@ -180,7 +180,7 @@ class ImageValidator extends FileValidator if (null !== $constraint->maxRatio) { if (!is_numeric((string) $constraint->maxRatio)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio', $constraint->maxRatio)); + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio.', $constraint->maxRatio)); } if ($ratio > $constraint->maxRatio) { @@ -218,7 +218,7 @@ class ImageValidator extends FileValidator if ($constraint->detectCorrupted) { if (!\function_exists('imagecreatefromstring')) { - throw new RuntimeException('Corrupted images detection requires installed and enabled GD extension'); + throw new RuntimeException('Corrupted images detection requires installed and enabled GD extension.'); } $resource = @imagecreatefromstring(file_get_contents($value)); diff --git a/src/Symfony/Component/Validator/Constraints/Ip.php b/src/Symfony/Component/Validator/Constraints/Ip.php index aff99d4672..57c674dc0e 100644 --- a/src/Symfony/Component/Validator/Constraints/Ip.php +++ b/src/Symfony/Component/Validator/Constraints/Ip.php @@ -80,7 +80,7 @@ class Ip extends Constraint parent::__construct($options); if (!\in_array($this->version, self::$versions)) { - throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s"', implode('", "', self::$versions))); + throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s".', implode('", "', self::$versions))); } } } diff --git a/src/Symfony/Component/Validator/Constraints/Length.php b/src/Symfony/Component/Validator/Constraints/Length.php index 996a1e479f..ee97a5bc09 100644 --- a/src/Symfony/Component/Validator/Constraints/Length.php +++ b/src/Symfony/Component/Validator/Constraints/Length.php @@ -55,7 +55,7 @@ class Length extends Constraint parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']); } } } diff --git a/src/Symfony/Component/Validator/Constraints/Range.php b/src/Symfony/Component/Validator/Constraints/Range.php index 65ece5d832..56ebd70229 100644 --- a/src/Symfony/Component/Validator/Constraints/Range.php +++ b/src/Symfony/Component/Validator/Constraints/Range.php @@ -43,7 +43,7 @@ class Range extends Constraint parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']); } } } diff --git a/src/Symfony/Component/Validator/Constraints/Traverse.php b/src/Symfony/Component/Validator/Constraints/Traverse.php index 78d115fdbb..40313e4a8c 100644 --- a/src/Symfony/Component/Validator/Constraints/Traverse.php +++ b/src/Symfony/Component/Validator/Constraints/Traverse.php @@ -26,7 +26,7 @@ class Traverse extends Constraint public function __construct($options = null) { if (\is_array($options) && \array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s', __CLASS__)); + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s.', __CLASS__)); } parent::__construct($options); diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php index 72affdf7b6..f5cc25dcb7 100644 --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -93,7 +93,7 @@ class UrlValidator extends ConstraintValidator Url::CHECK_DNS_TYPE_SRV, Url::CHECK_DNS_TYPE_TXT, ], true)) { - throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), ['checkDNS']); + throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s.', \get_class($constraint)), ['checkDNS']); } $host = parse_url($value, PHP_URL_HOST); diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php index aaa30cddd3..572bbc6d55 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php @@ -401,7 +401,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface public function setGroupSequence($groupSequence) { if ($this->isGroupSequenceProvider()) { - throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider'); + throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider.'); } if (\is_array($groupSequence)) { @@ -409,11 +409,11 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface } if (\in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { - throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP)); + throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences.', Constraint::DEFAULT_GROUP)); } if (!\in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { - throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup())); + throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence.', $this->getDefaultGroup())); } $this->groupSequence = $groupSequence; @@ -461,11 +461,11 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface public function setGroupSequenceProvider($active) { if ($this->hasGroupSequence()) { - throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence'); + throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence.'); } if (!$this->getReflectionClass()->implementsInterface('Symfony\Component\Validator\GroupSequenceProviderInterface')) { - throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface', $this->name)); + throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface.', $this->name)); } $this->groupSequenceProvider = $active; diff --git a/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php index cf0d08acce..ed7cea6904 100644 --- a/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php +++ b/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php @@ -79,7 +79,7 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface public function getMetadataFor($value) { if (!\is_object($value) && !\is_string($value)) { - throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s', \gettype($value))); + throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s.', \gettype($value))); } $class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\'); diff --git a/src/Symfony/Component/Validator/Mapping/GetterMetadata.php b/src/Symfony/Component/Validator/Mapping/GetterMetadata.php index 5a72bd84b7..63d144c45f 100644 --- a/src/Symfony/Component/Validator/Mapping/GetterMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GetterMetadata.php @@ -53,7 +53,7 @@ class GetterMetadata extends MemberMetadata } elseif (method_exists($class, $hasMethod)) { $method = $hasMethod; } else { - throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s', $class, $getMethod, $isMethod, $hasMethod)); + throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s.', $class, $getMethod, $isMethod, $hasMethod)); } } elseif (!method_exists($class, $method)) { throw new ValidatorException(sprintf('The %s() method does not exist in class %s.', $method, $class)); diff --git a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php index ae2e1e04cd..1d3d90132b 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php @@ -75,7 +75,7 @@ abstract class AbstractLoader implements LoaderInterface list($prefix, $className) = explode(':', $name, 2); if (!isset($this->namespaces[$prefix])) { - throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix)); + throw new MappingException(sprintf('Undefined namespace prefix "%s".', $prefix)); } $className = $this->namespaces[$prefix].$className; diff --git a/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php index b8f9490379..3b1c036e71 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php @@ -35,15 +35,15 @@ abstract class FileLoader extends AbstractLoader public function __construct($file) { if (!is_file($file)) { - throw new MappingException(sprintf('The mapping file "%s" does not exist', $file)); + throw new MappingException(sprintf('The mapping file "%s" does not exist.', $file)); } if (!is_readable($file)) { - throw new MappingException(sprintf('The mapping file "%s" is not readable', $file)); + throw new MappingException(sprintf('The mapping file "%s" is not readable.', $file)); } if (!stream_is_local($this->file)) { - throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file)); + throw new MappingException(sprintf('The mapping file "%s" is not a local file.', $file)); } $this->file = $file; diff --git a/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php b/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php index de80dcd8ad..05ef322fde 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php @@ -36,7 +36,7 @@ class LoaderChain implements LoaderInterface { foreach ($loaders as $loader) { if (!$loader instanceof LoaderInterface) { - throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', \get_class($loader))); + throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface.', \get_class($loader))); } } diff --git a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php index 95fc578eb4..6da3d1bf15 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php @@ -49,7 +49,7 @@ class StaticMethodLoader implements LoaderInterface } if (!$reflMethod->isStatic()) { - throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->name, $this->methodName)); + throw new MappingException(sprintf('The method %s::%s should be static.', $reflClass->name, $this->methodName)); } if ($reflMethod->getDeclaringClass()->name != $reflClass->name) { diff --git a/src/Symfony/Component/Validator/Mapping/MemberMetadata.php b/src/Symfony/Component/Validator/Mapping/MemberMetadata.php index 11bd54d33c..e561a5a85a 100644 --- a/src/Symfony/Component/Validator/Mapping/MemberMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/MemberMetadata.php @@ -72,7 +72,7 @@ abstract class MemberMetadata extends GenericMetadata implements PropertyMetadat public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); + throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters.', \get_class($constraint))); } parent::addConstraint($constraint); diff --git a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php index 1adad95b80..5e535dd27f 100644 --- a/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php @@ -37,7 +37,7 @@ class PropertyMetadata extends MemberMetadata public function __construct($class, $name) { if (!property_exists($class, $name)) { - throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s"', $name, $class)); + throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $name, $class)); } parent::__construct($class, $name, $name); diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index d14c5aa00b..ff59d96428 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -374,7 +374,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate break; default: - throw new \RuntimeException(sprintf('Unexpected Stub type: %s', $item->type)); + throw new \RuntimeException(sprintf('Unexpected Stub type: %s.', $item->type)); } } elseif ('array' === $type) { $dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false); diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 7d6112e3b9..f1cb6b57aa 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -207,7 +207,7 @@ class Parser $isRef = $mergeNode = false; if (self::preg_match('#^\-((?P\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) { if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } $context = 'sequence'; @@ -253,7 +253,7 @@ class Parser && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) ) { if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine, $this->filename); + throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); } $context = 'mapping';