Skip to content

Commit

Permalink
minor #36099 Fix more quotes in exception messages (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

Fix more quotes in exception messages

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

4ab6156 Fix more quotes in exception messages
  • Loading branch information
fabpot committed Mar 16, 2020
2 parents 2c4c19c + 4ab6156 commit 2baa812
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 18 deletions.
Expand Up @@ -40,7 +40,7 @@ public function __construct($container)
$this->router = $container;
@trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', RouterInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED);
} else {
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
}
}

Expand Down
Expand Up @@ -41,7 +41,7 @@ public function __construct($container)
$this->translator = $container;
@trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', TranslatorInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED);
} else {
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
}
}

Expand Down
Expand Up @@ -1201,7 +1201,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
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));
}
}

Expand Down
Expand Up @@ -42,7 +42,7 @@ public function __construct($container, \Traversable $iterator)
$this->twig = $container;
@trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since Symfony 3.4 and will be unsupported in version 4.0. Use a %s instead.', Environment::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED);
} else {
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
throw new \InvalidArgumentException(sprintf('"%s" only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
}

$this->iterator = $iterator;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/RedisTrait.php
Expand Up @@ -48,7 +48,7 @@ private function init($redisClient, $namespace = '', $defaultLifetime = 0)
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;
}
Expand Down
Expand Up @@ -56,7 +56,7 @@ public function getArguments(Request $request, $controller)
$resolved = $resolver->resolve($request, $metadata);

if (!$resolved instanceof \Generator) {
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', \get_class($resolver)));
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', \get_class($resolver)));
}

foreach ($resolved as $append) {
Expand Down
Expand Up @@ -363,7 +363,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
}

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.
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Lock/Store/MemcachedStore.php
Expand Up @@ -46,7 +46,7 @@ public function __construct(\Memcached $memcached, $initialTtl = 300)
}

if ($initialTtl < 1) {
throw new InvalidArgumentException(sprintf('%s() expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
}

$this->memcached = $memcached;
Expand Down Expand Up @@ -79,7 +79,7 @@ public function waitAndSave(Key $key)
public function putOffExpiration(Key $key, $ttl)
{
if ($ttl < 1) {
throw new InvalidArgumentException(sprintf('%s() expects a TTL greater or equals to 1. Got %s.', __METHOD__, $ttl));
throw new InvalidArgumentException(sprintf('"%s()" expects a TTL greater or equals to 1. Got %s.', __METHOD__, $ttl));
}

// Interface defines a float value but Store required an integer.
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Lock/Store/RedisStore.php
Expand Up @@ -143,7 +143,7 @@ private function evaluate($script, $resource, array $args)
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)));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/InputStream.php
Expand Up @@ -45,7 +45,7 @@ public function write($input)
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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Pipes/AbstractPipes.php
Expand Up @@ -107,7 +107,7 @@ protected function write()
} 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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/ProcessUtils.php
Expand Up @@ -110,7 +110,7 @@ public static function validateInput($caller, $input)
return new \IteratorIterator($input);
}

throw new InvalidArgumentException(sprintf('%s only accepts strings, Traversable objects or stream resources.', $caller));
throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
}

return $input;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Tests/ProcessBuilderTest.php
Expand Up @@ -200,7 +200,7 @@ public function testShouldReturnProcessWithEnabledOutput()
public function testInvalidInput()
{
$this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Symfony\Component\Process\ProcessBuilder::setInput only accepts strings, Traversable objects or stream resources.');
$this->expectExceptionMessage('"Symfony\Component\Process\ProcessBuilder::setInput" only accepts strings, Traversable objects or stream resources.');
$builder = ProcessBuilder::create();
$builder->setInput([]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Tests/ProcessTest.php
Expand Up @@ -263,7 +263,7 @@ public function testSetInputWhileRunningThrowsAnException()
public function testInvalidInput($value)
{
$this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Symfony\Component\Process\Process::setInput only accepts strings, Traversable objects or stream resources.');
$this->expectExceptionMessage('"Symfony\Component\Process\Process::setInput" only accepts strings, Traversable objects or stream resources.');
$process = $this->getProcess('foo');
$process->setInput($value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/ObjectRouteLoader.php
Expand Up @@ -55,7 +55,7 @@ public function load($resource, $type = null)
$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)) {
Expand Down
Expand Up @@ -221,7 +221,7 @@ private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticat
}

if (!$response instanceof Response) {
throw new \LogicException(sprintf('%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', \get_class($guardAuthenticator)));
throw new \LogicException(sprintf('"%s::onAuthenticationSuccess()" *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', \get_class($guardAuthenticator)));
}

$this->rememberMeServices->loginSuccess($request, $response, $token);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarDumper/Cloner/Data.php
Expand Up @@ -114,7 +114,7 @@ public function count()
public function getIterator()
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value)));
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, \gettype($value)));
}

foreach ($value as $k => $v) {
Expand Down

0 comments on commit 2baa812

Please sign in to comment.