Add missing dots at the end of exception messages

This commit is contained in:
Fabien Potencier 2020-03-15 15:54:58 +01:00
parent d6dd06ba89
commit c46d7027e5
12 changed files with 23 additions and 23 deletions

View File

@ -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) {

View File

@ -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));
}
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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'];

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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']);
}
}
}