Merge branch '3.4' into 4.4
* 3.4: Fix quotes in exception messages
This commit is contained in:
commit
09ee51aa4d
@ -454,7 +454,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;
|
||||
|
@ -69,7 +69,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)]);
|
||||
@ -92,7 +92,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))));
|
||||
}
|
||||
$listenerRefs[$con][$id] = new Reference($id);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -88,7 +88,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);
|
||||
|
@ -171,7 +171,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);
|
||||
|
@ -57,11 +57,11 @@ abstract class KernelTestCase extends TestCase
|
||||
protected static function getKernelClass()
|
||||
{
|
||||
if (!isset($_SERVER['KERNEL_CLASS']) && !isset($_ENV['KERNEL_CLASS'])) {
|
||||
throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$s::createKernel() or %1$s::getKernelClass() method.', static::class));
|
||||
throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the "%1$s::createKernel()" or "%1$s::getKernelClass()" method.', static::class));
|
||||
}
|
||||
|
||||
if (!class_exists($class = $_ENV['KERNEL_CLASS'] ?? $_SERVER['KERNEL_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;
|
||||
|
@ -106,11 +106,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,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%'));
|
||||
|
@ -41,7 +41,7 @@ class FirewallContext
|
||||
$this->logoutListener = $logoutListener;
|
||||
$this->config = $config;
|
||||
} else {
|
||||
throw new \TypeError(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 \TypeError(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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ class AddSecurityVotersPassTest extends TestCase
|
||||
public function testVoterMissingInterface()
|
||||
{
|
||||
$exception = LogicException::class;
|
||||
$message = 'stdClass must implement the Symfony\Component\Security\Core\Authorization\Voter\VoterInterface when used as a voter.';
|
||||
$message = '"stdClass" must implement the "Symfony\Component\Security\Core\Authorization\Voter\VoterInterface" when used as a voter.';
|
||||
|
||||
$this->expectException($exception);
|
||||
$this->expectExceptionMessage($message);
|
||||
|
@ -362,7 +362,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);
|
||||
|
@ -31,7 +31,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;
|
||||
|
@ -130,7 +130,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
||||
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:') || 0 === strpos($dsn, 'rediss:')) {
|
||||
return RedisAdapter::createConnection($dsn, $options);
|
||||
@ -139,7 +139,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
||||
return MemcachedAdapter::createConnection($dsn, $options);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Unsupported DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,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.');
|
||||
@ -99,7 +99,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[2])) {
|
||||
@ -109,7 +109,7 @@ trait MemcachedTrait
|
||||
return 'file:'.($m[1] ?? '');
|
||||
}, $dsn);
|
||||
if (false === $params = parse_url($params)) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
|
||||
}
|
||||
$query = $hosts = [];
|
||||
if (isset($params['query'])) {
|
||||
@ -136,7 +136,7 @@ trait MemcachedTrait
|
||||
}
|
||||
}
|
||||
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];
|
||||
|
@ -41,21 +41,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ EOF;
|
||||
try {
|
||||
$value = VarExporter::export($value, $isStaticValue);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \is_object($value) ? \get_class($value) : 'array'), 0, $e);
|
||||
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \is_object($value) ? \get_class($value) : 'array'), 0, $e);
|
||||
}
|
||||
} elseif (\is_string($value)) {
|
||||
// Wrap "N;" in a closure to not confuse it with an encoded `null`
|
||||
@ -90,7 +90,7 @@ EOF;
|
||||
}
|
||||
$value = var_export($value, true);
|
||||
} 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)));
|
||||
} else {
|
||||
$value = var_export($value, true);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ trait PhpFilesTrait
|
||||
}
|
||||
$value = var_export($value, true);
|
||||
} 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)));
|
||||
} else {
|
||||
$value = var_export($value, true);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ trait RedisTrait
|
||||
}
|
||||
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
|
||||
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 ($redisClient instanceof \Predis\ClientInterface && $redisClient->getOptions()->exceptions) {
|
||||
@ -93,11 +93,11 @@ trait RedisTrait
|
||||
} elseif (0 === strpos($dsn, 'rediss:')) {
|
||||
$scheme = 'rediss';
|
||||
} else {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis:" or "rediss".', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s" does not start with "redis:" or "rediss".', $dsn));
|
||||
}
|
||||
|
||||
if (!\extension_loaded('redis') && !class_exists(\Predis\Client::class)) {
|
||||
throw new CacheException(sprintf('Cannot find the "redis" extension nor the "predis/predis" package: %s.', $dsn));
|
||||
throw new CacheException(sprintf('Cannot find the "redis" extension nor the "predis/predis" package: "%s".', $dsn));
|
||||
}
|
||||
|
||||
$params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
|
||||
@ -109,7 +109,7 @@ trait RedisTrait
|
||||
}, $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));
|
||||
}
|
||||
|
||||
$query = $hosts = [];
|
||||
@ -119,7 +119,7 @@ trait RedisTrait
|
||||
|
||||
if (isset($query['host'])) {
|
||||
if (!\is_array($hosts = $query['host'])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
|
||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
|
||||
}
|
||||
foreach ($hosts as $host => $parameters) {
|
||||
if (\is_string($parameters)) {
|
||||
@ -174,7 +174,7 @@ trait RedisTrait
|
||||
try {
|
||||
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $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; });
|
||||
@ -182,7 +182,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))
|
||||
@ -190,7 +190,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));
|
||||
}
|
||||
|
||||
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
||||
|
@ -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;
|
||||
|
@ -77,7 +77,7 @@ class ApplicationDescription
|
||||
public function getCommand(string $name): Command
|
||||
{
|
||||
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];
|
||||
|
@ -115,7 +115,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
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)];
|
||||
|
@ -618,7 +618,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;
|
||||
|
@ -156,7 +156,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);
|
||||
|
@ -630,7 +630,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',
|
||||
|
@ -770,7 +770,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
|
||||
|
@ -53,7 +53,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();
|
||||
|
@ -134,7 +134,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
}
|
||||
|
||||
if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition && !$bindingValue instanceof TaggedIteratorArgument && !$bindingValue instanceof ServiceLocatorArgument) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, %s, %s, %s or ServiceLocatorArgument, %s given.', $key, $this->currentId, Reference::class, Definition::class, TaggedIteratorArgument::class, \gettype($bindingValue)));
|
||||
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, %s, %s, %s or ServiceLocatorArgument, "%s" given.', $key, $this->currentId, Reference::class, Definition::class, TaggedIteratorArgument::class, \gettype($bindingValue)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,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;
|
||||
|
@ -1448,7 +1448,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);
|
||||
}
|
||||
|
@ -1372,7 +1372,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));
|
||||
}
|
||||
$export = $this->exportParameters([$value]);
|
||||
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
|
||||
|
@ -184,7 +184,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) {
|
||||
@ -231,7 +231,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
||||
}
|
||||
|
||||
if (null !== $env && !\is_array($env)) {
|
||||
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, %s given.', $name, \gettype($env)));
|
||||
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, "%s" given.', $name, \gettype($env)));
|
||||
}
|
||||
|
||||
return $env;
|
||||
|
@ -31,7 +31,7 @@ abstract class AbstractConfigurator
|
||||
return $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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ class ContainerConfigurator extends AbstractConfigurator
|
||||
{
|
||||
if (!$this->container->hasExtension($namespace)) {
|
||||
$extensions = array_filter(array_map(function (ExtensionInterface $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));
|
||||
|
@ -92,10 +92,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, (array) $exclude);
|
||||
|
@ -171,7 +171,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,7 +344,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);
|
||||
@ -395,7 +395,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);
|
||||
@ -678,7 +678,7 @@ EOF
|
||||
// can it be handled by an extension?
|
||||
if (!$this->container->hasExtension($node->namespaceURI)) {
|
||||
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $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 ? implode('", "', $extensionNamespaces) : 'none'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,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) {
|
||||
@ -180,7 +180,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);
|
||||
@ -189,7 +189,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);
|
||||
@ -204,7 +204,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'])) {
|
||||
@ -218,10 +218,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, []);
|
||||
}
|
||||
@ -257,7 +257,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) {
|
||||
@ -266,18 +266,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,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));
|
||||
}
|
||||
|
||||
foreach ($this->resolveServices($defaults['bind'], $file) as $argument => $value) {
|
||||
@ -338,7 +338,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);
|
||||
@ -459,7 +459,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 $k => $call) {
|
||||
@ -500,7 +500,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));
|
||||
}
|
||||
|
||||
$args = $this->resolveServices($args, $file);
|
||||
@ -510,7 +510,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'])) {
|
||||
@ -523,18 +523,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,7 +575,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));
|
||||
@ -599,12 +599,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;
|
||||
@ -654,10 +654,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));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -718,7 +718,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
if (!$this->container->hasExtension($namespace)) {
|
||||
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,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)) {
|
||||
@ -164,7 +164,7 @@ class EnvPlaceholderParameterBag extends ParameterBag
|
||||
$this->parameters[$name] = (string) $default;
|
||||
} elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
|
||||
//throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string 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)));
|
||||
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default)));
|
||||
} elseif (is_scalar($default) && !\is_string($default)) {
|
||||
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
|
||||
}
|
||||
|
@ -230,7 +230,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;
|
||||
|
@ -738,7 +738,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();
|
||||
|
@ -621,7 +621,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');
|
||||
}
|
||||
|
@ -162,7 +162,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)', []);
|
||||
|
@ -162,7 +162,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);
|
||||
|
@ -383,10 +383,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,13 +43,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -1056,7 +1056,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to transform data for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1078,7 +1078,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$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, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1107,7 +1107,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1131,7 +1131,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$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, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -219,7 +219,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;
|
||||
|
@ -186,7 +186,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) {
|
||||
|
@ -311,7 +311,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()) {
|
||||
|
@ -69,7 +69,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();
|
||||
|
@ -99,7 +99,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;
|
||||
|
@ -198,7 +198,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 = [];
|
||||
|
||||
|
@ -98,7 +98,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();
|
||||
|
@ -231,7 +231,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
$class = static::class;
|
||||
$class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $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, $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, $class));
|
||||
}
|
||||
|
||||
return $this->bundles[$name];
|
||||
@ -713,10 +713,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');
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ abstract 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.
|
||||
|
@ -75,7 +75,7 @@ final class Ldap implements LdapInterface
|
||||
public static function create($adapter, array $config = []): self
|
||||
{
|
||||
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];
|
||||
|
@ -39,11 +39,11 @@ class RedisStore implements StoreInterface
|
||||
public function __construct($redisClient, float $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 InvalidTtlException(sprintf('%s() expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
|
||||
throw new InvalidTtlException(sprintf('"%s()" expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
|
||||
}
|
||||
|
||||
$this->redis = $redisClient;
|
||||
@ -153,7 +153,7 @@ class RedisStore implements StoreInterface
|
||||
return $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)));
|
||||
}
|
||||
|
||||
private function getUniqueToken(Key $key): string
|
||||
|
@ -95,6 +95,6 @@ class StoreFactory
|
||||
return new ZookeeperStore(ZookeeperStore::createConnection($connection));
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', $connection));
|
||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: "%s".', $connection));
|
||||
}
|
||||
}
|
||||
|
@ -1606,7 +1606,7 @@ class Process implements \IteratorAggregate
|
||||
private function requireProcessIsStarted(string $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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1618,7 +1618,7 @@ class Process implements \IteratorAggregate
|
||||
private function requireProcessIsTerminated(string $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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,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}();
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
||||
}
|
||||
|
||||
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
|
||||
throw new \LogicException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
|
||||
throw new \LogicException(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) {
|
||||
|
@ -147,7 +147,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, false);
|
||||
} elseif (!$role instanceof Role) {
|
||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, but got %s.', \gettype($role)));
|
||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, but got "%s".', \gettype($role)));
|
||||
}
|
||||
|
||||
$this->roles[] = $role;
|
||||
|
@ -58,7 +58,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
||||
public function decide(TokenInterface $token, array $attributes, $object = null)
|
||||
{
|
||||
if (\count($attributes) > 1) {
|
||||
@trigger_error(sprintf('Passing more than one Security attribute to %s() is deprecated since Symfony 4.4. Use multiple decide() calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing more than one Security attribute to "%s()" is deprecated since Symfony 4.4. Use multiple "decide()" calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $this->{$this->strategy}($token, $attributes, $object);
|
||||
|
@ -82,7 +82,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)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +112,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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,20 +105,20 @@ 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 !== $checkCredentialsResult = $guardAuthenticator->checkCredentials($token->getCredentials(), $user)) {
|
||||
if (false !== $checkCredentialsResult) {
|
||||
@trigger_error(sprintf('%s::checkCredentials() must return a boolean value. You returned %s. This behavior is deprecated in Symfony 4.4 and will trigger a TypeError in Symfony 5.', \get_class($guardAuthenticator), \is_object($checkCredentialsResult) ? \get_class($checkCredentialsResult) : \gettype($checkCredentialsResult)), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('"%s::checkCredentials()" must return a boolean value. You returned "%s". This behavior is deprecated in Symfony 4.4 and will trigger a TypeError in Symfony 5.', \get_class($guardAuthenticator), \is_object($checkCredentialsResult) ? \get_class($checkCredentialsResult) : \gettype($checkCredentialsResult)), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
if ($this->userProvider instanceof PasswordUpgraderInterface && $guardAuthenticator instanceof PasswordAuthenticatedInterface && null !== $this->passwordEncoder && (null !== $password = $guardAuthenticator->getPassword($token->getCredentials())) && method_exists($this->passwordEncoder, 'needsRehash') && $this->passwordEncoder->needsRehash($user)) {
|
||||
$this->userProvider->upgradePassword($user, $this->passwordEncoder->encodePassword($user, $password));
|
||||
@ -128,7 +128,7 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
|
||||
// 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;
|
||||
|
@ -62,7 +62,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)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,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];
|
||||
|
@ -146,7 +146,7 @@ class SimplePreAuthenticationListener extends AbstractListener implements Listen
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ class SimplePreAuthenticationListener extends AbstractListener implements Listen
|
||||
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, '')];
|
||||
|
@ -84,7 +84,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');
|
||||
|
||||
@ -152,7 +152,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');
|
||||
|
||||
|
@ -83,7 +83,7 @@ class ExceptionListenerTest extends TestCase
|
||||
$listener->onKernelException($event);
|
||||
// the exception has been replaced by our LogicException
|
||||
$this->assertInstanceOf('LogicException', $event->getThrowable());
|
||||
$this->assertStringEndsWith('start() method must return a Response object (string returned).', $event->getThrowable()->getMessage());
|
||||
$this->assertStringEndsWith('start()" method must return a Response object ("string" returned).', $event->getThrowable()->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,7 +454,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
|
||||
|
||||
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);
|
||||
@ -520,7 +520,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
|
||||
$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(string $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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
|
||||
if ($constructorParameter->isVariadic()) {
|
||||
if ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) {
|
||||
if (!\is_array($data[$paramName])) {
|
||||
throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name));
|
||||
throw new RuntimeException(sprintf('Cannot create an instance of "%s" from serialized data because the variadic parameter "%s" can only accept an array.', $class, $constructorParameter->name));
|
||||
}
|
||||
|
||||
$variadicParameters = [];
|
||||
@ -502,7 +502,7 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
|
||||
} elseif ($constructorParameter->isDefaultValueAvailable()) {
|
||||
$params[] = $constructorParameter->getDefaultValue();
|
||||
} else {
|
||||
throw new MissingConstructorArgumentsException(sprintf('Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name));
|
||||
throw new MissingConstructorArgumentsException(sprintf('Cannot create an instance of "%s" from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,7 +524,7 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
|
||||
try {
|
||||
if (null !== $parameter->getClass()) {
|
||||
if (!$this->serializer instanceof DenormalizerInterface) {
|
||||
throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer.', $parameter->getClass(), self::class));
|
||||
throw new LogicException(sprintf('Cannot create an instance of "%s" from serialized data because the serializer inject in "%s" is not a denormalizer.', $parameter->getClass(), self::class));
|
||||
}
|
||||
$parameterClass = $parameter->getClass()->getName();
|
||||
$parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName, $format));
|
||||
|
@ -69,7 +69,7 @@ class ArrayDenormalizer implements ContextAwareDenormalizerInterface, Serializer
|
||||
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
|
||||
{
|
||||
if (null === $this->serializer) {
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used.', __METHOD__));
|
||||
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used.', __METHOD__));
|
||||
}
|
||||
|
||||
return '[]' === substr($type, -2)
|
||||
|
@ -81,7 +81,7 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
if (!\is_string($data)) {
|
||||
throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', \gettype($data)));
|
||||
throw new InvalidArgumentException(sprintf('Data expected to be a string, "%s" given.', \gettype($data)));
|
||||
}
|
||||
|
||||
if (!$this->isISO8601($data)) {
|
||||
|
@ -118,7 +118,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
final public function serialize($data, $format, array $context = []): string
|
||||
{
|
||||
if (!$this->supportsEncoding($format, $context)) {
|
||||
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format));
|
||||
throw new NotEncodableValueException(sprintf('Serialization for the format "%s" is not supported.', $format));
|
||||
}
|
||||
|
||||
if ($this->encoder->needsNormalization($format, $context)) {
|
||||
@ -134,7 +134,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
final public function deserialize($data, $type, $format, array $context = [])
|
||||
{
|
||||
if (!$this->supportsDecoding($format, $context)) {
|
||||
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported.', $format));
|
||||
throw new NotEncodableValueException(sprintf('Deserialization for the format "%s" is not supported.', $format));
|
||||
}
|
||||
|
||||
$data = $this->decode($data, $format, $context);
|
||||
@ -170,7 +170,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
throw new LogicException('You must register at least one normalizer to be able to normalize objects.');
|
||||
}
|
||||
|
||||
throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data)));
|
||||
throw new NotNormalizableValueException(sprintf('Could not normalize object of type "%s", no supporting normalizer found.', \get_class($data)));
|
||||
}
|
||||
|
||||
throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||
@ -191,7 +191,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
return $normalizer->denormalize($data, $type, $format, $context);
|
||||
}
|
||||
|
||||
throw new NotNormalizableValueException(sprintf('Could not denormalize object of type %s, no supporting normalizer found.', $type));
|
||||
throw new NotNormalizableValueException(sprintf('Could not denormalize object of type "%s", no supporting normalizer found.', $type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
public function getMessages($domain)
|
||||
{
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['all'])) {
|
||||
@ -107,7 +107,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
public function getNewMessages($domain)
|
||||
{
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['new'])) {
|
||||
@ -123,7 +123,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
public function getObsoleteMessages($domain)
|
||||
{
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['obsolete'])) {
|
||||
|
@ -46,7 +46,7 @@ class CallbackValidator extends ConstraintValidator
|
||||
$method($object, $this->context, $constraint->payload);
|
||||
} elseif (null !== $object) {
|
||||
if (!method_exists($object, $method)) {
|
||||
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s.', $method, \get_class($object)));
|
||||
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, \get_class($object)));
|
||||
}
|
||||
|
||||
$reflMethod = new \ReflectionMethod($object, $method);
|
||||
|
@ -57,7 +57,7 @@ class Collection extends Composite
|
||||
parent::initializeNestedConstraints();
|
||||
|
||||
if (!\is_array($this->fields)) {
|
||||
throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s.', __CLASS__));
|
||||
throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint "%s".', __CLASS__));
|
||||
}
|
||||
|
||||
foreach ($this->fields as $fieldName => $field) {
|
||||
|
@ -71,11 +71,11 @@ abstract class Composite extends Constraint
|
||||
$constraint = \get_class($constraint);
|
||||
}
|
||||
|
||||
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s.', $constraint, static::class));
|
||||
throw new ConstraintDefinitionException(sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, static::class));
|
||||
}
|
||||
|
||||
if ($constraint instanceof Valid) {
|
||||
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', static::class));
|
||||
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', static::class));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ abstract class Composite extends Constraint
|
||||
$excessGroups = array_diff($constraint->groups, $this->groups);
|
||||
|
||||
if (\count($excessGroups) > 0) {
|
||||
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s.', implode('", "', $excessGroups), \get_class($constraint), static::class));
|
||||
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), \get_class($constraint), static::class));
|
||||
}
|
||||
} else {
|
||||
$constraint->groups = $this->groups;
|
||||
|
@ -51,7 +51,7 @@ class Count extends Constraint
|
||||
parent::__construct($options);
|
||||
|
||||
if (null === $this->min && null === $this->max) {
|
||||
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']);
|
||||
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint "%s".', __CLASS__), ['min', 'max']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class Length extends Constraint
|
||||
parent::__construct($options);
|
||||
|
||||
if (null === $this->min && null === $this->max) {
|
||||
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']);
|
||||
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint "%s".', __CLASS__), ['min', 'max']);
|
||||
}
|
||||
|
||||
if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
|
||||
|
@ -65,7 +65,7 @@ class Range extends Constraint
|
||||
parent::__construct($options);
|
||||
|
||||
if (null === $this->min && null === $this->minPropertyPath && null === $this->max && null === $this->maxPropertyPath) {
|
||||
throw new MissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint %s.', __CLASS__), ['min', 'minPropertyPath', 'max', 'maxPropertyPath']);
|
||||
throw new MissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint "%s".', __CLASS__), ['min', 'minPropertyPath', 'max', 'maxPropertyPath']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user