Merge branch '3.4' into 4.4
* 3.4: Various cleanups
This commit is contained in:
commit
282cafb093
@ -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": '.$errstr.' '.$errno, $host));
|
throw new RuntimeException(sprintf('Server start failed on "%s": ', $host).$errstr.' '.$errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getLogs($socket) as $clientId => $message) {
|
foreach ($this->getLogs($socket) as $clientId => $message) {
|
||||||
|
@ -39,7 +39,7 @@ class ProcessHelper extends Helper
|
|||||||
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
|
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
|
||||||
{
|
{
|
||||||
if (!class_exists(Process::class)) {
|
if (!class_exists(Process::class)) {
|
||||||
throw new \LogicException('The Process helper requires the "Process" component. Install "symfony/process" to use it.');
|
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($output instanceof ConsoleOutputInterface) {
|
if ($output instanceof ConsoleOutputInterface) {
|
||||||
|
@ -227,7 +227,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
$env = json_decode($env, true);
|
$env = json_decode($env, true);
|
||||||
|
|
||||||
if (JSON_ERROR_NONE !== json_last_error()) {
|
if (JSON_ERROR_NONE !== json_last_error()) {
|
||||||
throw new RuntimeException(sprintf('Invalid JSON in env var "%s": '.json_last_error_msg(), $name));
|
throw new RuntimeException(sprintf('Invalid JSON in env var "%s": ', $name).json_last_error_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $env && !\is_array($env)) {
|
if (null !== $env && !\is_array($env)) {
|
||||||
|
@ -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: '.$this->getControllerError($controller), $request->getPathInfo()));
|
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $controller;
|
return $controller;
|
||||||
|
@ -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: '.json_last_error_msg(), $fileName));
|
throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: ', $fileName).json_last_error_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -38,7 +38,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
|
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
|
||||||
throw new LdapException(sprintf('Could not add entry "%s": '.ldap_error($con), $entry->getDn()));
|
throw new LdapException(sprintf('Could not add entry "%s": ', $entry->getDn()).ldap_error($con));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -52,7 +52,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) {
|
if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) {
|
||||||
throw new LdapException(sprintf('Could not update entry "%s": '.ldap_error($con), $entry->getDn()));
|
throw new LdapException(sprintf('Could not update entry "%s": ', $entry->getDn()).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_delete($con, $entry->getDn())) {
|
if (!@ldap_delete($con, $entry->getDn())) {
|
||||||
throw new LdapException(sprintf('Could not remove entry "%s": '.ldap_error($con), $entry->getDn()));
|
throw new LdapException(sprintf('Could not remove entry "%s": ', $entry->getDn()).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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: '.ldap_error($con), $entry->getDn(), $attribute));
|
throw new LdapException(sprintf('Could not add values to entry "%s", attribute %s: ', $entry->getDn(), $attribute).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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: '.ldap_error($con), $entry->getDn(), $attribute));
|
throw new LdapException(sprintf('Could not remove values from entry "%s", attribute %s: ', $entry->getDn(), $attribute).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class EntryManager implements EntryManagerInterface
|
|||||||
$con = $this->getConnectionResource();
|
$con = $this->getConnectionResource();
|
||||||
|
|
||||||
if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) {
|
if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) {
|
||||||
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": '.ldap_error($con), $entry->getDn(), $newRdn));
|
throw new LdapException(sprintf('Could not rename entry "%s" to "%s": ', $entry->getDn(), $newRdn).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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": '.ldap_error($con), $entry->getDn(), $newParent));
|
throw new LdapException(sprintf('Could not move entry "%s" to "%s": ', $entry->getDn(), $newParent).ldap_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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: '.$result->Error->Message.' (code %d).', $result->Error->Code), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result->Error->Message.sprintf(' (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: '.$result->Error->Message.' (code %d).', $result->Error->Code), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result->Error->Message.sprintf(' (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: '.$result['message'].' (code %d).', $result['code']), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (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);
|
||||||
|
@ -57,7 +57,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: '.$result['message'].' (code %d).', $result['code']), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (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: '.$result['message'].' (code %d).', $response->getStatusCode()), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: '.$response->getContent(false).' (code %d).', $response->getStatusCode()), $response);
|
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (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: '.$result['message'].' (code %d).', $response->getStatusCode()), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new HttpTransportException(sprintf('Unable to send an email: '.$response->getContent(false).' (code %d).', $response->getStatusCode()), $response);
|
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (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: '.$result['Message'].' (code %d).', $result['ErrorCode']), $response);
|
throw new HttpTransportException('Unable to send an email: '.$result['Message'].sprintf(' (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: '.implode('; ', array_column($errors['errors'], 'message')).' (code %d).', $response->getStatusCode()), $response);
|
throw new HttpTransportException('Unable to send an email: '.implode('; ', array_column($errors['errors'], 'message')).sprintf(' (code %d).', $response->getStatusCode()), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
$sentMessage->setMessageId($response->getHeaders(false)['x-message-id'][0]);
|
||||||
|
@ -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": '.$msg, $this->url));
|
throw new TransportException(sprintf('Connection could not be established with host "%s": ', $this->url).$msg);
|
||||||
});
|
});
|
||||||
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);
|
||||||
|
@ -1648,7 +1648,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": '.$commandline, $matches[1]));
|
throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->escapeArgument($env[$matches[1]]);
|
return $this->escapeArgument($env[$matches[1]]);
|
||||||
|
@ -106,7 +106,7 @@ class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface,
|
|||||||
|
|
||||||
$dateTimeErrors = \DateTime::class === $type ? \DateTime::getLastErrors() : \DateTimeImmutable::getLastErrors();
|
$dateTimeErrors = \DateTime::class === $type ? \DateTime::getLastErrors() : \DateTimeImmutable::getLastErrors();
|
||||||
|
|
||||||
throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors:.'."\n".'%s', $data, $dateTimeFormat, $dateTimeErrors['error_count'], implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors']))));
|
throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors: ', $data, $dateTimeFormat, $dateTimeErrors['error_count'])."\n".implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -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): '.intl_get_error_message(), intl_get_error_code()), 0, $e);
|
throw new InvalidArgumentException(sprintf('Invalid message format (error #%d): ', intl_get_error_code()).intl_get_error_message(), 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): '.$formatter->getErrorMessage(), $formatter->getErrorCode()));
|
throw new InvalidArgumentException(sprintf('Unable to format message (error #%s): ', $formatter->getErrorCode()).$formatter->getErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
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: '.XliffUtils::getErrorsAsString($errors), $resource));
|
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: ', $resource).XliffUtils::getErrorsAsString($errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('1.2' === $xliffVersion) {
|
if ('1.2' === $xliffVersion) {
|
||||||
|
@ -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": '.$errstr.' '.$errno, $this->host));
|
throw new \RuntimeException(sprintf('Server start failed on "%s": ', $this->host).$errstr.' '.$errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user