Update composer dependencies

This commit is contained in:
Chris
2019-06-11 12:29:32 +01:00
parent 7d6df3843b
commit 1f608b1c21
1835 changed files with 74500 additions and 27482 deletions

View File

@@ -29,7 +29,7 @@ class Connection
* @param string $host The server host
* @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
*/
public function __construct(string $host, array $contextProviders = array())
public function __construct(string $host, array $contextProviders = [])
{
if (false === strpos($host, '://')) {
$host = 'tcp://'.$host;
@@ -51,14 +51,14 @@ class Connection
return false;
}
$context = array('timestamp' => microtime(true));
$context = ['timestamp' => microtime(true)];
foreach ($this->contextProviders as $name => $provider) {
$context[$name] = $provider->getContext();
}
$context = array_filter($context);
$encodedPayload = base64_encode(serialize(array($data, $context)))."\n";
$encodedPayload = base64_encode(serialize([$data, $context]))."\n";
set_error_handler(array(self::class, 'nullErrorHandler'));
set_error_handler([self::class, 'nullErrorHandler']);
try {
if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) {
return true;
@@ -85,13 +85,11 @@ class Connection
private function createSocket()
{
set_error_handler(array(self::class, 'nullErrorHandler'));
set_error_handler([self::class, 'nullErrorHandler']);
try {
return stream_socket_client($this->host, $errno, $errstr, 3, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
} finally {
restore_error_handler();
}
return $socket;
}
}

View File

@@ -52,12 +52,12 @@ class DumpServer
}
foreach ($this->getMessages() as $clientId => $message) {
$payload = @unserialize(base64_decode($message), array('allowed_classes' => array(Data::class, Stub::class)));
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);
// Impossible to decode the message, give up.
if (false === $payload) {
if ($this->logger) {
$this->logger->warning('Unable to decode a message from {clientId} client.', array('clientId' => $clientId));
$this->logger->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);
}
continue;
@@ -65,7 +65,7 @@ class DumpServer
if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) {
if ($this->logger) {
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', array('clientId' => $clientId));
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);
}
continue;
@@ -84,8 +84,8 @@ class DumpServer
private function getMessages(): iterable
{
$sockets = array((int) $this->socket => $this->socket);
$write = array();
$sockets = [(int) $this->socket => $this->socket];
$write = [];
while (true) {
$read = $sockets;