Merge branch '3.4' into 4.4
* 3.4: Tweak the code to avoid fabbot false positives
This commit is contained in:
commit
11a707200d
@ -92,7 +92,7 @@ class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInter
|
||||
|
||||
$refreshedUser = $repository->find($id);
|
||||
if (null === $refreshedUser) {
|
||||
throw new UsernameNotFoundException(sprintf('User with id %s not found.', json_encode($id)));
|
||||
throw new UsernameNotFoundException('User with id '.json_encode($id).' not found.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ EOF
|
||||
}
|
||||
|
||||
if (!$socket = stream_socket_server($host, $errno, $errstr)) {
|
||||
throw new RuntimeException(sprintf('Server start failed on "%s": %s %s.', $host, $errstr, $errno));
|
||||
throw new RuntimeException(sprintf('Server start failed on "%s": '.$errstr.' '.$errno, $host));
|
||||
}
|
||||
|
||||
foreach ($this->getLogs($socket) as $clientId => $message) {
|
||||
|
@ -59,7 +59,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
|
||||
|
||||
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
|
||||
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": '.json_last_error_msg(), $this->manifestPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ trait MemcachedTrait
|
||||
return $result;
|
||||
}
|
||||
|
||||
throw new CacheException(sprintf('MemcachedAdapter client error: %s.', strtolower($this->client->getResultMessage())));
|
||||
throw new CacheException('MemcachedAdapter client error: '.strtolower($this->client->getResultMessage()));
|
||||
}
|
||||
|
||||
private function getClient(): \Memcached
|
||||
|
@ -438,7 +438,7 @@ abstract class BaseNode implements NodeInterface
|
||||
|
||||
throw $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": '.$e->getMessage(), $this->getPath()), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ abstract class AbstractRecursivePass implements CompilerPassInterface
|
||||
throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new RuntimeException(sprintf('Invalid service "%s": %s.', $this->currentId, lcfirst(rtrim($e->getMessage(), '.'))));
|
||||
throw new RuntimeException(sprintf('Invalid service "%s": '.lcfirst($e->getMessage()), $this->currentId));
|
||||
}
|
||||
if (!$r = $r->getConstructor()) {
|
||||
if ($required) {
|
||||
|
@ -690,7 +690,7 @@ class YamlFileLoader extends FileLoader
|
||||
try {
|
||||
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
|
||||
} catch (ParseException $e) {
|
||||
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: "%s".', $file, $e->getMessage()), 0, $e);
|
||||
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: '.$e->getMessage(), $file), 0, $e);
|
||||
}
|
||||
|
||||
return $this->validate($configuration, $file);
|
||||
|
@ -102,7 +102,7 @@ class Filesystem
|
||||
if (!is_dir($dir)) {
|
||||
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
|
||||
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": '.self::$lastError, $dir), 0, null, $dir);
|
||||
}
|
||||
throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
|
||||
}
|
||||
@ -172,16 +172,16 @@ class Filesystem
|
||||
if (is_link($file)) {
|
||||
// See https://bugs.php.net/52176
|
||||
if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
|
||||
throw new IOException(sprintf('Failed to remove symlink "%s": '.self::$lastError, $file));
|
||||
}
|
||||
} elseif (is_dir($file)) {
|
||||
$this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
|
||||
|
||||
if (!self::box('rmdir', $file) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
|
||||
throw new IOException(sprintf('Failed to remove directory "%s": '.self::$lastError, $file));
|
||||
}
|
||||
} elseif (!self::box('unlink', $file) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
|
||||
throw new IOException(sprintf('Failed to remove file "%s": '.self::$lastError, $file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1056,7 +1056,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1078,7 +1078,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1107,7 +1107,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1131,7 +1131,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
@ -85,7 +85,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
try {
|
||||
$callable = $this->createController($controller);
|
||||
} 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: '.$e->getMessage(), $request->getPathInfo()), 0, $e);
|
||||
}
|
||||
|
||||
if (!\is_callable($callable)) {
|
||||
|
@ -46,7 +46,7 @@ class JsonBundleReader implements BundleReaderInterface
|
||||
$data = json_decode(file_get_contents($fileName), true);
|
||||
|
||||
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: '.json_last_error_msg(), $fileName));
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -123,7 +123,7 @@ class Collection implements CollectionInterface
|
||||
$attributes = ldap_get_attributes($con, $current);
|
||||
|
||||
if (false === $attributes) {
|
||||
throw new LdapException(sprintf('Could not fetch attributes: %s.', ldap_error($con)));
|
||||
throw new LdapException('Could not fetch attributes: '.ldap_error($con));
|
||||
}
|
||||
|
||||
$attributes = $this->cleanupAttributes($attributes);
|
||||
@ -131,7 +131,7 @@ class Collection implements CollectionInterface
|
||||
$dn = ldap_get_dn($con, $current);
|
||||
|
||||
if (false === $dn) {
|
||||
throw new LdapException(sprintf('Could not fetch DN: %s.', ldap_error($con)));
|
||||
throw new LdapException('Could not fetch DN: '.ldap_error($con));
|
||||
}
|
||||
|
||||
return new Entry($dn, $attributes);
|
||||
|
@ -140,11 +140,11 @@ class Connection extends AbstractConnection
|
||||
}
|
||||
|
||||
if (false === $this->connection) {
|
||||
throw new LdapException(sprintf('Could not connect to Ldap server: %s.', ldap_error($this->connection)));
|
||||
throw new LdapException('Could not connect to Ldap server: '.ldap_error($this->connection));
|
||||
}
|
||||
|
||||
if ('tls' === $this->config['encryption'] && false === @ldap_start_tls($this->connection)) {
|
||||
throw new LdapException(sprintf('Could not initiate TLS connection: %s.', ldap_error($this->connection)));
|
||||
throw new LdapException('Could not initiate TLS connection: '.ldap_error($this->connection));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class EntryManager implements EntryManagerInterface
|
||||
$con = $this->getConnectionResource();
|
||||
|
||||
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
|
||||
throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con)));
|
||||
throw new LdapException(sprintf('Could not add entry "%s": '.ldap_error($con), $entry->getDn()));
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -52,7 +52,7 @@ class EntryManager implements EntryManagerInterface
|
||||
$con = $this->getConnectionResource();
|
||||
|
||||
if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) {
|
||||
throw new LdapException(sprintf('Could not update entry "%s": %s.', $entry->getDn(), ldap_error($con)));
|
||||
throw new LdapException(sprintf('Could not update entry "%s": '.ldap_error($con), $entry->getDn()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class EntryManager implements EntryManagerInterface
|
||||
$con = $this->getConnectionResource();
|
||||
|
||||
if (!@ldap_delete($con, $entry->getDn())) {
|
||||
throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con)));
|
||||
throw new LdapException(sprintf('Could not remove entry "%s": '.ldap_error($con), $entry->getDn()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class EntryManager implements EntryManagerInterface
|
||||
$con = $this->getConnectionResource();
|
||||
|
||||
if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) {
|
||||
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": %s.', $entry->getDn(), $newRdn, ldap_error($con)));
|
||||
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": '.ldap_error($con), $entry->getDn(), $newRdn));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Query extends AbstractQuery
|
||||
continue;
|
||||
}
|
||||
if (!ldap_free_result($result)) {
|
||||
throw new LdapException(sprintf('Could not free results: %s.', ldap_error($con)));
|
||||
throw new LdapException('Could not free results: '.ldap_error($con));
|
||||
}
|
||||
}
|
||||
$this->results = null;
|
||||
|
@ -57,7 +57,7 @@ class WindowsPipes extends AbstractPipes
|
||||
|
||||
if (!$h = fopen($file.'.lock', 'w')) {
|
||||
restore_error_handler();
|
||||
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s.', $lastError));
|
||||
throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
|
||||
}
|
||||
if (!flock($h, LOCK_EX | LOCK_NB)) {
|
||||
continue 2;
|
||||
|
@ -72,10 +72,10 @@ class EncoderFactory implements EncoderFactoryInterface
|
||||
$config = $this->getEncoderConfigFromAlgorithm($config);
|
||||
}
|
||||
if (!isset($config['class'])) {
|
||||
throw new \InvalidArgumentException(sprintf('"class" must be set in %s.', json_encode($config)));
|
||||
throw new \InvalidArgumentException('"class" must be set in '.json_encode($config));
|
||||
}
|
||||
if (!isset($config['arguments'])) {
|
||||
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
|
||||
throw new \InvalidArgumentException('"arguments" must be set in '.json_encode($config));
|
||||
}
|
||||
|
||||
$encoder = new $config['class'](...$config['arguments']);
|
||||
|
@ -473,7 +473,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
|
||||
return $this->appendNode($parentNode, $data, 'data');
|
||||
}
|
||||
|
||||
throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||
throw new NotEncodableValueException('An unexpected value could not be serialized: '.(!\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,7 +173,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
throw new NotNormalizableValueException(sprintf('Could not normalize object of type "%s", no supporting normalizer found.', \get_class($data)));
|
||||
}
|
||||
|
||||
throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||
throw new NotNormalizableValueException('An unexpected value could not be normalized: '.(!\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ class JsonFileLoader extends FileLoader
|
||||
$messages = json_decode($data, true);
|
||||
|
||||
if (0 < $errorCode = json_last_error()) {
|
||||
throw new InvalidResourceException(sprintf('Error parsing JSON - %s.', $this->getJSONErrorMessage($errorCode)));
|
||||
throw new InvalidResourceException('Error parsing JSON: '.$this->getJSONErrorMessage($errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class XliffFileLoader implements LoaderInterface
|
||||
try {
|
||||
$dom = XmlUtils::loadFile($resource);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
throw new InvalidResourceException(sprintf('Unable to load "%s": %s.', $resource, $e->getMessage()), $e->getCode(), $e);
|
||||
throw new InvalidResourceException(sprintf('Unable to load "%s": '.$e->getMessage(), $resource), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
$xliffVersion = XliffUtils::getVersionNumber($dom);
|
||||
|
@ -55,7 +55,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
|
||||
try {
|
||||
$comparedValue = $this->getPropertyAccessor()->getValue($object, $path);
|
||||
} catch (NoSuchPropertyException $e) {
|
||||
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s.', $path, \get_class($constraint), $e->getMessage()), 0, $e);
|
||||
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: '.$e->getMessage(), $path, \get_class($constraint)), 0, $e);
|
||||
}
|
||||
} else {
|
||||
$comparedValue = $constraint->value;
|
||||
|
@ -40,7 +40,7 @@ class CallbackValidator extends ConstraintValidator
|
||||
if (isset($method[0]) && \is_object($method[0])) {
|
||||
$method[0] = \get_class($method[0]);
|
||||
}
|
||||
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable.', json_encode($method)));
|
||||
throw new ConstraintDefinitionException(json_encode($method).' targeted by Callback constraint is not a valid callable.');
|
||||
}
|
||||
|
||||
$method($object, $this->context, $constraint->payload);
|
||||
|
Reference in New Issue
Block a user