Add missing dots at the end of exception messages

This commit is contained in:
Fabien Potencier 2020-03-15 15:37:05 +01:00
parent 20a19884ac
commit 81cf96749b
6 changed files with 12 additions and 12 deletions

View File

@ -451,7 +451,7 @@ abstract class AbstractBrowser
}
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());

View File

@ -25,7 +25,7 @@ class ApcuAdapter extends AbstractAdapter
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null)
{
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);

View File

@ -48,7 +48,7 @@ class MemcachedAdapter extends AbstractAdapter
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
{
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);
@ -95,7 +95,7 @@ class MemcachedAdapter extends AbstractAdapter
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 {
@ -110,7 +110,7 @@ class MemcachedAdapter extends AbstractAdapter
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[2])) {
@ -120,7 +120,7 @@ class MemcachedAdapter extends AbstractAdapter
return 'file:'.($m[1] ?? '');
}, $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));
}
$query = $hosts = [];
if (isset($params['query'])) {
@ -128,7 +128,7 @@ class MemcachedAdapter extends AbstractAdapter
if (isset($query['host'])) {
if (!\is_array($hosts = $query['host'])) {
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn));
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
}
foreach ($hosts as $host => $weight) {
if (false === $port = strrpos($host, ':')) {
@ -147,7 +147,7 @@ class MemcachedAdapter extends AbstractAdapter
}
}
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];

View File

@ -73,7 +73,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
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;

View File

@ -264,7 +264,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
}
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;

View File

@ -50,11 +50,11 @@ final class TelegramTransportFactory extends AbstractTransportFactory
private function getToken(Dsn $dsn): string
{
if (null === $dsn->getUser() && null === $dsn->getPassword()) {
throw new IncompleteDsnException('Missing token');
throw new IncompleteDsnException('Missing token.');
}
if (null === $dsn->getPassword()) {
throw new IncompleteDsnException('Malformed token');
throw new IncompleteDsnException('Malformed token.');
}
return sprintf('%s:%s', $dsn->getUser(), $dsn->getPassword());