Merge branch '3.4' into 4.4
* 3.4: Add missing dots at the end of exception messages
This commit is contained in:
commit
14f2d22158
@ -69,7 +69,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
|||||||
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
||||||
foreach ($connections as $con) {
|
foreach ($connections as $con) {
|
||||||
if (!isset($this->connections[$con])) {
|
if (!isset($this->connections[$con])) {
|
||||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
|
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]);
|
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]);
|
||||||
@ -92,7 +92,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
|||||||
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
|
||||||
foreach ($connections as $con) {
|
foreach ($connections as $con) {
|
||||||
if (!isset($this->connections[$con])) {
|
if (!isset($this->connections[$con])) {
|
||||||
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections))));
|
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
|
||||||
}
|
}
|
||||||
$listenerRefs[$con][$id] = new Reference($id);
|
$listenerRefs[$con][$id] = new Reference($id);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
|
|||||||
$this->driverPattern = $driverPattern;
|
$this->driverPattern = $driverPattern;
|
||||||
$this->enabledParameter = $enabledParameter;
|
$this->enabledParameter = $enabledParameter;
|
||||||
if (\count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
|
if (\count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
|
||||||
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias');
|
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias.');
|
||||||
}
|
}
|
||||||
$this->configurationPattern = $configurationPattern;
|
$this->configurationPattern = $configurationPattern;
|
||||||
$this->registerAliasMethodName = $registerAliasMethodName;
|
$this->registerAliasMethodName = $registerAliasMethodName;
|
||||||
@ -218,7 +218,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s"', implode('", "', $this->managerParameters)));
|
throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s".', implode('", "', $this->managerParameters)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInter
|
|||||||
|
|
||||||
$refreshedUser = $repository->find($id);
|
$refreshedUser = $repository->find($id);
|
||||||
if (null === $refreshedUser) {
|
if (null === $refreshedUser) {
|
||||||
throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id)));
|
throw new UsernameNotFoundException(sprintf('User with id %s not found.', json_encode($id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class SwiftMailerHandler extends BaseSwiftMailerHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $this->transport) {
|
if (null === $this->transport) {
|
||||||
throw new \Exception('No transport available to flush mail queue');
|
throw new \Exception('No transport available to flush mail queue.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$spool->flushQueue($this->transport);
|
$spool->flushQueue($this->transport);
|
||||||
|
@ -88,7 +88,7 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator
|
|||||||
$newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body);
|
$newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body);
|
||||||
|
|
||||||
if ($body === $newBody) {
|
if ($body === $newBody) {
|
||||||
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct()', $originalClass->name));
|
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct().', $originalClass->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
$destructor->setBody($newBody);
|
$destructor->setBody($newBody);
|
||||||
|
@ -331,7 +331,7 @@ EOF
|
|||||||
} elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
|
} elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
|
||||||
$refl = new \ReflectionMethod($m[1], $m[2]);
|
$refl = new \ReflectionMethod($m[1], $m[2]);
|
||||||
} else {
|
} else {
|
||||||
throw new \UnexpectedValueException('Unsupported callback type');
|
throw new \UnexpectedValueException('Unsupported callback type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = $refl->getParameters();
|
$args = $refl->getParameters();
|
||||||
|
@ -152,7 +152,7 @@ EOF
|
|||||||
return Finder::create()->files()->in($filename)->name('*.twig');
|
return Finder::create()->files()->in($filename)->name('*.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
|
throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validate(string $template, string $file): array
|
private function validate(string $template, string $file): array
|
||||||
|
@ -112,11 +112,11 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
|||||||
public function validateConfiguration(ExtensionInterface $extension, $configuration)
|
public function validateConfiguration(ExtensionInterface $extension, $configuration)
|
||||||
{
|
{
|
||||||
if (!$configuration) {
|
if (!$configuration) {
|
||||||
throw new \LogicException(sprintf('The extension with alias "%s" does not have its getConfiguration() method setup', $extension->getAlias()));
|
throw new \LogicException(sprintf('The extension with alias "%s" does not have its getConfiguration() method setup.', $extension->getAlias()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$configuration instanceof ConfigurationInterface) {
|
if (!$configuration instanceof ConfigurationInterface) {
|
||||||
throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable', \get_class($configuration)));
|
throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable.', \get_class($configuration)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ EOF
|
|||||||
$fs->remove($oldCacheDir);
|
$fs->remove($oldCacheDir);
|
||||||
|
|
||||||
if (!is_writable($realCacheDir)) {
|
if (!is_writable($realCacheDir)) {
|
||||||
throw new RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
|
throw new RuntimeException(sprintf('Unable to write in the "%s" directory.', $realCacheDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
|
||||||
|
@ -145,7 +145,7 @@ EOF
|
|||||||
|
|
||||||
foreach ($steps as $step) {
|
foreach ($steps as $step) {
|
||||||
if (!\array_key_exists($step, $config)) {
|
if (!\array_key_exists($step, $config)) {
|
||||||
throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path));
|
throw new LogicException(sprintf('Unable to find configuration for "%s.%s".', $alias, $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $config[$step];
|
$config = $config[$step];
|
||||||
|
@ -39,7 +39,7 @@ class ProfilerPass implements CompilerPassInterface
|
|||||||
|
|
||||||
if (isset($attributes[0]['template'])) {
|
if (isset($attributes[0]['template'])) {
|
||||||
if (!isset($attributes[0]['id'])) {
|
if (!isset($attributes[0]['id'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template', $id));
|
throw new InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template.', $id));
|
||||||
}
|
}
|
||||||
$template = [$attributes[0]['id'], $attributes[0]['template']];
|
$template = [$attributes[0]['id'], $attributes[0]['template']];
|
||||||
}
|
}
|
||||||
|
@ -1196,7 +1196,7 @@ class FrameworkExtension extends Extension
|
|||||||
if ($container->fileExists($dir)) {
|
if ($container->fileExists($dir)) {
|
||||||
$dirs[] = $transPaths[] = $dir;
|
$dirs[] = $transPaths[] = $dir;
|
||||||
} else {
|
} else {
|
||||||
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
|
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory.', $dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,6 @@ class StopwatchHelper extends Helper
|
|||||||
return $this->stopwatch->{$method}(...$arguments);
|
return $this->stopwatch->{$method}(...$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist.', $method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ abstract class WebTestCase extends KernelTestCase
|
|||||||
if (class_exists(KernelBrowser::class)) {
|
if (class_exists(KernelBrowser::class)) {
|
||||||
throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.');
|
throw new \LogicException('You cannot create the client used in functional tests if the "framework.test" config is not set to true.');
|
||||||
}
|
}
|
||||||
throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit"');
|
throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit".');
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->setServerParameters($server);
|
$client->setServerParameters($server);
|
||||||
|
@ -115,6 +115,6 @@ class GuardAuthenticationFactory implements SecurityFactoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we have multiple entry points - we must ask them to configure one
|
// we have multiple entry points - we must ask them to configure one
|
||||||
throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s)', implode(', ', $authenticatorIds)));
|
throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s).', implode(', ', $authenticatorIds)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,7 +655,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
|||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name));
|
throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getUserProviderId(string $name): string
|
private function getUserProviderId(string $name): string
|
||||||
|
@ -39,7 +39,7 @@ class TwigLoaderPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader"');
|
throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader".');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === $found) {
|
if (1 === $found) {
|
||||||
|
@ -128,7 +128,7 @@ class UrlPackage extends Package
|
|||||||
if ('https://' === substr($url, 0, 8) || '//' === substr($url, 0, 2)) {
|
if ('https://' === substr($url, 0, 8) || '//' === substr($url, 0, 2)) {
|
||||||
$sslUrls[] = $url;
|
$sslUrls[] = $url;
|
||||||
} elseif (null === parse_url($url, PHP_URL_SCHEME)) {
|
} elseif (null === parse_url($url, PHP_URL_SCHEME)) {
|
||||||
throw new InvalidArgumentException(sprintf('"%s" is not a valid URL', $url));
|
throw new InvalidArgumentException(sprintf('"%s" is not a valid URL.', $url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
|
|||||||
|
|
||||||
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
|
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
|
||||||
if (0 < json_last_error()) {
|
if (0 < json_last_error()) {
|
||||||
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s" - %s', $this->manifestPath, json_last_error_msg()));
|
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s" - %s.', $this->manifestPath, json_last_error_msg()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ abstract class Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
|
if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
|
||||||
throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput()));
|
throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s.', $process->getOutput(), $process->getErrorOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return unserialize($process->getOutput());
|
return unserialize($process->getOutput());
|
||||||
|
@ -41,7 +41,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
{
|
{
|
||||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR;
|
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR;
|
||||||
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
|
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
|
||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||||
|
@ -82,7 +82,7 @@ final class CacheItem implements ItemInterface
|
|||||||
} elseif ($expiration instanceof \DateTimeInterface) {
|
} elseif ($expiration instanceof \DateTimeInterface) {
|
||||||
$this->expiry = (float) $expiration->format('U.u');
|
$this->expiry = (float) $expiration->format('U.u');
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration)));
|
throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', \is_object($expiration) ? \get_class($expiration) : \gettype($expiration)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -102,7 +102,7 @@ final class CacheItem implements ItemInterface
|
|||||||
} elseif (\is_int($time)) {
|
} elseif (\is_int($time)) {
|
||||||
$this->expiry = $time + microtime(true);
|
$this->expiry = $time + microtime(true);
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($time) ? \get_class($time) : \gettype($time)));
|
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($time) ? \get_class($time) : \gettype($time)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -121,13 +121,13 @@ final class CacheItem implements ItemInterface
|
|||||||
}
|
}
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (!\is_string($tag)) {
|
if (!\is_string($tag)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given', \is_object($tag) ? \get_class($tag) : \gettype($tag)));
|
throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given.', \is_object($tag) ? \get_class($tag) : \gettype($tag)));
|
||||||
}
|
}
|
||||||
if (isset($this->newMetadata[self::METADATA_TAGS][$tag])) {
|
if (isset($this->newMetadata[self::METADATA_TAGS][$tag])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ('' === $tag) {
|
if ('' === $tag) {
|
||||||
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));
|
||||||
@ -168,10 +168,10 @@ final class CacheItem implements ItemInterface
|
|||||||
public static function validateKey($key): string
|
public static function validateKey($key): string
|
||||||
{
|
{
|
||||||
if (!\is_string($key)) {
|
if (!\is_string($key)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key)));
|
throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key)));
|
||||||
}
|
}
|
||||||
if ('' === $key) {
|
if ('' === $key) {
|
||||||
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));
|
||||||
|
@ -45,7 +45,7 @@ abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterfac
|
|||||||
$this->defaultLifetime = max(0, $defaultLifetime);
|
$this->defaultLifetime = max(0, $defaultLifetime);
|
||||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':';
|
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':';
|
||||||
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
|
if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) {
|
||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterfac
|
|||||||
if ($keys instanceof \Traversable) {
|
if ($keys instanceof \Traversable) {
|
||||||
$keys = iterator_to_array($keys, false);
|
$keys = iterator_to_array($keys, false);
|
||||||
} elseif (!\is_array($keys)) {
|
} elseif (!\is_array($keys)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
$ids = [];
|
$ids = [];
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterfac
|
|||||||
public function setMultiple($values, $ttl = null)
|
public function setMultiple($values, $ttl = null)
|
||||||
{
|
{
|
||||||
if (!\is_array($values) && !$values instanceof \Traversable) {
|
if (!\is_array($values) && !$values instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
|
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
|
||||||
}
|
}
|
||||||
$valuesById = [];
|
$valuesById = [];
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterfac
|
|||||||
if ($keys instanceof \Traversable) {
|
if ($keys instanceof \Traversable) {
|
||||||
$keys = iterator_to_array($keys, false);
|
$keys = iterator_to_array($keys, false);
|
||||||
} elseif (!\is_array($keys)) {
|
} elseif (!\is_array($keys)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->deleteItems($keys);
|
return $this->deleteItems($keys);
|
||||||
@ -174,7 +174,7 @@ abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterfac
|
|||||||
return 0 < $ttl ? $ttl : false;
|
return 0 < $ttl ? $ttl : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
|
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateValues(iterable $values, array &$keys, $default): iterable
|
private function generateValues(iterable $values, array &$keys, $default): iterable
|
||||||
|
@ -74,7 +74,7 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl
|
|||||||
if ($keys instanceof \Traversable) {
|
if ($keys instanceof \Traversable) {
|
||||||
$keys = iterator_to_array($keys, false);
|
$keys = iterator_to_array($keys, false);
|
||||||
} elseif (!\is_array($keys)) {
|
} elseif (!\is_array($keys)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
if (!\is_string($key) || !isset($this->expiries[$key])) {
|
if (!\is_string($key) || !isset($this->expiries[$key])) {
|
||||||
@ -93,7 +93,7 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl
|
|||||||
public function deleteMultiple($keys)
|
public function deleteMultiple($keys)
|
||||||
{
|
{
|
||||||
if (!\is_array($keys) && !$keys instanceof \Traversable) {
|
if (!\is_array($keys) && !$keys instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$this->delete($key);
|
$this->delete($key);
|
||||||
@ -124,7 +124,7 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl
|
|||||||
public function setMultiple($values, $ttl = null)
|
public function setMultiple($values, $ttl = null)
|
||||||
{
|
{
|
||||||
if (!\is_array($values) && !$values instanceof \Traversable) {
|
if (!\is_array($values) && !$values instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
|
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
|
||||||
}
|
}
|
||||||
$valuesArray = [];
|
$valuesArray = [];
|
||||||
|
|
||||||
@ -162,6 +162,6 @@ class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, Resettabl
|
|||||||
return 0 < $ttl ? $ttl : false;
|
return 0 < $ttl ? $ttl : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
|
throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', \is_object($ttl) ? \get_class($ttl) : \gettype($ttl)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class PhpArrayCache implements Psr16CacheInterface, PruneableInterface, Resettab
|
|||||||
if ($keys instanceof \Traversable) {
|
if ($keys instanceof \Traversable) {
|
||||||
$keys = iterator_to_array($keys, false);
|
$keys = iterator_to_array($keys, false);
|
||||||
} elseif (!\is_array($keys)) {
|
} elseif (!\is_array($keys)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
if (!\is_string($key)) {
|
if (!\is_string($key)) {
|
||||||
@ -147,7 +147,7 @@ class PhpArrayCache implements Psr16CacheInterface, PruneableInterface, Resettab
|
|||||||
public function deleteMultiple($keys)
|
public function deleteMultiple($keys)
|
||||||
{
|
{
|
||||||
if (!\is_array($keys) && !$keys instanceof \Traversable) {
|
if (!\is_array($keys) && !$keys instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleted = true;
|
$deleted = true;
|
||||||
@ -200,7 +200,7 @@ class PhpArrayCache implements Psr16CacheInterface, PruneableInterface, Resettab
|
|||||||
public function setMultiple($values, $ttl = null)
|
public function setMultiple($values, $ttl = null)
|
||||||
{
|
{
|
||||||
if (!\is_array($values) && !$values instanceof \Traversable) {
|
if (!\is_array($values) && !$values instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
|
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', \is_object($values) ? \get_class($values) : \gettype($values)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$saved = true;
|
$saved = true;
|
||||||
|
@ -250,7 +250,7 @@ trait AbstractTrait
|
|||||||
if (false !== $value = unserialize($value)) {
|
if (false !== $value = unserialize($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
throw new \DomainException('Failed to unserialize cached value');
|
throw new \DomainException('Failed to unserialize cached value.');
|
||||||
} catch (\Error $e) {
|
} catch (\Error $e) {
|
||||||
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
|
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -29,7 +29,7 @@ trait ApcuTrait
|
|||||||
private function init(string $namespace, int $defaultLifetime, ?string $version)
|
private function init(string $namespace, int $defaultLifetime, ?string $version)
|
||||||
{
|
{
|
||||||
if (!static::isSupported()) {
|
if (!static::isSupported()) {
|
||||||
throw new CacheException('APCu is not enabled');
|
throw new CacheException('APCu is not enabled.');
|
||||||
}
|
}
|
||||||
if ('cli' === \PHP_SAPI) {
|
if ('cli' === \PHP_SAPI) {
|
||||||
ini_set('apc.use_request_time', 0);
|
ini_set('apc.use_request_time', 0);
|
||||||
|
@ -44,7 +44,7 @@ trait FilesystemCommonTrait
|
|||||||
$directory .= \DIRECTORY_SEPARATOR;
|
$directory .= \DIRECTORY_SEPARATOR;
|
||||||
// On Windows the whole path is limited to 258 chars
|
// On Windows the whole path is limited to 258 chars
|
||||||
if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
|
if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory));
|
throw new InvalidArgumentException(sprintf('Cache directory too long (%s).', $directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->directory = $directory;
|
$this->directory = $directory;
|
||||||
|
@ -103,7 +103,7 @@ trait FilesystemTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($failed && !is_writable($this->directory)) {
|
if ($failed && !is_writable($this->directory)) {
|
||||||
throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory));
|
throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -43,7 +43,7 @@ trait MemcachedTrait
|
|||||||
private function init(\Memcached $client, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller)
|
private function init(\Memcached $client, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller)
|
||||||
{
|
{
|
||||||
if (!static::isSupported()) {
|
if (!static::isSupported()) {
|
||||||
throw new CacheException('Memcached >= 2.2.0 is required');
|
throw new CacheException('Memcached >= 2.2.0 is required.');
|
||||||
}
|
}
|
||||||
if ('Memcached' === \get_class($client)) {
|
if ('Memcached' === \get_class($client)) {
|
||||||
$opt = $client->getOption(\Memcached::OPT_SERIALIZER);
|
$opt = $client->getOption(\Memcached::OPT_SERIALIZER);
|
||||||
@ -84,7 +84,7 @@ trait MemcachedTrait
|
|||||||
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers)));
|
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers)));
|
||||||
}
|
}
|
||||||
if (!static::isSupported()) {
|
if (!static::isSupported()) {
|
||||||
throw new CacheException('Memcached >= 2.2.0 is required');
|
throw new CacheException('Memcached >= 2.2.0 is required.');
|
||||||
}
|
}
|
||||||
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
|
set_error_handler(function ($type, $msg, $file, $line) { throw new \ErrorException($msg, 0, $type, $file, $line); });
|
||||||
try {
|
try {
|
||||||
@ -99,7 +99,7 @@ trait MemcachedTrait
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (0 !== strpos($dsn, 'memcached:')) {
|
if (0 !== strpos($dsn, 'memcached:')) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached:"', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached:".', $dsn));
|
||||||
}
|
}
|
||||||
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
|
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
|
||||||
if (!empty($m[2])) {
|
if (!empty($m[2])) {
|
||||||
@ -109,7 +109,7 @@ trait MemcachedTrait
|
|||||||
return 'file:'.($m[1] ?? '');
|
return 'file:'.($m[1] ?? '');
|
||||||
}, $dsn);
|
}, $dsn);
|
||||||
if (false === $params = parse_url($params)) {
|
if (false === $params = parse_url($params)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
|
||||||
}
|
}
|
||||||
$query = $hosts = [];
|
$query = $hosts = [];
|
||||||
if (isset($params['query'])) {
|
if (isset($params['query'])) {
|
||||||
@ -136,7 +136,7 @@ trait MemcachedTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isset($params['host']) && !isset($params['path'])) {
|
if (!isset($params['host']) && !isset($params['path'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
|
||||||
}
|
}
|
||||||
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
|
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
|
||||||
$params['weight'] = $m[1];
|
$params['weight'] = $m[1];
|
||||||
|
@ -49,7 +49,7 @@ trait PdoTrait
|
|||||||
|
|
||||||
if ($connOrDsn instanceof \PDO) {
|
if ($connOrDsn instanceof \PDO) {
|
||||||
if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
|
if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
|
||||||
throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__));
|
throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->conn = $connOrDsn;
|
$this->conn = $connOrDsn;
|
||||||
|
@ -247,7 +247,7 @@ trait PhpFilesTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$ok && !is_writable($this->directory)) {
|
if (!$ok && !is_writable($this->directory)) {
|
||||||
throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory));
|
throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ok;
|
return $ok;
|
||||||
|
@ -109,7 +109,7 @@ trait RedisTrait
|
|||||||
}, $dsn);
|
}, $dsn);
|
||||||
|
|
||||||
if (false === $params = parse_url($params)) {
|
if (false === $params = parse_url($params)) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn));
|
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $hosts = [];
|
$query = $hosts = [];
|
||||||
@ -174,7 +174,7 @@ trait RedisTrait
|
|||||||
try {
|
try {
|
||||||
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
|
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
|
||||||
} catch (\RedisException $e) {
|
} catch (\RedisException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn));
|
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e->getMessage(), $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||||
@ -182,7 +182,7 @@ trait RedisTrait
|
|||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
if (!$isConnected) {
|
if (!$isConnected) {
|
||||||
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s', $error, $dsn));
|
throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s.', $error, $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((null !== $auth && !$redis->auth($auth))
|
if ((null !== $auth && !$redis->auth($auth))
|
||||||
@ -190,7 +190,7 @@ trait RedisTrait
|
|||||||
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
|
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
|
||||||
) {
|
) {
|
||||||
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn));
|
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e, $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
||||||
|
@ -215,7 +215,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
protected function finalizeValue($value)
|
protected function finalizeValue($value)
|
||||||
{
|
{
|
||||||
if (false === $value) {
|
if (false === $value) {
|
||||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)));
|
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->children as $name => $child) {
|
foreach ($this->children as $name => $child) {
|
||||||
|
@ -438,7 +438,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s', $this->getPath(), $e->getMessage()), $e->getCode(), $e);
|
throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": %s.', $this->getPath(), $e->getMessage()), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
$path = $node->getPath();
|
$path = $node->getPath();
|
||||||
|
|
||||||
if (null !== $this->key) {
|
if (null !== $this->key) {
|
||||||
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $this->allowEmptyValue) {
|
if (false === $this->allowEmptyValue) {
|
||||||
@ -476,15 +476,15 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (true === $this->atLeastOne) {
|
if (true === $this->atLeastOne) {
|
||||||
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->default) {
|
if ($this->default) {
|
||||||
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== $this->addDefaultChildren) {
|
if (false !== $this->addDefaultChildren) {
|
||||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,20 +498,20 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
$path = $node->getPath();
|
$path = $node->getPath();
|
||||||
|
|
||||||
if ($this->addDefaults) {
|
if ($this->addDefaults) {
|
||||||
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== $this->addDefaultChildren) {
|
if (false !== $this->addDefaultChildren) {
|
||||||
if ($this->default) {
|
if ($this->default) {
|
||||||
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
|
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
|
||||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
|
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
|
||||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path));
|
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ class ExprBuilder
|
|||||||
*/
|
*/
|
||||||
public function thenUnset()
|
public function thenUnset()
|
||||||
{
|
{
|
||||||
$this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); };
|
$this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key.'); };
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
|
|||||||
public function max($max)
|
public function max($max)
|
||||||
{
|
{
|
||||||
if (isset($this->min) && $this->min > $max) {
|
if (isset($this->min) && $this->min > $max) {
|
||||||
throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s)', $max, $this->min));
|
throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min));
|
||||||
}
|
}
|
||||||
$this->max = $max;
|
$this->max = $max;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
|
|||||||
public function min($min)
|
public function min($min)
|
||||||
{
|
{
|
||||||
if (isset($this->max) && $this->max < $min) {
|
if (isset($this->max) && $this->max < $min) {
|
||||||
throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s)', $min, $this->max));
|
throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max));
|
||||||
}
|
}
|
||||||
$this->min = $min;
|
$this->min = $min;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class YamlReferenceDumper
|
|||||||
|
|
||||||
foreach (explode('.', $path) as $step) {
|
foreach (explode('.', $path) as $step) {
|
||||||
if (!$node instanceof ArrayNode) {
|
if (!$node instanceof ArrayNode) {
|
||||||
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path));
|
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var NodeInterface[] $children */
|
/** @var NodeInterface[] $children */
|
||||||
@ -53,7 +53,7 @@ class YamlReferenceDumper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s"', $rootNode->getName(), $path));
|
throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->dumpNode($node);
|
return $this->dumpNode($node);
|
||||||
|
@ -185,7 +185,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
protected function finalizeValue($value)
|
protected function finalizeValue($value)
|
||||||
{
|
{
|
||||||
if (false === $value) {
|
if (false === $value) {
|
||||||
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)));
|
throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
|
@ -559,7 +559,7 @@ class Command
|
|||||||
public function setAliases($aliases)
|
public function setAliases($aliases)
|
||||||
{
|
{
|
||||||
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
|
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
|
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($aliases as $alias) {
|
foreach ($aliases as $alias) {
|
||||||
|
@ -115,7 +115,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
|||||||
public function getStyle($name)
|
public function getStyle($name)
|
||||||
{
|
{
|
||||||
if (!$this->hasStyle($name)) {
|
if (!$this->hasStyle($name)) {
|
||||||
throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
|
throw new InvalidArgumentException(sprintf('Undefined style: %s.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->styles[strtolower($name)];
|
return $this->styles[strtolower($name)];
|
||||||
|
@ -87,7 +87,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(static::$availableForegroundColors[$color])) {
|
if (!isset(static::$availableForegroundColors[$color])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
|
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableForegroundColors))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->foreground = static::$availableForegroundColors[$color];
|
$this->foreground = static::$availableForegroundColors[$color];
|
||||||
@ -105,7 +105,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(static::$availableBackgroundColors[$color])) {
|
if (!isset(static::$availableBackgroundColors[$color])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
|
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->background = static::$availableBackgroundColors[$color];
|
$this->background = static::$availableBackgroundColors[$color];
|
||||||
@ -122,7 +122,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
public function setOption($option)
|
public function setOption($option)
|
||||||
{
|
{
|
||||||
if (!isset(static::$availableOptions[$option])) {
|
if (!isset(static::$availableOptions[$option])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
|
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\in_array(static::$availableOptions[$option], $this->options)) {
|
if (!\in_array(static::$availableOptions[$option], $this->options)) {
|
||||||
@ -136,7 +136,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
public function unsetOption($option)
|
public function unsetOption($option)
|
||||||
{
|
{
|
||||||
if (!isset(static::$availableOptions[$option])) {
|
if (!isset(static::$availableOptions[$option])) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
|
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = array_search(static::$availableOptions[$option], $this->options);
|
$pos = array_search(static::$availableOptions[$option], $this->options);
|
||||||
|
@ -58,7 +58,7 @@ class TableStyle
|
|||||||
public function setPaddingChar($paddingChar)
|
public function setPaddingChar($paddingChar)
|
||||||
{
|
{
|
||||||
if (!$paddingChar) {
|
if (!$paddingChar) {
|
||||||
throw new LogicException('The padding char must not be empty');
|
throw new LogicException('The padding char must not be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->paddingChar = $paddingChar;
|
$this->paddingChar = $paddingChar;
|
||||||
|
@ -57,7 +57,7 @@ class StringInput extends ArgvInput
|
|||||||
$tokens[] = stripcslashes($match[1]);
|
$tokens[] = stripcslashes($match[1]);
|
||||||
} else {
|
} else {
|
||||||
// should never happen
|
// should never happen
|
||||||
throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
|
throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cursor += \strlen($match[0]);
|
$cursor += \strlen($match[0]);
|
||||||
|
@ -53,7 +53,7 @@ class FunctionExtension extends AbstractExtension
|
|||||||
try {
|
try {
|
||||||
list($a, $b) = Parser::parseSeries($function->getArguments());
|
list($a, $b) = Parser::parseSeries($function->getArguments());
|
||||||
} catch (SyntaxErrorException $e) {
|
} catch (SyntaxErrorException $e) {
|
||||||
throw new ExpressionErrorException(sprintf('Invalid series: %s', implode(', ', $function->getArguments())), 0, $e);
|
throw new ExpressionErrorException(sprintf('Invalid series: %s.', implode(', ', $function->getArguments())), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$xpath->addStarPrefix();
|
$xpath->addStarPrefix();
|
||||||
|
@ -226,14 +226,14 @@ class ErrorHandler
|
|||||||
if (!\is_array($log)) {
|
if (!\is_array($log)) {
|
||||||
$log = [$log];
|
$log = [$log];
|
||||||
} elseif (!\array_key_exists(0, $log)) {
|
} elseif (!\array_key_exists(0, $log)) {
|
||||||
throw new \InvalidArgumentException('No logger provided');
|
throw new \InvalidArgumentException('No logger provided.');
|
||||||
}
|
}
|
||||||
if (null === $log[0]) {
|
if (null === $log[0]) {
|
||||||
$this->loggedErrors &= ~$type;
|
$this->loggedErrors &= ~$type;
|
||||||
} elseif ($log[0] instanceof LoggerInterface) {
|
} elseif ($log[0] instanceof LoggerInterface) {
|
||||||
$this->loggedErrors |= $type;
|
$this->loggedErrors |= $type;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException('Invalid logger provided');
|
throw new \InvalidArgumentException('Invalid logger provided.');
|
||||||
}
|
}
|
||||||
$this->loggers[$type] = $log + $prev[$type];
|
$this->loggers[$type] = $log + $prev[$type];
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
return $this->extensionsByNs[$name];
|
return $this->extensionsByNs[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new LogicException(sprintf('Container extension "%s" is not registered', $name));
|
throw new LogicException(sprintf('Container extension "%s" is not registered.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -839,7 +839,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
$alias = (string) $alias;
|
$alias = (string) $alias;
|
||||||
|
|
||||||
if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
|
if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias));
|
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\is_string($id)) {
|
if (\is_string($id)) {
|
||||||
@ -989,13 +989,18 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
public function setDefinition($id, Definition $definition)
|
public function setDefinition($id, Definition $definition)
|
||||||
{
|
{
|
||||||
if ($this->isCompiled()) {
|
if ($this->isCompiled()) {
|
||||||
throw new BadMethodCallException('Adding definition to a compiled container is not allowed');
|
throw new BadMethodCallException('Adding definition to a compiled container is not allowed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (string) $id;
|
$id = (string) $id;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) {
|
if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
|
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
|
||||||
|
=======
|
||||||
|
if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id));
|
||||||
|
>>>>>>> 3.4
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
|
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
|
||||||
@ -1120,7 +1125,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
if (\is_array($factory)) {
|
if (\is_array($factory)) {
|
||||||
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
|
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
|
||||||
} elseif (!\is_string($factory)) {
|
} elseif (!\is_string($factory)) {
|
||||||
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
|
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ EOTXT
|
|||||||
|
|
||||||
if (\is_array($callable)) {
|
if (\is_array($callable)) {
|
||||||
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) {
|
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) {
|
||||||
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $callable[1] ?: 'n/a'));
|
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($callable[0] instanceof Reference
|
if ($callable[0] instanceof Reference
|
||||||
@ -1761,7 +1761,7 @@ EOF;
|
|||||||
return sprintf('${($_ = %s) && false ?: "_"}', $class);
|
return sprintf('${($_ = %s) && false ?: "_"}', $class);
|
||||||
}
|
}
|
||||||
if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
|
if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
|
||||||
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a'));
|
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);
|
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);
|
||||||
|
@ -31,7 +31,7 @@ abstract class AbstractConfigurator
|
|||||||
return $this->{'set'.$method}(...$args);
|
return $this->{'set'.$method}(...$args);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
|
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s().', static::class, $method));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ class ContainerConfigurator extends AbstractConfigurator
|
|||||||
{
|
{
|
||||||
if (!$this->container->hasExtension($namespace)) {
|
if (!$this->container->hasExtension($namespace)) {
|
||||||
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $this->file, $namespace, $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none'));
|
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $this->file, $namespace, $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container->loadFromExtension($namespace, static::processValue($config));
|
$this->container->loadFromExtension($namespace, static::processValue($config));
|
||||||
|
@ -180,7 +180,7 @@ abstract class FileLoader extends BaseFileLoader
|
|||||||
$prefixLen = \strlen($resource->getPrefix());
|
$prefixLen = \strlen($resource->getPrefix());
|
||||||
|
|
||||||
if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) {
|
if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $namespace, $excludePattern, $pattern));
|
throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
try {
|
try {
|
||||||
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
|
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
|
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s.', $file, $e->getMessage()), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validateExtensions($dom, $file);
|
$this->validateExtensions($dom, $file);
|
||||||
@ -591,7 +591,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
$path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);
|
$path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);
|
||||||
|
|
||||||
if (!is_file($path)) {
|
if (!is_file($path)) {
|
||||||
throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', \get_class($extension), $path));
|
throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".', \get_class($extension), $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
$schemaLocations[$items[$i]] = $path;
|
$schemaLocations[$items[$i]] = $path;
|
||||||
@ -678,7 +678,7 @@ EOF
|
|||||||
// can it be handled by an extension?
|
// can it be handled by an extension?
|
||||||
if (!$this->container->hasExtension($node->namespaceURI)) {
|
if (!$this->container->hasExtension($node->namespaceURI)) {
|
||||||
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
|
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
|
||||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
|
|
||||||
if (!$this->container->hasExtension($namespace)) {
|
if (!$this->container->hasExtension($namespace)) {
|
||||||
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||||
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class FormFieldRegistry
|
|||||||
while ($segments) {
|
while ($segments) {
|
||||||
$path = array_shift($segments);
|
$path = array_shift($segments);
|
||||||
if (!\is_array($target) || !\array_key_exists($path, $target)) {
|
if (!\is_array($target) || !\array_key_exists($path, $target)) {
|
||||||
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
|
throw new \InvalidArgumentException(sprintf('Unreachable field "%s".', $path));
|
||||||
}
|
}
|
||||||
$target = &$target[$path];
|
$target = &$target[$path];
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,12 @@ class Lexer
|
|||||||
} elseif (false !== strpos(')]}', $expression[$cursor])) {
|
} elseif (false !== strpos(')]}', $expression[$cursor])) {
|
||||||
// closing bracket
|
// closing bracket
|
||||||
if (empty($brackets)) {
|
if (empty($brackets)) {
|
||||||
throw new SyntaxError(sprintf('Unexpected "%s"', $expression[$cursor]), $cursor, $expression);
|
throw new SyntaxError(sprintf('Unexpected "%s".', $expression[$cursor]), $cursor, $expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($expect, $cur) = array_pop($brackets);
|
list($expect, $cur) = array_pop($brackets);
|
||||||
if ($expression[$cursor] != strtr($expect, '([{', ')]}')) {
|
if ($expression[$cursor] != strtr($expect, '([{', ')]}')) {
|
||||||
throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur, $expression);
|
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1);
|
$tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1);
|
||||||
@ -87,7 +87,7 @@ class Lexer
|
|||||||
$cursor += \strlen($match[0]);
|
$cursor += \strlen($match[0]);
|
||||||
} else {
|
} else {
|
||||||
// unlexable
|
// unlexable
|
||||||
throw new SyntaxError(sprintf('Unexpected character "%s"', $expression[$cursor]), $cursor, $expression);
|
throw new SyntaxError(sprintf('Unexpected character "%s".', $expression[$cursor]), $cursor, $expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class Lexer
|
|||||||
|
|
||||||
if (!empty($brackets)) {
|
if (!empty($brackets)) {
|
||||||
list($expect, $cur) = array_pop($brackets);
|
list($expect, $cur) = array_pop($brackets);
|
||||||
throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur, $expression);
|
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TokenStream($tokens, $expression);
|
return new TokenStream($tokens, $expression);
|
||||||
|
@ -148,13 +148,13 @@ class BinaryNode extends Node
|
|||||||
return $left * $right;
|
return $left * $right;
|
||||||
case '/':
|
case '/':
|
||||||
if (0 == $right) {
|
if (0 == $right) {
|
||||||
throw new \DivisionByZeroError('Division by zero');
|
throw new \DivisionByZeroError('Division by zero.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $left / $right;
|
return $left / $right;
|
||||||
case '%':
|
case '%':
|
||||||
if (0 == $right) {
|
if (0 == $right) {
|
||||||
throw new \DivisionByZeroError('Modulo by zero');
|
throw new \DivisionByZeroError('Modulo by zero.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $left % $right;
|
return $left % $right;
|
||||||
|
@ -98,7 +98,7 @@ class Parser
|
|||||||
|
|
||||||
$node = $this->parseExpression();
|
$node = $this->parseExpression();
|
||||||
if (!$stream->isEOF()) {
|
if (!$stream->isEOF()) {
|
||||||
throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression());
|
throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $stream->current->type, $stream->current->value), $stream->current->cursor, $stream->getExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
@ -194,13 +194,13 @@ class Parser
|
|||||||
default:
|
default:
|
||||||
if ('(' === $this->stream->current->value) {
|
if ('(' === $this->stream->current->value) {
|
||||||
if (false === isset($this->functions[$token->value])) {
|
if (false === isset($this->functions[$token->value])) {
|
||||||
throw new SyntaxError(sprintf('The function "%s" does not exist', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, array_keys($this->functions));
|
throw new SyntaxError(sprintf('The function "%s" does not exist.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, array_keys($this->functions));
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = new Node\FunctionNode($token->value, $this->parseArguments());
|
$node = new Node\FunctionNode($token->value, $this->parseArguments());
|
||||||
} else {
|
} else {
|
||||||
if (!\in_array($token->value, $this->names, true)) {
|
if (!\in_array($token->value, $this->names, true)) {
|
||||||
throw new SyntaxError(sprintf('Variable "%s" is not valid', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names);
|
throw new SyntaxError(sprintf('Variable "%s" is not valid.', $token->value), $token->cursor, $this->stream->getExpression(), $token->value, $this->names);
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the name used in the compiled code different
|
// is the name used in the compiled code different
|
||||||
@ -226,7 +226,7 @@ class Parser
|
|||||||
} elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) {
|
} elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) {
|
||||||
$node = $this->parseHashExpression();
|
$node = $this->parseHashExpression();
|
||||||
} else {
|
} else {
|
||||||
throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $token->type, $token->value), $token->cursor, $this->stream->getExpression());
|
throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', $token->type, $token->value), $token->cursor, $this->stream->getExpression());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ class Parser
|
|||||||
} else {
|
} else {
|
||||||
$current = $this->stream->current;
|
$current = $this->stream->current;
|
||||||
|
|
||||||
throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', $current->type, $current->value), $current->cursor, $this->stream->getExpression());
|
throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', $current->type, $current->value), $current->cursor, $this->stream->getExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)');
|
$this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)');
|
||||||
@ -326,7 +326,7 @@ class Parser
|
|||||||
// As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown.
|
// As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown.
|
||||||
(Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value))
|
(Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value))
|
||||||
) {
|
) {
|
||||||
throw new SyntaxError('Expected name', $token->cursor, $this->stream->getExpression());
|
throw new SyntaxError('Expected name.', $token->cursor, $this->stream->getExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
$arg = new Node\ConstantNode($token->value, true);
|
$arg = new Node\ConstantNode($token->value, true);
|
||||||
|
@ -15,7 +15,7 @@ class SyntaxError extends \LogicException
|
|||||||
{
|
{
|
||||||
public function __construct(string $message, int $cursor = 0, string $expression = '', string $subject = null, array $proposals = null)
|
public function __construct(string $message, int $cursor = 0, string $expression = '', string $subject = null, array $proposals = null)
|
||||||
{
|
{
|
||||||
$message = sprintf('%s around position %d', $message, $cursor);
|
$message = sprintf('%s around position %d', rtrim($message, '.'), $cursor);
|
||||||
if ($expression) {
|
if ($expression) {
|
||||||
$message = sprintf('%s for expression `%s`', $message, $expression);
|
$message = sprintf('%s for expression `%s`', $message, $expression);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class TokenStream
|
|||||||
++$this->position;
|
++$this->position;
|
||||||
|
|
||||||
if (!isset($this->tokens[$this->position])) {
|
if (!isset($this->tokens[$this->position])) {
|
||||||
throw new SyntaxError('Unexpected end of expression', $this->current->cursor, $this->expression);
|
throw new SyntaxError('Unexpected end of expression.', $this->current->cursor, $this->expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->current = $this->tokens[$this->position];
|
$this->current = $this->tokens[$this->position];
|
||||||
@ -66,7 +66,7 @@ class TokenStream
|
|||||||
{
|
{
|
||||||
$token = $this->current;
|
$token = $this->current;
|
||||||
if (!$token->test($type, $value)) {
|
if (!$token->test($type, $value)) {
|
||||||
throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression);
|
throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor, $this->expression);
|
||||||
}
|
}
|
||||||
$this->next();
|
$this->next();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ class Filesystem
|
|||||||
if (self::$lastError) {
|
if (self::$lastError) {
|
||||||
throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
|
throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
|
||||||
}
|
}
|
||||||
throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
|
throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +359,7 @@ class Filesystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file($originFile)) {
|
if (!is_file($originFile)) {
|
||||||
throw new FileNotFoundException(sprintf('Origin file "%s" is not a file', $originFile));
|
throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->toIterable($targetFiles) as $targetFile) {
|
foreach ($this->toIterable($targetFiles) as $targetFile) {
|
||||||
|
@ -57,7 +57,7 @@ abstract class AbstractExtension implements FormExtensionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->types[$name])) {
|
if (!isset($this->types[$name])) {
|
||||||
throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name));
|
throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->types[$name];
|
return $this->types[$name];
|
||||||
|
@ -105,7 +105,7 @@ class Button implements \IteratorAggregate, FormInterface
|
|||||||
public function setParent(FormInterface $parent = null)
|
public function setParent(FormInterface $parent = null)
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('You cannot set the parent of a submitted button');
|
throw new AlreadySubmittedException('You cannot set the parent of a submitted button.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
@ -381,7 +381,7 @@ class Button implements \IteratorAggregate, FormInterface
|
|||||||
public function submit($submittedData, $clearMissing = true)
|
public function submit($submittedData, $clearMissing = true)
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('A form can only be submitted once');
|
throw new AlreadySubmittedException('A form can only be submitted once.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->submitted = true;
|
$this->submitted = true;
|
||||||
|
@ -191,7 +191,7 @@ EOF
|
|||||||
return $classes[0];
|
return $classes[0];
|
||||||
}
|
}
|
||||||
if (!$input->isInteractive()) {
|
if (!$input->isInteractive()) {
|
||||||
throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s", $shortClassName, implode("\n ", $classes)));
|
throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s.", $shortClassName, implode("\n ", $classes)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]);
|
return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]);
|
||||||
|
@ -76,7 +76,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)));
|
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -45,7 +45,7 @@ class ChoiceToValueTransformer implements DataTransformerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
|
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique.', $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return current($choices);
|
return current($choices);
|
||||||
|
@ -65,7 +65,7 @@ class ChoicesToValuesTransformer implements DataTransformerInterface
|
|||||||
$choices = $this->choiceList->getChoicesForValues($array);
|
$choices = $this->choiceList->getChoicesForValues($array);
|
||||||
|
|
||||||
if (\count($choices) !== \count($array)) {
|
if (\count($choices) !== \count($array)) {
|
||||||
throw new TransformationFailedException('Could not find all matching choices for the given values');
|
throw new TransformationFailedException('Could not find all matching choices for the given values.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $choices;
|
return $choices;
|
||||||
|
@ -129,14 +129,14 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (\count($emptyFields) > 0) {
|
if (\count($emptyFields) > 0) {
|
||||||
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields)));
|
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||||
}
|
}
|
||||||
if (isset($value['invert']) && !\is_bool($value['invert'])) {
|
if (isset($value['invert']) && !\is_bool($value['invert'])) {
|
||||||
throw new TransformationFailedException('The value of "invert" must be boolean');
|
throw new TransformationFailedException('The value of "invert" must be boolean.');
|
||||||
}
|
}
|
||||||
foreach (self::$availableFields as $field => $char) {
|
foreach (self::$availableFields as $field => $char) {
|
||||||
if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) {
|
if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) {
|
||||||
throw new TransformationFailedException(sprintf('This amount of "%s" is invalid', $field));
|
throw new TransformationFailedException(sprintf('This amount of "%s" is invalid.', $field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -79,7 +79,7 @@ class DateIntervalToStringTransformer implements DataTransformerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!$this->isISO8601($value)) {
|
if (!$this->isISO8601($value)) {
|
||||||
throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet');
|
throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet.');
|
||||||
}
|
}
|
||||||
$valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/';
|
$valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/';
|
||||||
if (!preg_match($valuePattern, $value)) {
|
if (!preg_match($valuePattern, $value)) {
|
||||||
|
@ -133,35 +133,35 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (\count($emptyFields) > 0) {
|
if (\count($emptyFields) > 0) {
|
||||||
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields)));
|
throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['month']) && !ctype_digit((string) $value['month'])) {
|
if (isset($value['month']) && !ctype_digit((string) $value['month'])) {
|
||||||
throw new TransformationFailedException('This month is invalid');
|
throw new TransformationFailedException('This month is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['day']) && !ctype_digit((string) $value['day'])) {
|
if (isset($value['day']) && !ctype_digit((string) $value['day'])) {
|
||||||
throw new TransformationFailedException('This day is invalid');
|
throw new TransformationFailedException('This day is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['year']) && !ctype_digit((string) $value['year'])) {
|
if (isset($value['year']) && !ctype_digit((string) $value['year'])) {
|
||||||
throw new TransformationFailedException('This year is invalid');
|
throw new TransformationFailedException('This year is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {
|
if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {
|
||||||
throw new TransformationFailedException('This is an invalid date');
|
throw new TransformationFailedException('This is an invalid date.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) {
|
if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) {
|
||||||
throw new TransformationFailedException('This hour is invalid');
|
throw new TransformationFailedException('This hour is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) {
|
if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) {
|
||||||
throw new TransformationFailedException('This minute is invalid');
|
throw new TransformationFailedException('This minute is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($value['second']) && !ctype_digit((string) $value['second'])) {
|
if (isset($value['second']) && !ctype_digit((string) $value['second'])) {
|
||||||
throw new TransformationFailedException('This second is invalid');
|
throw new TransformationFailedException('This second is invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -149,7 +149,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (\in_array($value, ['NaN', 'NAN', 'nan'], true)) {
|
if (\in_array($value, ['NaN', 'NAN', 'nan'], true)) {
|
||||||
throw new TransformationFailedException('"NaN" is not a valid number');
|
throw new TransformationFailedException('"NaN" is not a valid number.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$position = 0;
|
$position = 0;
|
||||||
@ -180,7 +180,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) {
|
if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) {
|
||||||
throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like');
|
throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->castParsedValue($result);
|
$result = $this->castParsedValue($result);
|
||||||
@ -201,7 +201,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
|
|||||||
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
||||||
|
|
||||||
if ('' !== $remainder) {
|
if ('' !== $remainder) {
|
||||||
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder));
|
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
|||||||
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
$remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0");
|
||||||
|
|
||||||
if ('' !== $remainder) {
|
if ('' !== $remainder) {
|
||||||
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder));
|
throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface
|
|||||||
foreach ($this->keys as $key) {
|
foreach ($this->keys as $key) {
|
||||||
if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && [] !== $array[$key]) {
|
if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && [] !== $array[$key]) {
|
||||||
if ($array[$key] !== $result) {
|
if ($array[$key] !== $result) {
|
||||||
throw new TransformationFailedException('All values in the array should be the same');
|
throw new TransformationFailedException('All values in the array should be the same.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$emptyKeys[] = $key;
|
$emptyKeys[] = $key;
|
||||||
@ -77,7 +77,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)));
|
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -163,7 +163,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
|||||||
public function getElement($index)
|
public function getElement($index)
|
||||||
{
|
{
|
||||||
if (!isset($this->elements[$index])) {
|
if (!isset($this->elements[$index])) {
|
||||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
|
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->elements[$index];
|
return $this->elements[$index];
|
||||||
@ -175,7 +175,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
|||||||
public function isProperty($index)
|
public function isProperty($index)
|
||||||
{
|
{
|
||||||
if (!isset($this->isIndex[$index])) {
|
if (!isset($this->isIndex[$index])) {
|
||||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
|
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||||
}
|
}
|
||||||
|
|
||||||
return !$this->isIndex[$index];
|
return !$this->isIndex[$index];
|
||||||
@ -187,7 +187,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
|||||||
public function isIndex($index)
|
public function isIndex($index)
|
||||||
{
|
{
|
||||||
if (!isset($this->isIndex[$index])) {
|
if (!isset($this->isIndex[$index])) {
|
||||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
|
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->isIndex[$index];
|
return $this->isIndex[$index];
|
||||||
@ -212,7 +212,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
|||||||
public function mapsForm($index)
|
public function mapsForm($index)
|
||||||
{
|
{
|
||||||
if (!isset($this->mapsForm[$index])) {
|
if (!isset($this->mapsForm[$index])) {
|
||||||
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
|
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->mapsForm[$index];
|
return $this->mapsForm[$index];
|
||||||
|
@ -169,7 +169,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
// `setData` and `add` will not lead to the correct population of
|
// `setData` and `add` will not lead to the correct population of
|
||||||
// the child forms.
|
// the child forms.
|
||||||
if ($config->getCompound() && !$config->getDataMapper()) {
|
if ($config->getCompound() && !$config->getDataMapper()) {
|
||||||
throw new LogicException('Compound forms need a data mapper');
|
throw new LogicException('Compound forms need a data mapper.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the form inherits the data from its parent, it is not necessary
|
// If the form inherits the data from its parent, it is not necessary
|
||||||
@ -266,7 +266,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
public function setParent(FormInterface $parent = null)
|
public function setParent(FormInterface $parent = null)
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('You cannot set the parent of a submitted form');
|
throw new AlreadySubmittedException('You cannot set the parent of a submitted form.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $parent && '' === $this->name) {
|
if (null !== $parent && '' === $this->name) {
|
||||||
@ -501,7 +501,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
public function submit($submittedData, $clearMissing = true)
|
public function submit($submittedData, $clearMissing = true)
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('A form can only be submitted once');
|
throw new AlreadySubmittedException('A form can only be submitted once.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize errors in the very beginning so we're sure
|
// Initialize errors in the very beginning so we're sure
|
||||||
@ -835,7 +835,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
public function add($child, $type = null, array $options = [])
|
public function add($child, $type = null, array $options = [])
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('You cannot add children to a submitted form');
|
throw new AlreadySubmittedException('You cannot add children to a submitted form.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->config->getCompound()) {
|
if (!$this->config->getCompound()) {
|
||||||
@ -906,7 +906,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
public function remove($name)
|
public function remove($name)
|
||||||
{
|
{
|
||||||
if ($this->submitted) {
|
if ($this->submitted) {
|
||||||
throw new AlreadySubmittedException('You cannot remove children from a submitted form');
|
throw new AlreadySubmittedException('You cannot remove children from a submitted form.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->children[$name])) {
|
if (isset($this->children[$name])) {
|
||||||
|
@ -132,7 +132,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||||||
*/
|
*/
|
||||||
public function offsetSet($name, $value)
|
public function offsetSet($name, $value)
|
||||||
{
|
{
|
||||||
throw new BadMethodCallException('Not supported');
|
throw new BadMethodCallException('Not supported.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ class PreloadedExtension implements FormExtensionInterface
|
|||||||
public function getType($name)
|
public function getType($name)
|
||||||
{
|
{
|
||||||
if (!isset($this->types[$name])) {
|
if (!isset($this->types[$name])) {
|
||||||
throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name));
|
throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->types[$name];
|
return $this->types[$name];
|
||||||
|
@ -30,11 +30,11 @@ trait ValidatorExtensionTrait
|
|||||||
protected function getValidatorExtension()
|
protected function getValidatorExtension()
|
||||||
{
|
{
|
||||||
if (!interface_exists(ValidatorInterface::class)) {
|
if (!interface_exists(ValidatorInterface::class)) {
|
||||||
throw new \Exception('In order to use the "ValidatorExtensionTrait", the symfony/validator component must be installed');
|
throw new \Exception('In order to use the "ValidatorExtensionTrait", the symfony/validator component must be installed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this instanceof TypeTestCase) {
|
if (!$this instanceof TypeTestCase) {
|
||||||
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s', TypeTestCase::class));
|
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s.', TypeTestCase::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
||||||
|
@ -112,7 +112,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
|
|||||||
public function offsetGet($key)
|
public function offsetGet($key)
|
||||||
{
|
{
|
||||||
if (!isset($this->elements[$key])) {
|
if (!isset($this->elements[$key])) {
|
||||||
throw new \OutOfBoundsException('The offset "'.$key.'" does not exist.');
|
throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->elements[$key];
|
return $this->elements[$key];
|
||||||
|
@ -91,7 +91,7 @@ class File extends \SplFileInfo
|
|||||||
$renamed = rename($this->getPathname(), $target);
|
$renamed = rename($this->getPathname(), $target);
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
if (!$renamed) {
|
if (!$renamed) {
|
||||||
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
|
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@chmod($target, 0666 & ~umask());
|
@chmod($target, 0666 & ~umask());
|
||||||
@ -106,10 +106,10 @@ class File extends \SplFileInfo
|
|||||||
{
|
{
|
||||||
if (!is_dir($directory)) {
|
if (!is_dir($directory)) {
|
||||||
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
|
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
|
||||||
throw new FileException(sprintf('Unable to create the "%s" directory', $directory));
|
throw new FileException(sprintf('Unable to create the "%s" directory.', $directory));
|
||||||
}
|
}
|
||||||
} elseif (!is_writable($directory)) {
|
} elseif (!is_writable($directory)) {
|
||||||
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
|
throw new FileException(sprintf('Unable to write in the "%s" directory.', $directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
||||||
|
@ -130,7 +130,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
|
if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
|
||||||
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
|
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?).');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -208,7 +208,7 @@ class UploadedFile extends File
|
|||||||
$moved = move_uploaded_file($this->getPathname(), $target);
|
$moved = move_uploaded_file($this->getPathname(), $target);
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
if (!$moved) {
|
if (!$moved) {
|
||||||
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
|
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@chmod($target, 0666 & ~umask());
|
@chmod($target, 0666 & ~umask());
|
||||||
|
@ -47,7 +47,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
|
|||||||
$this->memcached = $memcached;
|
$this->memcached = $memcached;
|
||||||
|
|
||||||
if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
|
if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
|
||||||
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
|
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
|
$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
|
||||||
|
@ -66,7 +66,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
|||||||
public function __construct(\MongoDB\Client $mongo, array $options)
|
public function __construct(\MongoDB\Client $mongo, array $options)
|
||||||
{
|
{
|
||||||
if (!isset($options['database']) || !isset($options['collection'])) {
|
if (!isset($options['database']) || !isset($options['collection'])) {
|
||||||
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler');
|
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mongo = $mongo;
|
$this->mongo = $mongo;
|
||||||
|
@ -38,7 +38,7 @@ class NativeFileSessionHandler extends \SessionHandler
|
|||||||
|
|
||||||
if ($count = substr_count($savePath, ';')) {
|
if ($count = substr_count($savePath, ';')) {
|
||||||
if ($count > 2) {
|
if ($count > 2) {
|
||||||
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
|
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'.', $savePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
// characters after last ';' are the path
|
// characters after last ';' are the path
|
||||||
@ -46,7 +46,7 @@ class NativeFileSessionHandler extends \SessionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
|
if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
|
||||||
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
|
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $baseDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_set('session.save_path', $savePath);
|
ini_set('session.save_path', $savePath);
|
||||||
|
@ -174,7 +174,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
|||||||
{
|
{
|
||||||
if ($pdoOrDsn instanceof \PDO) {
|
if ($pdoOrDsn instanceof \PDO) {
|
||||||
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
|
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
|
||||||
throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__));
|
throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pdo = $pdoOrDsn;
|
$this->pdo = $pdoOrDsn;
|
||||||
@ -468,7 +468,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($params['scheme'])) {
|
if (!isset($params['scheme'])) {
|
||||||
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
|
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$driverAliasMap = [
|
$driverAliasMap = [
|
||||||
|
@ -148,7 +148,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
if (!$this->started || $this->closed) {
|
if (!$this->started || $this->closed) {
|
||||||
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
|
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.');
|
||||||
}
|
}
|
||||||
// nothing to do since we don't persist the session data
|
// nothing to do since we don't persist the session data
|
||||||
$this->closed = false;
|
$this->closed = false;
|
||||||
|
@ -37,7 +37,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) {
|
if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) {
|
||||||
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $savePath));
|
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $savePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->savePath = $savePath;
|
$this->savePath = $savePath;
|
||||||
@ -87,7 +87,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
if (!$this->started) {
|
if (!$this->started) {
|
||||||
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
|
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->data;
|
$data = $this->data;
|
||||||
|
@ -149,7 +149,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
|
|
||||||
// ok to try and start the session
|
// ok to try and start the session
|
||||||
if (!session_start()) {
|
if (!session_start()) {
|
||||||
throw new \RuntimeException('Failed to start the session');
|
throw new \RuntimeException('Failed to start the session.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->emulateSameSite) {
|
if (null !== $this->emulateSameSite) {
|
||||||
|
@ -88,7 +88,7 @@ abstract class AbstractProxy
|
|||||||
public function setId($id)
|
public function setId($id)
|
||||||
{
|
{
|
||||||
if ($this->isActive()) {
|
if ($this->isActive()) {
|
||||||
throw new \LogicException('Cannot change the ID of an active session');
|
throw new \LogicException('Cannot change the ID of an active session.');
|
||||||
}
|
}
|
||||||
|
|
||||||
session_id($id);
|
session_id($id);
|
||||||
@ -114,7 +114,7 @@ abstract class AbstractProxy
|
|||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
if ($this->isActive()) {
|
if ($this->isActive()) {
|
||||||
throw new \LogicException('Cannot change the name of an active session');
|
throw new \LogicException('Cannot change the name of an active session.');
|
||||||
}
|
}
|
||||||
|
|
||||||
session_name($name);
|
session_name($name);
|
||||||
|
@ -85,7 +85,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
try {
|
try {
|
||||||
$callable = $this->createController($controller);
|
$callable = $this->createController($controller);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()), 0, $e);
|
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s.', $request->getPathInfo(), $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_callable($callable)) {
|
if (!\is_callable($callable)) {
|
||||||
|
@ -198,7 +198,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||||||
$dumper = new HtmlDumper($data, $this->charset);
|
$dumper = new HtmlDumper($data, $this->charset);
|
||||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
|
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s.', $format));
|
||||||
}
|
}
|
||||||
$dumps = [];
|
$dumps = [];
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
public function setTemplating($templating)
|
public function setTemplating($templating)
|
||||||
{
|
{
|
||||||
if (null !== $templating && !$templating instanceof EngineInterface && !$templating instanceof Environment) {
|
if (null !== $templating && !$templating instanceof EngineInterface && !$templating instanceof Environment) {
|
||||||
throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface');
|
throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($templating instanceof EngineInterface) {
|
if ($templating instanceof EngineInterface) {
|
||||||
|
@ -449,7 +449,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
foreach ($this->registerBundles() as $bundle) {
|
foreach ($this->registerBundles() as $bundle) {
|
||||||
$name = $bundle->getName();
|
$name = $bundle->getName();
|
||||||
if (isset($this->bundles[$name])) {
|
if (isset($this->bundles[$name])) {
|
||||||
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name));
|
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name));
|
||||||
}
|
}
|
||||||
$this->bundles[$name] = $bundle;
|
$this->bundles[$name] = $bundle;
|
||||||
}
|
}
|
||||||
@ -713,10 +713,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
|
foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
|
||||||
if (!is_dir($dir)) {
|
if (!is_dir($dir)) {
|
||||||
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
|
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
|
||||||
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
|
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n.", $name, $dir));
|
||||||
}
|
}
|
||||||
} elseif (!is_writable($dir)) {
|
} elseif (!is_writable($dir)) {
|
||||||
throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
|
throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n.", $name, $dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class GenrbCompiler implements BundleCompilerInterface
|
|||||||
exec('which '.$genrb, $output, $status);
|
exec('which '.$genrb, $output, $status);
|
||||||
|
|
||||||
if (0 !== $status) {
|
if (0 !== $status) {
|
||||||
throw new RuntimeException(sprintf('The command "%s" is not installed', $genrb));
|
throw new RuntimeException(sprintf('The command "%s" is not installed.', $genrb));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->genrb = ($envVars ? $envVars.' ' : '').$genrb;
|
$this->genrb = ($envVars ? $envVars.' ' : '').$genrb;
|
||||||
|
@ -46,7 +46,7 @@ class JsonBundleReader implements BundleReaderInterface
|
|||||||
$data = json_decode(file_get_contents($fileName), true);
|
$data = json_decode(file_get_contents($fileName), true);
|
||||||
|
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s', $fileName, json_last_error_msg()));
|
throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s.', $fileName, json_last_error_msg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -104,7 +104,7 @@ class FullTransformer
|
|||||||
|
|
||||||
// handle unimplemented characters
|
// handle unimplemented characters
|
||||||
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
|
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
|
||||||
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern));
|
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s".', $dateChars[0], $this->pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -108,7 +108,7 @@ abstract class IntlGlobals
|
|||||||
public static function setError(int $code, string $message = '')
|
public static function setError(int $code, string $message = '')
|
||||||
{
|
{
|
||||||
if (!isset(self::$errorCodes[$code])) {
|
if (!isset(self::$errorCodes[$code])) {
|
||||||
throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
|
throw new \InvalidArgumentException(sprintf('No such error code: "%s".', $code));
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
|
self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
|
||||||
|
@ -363,7 +363,7 @@ abstract class NumberFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self::CURRENCY === $this->style) {
|
if (self::CURRENCY === $this->style) {
|
||||||
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
|
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s.', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only the default type is supported.
|
// Only the default type is supported.
|
||||||
|
@ -75,7 +75,7 @@ final class Ldap implements LdapInterface
|
|||||||
public static function create($adapter, array $config = []): self
|
public static function create($adapter, array $config = []): self
|
||||||
{
|
{
|
||||||
if (!isset(self::$adapterMap[$adapter])) {
|
if (!isset(self::$adapterMap[$adapter])) {
|
||||||
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s', $adapter, implode(', ', self::$adapterMap)));
|
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s.', $adapter, implode(', ', self::$adapterMap)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = self::$adapterMap[$adapter];
|
$class = self::$adapterMap[$adapter];
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user