Fix quotes in exception messages
This commit is contained in:
parent
1ae2da01ff
commit
aab0e40cd2
@ -54,7 +54,7 @@ class EntityType extends DoctrineType
|
|||||||
public function getLoader(ObjectManager $manager, $queryBuilder, $class)
|
public function getLoader(ObjectManager $manager, $queryBuilder, $class)
|
||||||
{
|
{
|
||||||
if (!$queryBuilder instanceof QueryBuilder) {
|
if (!$queryBuilder instanceof QueryBuilder) {
|
||||||
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
|
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ORMQueryBuilderLoader($queryBuilder);
|
return new ORMQueryBuilderLoader($queryBuilder);
|
||||||
@ -80,7 +80,7 @@ class EntityType extends DoctrineType
|
|||||||
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
|
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
|
||||||
{
|
{
|
||||||
if (!$queryBuilder instanceof QueryBuilder) {
|
if (!$queryBuilder instanceof QueryBuilder) {
|
||||||
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
|
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -52,7 +52,7 @@ class ElasticsearchLogstashHandler extends AbstractHandler
|
|||||||
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', HttpClientInterface $client = null, int $level = Logger::DEBUG, bool $bubble = true)
|
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', HttpClientInterface $client = null, int $level = Logger::DEBUG, bool $bubble = true)
|
||||||
{
|
{
|
||||||
if (!interface_exists(HttpClientInterface::class)) {
|
if (!interface_exists(HttpClientInterface::class)) {
|
||||||
throw new \LogicException(sprintf('The %s handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
|
throw new \LogicException(sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($level, $bubble);
|
parent::__construct($level, $bubble);
|
||||||
|
@ -37,7 +37,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
|
|||||||
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
|
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
|
||||||
{
|
{
|
||||||
if (!\is_bool($debug) && !\is_callable($debug)) {
|
if (!\is_bool($debug) && !\is_callable($debug)) {
|
||||||
throw new \TypeError(sprintf('Argument 3 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
|
@ -42,7 +42,7 @@ class TranslationExtension extends AbstractExtension
|
|||||||
public function __construct($translator = null, NodeVisitorInterface $translationNodeVisitor = null)
|
public function __construct($translator = null, NodeVisitorInterface $translationNodeVisitor = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->translationNodeVisitor = $translationNodeVisitor;
|
$this->translationNodeVisitor = $translationNodeVisitor;
|
||||||
|
@ -51,7 +51,7 @@ class NotificationEmail extends TemplatedEmail
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($missingPackages) {
|
if ($missingPackages) {
|
||||||
throw new \LogicException(sprintf('You cannot use "%s" if the %s Twig extension%s not available; try running "composer require %s".', static::class, implode(' and ', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages))));
|
throw new \LogicException(sprintf('You cannot use "%s" if the "%s" Twig extension%s not available; try running "composer require "%s"".', static::class, implode('" and "', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages))));
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($headers, $body);
|
parent::__construct($headers, $body);
|
||||||
|
@ -39,7 +39,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
public function __construct($validatorBuilder, string $phpArrayFile)
|
public function __construct($validatorBuilder, string $phpArrayFile)
|
||||||
{
|
{
|
||||||
if (!$validatorBuilder instanceof ValidatorBuilder && !$validatorBuilder instanceof ValidatorBuilderInterface) {
|
if (!$validatorBuilder instanceof ValidatorBuilder && !$validatorBuilder instanceof ValidatorBuilderInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, ValidatorBuilder::class, \is_object($validatorBuilder) ? \get_class($validatorBuilder) : \gettype($validatorBuilder)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, ValidatorBuilder::class, \is_object($validatorBuilder) ? \get_class($validatorBuilder) : \gettype($validatorBuilder)));
|
||||||
}
|
}
|
||||||
if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) {
|
if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) {
|
||||||
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
@ -59,7 +59,7 @@ class TranslationDebugCommand extends Command
|
|||||||
public function __construct($translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $viewsPaths = [])
|
public function __construct($translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $viewsPaths = [])
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class ResolveControllerNameSubscriber implements EventSubscriberInterface
|
|||||||
public function __call(string $method, array $args)
|
public function __call(string $method, array $args)
|
||||||
{
|
{
|
||||||
if ('onKernelRequest' !== $method && 'onKernelRequest' !== strtolower($method)) {
|
if ('onKernelRequest' !== $method && 'onKernelRequest' !== strtolower($method)) {
|
||||||
throw new \Error(sprintf('Error: Call to undefined method %s::%s().', static::class, $method));
|
throw new \Error(sprintf('Error: Call to undefined method "%s::%s()".', static::class, $method));
|
||||||
}
|
}
|
||||||
|
|
||||||
$event = $args[0];
|
$event = $args[0];
|
||||||
|
@ -34,7 +34,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
|
|||||||
public function __construct(string $secretsDir, $decryptionKey = null)
|
public function __construct(string $secretsDir, $decryptionKey = null)
|
||||||
{
|
{
|
||||||
if (null !== $decryptionKey && !\is_string($decryptionKey) && !(\is_object($decryptionKey) && method_exists($decryptionKey, '__toString'))) {
|
if (null !== $decryptionKey && !\is_string($decryptionKey) && !(\is_object($decryptionKey) && method_exists($decryptionKey, '__toString'))) {
|
||||||
throw new \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, %s given.', \gettype($decryptionKey)));
|
throw new \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, "%s" given.', \gettype($decryptionKey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pathPrefix = rtrim(strtr($secretsDir, '/', \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.basename($secretsDir).'.';
|
$this->pathPrefix = rtrim(strtr($secretsDir, '/', \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.basename($secretsDir).'.';
|
||||||
|
@ -39,7 +39,7 @@ class TranslatorHelper extends Helper
|
|||||||
public function __construct($translator = null)
|
public function __construct($translator = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ final class CacheItem implements ItemInterface
|
|||||||
throw new InvalidArgumentException('Cache tag length must be greater than zero.');
|
throw new InvalidArgumentException('Cache tag length must be greater than zero.');
|
||||||
}
|
}
|
||||||
if (false !== strpbrk($tag, self::RESERVED_CHARACTERS)) {
|
if (false !== strpbrk($tag, self::RESERVED_CHARACTERS)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters %s.', $tag, self::RESERVED_CHARACTERS));
|
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters "%s".', $tag, self::RESERVED_CHARACTERS));
|
||||||
}
|
}
|
||||||
$this->newMetadata[self::METADATA_TAGS][$tag] = $tag;
|
$this->newMetadata[self::METADATA_TAGS][$tag] = $tag;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ final class CacheItem implements ItemInterface
|
|||||||
throw new InvalidArgumentException('Cache key length must be greater than zero.');
|
throw new InvalidArgumentException('Cache key length must be greater than zero.');
|
||||||
}
|
}
|
||||||
if (false !== strpbrk($key, self::RESERVED_CHARACTERS)) {
|
if (false !== strpbrk($key, self::RESERVED_CHARACTERS)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters %s.', $key, self::RESERVED_CHARACTERS));
|
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters "%s".', $key, self::RESERVED_CHARACTERS));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
|
@ -117,7 +117,7 @@ trait MemcachedTrait
|
|||||||
|
|
||||||
if (isset($query['host'])) {
|
if (isset($query['host'])) {
|
||||||
if (!\is_array($hosts = $query['host'])) {
|
if (!\is_array($hosts = $query['host'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
foreach ($hosts as $host => $weight) {
|
foreach ($hosts as $host => $weight) {
|
||||||
if (false === $port = strrpos($host, ':')) {
|
if (false === $port = strrpos($host, ':')) {
|
||||||
|
@ -209,7 +209,7 @@ trait PhpFilesTrait
|
|||||||
try {
|
try {
|
||||||
$value = VarExporter::export($value, $isStaticValue);
|
$value = VarExporter::export($value, $isStaticValue);
|
||||||
} catch (\Exception $e) {
|
} 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)) {
|
} elseif (\is_string($value)) {
|
||||||
// Wrap "N;" in a closure to not confuse it with an encoded `null`
|
// Wrap "N;" in a closure to not confuse it with an encoded `null`
|
||||||
|
@ -151,11 +151,11 @@ trait RedisTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$hosts) {
|
if (!$hosts) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class)) {
|
if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class)) {
|
||||||
throw new CacheException(sprintf('Redis Sentinel support requires the "predis/predis" package: %s.', $dsn));
|
throw new CacheException(sprintf('Redis Sentinel support requires the "predis/predis" package: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
$params += $query + $options + self::$defaultConnectionOptions;
|
$params += $query + $options + self::$defaultConnectionOptions;
|
||||||
@ -215,7 +215,7 @@ trait RedisTrait
|
|||||||
try {
|
try {
|
||||||
$redis = new $class($hosts, $params);
|
$redis = new $class($hosts, $params);
|
||||||
} catch (\RedisClusterException $e) {
|
} catch (\RedisClusterException $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));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
||||||
@ -230,7 +230,7 @@ trait RedisTrait
|
|||||||
try {
|
try {
|
||||||
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent']);
|
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent']);
|
||||||
} catch (\RedisClusterException $e) {
|
} catch (\RedisClusterException $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));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
||||||
@ -250,7 +250,7 @@ trait RedisTrait
|
|||||||
if ($params['redis_cluster']) {
|
if ($params['redis_cluster']) {
|
||||||
$params['cluster'] = 'redis';
|
$params['cluster'] = 'redis';
|
||||||
if (isset($params['redis_sentinel'])) {
|
if (isset($params['redis_sentinel'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Cannot use both "redis_cluster" and "redis_sentinel" at the same time: %s.', $dsn));
|
throw new InvalidArgumentException(sprintf('Cannot use both "redis_cluster" and "redis_sentinel" at the same time: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
} elseif (isset($params['redis_sentinel'])) {
|
} elseif (isset($params['redis_sentinel'])) {
|
||||||
$params['replication'] = 'sentinel';
|
$params['replication'] = 'sentinel';
|
||||||
|
@ -61,7 +61,7 @@ class TreeBuilder implements NodeParentInterface
|
|||||||
public function getRootNode(): NodeDefinition
|
public function getRootNode(): NodeDefinition
|
||||||
{
|
{
|
||||||
if (null === $this->root) {
|
if (null === $this->root) {
|
||||||
throw new \RuntimeException(sprintf('Calling %s() before creating the root node is not supported, migrate to the new constructor signature instead.', __METHOD__));
|
throw new \RuntimeException(sprintf('Calling "%s()" before creating the root node is not supported, migrate to the new constructor signature instead.', __METHOD__));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->root;
|
return $this->root;
|
||||||
|
@ -45,7 +45,7 @@ trait ReferenceSetArgumentTrait
|
|||||||
{
|
{
|
||||||
foreach ($values as $k => $v) {
|
foreach ($values as $k => $v) {
|
||||||
if (null !== $v && !$v instanceof Reference) {
|
if (null !== $v && !$v instanceof Reference) {
|
||||||
throw new InvalidArgumentException(sprintf('A %s must hold only Reference instances, "%s" given.', __CLASS__, \is_object($v) ? \get_class($v) : \gettype($v)));
|
throw new InvalidArgumentException(sprintf('A "%s" must hold only Reference instances, "%s" given.', __CLASS__, \is_object($v) ? \get_class($v) : \gettype($v)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
|
|||||||
$arg = $this->processValue(new Reference($id));
|
$arg = $this->processValue(new Reference($id));
|
||||||
$this->inExpression = false;
|
$this->inExpression = false;
|
||||||
if (!$arg instanceof Reference) {
|
if (!$arg instanceof Reference) {
|
||||||
throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, %s returned for service("%s").', static::class, \is_object($arg) ? \get_class($arg) : \gettype($arg), $id));
|
throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, \is_object($arg) ? \get_class($arg) : \gettype($arg), $id));
|
||||||
}
|
}
|
||||||
$arg = sprintf('"%s"', $arg);
|
$arg = sprintf('"%s"', $arg);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ class PriorityTaggedServiceUtil
|
|||||||
$defaultIndex = $rm->invoke(null);
|
$defaultIndex = $rm->invoke(null);
|
||||||
|
|
||||||
if (!\is_string($defaultIndex)) {
|
if (!\is_string($defaultIndex)) {
|
||||||
throw new InvalidArgumentException(sprintf('Either method "%s::%s()" should return a string (got %s) or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
|
throw new InvalidArgumentException(sprintf('Either method "%s::%s()" should return a string (got "%s") or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $defaultIndex;
|
return $defaultIndex;
|
||||||
@ -154,7 +154,7 @@ class PriorityTaggedServiceUtil
|
|||||||
$defaultPriority = $rm->invoke(null);
|
$defaultPriority = $rm->invoke(null);
|
||||||
|
|
||||||
if (!\is_int($defaultPriority)) {
|
if (!\is_int($defaultPriority)) {
|
||||||
throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer (got %s) or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, \gettype($defaultPriority), $tagName, $serviceId));
|
throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer (got "%s") or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, \gettype($defaultPriority), $tagName, $serviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $defaultPriority;
|
return $defaultPriority;
|
||||||
|
@ -134,7 +134,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition && !$bindingValue instanceof TaggedIteratorArgument && !$bindingValue instanceof ServiceLocatorArgument) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
|
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
|
||||||
}
|
}
|
||||||
if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) {
|
if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) {
|
||||||
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, %s given.', $name, $env));
|
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, "%s" given.', $name, $env));
|
||||||
}
|
}
|
||||||
$parsedEnv += [
|
$parsedEnv += [
|
||||||
'port' => null,
|
'port' => null,
|
||||||
|
@ -437,7 +437,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
// anonymous services "in the wild"
|
// anonymous services "in the wild"
|
||||||
if (false !== $nodes = $xpath->query('//container:services/container:service[not(@id)]')) {
|
if (false !== $nodes = $xpath->query('//container:services/container:service[not(@id)]')) {
|
||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
throw new InvalidArgumentException(sprintf('Top-level services must have "id" attribute, none found in %s at line %d.', $file, $node->getLineNo()));
|
throw new InvalidArgumentException(sprintf('Top-level services must have "id" attribute, none found in "%s" at line %d.', $file, $node->getLineNo()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,11 +464,11 @@ class YamlFileLoader extends FileLoader
|
|||||||
|
|
||||||
foreach ($service['calls'] as $k => $call) {
|
foreach ($service['calls'] as $k => $call) {
|
||||||
if (!\is_array($call) && (!\is_string($k) || !$call instanceof TaggedValue)) {
|
if (!\is_array($call) && (!\is_string($k) || !$call instanceof TaggedValue)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s": expected map or array, %s given in %s.', $id, $call instanceof TaggedValue ? '!'.$call->getTag() : \gettype($call), $file));
|
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s": expected map or array, "%s" given in "%s".', $id, $call instanceof TaggedValue ? '!'.$call->getTag() : \gettype($call), $file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_string($k)) {
|
if (\is_string($k)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in %s?', $id, $k, $file));
|
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($call['method'])) {
|
if (isset($call['method'])) {
|
||||||
@ -482,7 +482,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
|
|
||||||
if ($args instanceof TaggedValue) {
|
if ($args instanceof TaggedValue) {
|
||||||
if ('returns_clone' !== $args->getTag()) {
|
if ('returns_clone' !== $args->getTag()) {
|
||||||
throw new InvalidArgumentException(sprintf('Unsupported tag "!%s", did you mean "!returns_clone" for service "%s" in %s?', $args->getTag(), $id, $file));
|
throw new InvalidArgumentException(sprintf('Unsupported tag "!%s", did you mean "!returns_clone" for service "%s" in "%s"?', $args->getTag(), $id, $file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$returnsClone = true;
|
$returnsClone = true;
|
||||||
@ -491,7 +491,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
$returnsClone = false;
|
$returnsClone = false;
|
||||||
}
|
}
|
||||||
} elseif (empty($call[0])) {
|
} elseif (empty($call[0])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid call for service "%s": the method must be defined as the first index of an array or as the only key of a map in %s.', $id, $file));
|
throw new InvalidArgumentException(sprintf('Invalid call for service "%s": the method must be defined as the first index of an array or as the only key of a map in "%s".', $id, $file));
|
||||||
} else {
|
} else {
|
||||||
$method = $call[0];
|
$method = $call[0];
|
||||||
$args = $call[1] ?? [];
|
$args = $call[1] ?? [];
|
||||||
@ -690,7 +690,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
try {
|
try {
|
||||||
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
|
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s.', $file, $e->getMessage()), 0, $e);
|
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: "%s".', $file, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->validate($configuration, $file);
|
return $this->validate($configuration, $file);
|
||||||
|
@ -163,7 +163,7 @@ class EnvPlaceholderParameterBag extends ParameterBag
|
|||||||
}
|
}
|
||||||
$this->parameters[$name] = (string) $default;
|
$this->parameters[$name] = (string) $default;
|
||||||
} elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
|
} 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 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)) {
|
} 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);
|
@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);
|
||||||
|
@ -49,7 +49,7 @@ abstract class AbstractUriElement
|
|||||||
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), PHP_URL_SCHEME);
|
$elementUriIsRelative = null === parse_url(trim($this->getRawUri()), PHP_URL_SCHEME);
|
||||||
$baseUriIsAbsolute = \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
|
$baseUriIsAbsolute = \in_array(strtolower(substr($this->currentUri, 0, 4)), ['http', 'file']);
|
||||||
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
|
if ($elementUriIsRelative && !$baseUriIsAbsolute) {
|
||||||
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the %s class ("%s" was passed).', __CLASS__, $this->currentUri));
|
throw new \InvalidArgumentException(sprintf('The URL of the element is relative, so you must define its base URI passing an absolute URL to the constructor of the "%s" class ("%s" was passed).', __CLASS__, $this->currentUri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ class HtmlErrorRenderer implements ErrorRendererInterface
|
|||||||
public function __construct($debug = false, string $charset = null, $fileLinkFormat = null, string $projectDir = null, $outputBuffer = '', LoggerInterface $logger = null)
|
public function __construct($debug = false, string $charset = null, $fileLinkFormat = null, string $projectDir = null, $outputBuffer = '', LoggerInterface $logger = null)
|
||||||
{
|
{
|
||||||
if (!\is_bool($debug) && !\is_callable($debug)) {
|
if (!\is_bool($debug) && !\is_callable($debug)) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($outputBuffer) && !\is_callable($outputBuffer)) {
|
if (!\is_string($outputBuffer) && !\is_callable($outputBuffer)) {
|
||||||
throw new \TypeError(sprintf('Argument 5 passed to %s() must be a string or a callable, %s given.', __METHOD__, \is_object($outputBuffer) ? \get_class($outputBuffer) : \gettype($outputBuffer)));
|
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be a string or a callable, "%s" given.', __METHOD__, \is_object($outputBuffer) ? \get_class($outputBuffer) : \gettype($outputBuffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
|
@ -35,11 +35,11 @@ class SerializerErrorRenderer implements ErrorRendererInterface
|
|||||||
public function __construct(SerializerInterface $serializer, $format, ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
|
public function __construct(SerializerInterface $serializer, $format, ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
|
||||||
{
|
{
|
||||||
if (!\is_string($format) && !\is_callable($format)) {
|
if (!\is_string($format) && !\is_callable($format)) {
|
||||||
throw new \TypeError(sprintf('Argument 2 passed to %s() must be a string or a callable, %s given.', __METHOD__, \is_object($format) ? \get_class($format) : \gettype($format)));
|
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be a string or a callable, "%s" given.', __METHOD__, \is_object($format) ? \get_class($format) : \gettype($format)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_bool($debug) && !\is_callable($debug)) {
|
if (!\is_bool($debug) && !\is_callable($debug)) {
|
||||||
throw new \TypeError(sprintf('Argument 4 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
throw new \TypeError(sprintf('Argument 4 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->serializer = $serializer;
|
$this->serializer = $serializer;
|
||||||
|
@ -151,7 +151,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||||||
$eventName = $swap;
|
$eventName = $swap;
|
||||||
|
|
||||||
if (!$event instanceof Event) {
|
if (!$event instanceof Event) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of "%s", "%s" given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
$event = $eventName ?? new Event();
|
$event = $eventName ?? new Event();
|
||||||
$eventName = $swap;
|
$eventName = $swap;
|
||||||
} else {
|
} else {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, %s given.', EventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, "%s" given.', EventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->optimized && null !== $eventName) {
|
if (null !== $this->optimized && null !== $eventName) {
|
||||||
|
@ -65,7 +65,7 @@ final class LegacyEventDispatcherProxy implements EventDispatcherInterface
|
|||||||
$event = $eventName ?? new Event();
|
$event = $eventName ?? new Event();
|
||||||
$eventName = $swap;
|
$eventName = $swap;
|
||||||
} else {
|
} else {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, %s given.', ContractsEventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, "%s" given.', ContractsEventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$listeners = $this->getListeners($eventName);
|
$listeners = $this->getListeners($eventName);
|
||||||
|
@ -55,7 +55,7 @@ abstract class AbstractTypeExtension implements FormTypeExtensionInterface
|
|||||||
public function getExtendedType()
|
public function getExtendedType()
|
||||||
{
|
{
|
||||||
if (!method_exists($this, 'getExtendedTypes')) {
|
if (!method_exists($this, 'getExtendedTypes')) {
|
||||||
throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the %s in %s.', FormTypeExtensionInterface::class, static::class));
|
throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the "%s" in "%s".', FormTypeExtensionInterface::class, static::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', static::class), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', static::class), E_USER_DEPRECATED);
|
||||||
|
@ -39,7 +39,7 @@ class CoreExtension extends AbstractExtension
|
|||||||
public function __construct(PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
|
public function __construct(PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 3 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
|
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
|
||||||
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
|
$this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
|
||||||
|
@ -31,7 +31,7 @@ class TransformationFailureListener implements EventSubscriberInterface
|
|||||||
public function __construct($translator = null)
|
public function __construct($translator = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ class DateTimeType extends AbstractType
|
|||||||
$resolver->setDeprecated('date_format', function (Options $options, $dateFormat) {
|
$resolver->setDeprecated('date_format', function (Options $options, $dateFormat) {
|
||||||
if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
|
if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
|
||||||
return sprintf('Using the "date_format" option of %s with an HTML5 date widget is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
return sprintf('Using the "date_format" option of %s with an HTML5 date widget is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
//throw new LogicException(sprintf('Cannot use the "date_format" option of the %s with an HTML5 date.', self::class));
|
//throw new LogicException(sprintf('Cannot use the "date_format" option of the "%s" with an HTML5 date.', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@ -323,7 +323,7 @@ class DateTimeType extends AbstractType
|
|||||||
$resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) {
|
$resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) {
|
||||||
if (null !== $dateWidget && 'single_text' === $options['widget']) {
|
if (null !== $dateWidget && 'single_text' === $options['widget']) {
|
||||||
return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
//throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
|
//throw new LogicException(sprintf('Cannot use the "date_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@ -331,7 +331,7 @@ class DateTimeType extends AbstractType
|
|||||||
$resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) {
|
$resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) {
|
||||||
if (null !== $timeWidget && 'single_text' === $options['widget']) {
|
if (null !== $timeWidget && 'single_text' === $options['widget']) {
|
||||||
return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
//throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
|
//throw new LogicException(sprintf('Cannot use the "time_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@ -339,7 +339,7 @@ class DateTimeType extends AbstractType
|
|||||||
$resolver->setDeprecated('html5', function (Options $options, $html5) {
|
$resolver->setDeprecated('html5', function (Options $options, $html5) {
|
||||||
if ($html5 && self::HTML5_FORMAT !== $options['format']) {
|
if ($html5 && self::HTML5_FORMAT !== $options['format']) {
|
||||||
return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
//throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class));
|
//throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is disabled.', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -325,7 +325,7 @@ class DateType extends AbstractType
|
|||||||
$resolver->setDeprecated('html5', function (Options $options, $html5) {
|
$resolver->setDeprecated('html5', function (Options $options, $html5) {
|
||||||
if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
|
if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
|
||||||
return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
//throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class));
|
//throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is disabled.', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -42,7 +42,7 @@ class FileType extends AbstractType
|
|||||||
public function __construct($translator = null)
|
public function __construct($translator = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class TransformationFailureExtension extends AbstractTypeExtension
|
|||||||
public function __construct($translator = null)
|
public function __construct($translator = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ class WeekType extends AbstractType
|
|||||||
$resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);
|
$resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);
|
||||||
$resolver->setNormalizer('html5', function (Options $options, $html5) {
|
$resolver->setNormalizer('html5', function (Options $options, $html5) {
|
||||||
if ($html5 && 'single_text' !== $options['widget']) {
|
if ($html5 && 'single_text' !== $options['widget']) {
|
||||||
throw new LogicException(sprintf('The "widget" option of %s must be set to "single_text" when the "html5" option is enabled.', self::class));
|
throw new LogicException(sprintf('The "widget" option of "%s" must be set to "single_text" when the "html5" option is enabled.', self::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html5;
|
return $html5;
|
||||||
|
@ -34,7 +34,7 @@ class CsrfExtension extends AbstractExtension
|
|||||||
public function __construct(CsrfTokenManagerInterface $tokenManager, $translator = null, string $translationDomain = null)
|
public function __construct(CsrfTokenManagerInterface $tokenManager, $translator = null, string $translationDomain = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 2 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->tokenManager = $tokenManager;
|
$this->tokenManager = $tokenManager;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
|
@ -47,7 +47,7 @@ class CsrfValidationListener implements EventSubscriberInterface
|
|||||||
public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
|
public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 5 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->fieldName = $fieldName;
|
$this->fieldName = $fieldName;
|
||||||
$this->tokenManager = $tokenManager;
|
$this->tokenManager = $tokenManager;
|
||||||
|
@ -41,7 +41,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
|||||||
public function __construct(CsrfTokenManagerInterface $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '_token', $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
|
public function __construct(CsrfTokenManagerInterface $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '_token', $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
|
||||||
{
|
{
|
||||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 4 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 4 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->defaultTokenManager = $defaultTokenManager;
|
$this->defaultTokenManager = $defaultTokenManager;
|
||||||
$this->defaultEnabled = $defaultEnabled;
|
$this->defaultEnabled = $defaultEnabled;
|
||||||
|
@ -70,7 +70,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
|||||||
public function __construct(FormDataExtractorInterface $dataExtractor)
|
public function __construct(FormDataExtractorInterface $dataExtractor)
|
||||||
{
|
{
|
||||||
if (!class_exists(ClassStub::class)) {
|
if (!class_exists(ClassStub::class)) {
|
||||||
throw new \LogicException(sprintf('The VarDumper component is needed for using the %s class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
|
throw new \LogicException(sprintf('The VarDumper component is needed for using the "%s" class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dataExtractor = $dataExtractor;
|
$this->dataExtractor = $dataExtractor;
|
||||||
|
@ -33,7 +33,7 @@ class UploadValidatorExtension extends AbstractTypeExtension
|
|||||||
public function __construct($translator, string $translationDomain = null)
|
public function __construct($translator, string $translationDomain = null)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->translationDomain = $translationDomain;
|
$this->translationDomain = $translationDomain;
|
||||||
|
@ -22,7 +22,7 @@ class AbstractTypeExtensionTest extends TestCase
|
|||||||
public function testImplementingNeitherGetExtendedTypeNorExtendsTypeThrowsException()
|
public function testImplementingNeitherGetExtendedTypeNorExtendsTypeThrowsException()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\Form\Exception\LogicException');
|
$this->expectException('Symfony\Component\Form\Exception\LogicException');
|
||||||
$this->expectExceptionMessage('You need to implement the static getExtendedTypes() method when implementing the Symfony\Component\Form\FormTypeExtensionInterface in Symfony\Component\Form\Tests\TypeExtensionWithoutExtendedTypes.');
|
$this->expectExceptionMessage('You need to implement the static getExtendedTypes() method when implementing the "Symfony\Component\Form\FormTypeExtensionInterface" in "Symfony\Component\Form\Tests\TypeExtensionWithoutExtendedTypes".');
|
||||||
$extension = new TypeExtensionWithoutExtendedTypes();
|
$extension = new TypeExtensionWithoutExtendedTypes();
|
||||||
$extension->getExtendedType();
|
$extension->getExtendedType();
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ class CachingHttpClient implements HttpClientInterface
|
|||||||
if ($responses instanceof ResponseInterface) {
|
if ($responses instanceof ResponseInterface) {
|
||||||
$responses = [$responses];
|
$responses = [$responses];
|
||||||
} elseif (!is_iterable($responses)) {
|
} elseif (!is_iterable($responses)) {
|
||||||
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of ResponseInterface objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of ResponseInterface objects, "%s" given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$mockResponses = [];
|
$mockResponses = [];
|
||||||
|
@ -156,14 +156,14 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
|||||||
if (\is_array($options['auth_ntlm'])) {
|
if (\is_array($options['auth_ntlm'])) {
|
||||||
$count = \count($options['auth_ntlm']);
|
$count = \count($options['auth_ntlm']);
|
||||||
if ($count <= 0 || $count > 2) {
|
if ($count <= 0 || $count > 2) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must contain 1 or 2 elements, %s given.', $count));
|
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must contain 1 or 2 elements, %d given.', $count));
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['auth_ntlm'] = implode(':', $options['auth_ntlm']);
|
$options['auth_ntlm'] = implode(':', $options['auth_ntlm']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($options['auth_ntlm'])) {
|
if (!\is_string($options['auth_ntlm'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be a string or an array, %s given.', \gettype($options['auth_ntlm'])));
|
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be a string or an array, "%s" given.', \gettype($options['auth_ntlm'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
$curlopts[CURLOPT_USERPWD] = $options['auth_ntlm'];
|
$curlopts[CURLOPT_USERPWD] = $options['auth_ntlm'];
|
||||||
@ -319,7 +319,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
|||||||
if ($responses instanceof CurlResponse) {
|
if ($responses instanceof CurlResponse) {
|
||||||
$responses = [$responses];
|
$responses = [$responses];
|
||||||
} elseif (!is_iterable($responses)) {
|
} elseif (!is_iterable($responses)) {
|
||||||
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of CurlResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of CurlResponse objects, "%s" given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$active = 0;
|
$active = 0;
|
||||||
@ -439,7 +439,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
|||||||
{
|
{
|
||||||
if (!$eof && \strlen($buffer) < $length) {
|
if (!$eof && \strlen($buffer) < $length) {
|
||||||
if (!\is_string($data = $body($length))) {
|
if (!\is_string($data = $body($length))) {
|
||||||
throw new TransportException(sprintf('The return value of the "body" option callback must be a string, %s returned.', \gettype($data)));
|
throw new TransportException(sprintf('The return value of the "body" option callback must be a string, "%s" returned.', \gettype($data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$buffer .= $data;
|
$buffer .= $data;
|
||||||
|
@ -48,7 +48,7 @@ trait HttpClientTrait
|
|||||||
$options['buffer'] = static function (array $headers) use ($buffer) {
|
$options['buffer'] = static function (array $headers) use ($buffer) {
|
||||||
if (!\is_bool($buffer = $buffer($headers))) {
|
if (!\is_bool($buffer = $buffer($headers))) {
|
||||||
if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) {
|
if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) {
|
||||||
throw new \LogicException(sprintf('The closure passed as option "buffer" must return bool or stream resource, got %s.', \is_resource($buffer) ? get_resource_type($buffer).' resource' : \gettype($buffer)));
|
throw new \LogicException(sprintf('The closure passed as option "buffer" must return bool or stream resource, got "%s".', \is_resource($buffer) ? get_resource_type($buffer).' resource' : \gettype($buffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === strpbrk($bufferInfo['mode'], 'acew+')) {
|
if (false === strpbrk($bufferInfo['mode'], 'acew+')) {
|
||||||
@ -60,7 +60,7 @@ trait HttpClientTrait
|
|||||||
};
|
};
|
||||||
} elseif (!\is_bool($buffer)) {
|
} elseif (!\is_bool($buffer)) {
|
||||||
if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) {
|
if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "buffer" must be bool, stream resource or Closure, %s given.', \is_resource($buffer) ? get_resource_type($buffer).' resource' : \gettype($buffer)));
|
throw new InvalidArgumentException(sprintf('Option "buffer" must be bool, stream resource or Closure, "%s" given.', \is_resource($buffer) ? get_resource_type($buffer).' resource' : \gettype($buffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === strpbrk($bufferInfo['mode'], 'acew+')) {
|
if (false === strpbrk($bufferInfo['mode'], 'acew+')) {
|
||||||
@ -94,24 +94,24 @@ trait HttpClientTrait
|
|||||||
|
|
||||||
// Validate on_progress
|
// Validate on_progress
|
||||||
if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) {
|
if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, %s given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
|
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_array($options['auth_basic'] ?? null)) {
|
if (\is_array($options['auth_basic'] ?? null)) {
|
||||||
$count = \count($options['auth_basic']);
|
$count = \count($options['auth_basic']);
|
||||||
if ($count <= 0 || $count > 2) {
|
if ($count <= 0 || $count > 2) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_basic" must contain 1 or 2 elements, %s given.', $count));
|
throw new InvalidArgumentException(sprintf('Option "auth_basic" must contain 1 or 2 elements, "%s" given.', $count));
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['auth_basic'] = implode(':', $options['auth_basic']);
|
$options['auth_basic'] = implode(':', $options['auth_basic']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($options['auth_basic'] ?? '')) {
|
if (!\is_string($options['auth_basic'] ?? '')) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, %s given.', \gettype($options['auth_basic'])));
|
throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, "%s" given.', \gettype($options['auth_basic'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
|
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : \gettype($options['auth_bearer'])));
|
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : '"'.\gettype($options['auth_bearer']).'"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['auth_basic'], $options['auth_bearer'])) {
|
if (isset($options['auth_basic'], $options['auth_bearer'])) {
|
||||||
@ -206,10 +206,10 @@ trait HttpClientTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('auth_ntlm' === $name) {
|
if ('auth_ntlm' === $name) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by %s, try using CurlHttpClient instead.', __CLASS__));
|
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", try using CurlHttpClient instead.', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to %s, did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions))));
|
throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to "%s", did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
@ -231,13 +231,13 @@ trait HttpClientTrait
|
|||||||
|
|
||||||
if (\is_int($name)) {
|
if (\is_int($name)) {
|
||||||
if (!\is_string($values)) {
|
if (!\is_string($values)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, %s given.', $name, \gettype($values)));
|
throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, "%s" given.', $name, \gettype($values)));
|
||||||
}
|
}
|
||||||
[$name, $values] = explode(':', $values, 2);
|
[$name, $values] = explode(':', $values, 2);
|
||||||
$values = [ltrim($values)];
|
$values = [ltrim($values)];
|
||||||
} elseif (!is_iterable($values)) {
|
} elseif (!is_iterable($values)) {
|
||||||
if (\is_object($values)) {
|
if (\is_object($values)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, %s given.', $name, \get_class($values)));
|
throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, "%s" given.', $name, \get_class($values)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = (array) $values;
|
$values = (array) $values;
|
||||||
@ -299,7 +299,7 @@ trait HttpClientTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($body) && !\is_array(@stream_get_meta_data($body))) {
|
if (!\is_string($body) && !\is_array(@stream_get_meta_data($body))) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "body" must be string, stream resource, iterable or callable, %s given.', \is_resource($body) ? get_resource_type($body) : \gettype($body)));
|
throw new InvalidArgumentException(sprintf('Option "body" must be string, stream resource, iterable or callable, "%s" given.', \is_resource($body) ? get_resource_type($body) : \gettype($body)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
@ -325,7 +325,7 @@ trait HttpClientTrait
|
|||||||
$fingerprint[$algo] = 'pin-sha256' === $algo ? (array) $hash : str_replace(':', '', $hash);
|
$fingerprint[$algo] = 'pin-sha256' === $algo ? (array) $hash : str_replace(':', '', $hash);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException(sprintf('Option "peer_fingerprint" must be string or array, %s given.', \gettype($fingerprint)));
|
throw new InvalidArgumentException(sprintf('Option "peer_fingerprint" must be string or array, "%s" given.', \gettype($fingerprint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fingerprint;
|
return $fingerprint;
|
||||||
|
@ -184,7 +184,7 @@ final class HttplugClient implements HttplugInterface, HttpAsyncClient, RequestF
|
|||||||
} elseif (\is_resource($body)) {
|
} elseif (\is_resource($body)) {
|
||||||
$stream = $this->streamFactory->createStreamFromResource($body);
|
$stream = $this->streamFactory->createStreamFromResource($body);
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException(sprintf('%s() expects string, resource or StreamInterface, %s given.', __METHOD__, \gettype($body)));
|
throw new \InvalidArgumentException(sprintf('"%s()" expects string, resource or StreamInterface, "%s" given.', __METHOD__, \gettype($body)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stream->isSeekable()) {
|
if ($stream->isSeekable()) {
|
||||||
|
@ -79,7 +79,7 @@ class MockHttpClient implements HttpClientInterface
|
|||||||
if ($responses instanceof ResponseInterface) {
|
if ($responses instanceof ResponseInterface) {
|
||||||
$responses = [$responses];
|
$responses = [$responses];
|
||||||
} elseif (!is_iterable($responses)) {
|
} elseif (!is_iterable($responses)) {
|
||||||
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of MockResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of MockResponse objects, "%s" given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseStream(MockResponse::stream($responses, $timeout));
|
return new ResponseStream(MockResponse::stream($responses, $timeout));
|
||||||
|
@ -238,7 +238,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
|
|||||||
if ($responses instanceof NativeResponse) {
|
if ($responses instanceof NativeResponse) {
|
||||||
$responses = [$responses];
|
$responses = [$responses];
|
||||||
} elseif (!is_iterable($responses)) {
|
} elseif (!is_iterable($responses)) {
|
||||||
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of NativeResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of NativeResponse objects, "%s" given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseStream(NativeResponse::stream($responses, $timeout));
|
return new ResponseStream(NativeResponse::stream($responses, $timeout));
|
||||||
@ -258,7 +258,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
|
|||||||
|
|
||||||
while ('' !== $data = $body(self::$CHUNK_SIZE)) {
|
while ('' !== $data = $body(self::$CHUNK_SIZE)) {
|
||||||
if (!\is_string($data)) {
|
if (!\is_string($data)) {
|
||||||
throw new TransportException(sprintf('Return value of the "body" option callback must be string, %s returned.', \gettype($data)));
|
throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', \gettype($data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result .= $data;
|
$result .= $data;
|
||||||
|
@ -228,7 +228,7 @@ class MockResponse implements ResponseInterface
|
|||||||
} elseif ($body instanceof \Closure) {
|
} elseif ($body instanceof \Closure) {
|
||||||
while ('' !== $data = $body(16372)) {
|
while ('' !== $data = $body(16372)) {
|
||||||
if (!\is_string($data)) {
|
if (!\is_string($data)) {
|
||||||
throw new TransportException(sprintf('Return value of the "body" option callback must be string, %s returned.', \gettype($data)));
|
throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', \gettype($data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// "notify" upload progress
|
// "notify" upload progress
|
||||||
@ -295,7 +295,7 @@ class MockResponse implements ResponseInterface
|
|||||||
$onProgress($offset, $dlSize, $response->info);
|
$onProgress($offset, $dlSize, $response->info);
|
||||||
|
|
||||||
if ($dlSize && $offset !== $dlSize) {
|
if ($dlSize && $offset !== $dlSize) {
|
||||||
throw new TransportException(sprintf('Transfer closed with %s bytes remaining to read.', $dlSize - $offset));
|
throw new TransportException(sprintf('Transfer closed with %d bytes remaining to read.', $dlSize - $offset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ trait ResponseTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_array($content)) {
|
if (!\is_array($content)) {
|
||||||
throw new JsonException(sprintf('JSON content was expected to decode to an array, %s returned for "%s".', \gettype($content), $this->getInfo('url')));
|
throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned for "%s".', \gettype($content), $this->getInfo('url')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->content) {
|
if (null !== $this->content) {
|
||||||
|
@ -179,7 +179,7 @@ class HttpClientTraitTest extends TestCase
|
|||||||
public function testInvalidAuthBearerOption()
|
public function testInvalidAuthBearerOption()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
|
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
|
||||||
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, object given.');
|
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, "object" given.');
|
||||||
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => new \stdClass()], HttpClientInterface::OPTIONS_DEFAULTS);
|
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => new \stdClass()], HttpClientInterface::OPTIONS_DEFAULTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class HttpClientTraitTest extends TestCase
|
|||||||
public function testNormalizePeerFingerprintTypeException()
|
public function testNormalizePeerFingerprintTypeException()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
|
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
|
||||||
$this->expectExceptionMessage('Option "peer_fingerprint" must be string or array, object given.');
|
$this->expectExceptionMessage('Option "peer_fingerprint" must be string or array, "object" given.');
|
||||||
$fingerprint = new \stdClass();
|
$fingerprint = new \stdClass();
|
||||||
|
|
||||||
$this->normalizePeerFingerprint($fingerprint);
|
$this->normalizePeerFingerprint($fingerprint);
|
||||||
|
@ -56,13 +56,13 @@ class MockResponseTest extends TestCase
|
|||||||
yield [
|
yield [
|
||||||
'content' => '"not an array"',
|
'content' => '"not an array"',
|
||||||
'responseHeaders' => [],
|
'responseHeaders' => [],
|
||||||
'message' => 'JSON content was expected to decode to an array, string returned for "https://example.com/file.json".',
|
'message' => 'JSON content was expected to decode to an array, "string" returned for "https://example.com/file.json".',
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'content' => '8',
|
'content' => '8',
|
||||||
'responseHeaders' => [],
|
'responseHeaders' => [],
|
||||||
'message' => 'JSON content was expected to decode to an array, integer returned for "https://example.com/file.json".',
|
'message' => 'JSON content was expected to decode to an array, "integer" returned for "https://example.com/file.json".',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
|||||||
!$redis instanceof RedisProxy &&
|
!$redis instanceof RedisProxy &&
|
||||||
!$redis instanceof RedisClusterProxy
|
!$redis instanceof RedisClusterProxy
|
||||||
) {
|
) {
|
||||||
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given.', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
|
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {
|
if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {
|
||||||
|
@ -27,7 +27,7 @@ class SessionHandlerFactory
|
|||||||
public static function createHandler($connection): AbstractSessionHandler
|
public static function createHandler($connection): AbstractSessionHandler
|
||||||
{
|
{
|
||||||
if (!\is_string($connection) && !\is_object($connection)) {
|
if (!\is_string($connection) && !\is_object($connection)) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be a string or a connection object, %s given.', __METHOD__, \gettype($connection)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a string or a connection object, "%s" given.', __METHOD__, \gettype($connection)));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@ -46,7 +46,7 @@ class SessionHandlerFactory
|
|||||||
return new PdoSessionHandler($connection);
|
return new PdoSessionHandler($connection);
|
||||||
|
|
||||||
case !\is_string($connection):
|
case !\is_string($connection):
|
||||||
throw new \InvalidArgumentException(sprintf('Unsupported Connection: %s.', \get_class($connection)));
|
throw new \InvalidArgumentException(sprintf('Unsupported Connection: "%s".', \get_class($connection)));
|
||||||
case 0 === strpos($connection, 'file://'):
|
case 0 === strpos($connection, 'file://'):
|
||||||
return new StrictSessionHandler(new NativeFileSessionHandler(substr($connection, 7)));
|
return new StrictSessionHandler(new NativeFileSessionHandler(substr($connection, 7)));
|
||||||
|
|
||||||
@ -80,6 +80,6 @@ class SessionHandlerFactory
|
|||||||
return new PdoSessionHandler($connection);
|
return new PdoSessionHandler($connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('Unsupported Connection: %s.', $connection));
|
throw new \InvalidArgumentException(sprintf('Unsupported Connection: "%s".', $connection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class Psr6CacheClearer implements CacheClearerInterface
|
|||||||
public function getPool($name)
|
public function getPool($name)
|
||||||
{
|
{
|
||||||
if (!$this->hasPool($name)) {
|
if (!$this->hasPool($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];
|
return $this->pools[$name];
|
||||||
|
@ -40,7 +40,7 @@ class TranslatorListener implements EventSubscriberInterface
|
|||||||
public function __construct($translator, RequestStack $requestStack)
|
public function __construct($translator, RequestStack $requestStack)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof TranslatorInterface && !$translator instanceof LocaleAwareInterface) {
|
if (!$translator instanceof TranslatorInterface && !$translator instanceof LocaleAwareInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, LocaleAwareInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, LocaleAwareInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->requestStack = $requestStack;
|
$this->requestStack = $requestStack;
|
||||||
|
@ -33,7 +33,7 @@ class StoreFactory
|
|||||||
public static function createStore($connection)
|
public static function createStore($connection)
|
||||||
{
|
{
|
||||||
if (!\is_string($connection) && !\is_object($connection)) {
|
if (!\is_string($connection) && !\is_object($connection)) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be a string or a connection object, %s given.', __METHOD__, \gettype($connection)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a string or a connection object, "%s" given.', __METHOD__, \gettype($connection)));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
@ -56,7 +56,7 @@ class StoreFactory
|
|||||||
return new ZookeeperStore($connection);
|
return new ZookeeperStore($connection);
|
||||||
|
|
||||||
case !\is_string($connection):
|
case !\is_string($connection):
|
||||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', \get_class($connection)));
|
throw new InvalidArgumentException(sprintf('Unsupported Connection: "%s".', \get_class($connection)));
|
||||||
case 'flock' === $connection:
|
case 'flock' === $connection:
|
||||||
return new FlockStore();
|
return new FlockStore();
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ class ZookeeperStore implements StoreInterface
|
|||||||
public static function createConnection(string $dsn): \Zookeeper
|
public static function createConnection(string $dsn): \Zookeeper
|
||||||
{
|
{
|
||||||
if (0 !== strpos($dsn, 'zookeeper:')) {
|
if (0 !== strpos($dsn, 'zookeeper:')) {
|
||||||
throw new InvalidArgumentException(sprintf('Unsupported DSN: %s.', $dsn));
|
throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $params = parse_url($dsn)) {
|
if (false === $params = parse_url($dsn)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Zookeeper DSN: %s.', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Zookeeper DSN: "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
$host = $params['host'] ?? '';
|
$host = $params['host'] ?? '';
|
||||||
|
@ -74,7 +74,7 @@ class TransportTest extends TestCase
|
|||||||
|
|
||||||
public function fromWrongStringProvider(): iterable
|
public function fromWrongStringProvider(): iterable
|
||||||
{
|
{
|
||||||
yield 'garbage at the end' => ['dummy://a some garbage here', 'The DSN has some garbage at the end: some garbage here.'];
|
yield 'garbage at the end' => ['dummy://a some garbage here', 'The DSN has some garbage at the end: " some garbage here".'];
|
||||||
|
|
||||||
yield 'not a valid DSN' => ['something not a dsn', 'The "something" mailer DSN must contain a scheme.'];
|
yield 'not a valid DSN' => ['something not a dsn', 'The "something" mailer DSN must contain a scheme.'];
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class Transport
|
|||||||
{
|
{
|
||||||
list($transport, $offset) = $this->parseDsn($dsn);
|
list($transport, $offset) = $this->parseDsn($dsn);
|
||||||
if ($offset !== \strlen($dsn)) {
|
if ($offset !== \strlen($dsn)) {
|
||||||
throw new InvalidArgumentException(sprintf('The DSN has some garbage at the end: %s.', substr($dsn, $offset)));
|
throw new InvalidArgumentException(sprintf('The DSN has some garbage at the end: "%s".', substr($dsn, $offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $transport;
|
return $transport;
|
||||||
|
@ -42,7 +42,7 @@ class DebugCommand extends Command
|
|||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))))
|
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of "%s")', implode('", "', array_keys($this->mapping))))
|
||||||
->setDescription('Lists messages you can dispatch using the message buses')
|
->setDescription('Lists messages you can dispatch using the message buses')
|
||||||
->setHelp(<<<'EOF'
|
->setHelp(<<<'EOF'
|
||||||
The <info>%command.name%</info> command displays all messages that can be
|
The <info>%command.name%</info> command displays all messages that can be
|
||||||
@ -70,7 +70,7 @@ EOF
|
|||||||
$mapping = $this->mapping;
|
$mapping = $this->mapping;
|
||||||
if ($bus = $input->getArgument('bus')) {
|
if ($bus = $input->getArgument('bus')) {
|
||||||
if (!isset($mapping[$bus])) {
|
if (!isset($mapping[$bus])) {
|
||||||
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are %s.', $bus, implode(', ', array_keys($this->mapping))));
|
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are "%s".', $bus, implode('", "', array_keys($this->mapping))));
|
||||||
}
|
}
|
||||||
$mapping = [$bus => $mapping[$bus]];
|
$mapping = [$bus => $mapping[$bus]];
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class MessengerPass implements CompilerPassInterface
|
|||||||
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
|
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (isset($tag['bus']) && !\in_array($tag['bus'], $busIds, true)) {
|
if (isset($tag['bus']) && !\in_array($tag['bus'], $busIds, true)) {
|
||||||
throw new RuntimeException(sprintf('Invalid handler service "%s": bus "%s" specified on the tag "%s" does not exist (known ones are: %s).', $serviceId, $tag['bus'], $this->handlerTag, implode(', ', $busIds)));
|
throw new RuntimeException(sprintf('Invalid handler service "%s": bus "%s" specified on the tag "%s" does not exist (known ones are: "%s").', $serviceId, $tag['bus'], $this->handlerTag, implode('", "', $busIds)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$className = $container->getDefinition($serviceId)->getClass();
|
$className = $container->getDefinition($serviceId)->getClass();
|
||||||
|
@ -30,7 +30,7 @@ final class Envelope
|
|||||||
public function __construct($message, array $stamps = [])
|
public function __construct($message, array $stamps = [])
|
||||||
{
|
{
|
||||||
if (!\is_object($message)) {
|
if (!\is_object($message)) {
|
||||||
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got %s.', __METHOD__, \gettype($message)));
|
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, \gettype($message)));
|
||||||
}
|
}
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MessageBus implements MessageBusInterface
|
|||||||
public function dispatch($message, array $stamps = []): Envelope
|
public function dispatch($message, array $stamps = []): Envelope
|
||||||
{
|
{
|
||||||
if (!\is_object($message)) {
|
if (!\is_object($message)) {
|
||||||
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got %s.', __METHOD__, \gettype($message)));
|
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got "%s".', __METHOD__, \gettype($message)));
|
||||||
}
|
}
|
||||||
$envelope = Envelope::wrap($message, $stamps);
|
$envelope = Envelope::wrap($message, $stamps);
|
||||||
$middlewareIterator = $this->middlewareAggregate->getIterator();
|
$middlewareIterator = $this->middlewareAggregate->getIterator();
|
||||||
|
@ -37,7 +37,7 @@ class StackMiddleware implements MiddlewareInterface, StackInterface
|
|||||||
} elseif ($middlewareIterator instanceof MiddlewareInterface) {
|
} elseif ($middlewareIterator instanceof MiddlewareInterface) {
|
||||||
$this->stack->stack[] = $middlewareIterator;
|
$this->stack->stack[] = $middlewareIterator;
|
||||||
} elseif (!is_iterable($middlewareIterator)) {
|
} elseif (!is_iterable($middlewareIterator)) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be iterable of %s, %s given.', __METHOD__, MiddlewareInterface::class, \is_object($middlewareIterator) ? \get_class($middlewareIterator) : \gettype($middlewareIterator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be iterable of "%s", "%s" given.', __METHOD__, MiddlewareInterface::class, \is_object($middlewareIterator) ? \get_class($middlewareIterator) : \gettype($middlewareIterator)));
|
||||||
} else {
|
} else {
|
||||||
$this->stack->iterator = (function () use ($middlewareIterator) {
|
$this->stack->iterator = (function () use ($middlewareIterator) {
|
||||||
yield from $middlewareIterator;
|
yield from $middlewareIterator;
|
||||||
|
@ -142,7 +142,7 @@ TXT
|
|||||||
public function testExceptionOnUnknownBusArgument()
|
public function testExceptionOnUnknownBusArgument()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\Console\Exception\RuntimeException');
|
$this->expectException('Symfony\Component\Console\Exception\RuntimeException');
|
||||||
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are command_bus, query_bus.');
|
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are "command_bus", "query_bus".');
|
||||||
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
|
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
|
||||||
|
|
||||||
$tester = new CommandTester($command);
|
$tester = new CommandTester($command);
|
||||||
|
@ -156,7 +156,7 @@ class MessengerPassTest extends TestCase
|
|||||||
public function testProcessTagWithUnknownBus()
|
public function testProcessTagWithUnknownBus()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||||
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\Fixtures\DummyCommandHandler": bus "unknown_bus" specified on the tag "messenger.message_handler" does not exist (known ones are: command_bus).');
|
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\Fixtures\DummyCommandHandler": bus "unknown_bus" specified on the tag "messenger.message_handler" does not exist (known ones are: "command_bus").');
|
||||||
$container = $this->getContainerBuilder($commandBusId = 'command_bus');
|
$container = $this->getContainerBuilder($commandBusId = 'command_bus');
|
||||||
|
|
||||||
$container->register(DummyCommandHandler::class)->addTag('messenger.message_handler', ['bus' => 'unknown_bus']);
|
$container->register(DummyCommandHandler::class)->addTag('messenger.message_handler', ['bus' => 'unknown_bus']);
|
||||||
|
@ -35,7 +35,7 @@ class MessageBusTest extends TestCase
|
|||||||
public function testItDispatchInvalidMessageType()
|
public function testItDispatchInvalidMessageType()
|
||||||
{
|
{
|
||||||
$this->expectException('TypeError');
|
$this->expectException('TypeError');
|
||||||
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got string.');
|
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got "string".');
|
||||||
(new MessageBus())->dispatch('wrong');
|
(new MessageBus())->dispatch('wrong');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_numeric($arguments[$key])) {
|
if (!is_numeric($arguments[$key])) {
|
||||||
throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", %s given.', $key, \gettype($arguments[$key])));
|
throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", "%s" given.', $key, \gettype($arguments[$key])));
|
||||||
}
|
}
|
||||||
|
|
||||||
$arguments[$key] = (int) $arguments[$key];
|
$arguments[$key] = (int) $arguments[$key];
|
||||||
|
@ -28,7 +28,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
|
|||||||
public function __construct($registry)
|
public function __construct($registry)
|
||||||
{
|
{
|
||||||
if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
|
if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
|
||||||
throw new \TypeError(sprintf('Expected an instance of %s or %s, but got %s.', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
|
throw new \TypeError(sprintf('Expected an instance of "%s" or "%s", but got "%s".', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->registry = $registry;
|
$this->registry = $registry;
|
||||||
|
@ -24,7 +24,7 @@ abstract class SMime
|
|||||||
protected function normalizeFilePath(string $path): string
|
protected function normalizeFilePath(string $path): string
|
||||||
{
|
{
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
throw new RuntimeException(sprintf('File does not exist: %s.', $path));
|
throw new RuntimeException(sprintf('File does not exist: "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'file://'.str_replace('\\', '/', realpath($path));
|
return 'file://'.str_replace('\\', '/', realpath($path));
|
||||||
|
@ -33,7 +33,7 @@ abstract class SMimeTestCase extends TestCase
|
|||||||
protected function normalizeFilePath(string $path): string
|
protected function normalizeFilePath(string $path): string
|
||||||
{
|
{
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
throw new RuntimeException(sprintf('File does not exist: %s', $path));
|
throw new RuntimeException(sprintf('File does not exist: "%s"', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace('\\', '/', realpath($path));
|
return str_replace('\\', '/', realpath($path));
|
||||||
|
@ -57,7 +57,7 @@ abstract class ObjectLoader extends Loader
|
|||||||
$loaderObject = $this->getObject($parts[0]);
|
$loaderObject = $this->getObject($parts[0]);
|
||||||
|
|
||||||
if (!\is_object($loaderObject)) {
|
if (!\is_object($loaderObject)) {
|
||||||
throw new \TypeError(sprintf('%s:getObject() must return an object: %s returned.', static::class, \gettype($loaderObject)));
|
throw new \TypeError(sprintf('"%s:getObject()" must return an object: "%s" returned.', static::class, \gettype($loaderObject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_callable([$loaderObject, $method])) {
|
if (!\is_callable([$loaderObject, $method])) {
|
||||||
@ -69,7 +69,7 @@ abstract class ObjectLoader extends Loader
|
|||||||
if (!$routeCollection instanceof RouteCollection) {
|
if (!$routeCollection instanceof RouteCollection) {
|
||||||
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
|
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
|
||||||
|
|
||||||
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned.', \get_class($loaderObject), $method, $type));
|
throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', \get_class($loaderObject), $method, $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the object file tracked so that if it changes, the cache rebuilds
|
// make the object file tracked so that if it changes, the cache rebuilds
|
||||||
|
@ -49,7 +49,7 @@ class ExpressionVoter implements VoterInterface
|
|||||||
} elseif (null === $authChecker) {
|
} elseif (null === $authChecker) {
|
||||||
@trigger_error(sprintf('Argument 3 passed to "%s()" should be an instance of AuthorizationCheckerInterface, not passing it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Argument 3 passed to "%s()" should be an instance of AuthorizationCheckerInterface, not passing it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
|
||||||
} elseif (!$authChecker instanceof AuthorizationCheckerInterface) {
|
} elseif (!$authChecker instanceof AuthorizationCheckerInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 3 passed to %s() must be an instance of %s or null, %s given.', __METHOD__, AuthorizationCheckerInterface::class, \is_object($authChecker) ? \get_class($authChecker) : \gettype($authChecker)));
|
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be an instance of "%s" or null, "%s" given.', __METHOD__, AuthorizationCheckerInterface::class, \is_object($authChecker) ? \get_class($authChecker) : \gettype($authChecker)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->expressionLanguage = $expressionLanguage;
|
$this->expressionLanguage = $expressionLanguage;
|
||||||
|
@ -53,7 +53,7 @@ class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface, C
|
|||||||
$mimeTypeGuesser = MimeTypeGuesser::getInstance();
|
$mimeTypeGuesser = MimeTypeGuesser::getInstance();
|
||||||
}
|
}
|
||||||
} elseif (!$mimeTypeGuesser instanceof MimeTypes) {
|
} elseif (!$mimeTypeGuesser instanceof MimeTypes) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s" or null, %s given.', __METHOD__, MimeTypes::class, \is_object($mimeTypeGuesser) ? \get_class($mimeTypeGuesser) : \gettype($mimeTypeGuesser)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s" or null, "%s" given.', __METHOD__, MimeTypes::class, \is_object($mimeTypeGuesser) ? \get_class($mimeTypeGuesser) : \gettype($mimeTypeGuesser)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mimeTypeGuesser = $mimeTypeGuesser;
|
$this->mimeTypeGuesser = $mimeTypeGuesser;
|
||||||
|
@ -39,7 +39,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn
|
|||||||
public function __construct($translator)
|
public function __construct($translator)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) {
|
if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) {
|
||||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator)));
|
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator)));
|
||||||
|
@ -32,7 +32,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf
|
|||||||
if ($translator instanceof MessageSelector) {
|
if ($translator instanceof MessageSelector) {
|
||||||
$translator = new IdentityTranslator($translator);
|
$translator = new IdentityTranslator($translator);
|
||||||
} elseif (null !== $translator && !$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslatorInterface) {
|
} elseif (null !== $translator && !$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->translator = $translator ?? new IdentityTranslator();
|
$this->translator = $translator ?? new IdentityTranslator();
|
||||||
|
@ -35,7 +35,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac
|
|||||||
public function __construct($translator, LoggerInterface $logger)
|
public function __construct($translator, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) {
|
if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) {
|
||||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator)));
|
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', \get_class($translator)));
|
||||||
|
@ -100,7 +100,7 @@ class EmailValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\in_array($constraint->mode, Email::$validationModes, true)) {
|
if (!\in_array($constraint->mode, Email::$validationModes, true)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The %s::$mode parameter value is not valid.', \get_class($constraint)));
|
throw new \InvalidArgumentException(sprintf('The "%s::$mode" parameter value is not valid.', \get_class($constraint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {
|
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {
|
||||||
|
@ -33,7 +33,7 @@ class ExpressionValidator extends ConstraintValidator
|
|||||||
$expressionLanguage = func_get_arg(1);
|
$expressionLanguage = func_get_arg(1);
|
||||||
|
|
||||||
if (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
|
if (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
|
||||||
throw new \TypeError(sprintf('Argument 2 passed to %s() must be an instance of %s or null, %s given. Since 4.4, passing it as the second argument is deprecated and will trigger a deprecation. Pass it as the first argument instead.', __METHOD__, ExpressionLanguage::class, \is_object($expressionLanguage) ? \get_class($expressionLanguage) : \gettype($expressionLanguage)));
|
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be an instance of "%s" or null, "%s" given. Since 4.4, passing it as the second argument is deprecated and will trigger a deprecation. Pass it as the first argument instead.', __METHOD__, ExpressionLanguage::class, \is_object($expressionLanguage) ? \get_class($expressionLanguage) : \gettype($expressionLanguage)));
|
||||||
}
|
}
|
||||||
} elseif (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
|
} elseif (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
|
||||||
@trigger_error(sprintf('The "%s" first argument must be an instance of "%s" or null since 4.4. "%s" given', __METHOD__, ExpressionLanguage::class, \is_object($expressionLanguage) ? \get_class($expressionLanguage) : \gettype($expressionLanguage)), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" first argument must be an instance of "%s" or null since 4.4. "%s" given', __METHOD__, ExpressionLanguage::class, \is_object($expressionLanguage) ? \get_class($expressionLanguage) : \gettype($expressionLanguage)), E_USER_DEPRECATED);
|
||||||
|
@ -145,7 +145,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||||||
public function __construct(ValidatorInterface $validator, $root, $translator, string $translationDomain = null)
|
public function __construct(ValidatorInterface $validator, $root, $translator, string $translationDomain = null)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 3 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
$this->root = $root;
|
$this->root = $root;
|
||||||
|
@ -38,7 +38,7 @@ class ExecutionContextFactory implements ExecutionContextFactoryInterface
|
|||||||
public function __construct($translator, string $translationDomain = null)
|
public function __construct($translator, string $translationDomain = null)
|
||||||
{
|
{
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
|
@ -60,7 +60,7 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
|
|||||||
if ($cache instanceof CacheInterface) {
|
if ($cache instanceof CacheInterface) {
|
||||||
@trigger_error(sprintf('Passing a "%s" to "%s" is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0. Please pass an implementation of "%s" instead.', \get_class($cache), __METHOD__, CacheItemPoolInterface::class), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Passing a "%s" to "%s" is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0. Please pass an implementation of "%s" instead.', \get_class($cache), __METHOD__, CacheItemPoolInterface::class), E_USER_DEPRECATED);
|
||||||
} elseif (!$cache instanceof CacheItemPoolInterface && null !== $cache) {
|
} elseif (!$cache instanceof CacheItemPoolInterface && null !== $cache) {
|
||||||
throw new \TypeError(sprintf('Expected an instance of %s, got %s.', CacheItemPoolInterface::class, \is_object($cache) ? \get_class($cache) : \gettype($cache)));
|
throw new \TypeError(sprintf('Expected an instance of "%s", got "%s".', CacheItemPoolInterface::class, \is_object($cache) ? \get_class($cache) : \gettype($cache)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->loader = $loader;
|
$this->loader = $loader;
|
||||||
|
@ -232,7 +232,7 @@ class EmailValidatorTest extends ConstraintValidatorTestCase
|
|||||||
public function testUnknownModesOnValidateTriggerException()
|
public function testUnknownModesOnValidateTriggerException()
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$this->expectExceptionMessage('The Symfony\Component\Validator\Constraints\Email::$mode parameter value is not valid.');
|
$this->expectExceptionMessage('The "Symfony\Component\Validator\Constraints\Email::$mode" parameter value is not valid.');
|
||||||
$constraint = new Email();
|
$constraint = new Email();
|
||||||
$constraint->mode = 'Unknown Mode';
|
$constraint->mode = 'Unknown Mode';
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
|
|||||||
$message = '';
|
$message = '';
|
||||||
}
|
}
|
||||||
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||||
throw new \TypeError(sprintf('Argument 8 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
throw new \TypeError(sprintf('Argument 8 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||||
}
|
}
|
||||||
$this->violations = $violations;
|
$this->violations = $violations;
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
|
@ -78,7 +78,7 @@ class Exporter
|
|||||||
|
|
||||||
if ($reflector->hasMethod('__serialize')) {
|
if ($reflector->hasMethod('__serialize')) {
|
||||||
if (!$reflector->getMethod('__serialize')->isPublic()) {
|
if (!$reflector->getMethod('__serialize')->isPublic()) {
|
||||||
throw new \Error(sprintf('Call to %s method %s::__serialize().', $reflector->getMethod('__serialize')->isProtected() ? 'protected' : 'private', $class));
|
throw new \Error(sprintf('Call to %s method "%s::__serialize()".', $reflector->getMethod('__serialize')->isProtected() ? 'protected' : 'private', $class));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_array($properties = $value->__serialize())) {
|
if (!\is_array($properties = $value->__serialize())) {
|
||||||
|
@ -45,7 +45,7 @@ class StateMachineValidator implements DefinitionValidatorInterface
|
|||||||
|
|
||||||
$initialPlaces = $definition->getInitialPlaces();
|
$initialPlaces = $definition->getInitialPlaces();
|
||||||
if (2 <= \count($initialPlaces)) {
|
if (2 <= \count($initialPlaces)) {
|
||||||
throw new InvalidDefinitionException(sprintf('The state machine "%s" can not store many places. But the definition has %s initial places. Only one is supported.', $name, \count($initialPlaces)));
|
throw new InvalidDefinitionException(sprintf('The state machine "%s" can not store many places. But the definition has %d initial places. Only one is supported.', $name, \count($initialPlaces)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class WorkflowValidator implements DefinitionValidatorInterface
|
|||||||
|
|
||||||
$initialPlaces = $definition->getInitialPlaces();
|
$initialPlaces = $definition->getInitialPlaces();
|
||||||
if (2 <= \count($initialPlaces)) {
|
if (2 <= \count($initialPlaces)) {
|
||||||
throw new InvalidDefinitionException(sprintf('The marking store of workflow "%s" can not store many places. But the definition has %s initial places. Only one is supported.', $name, \count($initialPlaces)));
|
throw new InvalidDefinitionException(sprintf('The marking store of workflow "%s" can not store many places. But the definition has %d initial places. Only one is supported.', $name, \count($initialPlaces)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user