8000 Add missing dots at the end of exception messages by fabpot · Pull Request #36087 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Add missing dots at the end of exception messages #36087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add missing dots at the end of exception messages
  • Loading branch information
fabpot committed Mar 15, 2020
commit c46d7027e54ddd23f53c42add11036ec6ba891d3
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Monolog/Handler/MailerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ protected function buildMessage(string $content, array $records): Email
} 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function __construct(array $thresholds = [], $regex = '', $verboseOutput

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;
}
Expand Down Expand Up @@ -162,7 +162,7 @@ public static function fromUrlEncodedString($serializedConfiguration)
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));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Lock/Store/MongoDbStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ public function save(Key $key)
$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'])) {
Expand Down 8000 Expand Up @@ -232,7 +232,7 @@ public function putOffExpiration(Key $key, $ttl)
$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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ public static function fromDsn(string $dsn, array $options = [], HttpClientInter
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public function channel(): \AMQPChannel
$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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public static function buildConfiguration(string $dsn, array $options = []): arr
// 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;
Expand Down
9E88 4 changes: 2 additions & 2 deletions src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public function __construct(array $configuration, array $connectionCredentials =
$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'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
$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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function doSend(MessageInterface $message): void
$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();
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/PropertyInfo/PropertyWriteInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getType(): string
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;
Expand All @@ -68,7 +68,7 @@ public function setAdderInfo(self $adderInfo): void
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;
Expand All @@ -82,7 +82,7 @@ public function setRemoverInfo(self $removerInfo): void
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;
Expand All @@ -91,7 +91,7 @@ public function getRemoverInfo(): self
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;
Expand All @@ -100,7 +100,7 @@ public function getVisibility(): string
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;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Serializer/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function denormalize($data, string $type, string $format = null, array $c
{
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;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct($options = null)
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']);
}
}
}
0