From c46d7027e54ddd23f53c42add11036ec6ba891d3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 15 Mar 2020 15:54:58 +0100 Subject: [PATCH] Add missing dots at the end of exception messages --- src/Symfony/Bridge/Monolog/Handler/MailerHandler.php | 4 ++-- .../PhpUnit/DeprecationErrorHandler/Configuration.php | 4 ++-- src/Symfony/Component/Lock/Store/MongoDbStore.php | 6 +++--- .../Bridge/AmazonSqs/Transport/Connection.php | 4 ++-- .../Messenger/Bridge/Amqp/Transport/Connection.php | 2 +- .../Messenger/Bridge/Doctrine/Transport/Connection.php | 4 ++-- .../Messenger/Bridge/Redis/Transport/Connection.php | 4 ++-- .../Component/Messenger/Transport/TransportFactory.php | 2 +- .../Notifier/Bridge/Firebase/FirebaseTransport.php | 2 +- .../Component/PropertyInfo/PropertyWriteInfo.php | 10 +++++----- src/Symfony/Component/Serializer/Serializer.php | 2 +- src/Symfony/Component/Validator/Constraints/Count.php | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php index 1970d7085f..2b70f52d2c 100644 --- a/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/MailerHandler.php @@ -101,10 +101,10 @@ class MailerHandler extends AbstractProcessingHandler } elseif (\is_callable($this->messageTemplate)) { $message = \call_user_func($this->messageTemplate, $content, $records); if (!$message instanceof Email) { - throw new \InvalidArgumentException(sprintf('Could not resolve message from a callable. Instance of "%s" is expected', Email::class)); + throw new \InvalidArgumentException(sprintf('Could not resolve message from a callable. Instance of "%s" is expected.', Email::class)); } } else { - throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it'); + throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it.'); } if ($records) { diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php index f3949ea79a..bc0fe98499 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php @@ -83,7 +83,7 @@ class Configuration foreach ($verboseOutput as $group => $status) { if (!isset($this->verboseOutput[$group])) { - throw new \InvalidArgumentException(sprintf('Unsupported verbosity group "%s", expected one of "%s"', $group, implode('", "', array_keys($this->verboseOutput)))); + throw new \InvalidArgumentException(sprintf('Unsupported verbosity group "%s", expected one of "%s".', $group, implode('", "', array_keys($this->verboseOutput)))); } $this->verboseOutput[$group] = (bool) $status; } @@ -162,7 +162,7 @@ class Configuration parse_str($serializedConfiguration, $normalizedConfiguration); foreach (array_keys($normalizedConfiguration) as $key) { if (!\in_array($key, ['max', 'disabled', 'verbose', 'quiet'], true)) { - throw new \InvalidArgumentException(sprintf('Unknown configuration option "%s"', $key)); + throw new \InvalidArgumentException(sprintf('Unknown configuration option "%s".', $key)); } } diff --git a/src/Symfony/Component/Lock/Store/MongoDbStore.php b/src/Symfony/Component/Lock/Store/MongoDbStore.php index 9306a86060..50d8a208a5 100644 --- a/src/Symfony/Component/Lock/Store/MongoDbStore.php +++ b/src/Symfony/Component/Lock/Store/MongoDbStore.php @@ -198,9 +198,9 @@ class MongoDbStore implements BlockingStoreInterface $this->upsert($key, $this->initialTtl); } catch (WriteException $e) { if ($this->isDuplicateKeyException($e)) { - throw new LockConflictedException('Lock was acquired by someone else', 0, $e); + throw new LockConflictedException('Lock was acquired by someone else.', 0, $e); } - throw new LockAcquiringException('Failed to acquire lock', 0, $e); + throw new LockAcquiringException('Failed to acquire lock.', 0, $e); } if ($this->options['gcProbablity'] > 0.0 && (1.0 === $this->options['gcProbablity'] || (random_int(0, PHP_INT_MAX) / PHP_INT_MAX) <= $this->options['gcProbablity'])) { @@ -232,7 +232,7 @@ class MongoDbStore implements BlockingStoreInterface $this->upsert($key, $ttl); } catch (WriteException $e) { if ($this->isDuplicateKeyException($e)) { - throw new LockConflictedException('Failed to put off the expiration of the lock', 0, $e); + throw new LockConflictedException('Failed to put off the expiration of the lock.', 0, $e); } throw new LockStorageException($e->getMessage(), 0, $e); } diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php index 13931dd0c0..01283928b5 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php @@ -117,13 +117,13 @@ class Connection // check for extra keys in options $optionsExtraKeys = array_diff(array_keys($options), array_keys($configuration)); if (0 < \count($optionsExtraKeys)) { - throw new InvalidArgumentException(sprintf('Unknown option found : [%s]. Allowed options are [%s]', implode(', ', $optionsExtraKeys), implode(', ', array_keys(self::DEFAULT_OPTIONS)))); + throw new InvalidArgumentException(sprintf('Unknown option found : [%s]. Allowed options are [%s].', implode(', ', $optionsExtraKeys), implode(', ', array_keys(self::DEFAULT_OPTIONS)))); } // check for extra keys in options $queryExtraKeys = array_diff(array_keys($query), array_keys($configuration)); if (0 < \count($queryExtraKeys)) { - throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s]', implode(', ', $queryExtraKeys), implode(', ', array_keys(self::DEFAULT_OPTIONS)))); + throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s].', implode(', ', $queryExtraKeys), implode(', ', array_keys(self::DEFAULT_OPTIONS)))); } return new self($configuration, $client); diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php index 644055399f..319ad88907 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php @@ -470,7 +470,7 @@ class Connection $credentials['password'] = '********'; unset($credentials['delay']); - throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s)', json_encode($credentials)), 0, $e); + throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s).', json_encode($credentials)), 0, $e); } $this->amqpChannel = $this->amqpFactory->createChannel($connection); diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php index 13cf9c982b..b64011ec79 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php @@ -99,13 +99,13 @@ class Connection implements ResetInterface // check for extra keys in options $optionsExtraKeys = array_diff(array_keys($options), array_keys(static::DEFAULT_OPTIONS)); if (0 < \count($optionsExtraKeys)) { - throw new InvalidArgumentException(sprintf('Unknown option found: [%s]. Allowed options are [%s]', implode(', ', $optionsExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS)))); + throw new InvalidArgumentException(sprintf('Unknown option found: [%s]. Allowed options are [%s].', implode(', ', $optionsExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS)))); } // check for extra keys in options $queryExtraKeys = array_diff(array_keys($query), array_keys(static::DEFAULT_OPTIONS)); if (0 < \count($queryExtraKeys)) { - throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s]', implode(', ', $queryExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS)))); + throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s].', implode(', ', $queryExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS)))); } return $configuration; diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php index 57b1db3981..02ebcfe487 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php @@ -62,11 +62,11 @@ class Connection $this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP); if (isset($connectionCredentials['auth']) && !$this->connection->auth($connectionCredentials['auth'])) { - throw new InvalidArgumentException(sprintf('Redis connection failed: %s', $redis->getLastError())); + throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError())); } if (($dbIndex = $configuration['dbindex'] ?? self::DEFAULT_OPTIONS['dbindex']) && !$this->connection->select($dbIndex)) { - throw new InvalidArgumentException(sprintf('Redis connection failed: %s', $redis->getLastError())); + throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError())); } $this->stream = $configuration['stream'] ?? self::DEFAULT_OPTIONS['stream']; diff --git a/src/Symfony/Component/Messenger/Transport/TransportFactory.php b/src/Symfony/Component/Messenger/Transport/TransportFactory.php index 4e4fa58c5a..201f1473bc 100644 --- a/src/Symfony/Component/Messenger/Transport/TransportFactory.php +++ b/src/Symfony/Component/Messenger/Transport/TransportFactory.php @@ -47,7 +47,7 @@ class TransportFactory implements TransportFactoryInterface $packageSuggestion = ' Run "composer require symfony/redis-messenger" to install Redis transport.'; } - throw new InvalidArgumentException(sprintf('No transport supports the given Messenger DSN "%s".%s', $dsn, $packageSuggestion)); + throw new InvalidArgumentException(sprintf('No transport supports the given Messenger DSN "%s".%s.', $dsn, $packageSuggestion)); } public function supports(string $dsn, array $options): bool diff --git a/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php b/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php index eed61d8584..98f8721ef1 100644 --- a/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php @@ -62,7 +62,7 @@ final class FirebaseTransport extends AbstractTransport $options['to'] = $message->getRecipientId(); } if (null === $options['to']) { - throw new InvalidArgumentException(sprintf('The "%s" transport required the "to" option to be set', __CLASS__)); + throw new InvalidArgumentException(sprintf('The "%s" transport required the "to" option to be set.', __CLASS__)); } $options['notification'] = $options['notification'] ?? []; $options['notification']['body'] = $message->getSubject(); diff --git a/src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php b/src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php index 207003ea15..b4e33b2408 100644 --- a/src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php +++ b/src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php @@ -54,7 +54,7 @@ final class PropertyWriteInfo public function getName(): string { if (null === $this->name) { - throw new \LogicException("Calling getName() when having a mutator of type {$this->type} is not tolerated"); + throw new \LogicException("Calling getName() when having a mutator of type {$this->type} is not tolerated."); } return $this->name; @@ -68,7 +68,7 @@ final class PropertyWriteInfo public function getAdderInfo(): self { if (null === $this->adderInfo) { - throw new \LogicException("Calling getAdderInfo() when having a mutator of type {$this->type} is not tolerated"); + throw new \LogicException("Calling getAdderInfo() when having a mutator of type {$this->type} is not tolerated."); } return $this->adderInfo; @@ -82,7 +82,7 @@ final class PropertyWriteInfo public function getRemoverInfo(): self { if (null === $this->removerInfo) { - throw new \LogicException("Calling getRemoverInfo() when having a mutator of type {$this->type} is not tolerated"); + throw new \LogicException("Calling getRemoverInfo() when having a mutator of type {$this->type} is not tolerated."); } return $this->removerInfo; @@ -91,7 +91,7 @@ final class PropertyWriteInfo public function getVisibility(): string { if (null === $this->visibility) { - throw new \LogicException("Calling getVisibility() when having a mutator of type {$this->type} is not tolerated"); + throw new \LogicException("Calling getVisibility() when having a mutator of type {$this->type} is not tolerated."); } return $this->visibility; @@ -100,7 +100,7 @@ final class PropertyWriteInfo public function isStatic(): bool { if (null === $this->static) { - throw new \LogicException("Calling isStatic() when having a mutator of type {$this->type} is not tolerated"); + throw new \LogicException("Calling isStatic() when having a mutator of type {$this->type} is not tolerated."); } return $this->static; diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 5d1ca9d4b3..8a10139afc 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -186,7 +186,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface { if (isset(self::SCALAR_TYPES[$type])) { if (!('is_'.$type)($data)) { - throw new NotNormalizableValueException(sprintf('Data expected to be of type "%s" ("%s" given)', $type, \is_object($data) ? \get_class($data) : \gettype($data))); + throw new NotNormalizableValueException(sprintf('Data expected to be of type "%s" ("%s" given).', $type, \is_object($data) ? \get_class($data) : \gettype($data))); } return $data; diff --git a/src/Symfony/Component/Validator/Constraints/Count.php b/src/Symfony/Component/Validator/Constraints/Count.php index 6d1e7afcd8..5bd2ae0b31 100644 --- a/src/Symfony/Component/Validator/Constraints/Count.php +++ b/src/Symfony/Component/Validator/Constraints/Count.php @@ -55,7 +55,7 @@ class Count extends Constraint parent::__construct($options); if (null === $this->min && null === $this->max && null === $this->divisibleBy) { - throw new MissingOptionsException(sprintf('Either option "min", "max" or "divisibleBy" must be given for constraint %s', __CLASS__), ['min', 'max', 'divisibleBy']); + throw new MissingOptionsException(sprintf('Either option "min", "max" or "divisibleBy" must be given for constraint %s.', __CLASS__), ['min', 'max', 'divisibleBy']); } } }