Update to laravel 7

This commit is contained in:
KodeStar
2022-03-10 11:54:29 +00:00
parent 61a5a1a8b0
commit f9a19fce91
7170 changed files with 274189 additions and 283773 deletions

View File

@@ -23,6 +23,10 @@ class Connection
{
private $host;
private $contextProviders;
/**
* @var resource|null
*/
private $socket;
/**
@@ -31,7 +35,7 @@ class Connection
*/
public function __construct(string $host, array $contextProviders = [])
{
if (false === strpos($host, '://')) {
if (!str_contains($host, '://')) {
$host = 'tcp://'.$host;
}
@@ -64,7 +68,7 @@ class Connection
return true;
}
if (!$socketIsFresh) {
stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR);
stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR);
fclose($this->socket);
$this->socket = $this->createSocket();
}
@@ -78,7 +82,7 @@ class Connection
return false;
}
private static function nullErrorHandler($t, $m)
private static function nullErrorHandler(int $t, string $m)
{
// no-op
}
@@ -87,7 +91,7 @@ class Connection
{
set_error_handler([self::class, 'nullErrorHandler']);
try {
return stream_socket_client($this->host, $errno, $errstr, 3, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
return stream_socket_client($this->host, $errno, $errstr, 3, \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT);
} finally {
restore_error_handler();
}

View File

@@ -25,12 +25,16 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class DumpServer
{
private $host;
private $socket;
private $logger;
/**
* @var resource|null
*/
private $socket;
public function __construct(string $host, LoggerInterface $logger = null)
{
if (false === strpos($host, '://')) {
if (!str_contains($host, '://')) {
$host = 'tcp://'.$host;
}
@@ -41,7 +45,7 @@ class DumpServer
public function start(): void
{
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": ', $this->host).$errstr.' '.$errno);
}
}
@@ -52,6 +56,10 @@ class DumpServer
}
foreach ($this->getMessages() as $clientId => $message) {
if ($this->logger) {
$this->logger->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
}
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);
// Impossible to decode the message, give up.
@@ -71,7 +79,7 @@ class DumpServer
continue;
}
list($data, $context) = $payload;
[$data, $context] = $payload;
$callback($data, $context, $clientId);
}