Merge branch '4.4' into 5.0
* 4.4: Fix code Tweak the code to avoid fabbot false positives
This commit is contained in:
commit
8e9bd7ad06
@ -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('User with id '.json_encode($id).' not found.'));
|
throw new UsernameNotFoundException('User with id '.json_encode($id).' not found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$socket = stream_socket_server($host, $errno, $errstr)) {
|
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) {
|
foreach ($this->getLogs($socket) as $clientId => $message) {
|
||||||
|
@ -96,7 +96,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
try {
|
try {
|
||||||
$options = $this->getOptionsResolver()->resolve($options);
|
$options = $this->getOptionsResolver()->resolve($options);
|
||||||
} catch (ExceptionInterface $e) {
|
} catch (ExceptionInterface $e) {
|
||||||
throw new $e(sprintf('An error has occurred resolving the options of the form "%s": %s.', \get_class($this->getInnerType()), $e->getMessage()), $e->getCode(), $e);
|
throw new $e(sprintf('An error has occurred resolving the options of the form "%s": '.$e->getMessage(), \get_class($this->getInnerType())), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be decoupled from the specific option at some point
|
// Should be decoupled from the specific option at some point
|
||||||
|
@ -343,11 +343,11 @@ trait HttpClientTrait
|
|||||||
try {
|
try {
|
||||||
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
|
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
|
throw new InvalidArgumentException('Invalid value for "json" option: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
|
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', json_last_error_msg()));
|
throw new InvalidArgumentException('Invalid value for "json" option: '.json_last_error_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -153,11 +153,11 @@ trait ResponseTrait
|
|||||||
try {
|
try {
|
||||||
$content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0));
|
$content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0));
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
throw new JsonException(sprintf('%s for "%s".', $e->getMessage(), $this->getInfo('url')), $e->getCode());
|
throw new JsonException(sprintf($e->getMessage().' for "%s".', $this->getInfo('url')), $e->getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error()) {
|
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error()) {
|
||||||
throw new JsonException(sprintf('%s for "%s".', json_last_error_msg(), $this->getInfo('url')), json_last_error());
|
throw new JsonException(sprintf(json_last_error_msg().' for "%s".', $this->getInfo('url')), json_last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_array($content)) {
|
if (!\is_array($content)) {
|
||||||
|
@ -64,7 +64,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_callable($controller)) {
|
if (!\is_callable($controller)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s.', $request->getPathInfo(), $this->getControllerError($controller)));
|
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: '.$this->getControllerError($controller), $request->getPathInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $controller;
|
return $controller;
|
||||||
@ -72,7 +72,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
|
|
||||||
if (\is_object($controller)) {
|
if (\is_object($controller)) {
|
||||||
if (!\is_callable($controller)) {
|
if (!\is_callable($controller)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s.', $request->getPathInfo(), $this->getControllerError($controller)));
|
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: '.$this->getControllerError($controller), $request->getPathInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $controller;
|
return $controller;
|
||||||
@ -89,7 +89,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_callable($callable)) {
|
if (!\is_callable($callable)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s.', $request->getPathInfo(), $this->getControllerError($callable)));
|
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: '.$this->getControllerError($callable), $request->getPathInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $callable;
|
return $callable;
|
||||||
|
@ -173,17 +173,17 @@ class ControllerResolverTest extends TestCase
|
|||||||
['foo', \Error::class, 'Class \'foo\' not found'],
|
['foo', \Error::class, 'Class \'foo\' not found'],
|
||||||
['oof::bar', \Error::class, 'Class \'oof\' not found'],
|
['oof::bar', \Error::class, 'Class \'oof\' not found'],
|
||||||
[['oof', 'bar'], \Error::class, 'Class \'oof\' not found'],
|
[['oof', 'bar'], \Error::class, 'Class \'oof\' not found'],
|
||||||
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'],
|
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'],
|
||||||
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
||||||
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
||||||
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'],
|
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'],
|
||||||
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'],
|
['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest', \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'],
|
||||||
[[$controller, 'staticsAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'],
|
[[$controller, 'staticsAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'],
|
||||||
[[$controller, 'privateAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
[[$controller, 'privateAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
||||||
[[$controller, 'protectedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
[[$controller, 'protectedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'],
|
||||||
[[$controller, 'undefinedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'],
|
[[$controller, 'undefinedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'],
|
||||||
[$controller, \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'],
|
[$controller, \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'],
|
||||||
[['a' => 'foo', 'b' => 'bar'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Invalid array callable, expected [controller, method].'],
|
[['a' => 'foo', 'b' => 'bar'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable: Invalid array callable, expected [controller, method].'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Collection implements CollectionInterface
|
|||||||
foreach ($searches as $search) {
|
foreach ($searches as $search) {
|
||||||
$searchCount = ldap_count_entries($con, $search);
|
$searchCount = ldap_count_entries($con, $search);
|
||||||
if (false === $searchCount) {
|
if (false === $searchCount) {
|
||||||
throw new LdapException(sprintf('Error while retrieving entry count: %s.', ldap_error($con)));
|
throw new LdapException('Error while retrieving entry count: '.ldap_error($con));
|
||||||
}
|
}
|
||||||
$count += $searchCount;
|
$count += $searchCount;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ class Collection implements CollectionInterface
|
|||||||
$current = ldap_first_entry($con, $search);
|
$current = ldap_first_entry($con, $search);
|
||||||
|
|
||||||
if (false === $current) {
|
if (false === $current) {
|
||||||
throw new LdapException(sprintf('Could not rewind entries array: %s.', ldap_error($con)));
|
throw new LdapException('Could not rewind entries array: '.ldap_error($con));
|
||||||
}
|
}
|
||||||
|
|
||||||
yield $this->getSingleEntry($con, $current);
|
yield $this->getSingleEntry($con, $current);
|
||||||
|
@ -79,7 +79,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_mod_add($con, $entry->getDn(), [$attribute => $values])) {
|
if (!@ldap_mod_add($con, $entry->getDn(), [$attribute => $values])) {
|
||||||
throw new LdapException(sprintf('Could not add values to entry "%s", attribute %s: %s.', $entry->getDn(), $attribute, ldap_error($con)));
|
throw new LdapException(sprintf('Could not add values to entry "%s", attribute %s: '.ldap_error($con), $entry->getDn(), $attribute));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_mod_del($con, $entry->getDn(), [$attribute => $values])) {
|
if (!@ldap_mod_del($con, $entry->getDn(), [$attribute => $values])) {
|
||||||
throw new LdapException(sprintf('Could not remove values from entry "%s", attribute %s: %s.', $entry->getDn(), $attribute, ldap_error($con)));
|
throw new LdapException(sprintf('Could not remove values from entry "%s", attribute %s: '.ldap_error($con), $entry->getDn(), $attribute));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$rdn = $this->parseRdnFromEntry($entry);
|
$rdn = $this->parseRdnFromEntry($entry);
|
||||||
// deleteOldRdn does not matter here, since the Rdn will not be changing in the move.
|
// deleteOldRdn does not matter here, since the Rdn will not be changing in the move.
|
||||||
if (!@ldap_rename($con, $entry->getDn(), $rdn, $newParent, true)) {
|
if (!@ldap_rename($con, $entry->getDn(), $rdn, $newParent, true)) {
|
||||||
throw new LdapException(sprintf('Could not move entry "%s" to "%s": %s.', $entry->getDn(), $newParent, ldap_error($con)));
|
throw new LdapException(sprintf('Could not move entry "%s" to "%s": '.ldap_error($con), $entry->getDn(), $newParent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class SesApiTransport extends AbstractApiTransport
|
|||||||
|
|
||||||
$result = new \SimpleXMLElement($response->getContent(false));
|
$result = new \SimpleXMLElement($response->getContent(false));
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result->Error->Message, $result->Error->Code), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result->Error->Message.' (code %d).', $result->Error->Code), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$property = $payload['Action'].'Result';
|
$property = $payload['Action'].'Result';
|
||||||
|
@ -65,7 +65,7 @@ class SesHttpTransport extends AbstractHttpTransport
|
|||||||
|
|
||||||
$result = new \SimpleXMLElement($response->getContent(false));
|
$result = new \SimpleXMLElement($response->getContent(false));
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result->Error->Message, $result->Error->Code), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result->Error->Message.' (code %d).', $result->Error->Code), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->setMessageId($result->SendRawEmailResult->MessageId);
|
$message->setMessageId($result->SendRawEmailResult->MessageId);
|
||||||
|
@ -51,7 +51,7 @@ class MandrillApiTransport extends AbstractApiTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('error' === ($result['status'] ?? false)) {
|
if ('error' === ($result['status'] ?? false)) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result['message'].' (code %d).', $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
||||||
|
@ -58,7 +58,7 @@ class MandrillHttpTransport extends AbstractHttpTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('error' === ($result['status'] ?? false)) {
|
if ('error' === ($result['status'] ?? false)) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result['message'].' (code %d).', $result['code']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email (code %d).', $result['code']), $response);
|
||||||
|
@ -65,10 +65,10 @@ class MailgunApiTransport extends AbstractApiTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result['message'].' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $response->getContent(false), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$response->getContent(false).' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($result['id']);
|
$sentMessage->setMessageId($result['id']);
|
||||||
|
@ -67,10 +67,10 @@ class MailgunHttpTransport extends AbstractHttpTransport
|
|||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
if ('application/json' === $response->getHeaders(false)['content-type'][0]) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['message'], $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result['message'].' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $response->getContent(false), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$response->getContent(false).' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->setMessageId($result['id']);
|
$message->setMessageId($result['id']);
|
||||||
|
@ -54,7 +54,7 @@ class PostmarkApiTransport extends AbstractApiTransport
|
|||||||
|
|
||||||
$result = $response->toArray(false);
|
$result = $response->toArray(false);
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', $result['Message'], $result['ErrorCode']), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.$result['Message'].' (code %d).', $result['ErrorCode']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($result['MessageID']);
|
$sentMessage->setMessageId($result['MessageID']);
|
||||||
|
@ -53,7 +53,7 @@ class SendgridApiTransport extends AbstractApiTransport
|
|||||||
if (202 !== $response->getStatusCode()) {
|
if (202 !== $response->getStatusCode()) {
|
||||||
$errors = $response->toArray(false);
|
$errors = $response->toArray(false);
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %d).', implode('; ', array_column($errors['errors'], 'message')), $response->getStatusCode()), $response);
|
throw new HttpTransportException(sprintf('Unable to send an email: '.implode('; ', array_column($errors['errors'], 'message')).' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
||||||
|
@ -31,7 +31,7 @@ abstract class AbstractApiTransport extends AbstractHttpTransport
|
|||||||
try {
|
try {
|
||||||
$email = MessageConverter::toEmail($message->getOriginalMessage());
|
$email = MessageConverter::toEmail($message->getOriginalMessage());
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new RuntimeException(sprintf('Unable to send message with the "%s" transport: %s.', __CLASS__, $e->getMessage()), 0, $e);
|
throw new RuntimeException(sprintf('Unable to send message with the "%s" transport: '.$e->getMessage(), __CLASS__), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->doSendApi($message, $email, $message->getEnvelope());
|
return $this->doSendApi($message, $email, $message->getEnvelope());
|
||||||
|
@ -41,7 +41,7 @@ final class ProcessStream extends AbstractStream
|
|||||||
$this->stream = proc_open($this->command, $descriptorSpec, $pipes);
|
$this->stream = proc_open($this->command, $descriptorSpec, $pipes);
|
||||||
stream_set_blocking($pipes[2], false);
|
stream_set_blocking($pipes[2], false);
|
||||||
if ($err = stream_get_contents($pipes[2])) {
|
if ($err = stream_get_contents($pipes[2])) {
|
||||||
throw new TransportException(sprintf('Process could not be started: %s.', $err));
|
throw new TransportException('Process could not be started: '.$err);
|
||||||
}
|
}
|
||||||
$this->in = &$pipes[0];
|
$this->in = &$pipes[0];
|
||||||
$this->out = &$pipes[1];
|
$this->out = &$pipes[1];
|
||||||
|
@ -135,7 +135,7 @@ final class SocketStream extends AbstractStream
|
|||||||
$streamContext = stream_context_create($options);
|
$streamContext = stream_context_create($options);
|
||||||
|
|
||||||
set_error_handler(function ($type, $msg) {
|
set_error_handler(function ($type, $msg) {
|
||||||
throw new TransportException(sprintf('Connection could not be established with host "%s": %s.', $this->url, $msg));
|
throw new TransportException(sprintf('Connection could not be established with host "%s": '.$msg, $this->url));
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
$this->stream = stream_socket_client($this->url, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $streamContext);
|
$this->stream = stream_socket_client($this->url, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $streamContext);
|
||||||
|
@ -56,11 +56,11 @@ class Connection
|
|||||||
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
|
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
|
||||||
|
|
||||||
if (isset($connectionCredentials['auth']) && !$this->connection->auth($connectionCredentials['auth'])) {
|
if (isset($connectionCredentials['auth']) && !$this->connection->auth($connectionCredentials['auth'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError()));
|
throw new InvalidArgumentException('Redis connection failed: '.$redis->getLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($dbIndex = $configuration['dbindex'] ?? self::DEFAULT_OPTIONS['dbindex']) && !$this->connection->select($dbIndex)) {
|
if (($dbIndex = $configuration['dbindex'] ?? self::DEFAULT_OPTIONS['dbindex']) && !$this->connection->select($dbIndex)) {
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection failed: %s.', $redis->getLastError()));
|
throw new InvalidArgumentException('Redis connection failed: '.$redis->getLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->stream = $configuration['stream'] ?? self::DEFAULT_OPTIONS['stream'];
|
$this->stream = $configuration['stream'] ?? self::DEFAULT_OPTIONS['stream'];
|
||||||
|
@ -80,7 +80,7 @@ class Serializer implements SerializerInterface
|
|||||||
try {
|
try {
|
||||||
$message = $this->serializer->deserialize($encodedEnvelope['body'], $encodedEnvelope['headers']['type'], $this->format, $context);
|
$message = $this->serializer->deserialize($encodedEnvelope['body'], $encodedEnvelope['headers']['type'], $this->format, $context);
|
||||||
} catch (ExceptionInterface $e) {
|
} catch (ExceptionInterface $e) {
|
||||||
throw new MessageDecodingFailedException(sprintf('Could not decode message: %s.', $e->getMessage()), $e->getCode(), $e);
|
throw new MessageDecodingFailedException('Could not decode message: '.$e->getMessage(), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Envelope($message, $stamps);
|
return new Envelope($message, $stamps);
|
||||||
@ -118,7 +118,7 @@ class Serializer implements SerializerInterface
|
|||||||
try {
|
try {
|
||||||
$stamps[] = $this->serializer->deserialize($value, substr($name, \strlen(self::STAMP_HEADER_PREFIX)).'[]', $this->format, $this->context);
|
$stamps[] = $this->serializer->deserialize($value, substr($name, \strlen(self::STAMP_HEADER_PREFIX)).'[]', $this->format, $this->context);
|
||||||
} catch (ExceptionInterface $e) {
|
} catch (ExceptionInterface $e) {
|
||||||
throw new MessageDecodingFailedException(sprintf('Could not decode stamp: %s.', $e->getMessage()), $e->getCode(), $e);
|
throw new MessageDecodingFailedException('Could not decode stamp: '.$e->getMessage(), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($stamps) {
|
if ($stamps) {
|
||||||
|
@ -1596,7 +1596,7 @@ class Process implements \IteratorAggregate
|
|||||||
{
|
{
|
||||||
return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
|
return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
|
||||||
if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
|
if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
|
||||||
throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": %s.', $matches[1], $commandline));
|
throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": '.$commandline, $matches[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->escapeArgument($env[$matches[1]]);
|
return $this->escapeArgument($env[$matches[1]]);
|
||||||
|
@ -332,7 +332,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
|
|||||||
try {
|
try {
|
||||||
$this->setAttributeValue($object, $attribute, $value, $format, $context);
|
$this->setAttributeValue($object, $attribute, $value, $format, $context);
|
||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": %s.', $attribute, $type, $e->getMessage()), $e->getCode(), $e);
|
throw new NotNormalizableValueException(sprintf('Failed to denormalize attribute "%s" value for class "%s": '.$e->getMessage(), $attribute, $type), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class IntlFormatter implements IntlFormatterInterface
|
|||||||
try {
|
try {
|
||||||
$this->cache[$locale][$message] = $formatter = new \MessageFormatter($locale, $message);
|
$this->cache[$locale][$message] = $formatter = new \MessageFormatter($locale, $message);
|
||||||
} catch (\IntlException $e) {
|
} catch (\IntlException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid message format (error #%d): %s.', intl_get_error_code(), intl_get_error_message()), 0, $e);
|
throw new InvalidArgumentException(sprintf('Invalid message format (error #%d): '.intl_get_error_message(), intl_get_error_code()), 0, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class IntlFormatter implements IntlFormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (false === $message = $formatter->format($parameters)) {
|
if (false === $message = $formatter->format($parameters)) {
|
||||||
throw new InvalidArgumentException(sprintf('Unable to format message (error #%s): %s.', $formatter->getErrorCode(), $formatter->getErrorMessage()));
|
throw new InvalidArgumentException(sprintf('Unable to format message (error #%s): '.$formatter->getErrorMessage(), $formatter->getErrorCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -58,7 +58,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
|
|
||||||
$xliffVersion = XliffUtils::getVersionNumber($dom);
|
$xliffVersion = XliffUtils::getVersionNumber($dom);
|
||||||
if ($errors = XliffUtils::validateSchema($dom)) {
|
if ($errors = XliffUtils::validateSchema($dom)) {
|
||||||
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s.', $resource, XliffUtils::getErrorsAsString($errors)));
|
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: '.XliffUtils::getErrorsAsString($errors), $resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('1.2' === $xliffVersion) {
|
if ('1.2' === $xliffVersion) {
|
||||||
|
@ -50,7 +50,7 @@ class JsonFileLoaderTest extends TestCase
|
|||||||
public function testParseException()
|
public function testParseException()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
|
$this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
|
||||||
$this->expectExceptionMessage('Error parsing JSON - Syntax error, malformed JSON');
|
$this->expectExceptionMessage('Error parsing JSON: Syntax error, malformed JSON');
|
||||||
$loader = new JsonFileLoader();
|
$loader = new JsonFileLoader();
|
||||||
$resource = __DIR__.'/../fixtures/malformed.json';
|
$resource = __DIR__.'/../fixtures/malformed.json';
|
||||||
$loader->load($resource, 'en', 'domain1');
|
$loader->load($resource, 'en', 'domain1');
|
||||||
|
@ -130,7 +130,7 @@ class BicValidator extends ConstraintValidator
|
|||||||
try {
|
try {
|
||||||
$iban = $this->getPropertyAccessor()->getValue($object, $path);
|
$iban = $this->getPropertyAccessor()->getValue($object, $path);
|
||||||
} catch (NoSuchPropertyException $e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$iban) {
|
if (!$iban) {
|
||||||
|
@ -157,7 +157,7 @@ class RangeValidator extends ConstraintValidator
|
|||||||
try {
|
try {
|
||||||
return $this->getPropertyAccessor()->getValue($object, $propertyPath);
|
return $this->getPropertyAccessor()->getValue($object, $propertyPath);
|
||||||
} catch (NoSuchPropertyException $e) {
|
} catch (NoSuchPropertyException $e) {
|
||||||
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s.', $propertyPath, \get_class($constraint), $e->getMessage()), 0, $e);
|
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: '.$e->getMessage(), $propertyPath, \get_class($constraint)), 0, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class DumpServer
|
|||||||
public function start(): void
|
public function start(): void
|
||||||
{
|
{
|
||||||
if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) {
|
if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) {
|
||||||
throw new \RuntimeException(sprintf('Server start failed on "%s": %s %s.', $this->host, $errstr, $errno));
|
throw new \RuntimeException(sprintf('Server start failed on "%s": '.$errstr.' '.$errno, $this->host));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user