minor #36090 Fix quotes in exception messages (fabpot)
This PR was merged into the 3.4 branch.
Discussion
----------
Fix quotes in exception messages
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix #36067 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | n/a
Commits
-------
48102d96f3
Fix quotes in exception messages
This commit is contained in:
commit
e29cdb7076
@ -465,7 +465,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
||||
}
|
||||
|
||||
if (null !== $autoMappedManager) {
|
||||
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and %s").', $autoMappedManager, $name));
|
||||
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and "%s"").', $autoMappedManager, $name));
|
||||
}
|
||||
|
||||
$autoMappedManager = $name;
|
||||
|
@ -68,7 +68,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
||||
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
||||
foreach ($connections as $con) {
|
||||
if (!isset($this->connections[$con])) {
|
||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
|
||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
|
||||
}
|
||||
|
||||
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]);
|
||||
@ -91,7 +91,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
||||
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
||||
foreach ($connections as $con) {
|
||||
if (!isset($this->connections[$con])) {
|
||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
|
||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
|
||||
}
|
||||
|
||||
if ($lazy = !empty($tag['lazy'])) {
|
||||
|
@ -50,7 +50,7 @@ class DoctrineFooType extends Type
|
||||
return null;
|
||||
}
|
||||
if (!$value instanceof Foo) {
|
||||
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
||||
throw new ConversionException(sprintf('Expected "%s", got "%s"', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
|
||||
}
|
||||
|
||||
return $foo->bar;
|
||||
|
@ -32,7 +32,7 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator
|
||||
$newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body);
|
||||
|
||||
if ($body === $newBody) {
|
||||
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct().', $originalClass->name));
|
||||
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method "%s::__destruct()".', $originalClass->name));
|
||||
}
|
||||
|
||||
$destructor->setBody($newBody);
|
||||
|
@ -40,7 +40,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface
|
||||
if ($renderer instanceof TwigRendererInterface) {
|
||||
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED);
|
||||
} elseif (null !== $renderer && !(\is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) {
|
||||
throw new \InvalidArgumentException(sprintf('Passing any arguments to the constructor of %s is reserved for internal use.', __CLASS__));
|
||||
throw new \InvalidArgumentException(sprintf('Passing any arguments to the constructor of "%s" is reserved for internal use.', __CLASS__));
|
||||
}
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
return (string) $this->resolve($resolved);
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
|
||||
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type "%s".', $match[1], $value, \gettype($resolved)));
|
||||
}, $value);
|
||||
|
||||
return str_replace('%%', '%', $escapedValue);
|
||||
|
@ -125,7 +125,7 @@ abstract class KernelTestCase extends TestCase
|
||||
if (isset($_SERVER['KERNEL_CLASS']) || isset($_ENV['KERNEL_CLASS'])) {
|
||||
$class = isset($_ENV['KERNEL_CLASS']) ? $_ENV['KERNEL_CLASS'] : $_SERVER['KERNEL_CLASS'];
|
||||
if (!class_exists($class)) {
|
||||
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
|
||||
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the "%s::createKernel()" method.', $class, static::class));
|
||||
}
|
||||
|
||||
return $class;
|
||||
|
@ -46,11 +46,11 @@ class TestAbstractController extends AbstractController
|
||||
continue;
|
||||
}
|
||||
if (!isset($expected[$id])) {
|
||||
throw new \UnexpectedValueException(sprintf('Service "%s" is not expected, as declared by %s::getSubscribedServices()', $id, AbstractController::class));
|
||||
throw new \UnexpectedValueException(sprintf('Service "%s" is not expected, as declared by "%s::getSubscribedServices()".', $id, AbstractController::class));
|
||||
}
|
||||
$type = substr($expected[$id], 1);
|
||||
if (!$container->get($id) instanceof $type) {
|
||||
throw new \UnexpectedValueException(sprintf('Service "%s" is expected to be an instance of "%s", as declared by %s::getSubscribedServices()', $id, $type, AbstractController::class));
|
||||
throw new \UnexpectedValueException(sprintf('Service "%s" is expected to be an instance of "%s", as declared by "%s::getSubscribedServices()".', $id, $type, AbstractController::class));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ class RouterTest extends TestCase
|
||||
public function testExceptionOnNonStringParameter()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.');
|
||||
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type "object".');
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%object%'));
|
||||
|
@ -121,7 +121,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
|
||||
|
||||
$extractRoles = function ($role) {
|
||||
if (!$role instanceof RoleInterface && !$role instanceof Role) {
|
||||
throw new \InvalidArgumentException(sprintf('Roles must be instances of %s or %s (%s given).', RoleInterface::class, Role::class, \is_object($role) ? \get_class($role) : \gettype($role)));
|
||||
throw new \InvalidArgumentException(sprintf('Roles must be instances of "%s" or "%s" ("%s" given).', RoleInterface::class, Role::class, \is_object($role) ? \get_class($role) : \gettype($role)));
|
||||
}
|
||||
|
||||
return $role->getRole();
|
||||
|
@ -51,7 +51,7 @@ class AddSecurityVotersPass implements CompilerPassInterface
|
||||
|
||||
if (!method_exists($class, 'vote')) {
|
||||
// in case the vote method is completely missing, to prevent exceptions when voting
|
||||
throw new LogicException(sprintf('%s should implement the %s interface when used as voter.', $class, VoterInterface::class));
|
||||
throw new LogicException(sprintf('"%s" should implement the "%s" interface when used as voter.', $class, VoterInterface::class));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class FirewallContext
|
||||
$this->logoutListener = $logoutListener;
|
||||
$this->config = $config;
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('Argument 3 passed to %s() must be instance of %s or null, %s given.', __METHOD__, LogoutListener::class, \is_object($logoutListener) ? \get_class($logoutListener) : \gettype($logoutListener)));
|
||||
throw new \InvalidArgumentException(sprintf('Argument 3 passed to "%s()" must be instance of "%s" or null, "%s" given.', __METHOD__, LogoutListener::class, \is_object($logoutListener) ? \get_class($logoutListener) : \gettype($logoutListener)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class AddSecurityVotersPassTest extends TestCase
|
||||
public function testVoterMissingInterfaceAndMethod()
|
||||
{
|
||||
$exception = LogicException::class;
|
||||
$message = 'stdClass should implement the Symfony\Component\Security\Core\Authorization\Voter\VoterInterface interface when used as voter.';
|
||||
$message = '"stdClass" should implement the "Symfony\Component\Security\Core\Authorization\Voter\VoterInterface" interface when used as voter.';
|
||||
|
||||
$this->expectException($exception);
|
||||
$this->expectExceptionMessage($message);
|
||||
|
@ -347,7 +347,7 @@ class TwigExtensionTest extends TestCase
|
||||
$loader = new YamlFileLoader($container, $locator);
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Unsupported format: %s', $format));
|
||||
throw new \InvalidArgumentException(sprintf('Unsupported format: "%s"', $format));
|
||||
}
|
||||
|
||||
$loader->load($file.'.'.$format);
|
||||
|
@ -29,7 +29,7 @@ class WebServerConfig
|
||||
}
|
||||
|
||||
if (null === $file = $this->findFrontController($documentRoot, $env)) {
|
||||
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env))));
|
||||
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: "%s").', $documentRoot, implode('", "', $this->getFrontControllerFileNames($env))));
|
||||
}
|
||||
|
||||
$_ENV['APP_FRONT_CONTROLLER'] = $file;
|
||||
|
@ -133,7 +133,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
||||
public static function createConnection($dsn, array $options = [])
|
||||
{
|
||||
if (!\is_string($dsn)) {
|
||||
throw new InvalidArgumentException(sprintf('The %s() method expect argument #1 to be string, %s given.', __METHOD__, \gettype($dsn)));
|
||||
throw new InvalidArgumentException(sprintf('The "%s()" method expect argument #1 to be string, "%s" given.', __METHOD__, \gettype($dsn)));
|
||||
}
|
||||
if (0 === strpos($dsn, 'redis://')) {
|
||||
return RedisAdapter::createConnection($dsn, $options);
|
||||
@ -142,7 +142,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
||||
return MemcachedAdapter::createConnection($dsn, $options);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Unsupported DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ trait MemcachedTrait
|
||||
if (\is_string($servers)) {
|
||||
$servers = [$servers];
|
||||
} elseif (!\is_array($servers)) {
|
||||
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers)));
|
||||
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.');
|
||||
@ -96,7 +96,7 @@ trait MemcachedTrait
|
||||
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[1])) {
|
||||
@ -106,10 +106,10 @@ trait MemcachedTrait
|
||||
return 'file://';
|
||||
}, $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));
|
||||
}
|
||||
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];
|
||||
|
@ -39,21 +39,21 @@ trait PhpArrayTrait
|
||||
{
|
||||
if (file_exists($this->file)) {
|
||||
if (!is_file($this->file)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: %s.', $this->file));
|
||||
throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: "%s".', $this->file));
|
||||
}
|
||||
|
||||
if (!is_writable($this->file)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache file is not writable: %s.', $this->file));
|
||||
throw new InvalidArgumentException(sprintf('Cache file is not writable: "%s".', $this->file));
|
||||
}
|
||||
} else {
|
||||
$directory = \dirname($this->file);
|
||||
|
||||
if (!is_dir($directory) && !@mkdir($directory, 0777, true)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: %s.', $directory));
|
||||
throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: "%s".', $directory));
|
||||
}
|
||||
|
||||
if (!is_writable($directory)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache directory is not writable: %s.', $directory));
|
||||
throw new InvalidArgumentException(sprintf('Cache directory is not writable: "%s".', $directory));
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ EOF;
|
||||
try {
|
||||
$value = serialize($value);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \get_class($value)), 0, $e);
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \get_class($value)), 0, $e);
|
||||
}
|
||||
} elseif (\is_array($value)) {
|
||||
try {
|
||||
@ -93,7 +93,7 @@ EOF;
|
||||
$value = serialize($value);
|
||||
}
|
||||
} elseif (!is_scalar($value)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value)));
|
||||
}
|
||||
|
||||
$dump .= var_export($key, true).' => '.var_export($value, true).",\n";
|
||||
|
@ -137,7 +137,7 @@ trait PhpFilesTrait
|
||||
$value = serialize($value);
|
||||
}
|
||||
} elseif (!is_scalar($value)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \gettype($value)));
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \gettype($value)));
|
||||
}
|
||||
|
||||
$data[1] = $value;
|
||||
|
@ -48,7 +48,7 @@ trait RedisTrait
|
||||
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;
|
||||
}
|
||||
@ -73,7 +73,7 @@ trait RedisTrait
|
||||
public static function createConnection($dsn, array $options = [])
|
||||
{
|
||||
if (0 !== strpos($dsn, 'redis://')) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis://".', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s" does not start with "redis://".', $dsn));
|
||||
}
|
||||
$params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
|
||||
if (isset($m[1])) {
|
||||
@ -83,10 +83,10 @@ trait RedisTrait
|
||||
return 'file://';
|
||||
}, $dsn);
|
||||
if (false === $params = parse_url($params)) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
|
||||
}
|
||||
if (!isset($params['host']) && !isset($params['path'])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
|
||||
}
|
||||
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
|
||||
$params['dbindex'] = $m[1];
|
||||
@ -108,7 +108,7 @@ trait RedisTrait
|
||||
}
|
||||
$params += $options + self::$defaultConnectionOptions;
|
||||
if (null === $params['class'] && !\extension_loaded('redis') && !class_exists(\Predis\Client::class)) {
|
||||
throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: %s.', $dsn));
|
||||
throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: "%s".', $dsn));
|
||||
}
|
||||
$class = null === $params['class'] ? (\extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class'];
|
||||
|
||||
@ -120,7 +120,7 @@ trait RedisTrait
|
||||
try {
|
||||
@$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']);
|
||||
} catch (\RedisException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e->getMessage(), $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn));
|
||||
}
|
||||
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
@ -128,7 +128,7 @@ trait RedisTrait
|
||||
restore_error_handler();
|
||||
if (!$isConnected) {
|
||||
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s.', $error, $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed%s: "%s".', $error, $dsn));
|
||||
}
|
||||
|
||||
if ((null !== $auth && !$redis->auth($auth))
|
||||
@ -136,7 +136,7 @@ trait RedisTrait
|
||||
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
|
||||
) {
|
||||
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e, $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e, $dsn));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -215,7 +215,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
||||
protected function finalizeValue($value)
|
||||
{
|
||||
if (false === $value) {
|
||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value)));
|
||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), json_encode($value)));
|
||||
}
|
||||
|
||||
foreach ($this->children as $name => $child) {
|
||||
|
@ -185,7 +185,7 @@ class PrototypedArrayNode extends ArrayNode
|
||||
protected function finalizeValue($value)
|
||||
{
|
||||
if (false === $value) {
|
||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value)));
|
||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: "%s".', $this->getPath(), json_encode($value)));
|
||||
}
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
|
@ -68,7 +68,7 @@ class FileLocator implements FileLocatorInterface
|
||||
}
|
||||
|
||||
if (!$filepaths) {
|
||||
throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound);
|
||||
throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: "%s").', $name, implode('", "', $paths)), 0, null, $notfound);
|
||||
}
|
||||
|
||||
return $filepaths;
|
||||
|
@ -88,7 +88,7 @@ class ApplicationDescription
|
||||
public function getCommand($name)
|
||||
{
|
||||
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
|
||||
throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
|
||||
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
|
||||
|
@ -119,7 +119,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
public function getStyle($name)
|
||||
{
|
||||
if (!$this->hasStyle($name)) {
|
||||
throw new InvalidArgumentException(sprintf('Undefined style: %s.', $name));
|
||||
throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
|
||||
}
|
||||
|
||||
return $this->styles[strtolower($name)];
|
||||
|
@ -460,7 +460,7 @@ class Table
|
||||
$unmergedRows = [];
|
||||
foreach ($rows[$line] as $column => $cell) {
|
||||
if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
|
||||
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell)));
|
||||
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', \gettype($cell)));
|
||||
}
|
||||
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
|
||||
$nbLines = $cell->getRowspan() - 1;
|
||||
|
@ -155,7 +155,7 @@ class ChoiceQuestion extends Question
|
||||
}
|
||||
|
||||
if (\count($results) > 1) {
|
||||
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
|
||||
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
|
||||
}
|
||||
|
||||
$result = array_search($value, $choices);
|
||||
|
@ -524,7 +524,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
public function testAmbiguousChoiceFromChoicelist()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of env_2 or env_3.');
|
||||
$this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of "env_2" or "env_3".');
|
||||
$possibleChoices = [
|
||||
'env_1' => 'My first environment',
|
||||
'env_2' => 'My environment',
|
||||
@ -891,7 +891,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
public function testLegacyAmbiguousChoiceFromChoicelist()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of env_2 or env_3.');
|
||||
$this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of "env_2" or "env_3".');
|
||||
$possibleChoices = [
|
||||
'env_1' => 'My first environment',
|
||||
'env_2' => 'My environment',
|
||||
|
@ -729,7 +729,7 @@ TABLE;
|
||||
public function testThrowsWhenTheCellInAnArray()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing __toString, array given.');
|
||||
$this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.');
|
||||
$table = new Table($output = $this->getOutputStream());
|
||||
$table
|
||||
->setHeaders(['ISBN', 'Title', 'Author', 'Price'])
|
||||
|
@ -55,7 +55,7 @@ class StringHandler implements HandlerInterface
|
||||
$match = $reader->findPattern($this->patterns->getQuotedStringPattern($quote));
|
||||
|
||||
if (!$match) {
|
||||
throw new InternalErrorException(sprintf('Should have found at least an empty match at %s.', $reader->getPosition()));
|
||||
throw new InternalErrorException(sprintf('Should have found at least an empty match at %d.', $reader->getPosition()));
|
||||
}
|
||||
|
||||
// check unclosed strings
|
||||
|
@ -58,7 +58,7 @@ class FunctionExtension extends AbstractExtension
|
||||
try {
|
||||
list($a, $b) = Parser::parseSeries($function->getArguments());
|
||||
} catch (SyntaxErrorException $e) {
|
||||
throw new ExpressionErrorException(sprintf('Invalid series: %s.', implode(', ', $function->getArguments())), 0, $e);
|
||||
throw new ExpressionErrorException(sprintf('Invalid series: "%s".', implode('", "', $function->getArguments())), 0, $e);
|
||||
}
|
||||
|
||||
$xpath->addStarPrefix();
|
||||
|
@ -90,7 +90,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
}
|
||||
|
||||
if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of %s or an instance of %s, %s given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue)));
|
||||
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
||||
}
|
||||
|
||||
if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of %s or an instance of %s, %s given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument)));
|
||||
throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument)));
|
||||
}
|
||||
|
||||
$typeFound = false;
|
||||
|
@ -1439,7 +1439,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$completed = true;
|
||||
} else {
|
||||
if (!\is_string($resolved) && !is_numeric($resolved)) {
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
|
||||
}
|
||||
$value = str_ireplace($placeholder, $resolved, $value);
|
||||
}
|
||||
|
@ -1306,7 +1306,7 @@ EOF;
|
||||
|
||||
foreach ($this->container->getParameterBag()->all() as $key => $value) {
|
||||
if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
|
||||
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey));
|
||||
}
|
||||
if ($key !== $lcKey = strtolower($key)) {
|
||||
$normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key));
|
||||
|
@ -57,7 +57,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name));
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
throw new RuntimeException(sprintf('Env "file:%s" not found: %s does not exist.', $name, $file));
|
||||
throw new RuntimeException(sprintf('Env "file:%s" not found: "%s" does not exist.', $name, $file));
|
||||
}
|
||||
|
||||
return file_get_contents($file);
|
||||
@ -82,7 +82,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (!is_scalar($env)) {
|
||||
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to %s.', $name, $prefix));
|
||||
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix));
|
||||
}
|
||||
|
||||
if ('string' === $prefix) {
|
||||
@ -129,7 +129,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (!\is_array($env)) {
|
||||
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, %s given.', $name, \gettype($env)));
|
||||
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, "%s" given.', $name, \gettype($env)));
|
||||
}
|
||||
|
||||
return $env;
|
||||
|
@ -31,7 +31,7 @@ abstract class AbstractConfigurator
|
||||
return \call_user_func_array([$this, 'set'.$method], $args);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s().', static::class, $method));
|
||||
throw new \BadMethodCallException(sprintf('Call to undefined method "%s::%s()".', static::class, $method));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ class ContainerConfigurator extends AbstractConfigurator
|
||||
{
|
||||
if (!$this->container->hasExtension($namespace)) {
|
||||
$extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $this->file, $namespace, $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none'));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? implode('", "', $extensions) : 'none'));
|
||||
}
|
||||
|
||||
$this->container->loadFromExtension($namespace, static::processValue($config));
|
||||
|
@ -48,10 +48,10 @@ abstract class FileLoader extends BaseFileLoader
|
||||
public function registerClasses(Definition $prototype, $namespace, $resource, $exclude = null)
|
||||
{
|
||||
if ('\\' !== substr($namespace, -1)) {
|
||||
throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": %s.', $namespace));
|
||||
throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace));
|
||||
}
|
||||
if (!preg_match('/^(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+\\\\)++$/', $namespace)) {
|
||||
throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: %s.', $namespace));
|
||||
throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace));
|
||||
}
|
||||
|
||||
$classes = $this->findClasses($namespace, $resource, $exclude);
|
||||
|
@ -170,7 +170,7 @@ class XmlFileLoader extends FileLoader
|
||||
|
||||
foreach ($defaults['tags'] as $tag) {
|
||||
if ('' === $tag->getAttribute('name')) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for tag "<defaults>" in %s must be a non-empty string.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The tag name for tag "<defaults>" in "%s" must be a non-empty string.', $file));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ class XmlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if ('' === $tag->getAttribute('name')) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', (string) $service->getAttribute('id'), $file));
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', (string) $service->getAttribute('id'), $file));
|
||||
}
|
||||
|
||||
$definition->addTag($tag->getAttribute('name'), $parameters);
|
||||
@ -378,7 +378,7 @@ class XmlFileLoader extends FileLoader
|
||||
try {
|
||||
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s.', $file, $e->getMessage()), $e->getCode(), $e);
|
||||
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
$this->validateExtensions($dom, $file);
|
||||
@ -668,7 +668,7 @@ EOF
|
||||
// can it be handled by an extension?
|
||||
if (!$this->container->hasExtension($node->namespaceURI)) {
|
||||
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class YamlFileLoader extends FileLoader
|
||||
// parameters
|
||||
if (isset($content['parameters'])) {
|
||||
if (!\is_array($content['parameters'])) {
|
||||
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $path));
|
||||
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in "%s". Check your YAML syntax.', $path));
|
||||
}
|
||||
|
||||
foreach ($content['parameters'] as $key => $value) {
|
||||
@ -179,7 +179,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!\is_array($content['imports'])) {
|
||||
throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in "%s". Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$defaultDirectory = \dirname($file);
|
||||
@ -188,7 +188,7 @@ class YamlFileLoader extends FileLoader
|
||||
$import = ['resource' => $import];
|
||||
}
|
||||
if (!isset($import['resource'])) {
|
||||
throw new InvalidArgumentException(sprintf('An import should provide a resource in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('An import should provide a resource in "%s". Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$this->setCurrentDir($defaultDirectory);
|
||||
@ -208,7 +208,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!\is_array($content['services'])) {
|
||||
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in "%s". Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
if (\array_key_exists('_instanceof', $content['services'])) {
|
||||
@ -222,10 +222,10 @@ class YamlFileLoader extends FileLoader
|
||||
$this->isLoadingInstanceof = true;
|
||||
foreach ($instanceof as $id => $service) {
|
||||
if (!$service || !\is_array($service)) {
|
||||
throw new InvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
if (\is_string($service) && 0 === strpos($service, '@')) {
|
||||
throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
$this->parseDefinition($id, $service, $file, []);
|
||||
}
|
||||
@ -265,7 +265,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (isset($defaults['tags'])) {
|
||||
if (!\is_array($tags = $defaults['tags'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
@ -274,18 +274,18 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!isset($tag['name'])) {
|
||||
throw new InvalidArgumentException(sprintf('A "tags" entry in "_defaults" is missing a "name" key in %s.', $file));
|
||||
throw new InvalidArgumentException(sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".', $file));
|
||||
}
|
||||
$name = $tag['name'];
|
||||
unset($tag['name']);
|
||||
|
||||
if (!\is_string($name) || '' === $name) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in %s.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in "%s".', $file));
|
||||
}
|
||||
|
||||
foreach ($tag as $attribute => $value) {
|
||||
if (!is_scalar($value) && null !== $value) {
|
||||
throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in %s. Check your YAML syntax.', $name, $attribute, $file));
|
||||
throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.', $name, $attribute, $file));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,7 +293,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (isset($defaults['bind'])) {
|
||||
if (!\is_array($defaults['bind'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$defaults['bind'] = array_map(function ($v) { return new BoundArgument($v); }, $this->resolveServices($defaults['bind'], $file));
|
||||
@ -348,7 +348,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!\is_array($service)) {
|
||||
throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but %s found for service "%s" in %s. Check your YAML syntax.', \gettype($service), $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.', \gettype($service), $id, $file));
|
||||
}
|
||||
|
||||
$this->checkDefinition($id, $service, $file);
|
||||
@ -458,7 +458,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (isset($service['calls'])) {
|
||||
if (!\is_array($service['calls'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "calls" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "calls" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
foreach ($service['calls'] as $call) {
|
||||
@ -471,7 +471,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!\is_array($args)) {
|
||||
throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in %s. Check your YAML syntax.', $method, $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.', $method, $id, $file));
|
||||
}
|
||||
$definition->addMethodCall($method, $args);
|
||||
}
|
||||
@ -479,7 +479,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
$tags = isset($service['tags']) ? $service['tags'] : [];
|
||||
if (!\is_array($tags)) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
if (isset($defaults['tags'])) {
|
||||
@ -492,18 +492,18 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (!isset($tag['name'])) {
|
||||
throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in "%s".', $id, $file));
|
||||
}
|
||||
$name = $tag['name'];
|
||||
unset($tag['name']);
|
||||
|
||||
if (!\is_string($name) || '' === $name) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', $id, $file));
|
||||
}
|
||||
|
||||
foreach ($tag as $attribute => $value) {
|
||||
if (!is_scalar($value) && null !== $value) {
|
||||
throw new InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in %s. Check your YAML syntax.', $id, $name, $attribute, $file));
|
||||
throw new InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.', $id, $name, $attribute, $file));
|
||||
}
|
||||
}
|
||||
|
||||
@ -529,12 +529,12 @@ class YamlFileLoader extends FileLoader
|
||||
$definition->addAutowiringType($service['autowiring_types']);
|
||||
} else {
|
||||
if (!\is_array($service['autowiring_types'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
foreach ($service['autowiring_types'] as $autowiringType) {
|
||||
if (!\is_string($autowiringType)) {
|
||||
throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
$definition->addAutowiringType($autowiringType);
|
||||
@ -548,7 +548,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (isset($service['bind'])) {
|
||||
if (!\is_array($service['bind'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "bind" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "bind" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
$bindings = array_merge($bindings, $this->resolveServices($service['bind'], $file));
|
||||
@ -566,12 +566,12 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) {
|
||||
throw new InvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
if (\array_key_exists('resource', $service)) {
|
||||
if (!\is_string($service['resource'])) {
|
||||
throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
$exclude = isset($service['exclude']) ? $service['exclude'] : null;
|
||||
$namespace = isset($service['namespace']) ? $service['namespace'] : $id;
|
||||
@ -618,10 +618,10 @@ class YamlFileLoader extends FileLoader
|
||||
return $callable;
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Parameter "%s" must contain an array with two elements for service "%s" in %s. Check your YAML syntax.', $parameter, $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "%s" must contain an array with two elements for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file));
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Parameter "%s" must be a string or an array for service "%s" in %s. Check your YAML syntax.', $parameter, $id, $file));
|
||||
throw new InvalidArgumentException(sprintf('Parameter "%s" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -695,7 +695,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (!$this->container->hasExtension($namespace)) {
|
||||
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class EnvPlaceholderParameterBag extends ParameterBag
|
||||
}
|
||||
}
|
||||
if (!preg_match('/^(?:\w++:)*+\w++$/', $env)) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name));
|
||||
throw new InvalidArgumentException(sprintf('Invalid "%s" name: only "word" characters are allowed.', $name));
|
||||
}
|
||||
|
||||
if ($this->has($name)) {
|
||||
@ -116,7 +116,7 @@ class EnvPlaceholderParameterBag extends ParameterBag
|
||||
if (is_numeric($default = $this->parameters[$name])) {
|
||||
$this->parameters[$name] = (string) $default;
|
||||
} elseif (null !== $default && !is_scalar($default)) {
|
||||
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, \gettype($default)));
|
||||
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class ParameterBag implements ParameterBagInterface
|
||||
$resolved = $this->get($key);
|
||||
|
||||
if (!\is_string($resolved) && !is_numeric($resolved)) {
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type %s inside string value "%s".', $key, \gettype($resolved), $value));
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, \gettype($resolved), $value));
|
||||
}
|
||||
|
||||
$resolved = (string) $resolved;
|
||||
|
@ -719,7 +719,7 @@ class ContainerBuilderTest extends TestCase
|
||||
public function testCompileWithArrayInStringResolveEnv()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type array inside string value "ABC %env(json:ARRAY)%".');
|
||||
$this->expectExceptionMessage('A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type "array" inside string value "ABC %env(json:ARRAY)%".');
|
||||
putenv('ARRAY={"foo":"bar"}');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
|
@ -536,7 +536,7 @@ class YamlFileLoaderTest extends TestCase
|
||||
public function testInvalidTagsWithDefaults()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\Bar" in .+services31_invalid_tags\.yml\. Check your YAML syntax./');
|
||||
$this->expectExceptionMessageRegExp('/Parameter "tags" must be an array for service "Foo\\\Bar" in ".+services31_invalid_tags\.yml"\. Check your YAML syntax./');
|
||||
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
|
||||
$loader->load('services31_invalid_tags.yml');
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class EnvPlaceholderParameterBagTest extends TestCase
|
||||
public function testResolveThrowsOnBadDefaultValue()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('The default value of env parameter "ARRAY_VAR" must be scalar or null, array given.');
|
||||
$this->expectExceptionMessage('The default value of env parameter "ARRAY_VAR" must be scalar or null, "array" given.');
|
||||
$bag = new EnvPlaceholderParameterBag();
|
||||
$bag->get('env(ARRAY_VAR)');
|
||||
$bag->set('env(ARRAY_VAR)', []);
|
||||
|
@ -170,7 +170,7 @@ class ParameterBagTest extends TestCase
|
||||
$bag->resolveValue('%foo%');
|
||||
$this->fail('->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter');
|
||||
} catch (RuntimeException $e) {
|
||||
$this->assertEquals('A string value must be composed of strings and/or numbers, but found parameter "bar" of type array inside string value "a %bar%".', $e->getMessage(), '->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter');
|
||||
$this->assertEquals('A string value must be composed of strings and/or numbers, but found parameter "bar" of type "array" inside string value "a %bar%".', $e->getMessage(), '->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter');
|
||||
}
|
||||
|
||||
$bag = new ParameterBag(['foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%']);
|
||||
|
@ -133,11 +133,11 @@ class ChoiceFormField extends FormField
|
||||
|
||||
foreach ($value as $v) {
|
||||
if (!$this->containsOption($v, $this->options)) {
|
||||
throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $v, implode(', ', $this->availableOptionValues())));
|
||||
throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: "%s").', $this->name, $v, implode('", "', $this->availableOptionValues())));
|
||||
}
|
||||
}
|
||||
} elseif (!$this->containsOption($value, $this->options)) {
|
||||
throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $value, implode(', ', $this->availableOptionValues())));
|
||||
throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: "%s").', $this->name, $value, implode('", "', $this->availableOptionValues())));
|
||||
}
|
||||
|
||||
if ($this->multiple) {
|
||||
@ -205,7 +205,7 @@ class ChoiceFormField extends FormField
|
||||
}
|
||||
|
||||
if ('input' === $this->node->nodeName && 'checkbox' !== strtolower($this->node->getAttribute('type')) && 'radio' !== strtolower($this->node->getAttribute('type'))) {
|
||||
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $this->node->getAttribute('type')));
|
||||
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is "%s").', $this->node->getAttribute('type')));
|
||||
}
|
||||
|
||||
$this->value = null;
|
||||
|
@ -29,7 +29,7 @@ class FileFormField extends FormField
|
||||
{
|
||||
$codes = [UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION];
|
||||
if (!\in_array($error, $codes)) {
|
||||
throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error));
|
||||
throw new \InvalidArgumentException(sprintf('The error code "%s" is not valid.', $error));
|
||||
}
|
||||
|
||||
$this->value = ['name' => '', 'type' => '', 'tmp_name' => '', 'error' => $error, 'size' => 0];
|
||||
@ -100,7 +100,7 @@ class FileFormField extends FormField
|
||||
}
|
||||
|
||||
if ('file' !== strtolower($this->node->getAttribute('type'))) {
|
||||
throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $this->node->getAttribute('type')));
|
||||
throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is "%s").', $this->node->getAttribute('type')));
|
||||
}
|
||||
|
||||
$this->setValue(null);
|
||||
|
@ -41,7 +41,7 @@ class ExpressionLanguage
|
||||
@trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED);
|
||||
$cache = new ParserCacheAdapter($cache);
|
||||
} elseif (!$cache instanceof CacheItemPoolInterface) {
|
||||
throw new \InvalidArgumentException(sprintf('Cache argument has to implement %s.', CacheItemPoolInterface::class));
|
||||
throw new \InvalidArgumentException(sprintf('Cache argument has to implement "%s".', CacheItemPoolInterface::class));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class ExpressionLanguageTest extends TestCase
|
||||
public function testWrongCacheImplementation()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Cache argument has to implement Psr\Cache\CacheItemPoolInterface.');
|
||||
$this->expectExceptionMessage('Cache argument has to implement "Psr\Cache\CacheItemPoolInterface".');
|
||||
$cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemSpoolInterface')->getMock();
|
||||
new ExpressionLanguage($cacheMock);
|
||||
}
|
||||
|
@ -388,10 +388,10 @@ class Filesystem
|
||||
{
|
||||
if (self::$lastError) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
|
||||
throw new IOException(sprintf('Unable to create %s link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
|
||||
throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
|
||||
}
|
||||
}
|
||||
throw new IOException(sprintf('Failed to create %s link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target);
|
||||
throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,13 +53,13 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
|
||||
try {
|
||||
new \DateTimeZone($this->inputTimezone);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Input timezone is invalid: %s.', $this->inputTimezone), $e->getCode(), $e);
|
||||
throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
try {
|
||||
new \DateTimeZone($this->outputTimezone);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Output timezone is invalid: %s.', $this->outputTimezone), $e->getCode(), $e);
|
||||
throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ class ChoiceType extends AbstractType
|
||||
|
||||
// Set by the user
|
||||
if (true !== $choicesAsValues) {
|
||||
throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
|
||||
throw new \RuntimeException(sprintf('The "choices_as_values" option of the "%s" should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
|
||||
}
|
||||
|
||||
@trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED);
|
||||
|
@ -163,7 +163,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function getElement($index)
|
||||
{
|
||||
if (!isset($this->elements[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->elements[$index];
|
||||
@ -175,7 +175,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isProperty($index)
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return !$this->isIndex[$index];
|
||||
@ -187,7 +187,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isIndex($index)
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->isIndex[$index];
|
||||
@ -212,7 +212,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function mapsForm($index)
|
||||
{
|
||||
if (!isset($this->mapsForm[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
|
||||
}
|
||||
|
||||
return $this->mapsForm[$index];
|
||||
|
@ -1031,7 +1031,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to transform data for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1055,7 +1055,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1086,7 +1086,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1112,7 +1112,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
@ -34,7 +34,7 @@ trait ValidatorExtensionTrait
|
||||
}
|
||||
|
||||
if (!$this instanceof TypeTestCase) {
|
||||
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s.', TypeTestCase::class));
|
||||
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends "%s".', TypeTestCase::class));
|
||||
}
|
||||
|
||||
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
||||
|
@ -225,7 +225,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) {
|
||||
throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value));
|
||||
throw new \RuntimeException(sprintf('The "%s" HTTP header is not parseable (%s).', $key, $value));
|
||||
}
|
||||
|
||||
return $date;
|
||||
|
@ -190,7 +190,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
public function getBag($name)
|
||||
{
|
||||
if (!isset($this->bags[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
}
|
||||
|
||||
if (!$this->started) {
|
||||
|
@ -314,7 +314,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
public function getBag($name)
|
||||
{
|
||||
if (!isset($this->bags[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
}
|
||||
|
||||
if (!$this->started && $this->saveHandler->isActive()) {
|
||||
|
@ -70,7 +70,7 @@ abstract class Bundle implements BundleInterface
|
||||
|
||||
if (null !== $extension) {
|
||||
if (!$extension instanceof ExtensionInterface) {
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
|
||||
throw new \LogicException(sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
|
||||
}
|
||||
|
||||
// check naming convention
|
||||
|
@ -40,7 +40,7 @@ class Psr6CacheClearer implements CacheClearerInterface
|
||||
public function clearPool($name)
|
||||
{
|
||||
if (!isset($this->pools[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Cache pool not found: %s.', $name));
|
||||
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
|
||||
}
|
||||
|
||||
return $this->pools[$name]->clear();
|
||||
|
@ -107,7 +107,7 @@ class ArgumentMetadata
|
||||
public function getDefaultValue()
|
||||
{
|
||||
if (!$this->hasDefaultValue) {
|
||||
throw new \LogicException(sprintf('Argument $%s does not have a default value. Use %s::hasDefaultValue() to avoid this exception.', $this->name, __CLASS__));
|
||||
throw new \LogicException(sprintf('Argument $%s does not have a default value. Use "%s::hasDefaultValue()" to avoid this exception.', $this->name, __CLASS__));
|
||||
}
|
||||
|
||||
return $this->defaultValue;
|
||||
|
@ -217,7 +217,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$dumper = new HtmlDumper($data, $this->charset);
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s.', $format));
|
||||
throw new \InvalidArgumentException(sprintf('Invalid dump format: "%s".', $format));
|
||||
}
|
||||
$dumps = [];
|
||||
|
||||
|
@ -46,7 +46,7 @@ class ResettableServicePass implements CompilerPassInterface
|
||||
$attributes = $tags[0];
|
||||
|
||||
if (!isset($attributes['method'])) {
|
||||
throw new RuntimeException(sprintf('Tag %s requires the "method" attribute to be set.', $this->tagName));
|
||||
throw new RuntimeException(sprintf('Tag "%s" requires the "method" attribute to be set.', $this->tagName));
|
||||
}
|
||||
|
||||
$methods[$id] = $attributes['method'];
|
||||
|
@ -100,7 +100,7 @@ class FragmentHandler
|
||||
protected function deliver(Response $response)
|
||||
{
|
||||
if (!$response->isSuccessful()) {
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode()));
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode()));
|
||||
}
|
||||
|
||||
if (!$response instanceof StreamedResponse) {
|
||||
|
@ -96,7 +96,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
|
||||
$response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
|
||||
|
||||
if (!$response->isSuccessful()) {
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode()));
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
|
||||
}
|
||||
|
||||
return $response->getContent();
|
||||
|
@ -236,7 +236,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
}
|
||||
|
||||
if (!isset($this->bundleMap[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, static::class));
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your "%s.php" file?', $name, static::class));
|
||||
}
|
||||
|
||||
if (true === $first) {
|
||||
@ -762,10 +762,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
|
||||
if (!is_dir($dir)) {
|
||||
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
|
||||
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n.", $name, $dir));
|
||||
throw new \RuntimeException(sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
|
||||
}
|
||||
} elseif (!is_writable($dir)) {
|
||||
throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n.", $name, $dir));
|
||||
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Psr6CacheClearerTest extends TestCase
|
||||
public function testClearPoolThrowsExceptionOnUnreferencedPool()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Cache pool not found: unknown');
|
||||
$this->expectExceptionMessage('Cache pool not found: "unknown"');
|
||||
(new Psr6CacheClearer())->clearPool('unknown');
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class ResettableServicePassTest extends TestCase
|
||||
public function testMissingMethod()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('Tag kernel.reset requires the "method" attribute to be set.');
|
||||
$this->expectExceptionMessage('Tag "kernel.reset" requires the "method" attribute to be set.');
|
||||
$container = new ContainerBuilder();
|
||||
$container->register(ResettableService::class)
|
||||
->addTag('kernel.reset');
|
||||
|
@ -55,7 +55,7 @@ class GenrbCompiler implements BundleCompilerInterface
|
||||
exec($this->genrb.' --quiet -e UTF-8 -d '.$targetDir.' '.$sourcePath, $output, $status);
|
||||
|
||||
if (0 !== $status) {
|
||||
throw new RuntimeException(sprintf('genrb failed with status %d while compiling %s to %s.', $status, $sourcePath, $targetDir));
|
||||
throw new RuntimeException(sprintf('genrb failed with status %d while compiling "%s" to "%s".', $status, $sourcePath, $targetDir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class RecursiveArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
throw new OutOfBoundsException(sprintf('The index %s does not exist.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" does not exist.', $index));
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
@ -105,7 +105,7 @@ class TimezoneTransformer extends Transformer
|
||||
$signal = '-' === $matches['signal'] ? '+' : '-';
|
||||
|
||||
if (0 < $minutes) {
|
||||
throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', $formattedTimeZone));
|
||||
throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: "%s".', $formattedTimeZone));
|
||||
}
|
||||
|
||||
return 'Etc/GMT'.(0 !== $hours ? $signal.$hours : '');
|
||||
|
@ -363,7 +363,7 @@ class NumberFormatter
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -73,7 +73,7 @@ final class Ldap implements LdapInterface
|
||||
public static function create($adapter, array $config = [])
|
||||
{
|
||||
if (!isset(self::$adapterMap[$adapter])) {
|
||||
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s.', $adapter, implode(', ', self::$adapterMap)));
|
||||
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: "%s".', $adapter, implode('", "', self::$adapterMap)));
|
||||
}
|
||||
|
||||
$class = self::$adapterMap[$adapter];
|
||||
|
@ -37,11 +37,11 @@ class RedisStore implements StoreInterface
|
||||
public function __construct($redisClient, $initialTtl = 300.0)
|
||||
{
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) {
|
||||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %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\ClientInterface, "%s" given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
|
||||
}
|
||||
|
||||
if ($initialTtl <= 0) {
|
||||
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->redis = $redisClient;
|
||||
@ -143,7 +143,7 @@ class RedisStore implements StoreInterface
|
||||
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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,6 +35,6 @@ class StoreFactory
|
||||
return new MemcachedStore($connection);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', \get_class($connection)));
|
||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: "%s".', \get_class($connection)));
|
||||
}
|
||||
}
|
||||
|
@ -1681,7 +1681,7 @@ class Process implements \IteratorAggregate
|
||||
private function requireProcessIsStarted($functionName)
|
||||
{
|
||||
if (!$this->isStarted()) {
|
||||
throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
|
||||
throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1695,7 +1695,7 @@ class Process implements \IteratorAggregate
|
||||
private function requireProcessIsTerminated($functionName)
|
||||
{
|
||||
if (!$this->isTerminated()) {
|
||||
throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
|
||||
throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -936,7 +936,7 @@ class ProcessTest extends TestCase
|
||||
$process = $this->getProcess('foo');
|
||||
|
||||
$this->expectException('Symfony\Component\Process\Exception\LogicException');
|
||||
$this->expectExceptionMessage(sprintf('Process must be started before calling %s.', $method));
|
||||
$this->expectExceptionMessage(sprintf('Process must be started before calling "%s()".', $method));
|
||||
|
||||
$process->{$method}();
|
||||
}
|
||||
|
@ -917,7 +917,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
|
||||
{
|
||||
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
|
||||
throw new \RuntimeException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
|
||||
throw new \RuntimeException(sprintf('The Symfony Cache component must be installed to use "%s()".', __METHOD__));
|
||||
}
|
||||
|
||||
if (!ApcuAdapter::isSupported()) {
|
||||
|
@ -173,7 +173,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function getElement($index)
|
||||
{
|
||||
if (!isset($this->elements[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
|
||||
}
|
||||
|
||||
return $this->elements[$index];
|
||||
@ -185,7 +185,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isProperty($index)
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
|
||||
}
|
||||
|
||||
return !$this->isIndex[$index];
|
||||
@ -197,7 +197,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
|
||||
public function isIndex($index)
|
||||
{
|
||||
if (!isset($this->isIndex[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index %s is not within the property path.', $index));
|
||||
throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index));
|
||||
}
|
||||
|
||||
return $this->isIndex[$index];
|
||||
|
@ -94,7 +94,7 @@ class PropertyPathBuilder
|
||||
public function remove($offset, $length = 1)
|
||||
{
|
||||
if (!isset($this->elements[$offset])) {
|
||||
throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset));
|
||||
throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset));
|
||||
}
|
||||
|
||||
$this->resize($offset, $length, 0);
|
||||
@ -149,7 +149,7 @@ class PropertyPathBuilder
|
||||
public function replaceByIndex($offset, $name = null)
|
||||
{
|
||||
if (!isset($this->elements[$offset])) {
|
||||
throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset));
|
||||
throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset));
|
||||
}
|
||||
|
||||
if (null !== $name) {
|
||||
@ -170,7 +170,7 @@ class PropertyPathBuilder
|
||||
public function replaceByProperty($offset, $name = null)
|
||||
{
|
||||
if (!isset($this->elements[$offset])) {
|
||||
throw new OutOfBoundsException(sprintf('The offset %s is not within the property path.', $offset));
|
||||
throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset));
|
||||
}
|
||||
|
||||
if (null !== $name) {
|
||||
|
@ -55,7 +55,7 @@ abstract class ObjectRouteLoader extends Loader
|
||||
$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)) {
|
||||
@ -67,7 +67,7 @@ abstract class ObjectRouteLoader extends Loader
|
||||
if (!$routeCollection instanceof RouteCollection) {
|
||||
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
|
||||
|
||||
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned.', \get_class($loaderObject), $method, $type));
|
||||
throw new \LogicException(sprintf('The "%s"::%s method must return a RouteCollection: "%s" returned.', \get_class($loaderObject), $method, $type));
|
||||
}
|
||||
|
||||
// make the service file tracked so that if it changes, the cache rebuilds
|
||||
|
@ -139,7 +139,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
}
|
||||
|
||||
if (\strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) {
|
||||
throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %s characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern));
|
||||
throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %d characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern));
|
||||
}
|
||||
|
||||
if ($isSeparator && $precedingText !== $precedingChar) {
|
||||
|
@ -41,7 +41,7 @@ abstract class AbstractToken implements TokenInterface
|
||||
if (\is_string($role)) {
|
||||
$role = new Role($role);
|
||||
} elseif (!$role instanceof RoleInterface) {
|
||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings or Role instances, but got %s.', \gettype($role)));
|
||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings or Role instances, but got "%s".', \gettype($role)));
|
||||
}
|
||||
|
||||
$this->roles[] = $role;
|
||||
|
@ -62,7 +62,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
*/
|
||||
public function setVoters(array $voters)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the voters to the constructor instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the voters to the constructor instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->voters = $voters;
|
||||
}
|
||||
@ -197,6 +197,6 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
return $voter->vote($token, $subject, $attributes);
|
||||
}
|
||||
|
||||
throw new LogicException(sprintf('%s should implement the %s interface when used as voter.', \get_class($voter), VoterInterface::class));
|
||||
throw new LogicException(sprintf('"%s" should implement the "%s" interface when used as voter.', \get_class($voter), VoterInterface::class));
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class AccessDecisionManagerTest extends TestCase
|
||||
public function testVotingWrongTypeNoVoteMethod()
|
||||
{
|
||||
$exception = LogicException::class;
|
||||
$message = sprintf('stdClass should implement the %s interface when used as voter.', VoterInterface::class);
|
||||
$message = sprintf('"stdClass" should implement the "%s" interface when used as voter.', VoterInterface::class);
|
||||
|
||||
$this->expectException($exception);
|
||||
$this->expectExceptionMessage($message);
|
||||
|
@ -64,7 +64,7 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
|
||||
@trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', static::class), E_USER_DEPRECATED);
|
||||
|
||||
if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) {
|
||||
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', static::class));
|
||||
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in "%s".', static::class));
|
||||
}
|
||||
|
||||
$targetPath = null;
|
||||
|
@ -81,7 +81,7 @@ class GuardAuthenticatorHandler
|
||||
return $response;
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null or a Response object. You returned "%s".', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ class GuardAuthenticatorHandler
|
||||
return $response;
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null or a Response object. You returned "%s".', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,23 +101,23 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
|
||||
$user = $guardAuthenticator->getUser($token->getCredentials(), $this->userProvider);
|
||||
|
||||
if (null === $user) {
|
||||
throw new UsernameNotFoundException(sprintf('Null returned from %s::getUser().', \get_class($guardAuthenticator)));
|
||||
throw new UsernameNotFoundException(sprintf('Null returned from "%s::getUser()".', \get_class($guardAuthenticator)));
|
||||
}
|
||||
|
||||
if (!$user instanceof UserInterface) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::getUser() method must return a UserInterface. You returned %s.', \get_class($guardAuthenticator), \is_object($user) ? \get_class($user) : \gettype($user)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::getUser()" method must return a UserInterface. You returned "%s".', \get_class($guardAuthenticator), \is_object($user) ? \get_class($user) : \gettype($user)));
|
||||
}
|
||||
|
||||
$this->userChecker->checkPreAuth($user);
|
||||
if (true !== $guardAuthenticator->checkCredentials($token->getCredentials(), $user)) {
|
||||
throw new BadCredentialsException(sprintf('Authentication failed because %s::checkCredentials() did not return true.', \get_class($guardAuthenticator)));
|
||||
throw new BadCredentialsException(sprintf('Authentication failed because "%s"::checkCredentials() did not return true.', \get_class($guardAuthenticator)));
|
||||
}
|
||||
$this->userChecker->checkPostAuth($user);
|
||||
|
||||
// turn the UserInterface into a TokenInterface
|
||||
$authenticatedToken = $guardAuthenticator->createAuthenticatedToken($user, $this->providerKey);
|
||||
if (!$authenticatedToken instanceof TokenInterface) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::createAuthenticatedToken() method must return a TokenInterface. You returned %s.', \get_class($guardAuthenticator), \is_object($authenticatedToken) ? \get_class($authenticatedToken) : \gettype($authenticatedToken)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::createAuthenticatedToken()" method must return a TokenInterface. You returned "%s".', \get_class($guardAuthenticator), \is_object($authenticatedToken) ? \get_class($authenticatedToken) : \gettype($authenticatedToken)));
|
||||
}
|
||||
|
||||
return $authenticatedToken;
|
||||
|
@ -64,7 +64,7 @@ class SimpleAuthenticationHandler implements AuthenticationFailureHandlerInterfa
|
||||
}
|
||||
|
||||
if (null !== $response) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null to use the default success handler, or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class SimpleAuthenticationHandler implements AuthenticationFailureHandlerInterfa
|
||||
}
|
||||
|
||||
if (null !== $response) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null to use the default failure handler, or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class ExceptionListener
|
||||
if (!$response instanceof Response) {
|
||||
$given = \is_object($response) ? \get_class($response) : \gettype($response);
|
||||
|
||||
throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned).', \get_class($this->authenticationEntryPoint), $given));
|
||||
throw new \LogicException(sprintf('The "%s::start()" method must return a Response object ("%s" returned).', \get_class($this->authenticationEntryPoint), $given));
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
@ -41,7 +41,7 @@ class RemoteUserAuthenticationListener extends AbstractPreAuthenticatedListener
|
||||
protected function getPreAuthenticatedData(Request $request)
|
||||
{
|
||||
if (!$request->server->has($this->userKey)) {
|
||||
throw new BadCredentialsException(sprintf('User key was not found: %s.', $this->userKey));
|
||||
throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey));
|
||||
}
|
||||
|
||||
return [$request->server->get($this->userKey), null];
|
||||
|
@ -120,7 +120,7 @@ class SimplePreAuthenticationListener implements ListenerInterface
|
||||
if ($response instanceof Response) {
|
||||
$event->setResponse($response);
|
||||
} elseif (null !== $response) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class SimplePreAuthenticationListener implements ListenerInterface
|
||||
if ($response instanceof Response) {
|
||||
$event->setResponse($response);
|
||||
} elseif (null !== $response) {
|
||||
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener
|
||||
}
|
||||
|
||||
if (null === $user) {
|
||||
throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s.', $this->userKey, $this->credentialKey));
|
||||
throw new BadCredentialsException(sprintf('SSL credentials not found: "%s", "%s".', $this->userKey, $this->credentialKey));
|
||||
}
|
||||
|
||||
return [$user, $request->server->get($this->credentialKey, '')];
|
||||
|
@ -81,7 +81,7 @@ class SimpleAuthenticationHandlerTest extends TestCase
|
||||
public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsReturned()
|
||||
{
|
||||
$this->expectException('UnexpectedValueException');
|
||||
$this->expectExceptionMessage('onAuthenticationSuccess method must return null to use the default success handler, or a Response object');
|
||||
$this->expectExceptionMessage('onAuthenticationSuccess()" method must return null to use the default success handler, or a Response object');
|
||||
$this->successHandler->expects($this->never())
|
||||
->method('onAuthenticationSuccess');
|
||||
|
||||
@ -149,7 +149,7 @@ class SimpleAuthenticationHandlerTest extends TestCase
|
||||
public function testOnAuthenticationFailureThrowsAnExceptionIfNonResponseIsReturned()
|
||||
{
|
||||
$this->expectException('UnexpectedValueException');
|
||||
$this->expectExceptionMessage('onAuthenticationFailure method must return null to use the default failure handler, or a Response object');
|
||||
$this->expectExceptionMessage('onAuthenticationFailure()" method must return null to use the default failure handler, or a Response object');
|
||||
$this->failureHandler->expects($this->never())
|
||||
->method('onAuthenticationFailure');
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ExceptionListenerTest extends TestCase
|
||||
$listener->onKernelException($event);
|
||||
// the exception has been replaced by our LogicException
|
||||
$this->assertInstanceOf('LogicException', $event->getException());
|
||||
$this->assertStringEndsWith('start() method must return a Response object (string returned).', $event->getException()->getMessage());
|
||||
$this->assertStringEndsWith('start()" method must return a Response object ("string" returned).', $event->getException()->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
|
||||
if (\is_object($data)) {
|
||||
if (null === $this->serializer) {
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used with object data.', __METHOD__));
|
||||
}
|
||||
|
||||
$data = $this->serializer->normalize($data, $this->format, $this->context);
|
||||
@ -490,7 +490,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
$this->buildXml($node, $val);
|
||||
} elseif (\is_object($val)) {
|
||||
if (null === $this->serializer) {
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used with object data.', __METHOD__));
|
||||
}
|
||||
|
||||
return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context));
|
||||
|
@ -30,11 +30,11 @@ abstract class FileLoader implements LoaderInterface
|
||||
public function __construct($file)
|
||||
{
|
||||
if (!is_file($file)) {
|
||||
throw new MappingException(sprintf('The mapping file %s does not exist.', $file));
|
||||
throw new MappingException(sprintf('The mapping file "%s" does not exist.', $file));
|
||||
}
|
||||
|
||||
if (!is_readable($file)) {
|
||||
throw new MappingException(sprintf('The mapping file %s is not readable.', $file));
|
||||
throw new MappingException(sprintf('The mapping file "%s" is not readable.', $file));
|
||||
}
|
||||
|
||||
$this->file = $file;
|
||||
|
@ -40,7 +40,7 @@ class LoaderChain implements LoaderInterface
|
||||
{
|
||||
foreach ($loaders as $loader) {
|
||||
if (!$loader instanceof LoaderInterface) {
|
||||
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface.', \get_class($loader)));
|
||||
throw new MappingException(sprintf('Class "%s" is expected to implement LoaderInterface.', \get_class($loader)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user