cs: don't import globals
This commit is contained in:
@@ -5,12 +5,6 @@ declare(strict_types=1);
|
||||
namespace Nsq\Config;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use InvalidArgumentException;
|
||||
use JsonSerializable;
|
||||
use function gethostname;
|
||||
use function json_encode;
|
||||
use const JSON_FORCE_OBJECT;
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
/**
|
||||
* This class is used for configuring the clients for nsq. Immutable properties must be set when creating the object and
|
||||
@@ -19,7 +13,7 @@ use const JSON_THROW_ON_ERROR;
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class ClientConfig implements JsonSerializable
|
||||
final class ClientConfig implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* @psalm-suppress ImpureFunctionCall
|
||||
@@ -116,7 +110,7 @@ final class ClientConfig implements JsonSerializable
|
||||
}
|
||||
|
||||
if ($this->snappy && $this->deflate) {
|
||||
throw new InvalidArgumentException('Client cannot enable both [snappy] and [deflate]');
|
||||
throw new \InvalidArgumentException('Client cannot enable both [snappy] and [deflate]');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,11 +22,6 @@ use Nsq\Socket\SnappySocket;
|
||||
use Psr\Log\LoggerAwareTrait;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Throwable;
|
||||
use function addcslashes;
|
||||
use function http_build_query;
|
||||
use function implode;
|
||||
use const PHP_EOL;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -111,7 +106,7 @@ abstract class Connection
|
||||
try {
|
||||
$this->command('CLS');
|
||||
$this->socket->close();
|
||||
} catch (Throwable) {
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
|
||||
$this->closed = true;
|
||||
|
@@ -12,7 +12,6 @@ use Nsq\Protocol\Error;
|
||||
use Nsq\Protocol\Message;
|
||||
use Nsq\Protocol\Response;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use function microtime;
|
||||
|
||||
final class Consumer extends Connection
|
||||
{
|
||||
@@ -31,7 +30,7 @@ final class Consumer extends Connection
|
||||
/**
|
||||
* @psalm-return Generator<int, Message|float|null, int|null, void>
|
||||
*/
|
||||
public function generator(): Generator
|
||||
public function generator(): \Generator
|
||||
{
|
||||
$this->command('SUB', [$this->topic, $this->channel])->checkIsOK();
|
||||
|
||||
|
@@ -4,14 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Nsq\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
final class ConnectionFail extends NsqException
|
||||
{
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function fromThrowable(Throwable $throwable): self
|
||||
public static function fromThrowable(\Throwable $throwable): self
|
||||
{
|
||||
return new self($throwable->getMessage(), (int) $throwable->getCode(), $throwable);
|
||||
}
|
||||
|
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Nsq\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class NsqException extends RuntimeException
|
||||
class NsqException extends \RuntimeException
|
||||
{
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ use Nsq\Exception\ConnectionFail;
|
||||
use Nsq\Socket\Socket;
|
||||
use PHPinnacle\Buffer\ByteBuffer;
|
||||
use Throwable;
|
||||
use const PHP_EOL;
|
||||
|
||||
final class NsqSocket
|
||||
{
|
||||
|
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Nsq\Protocol;
|
||||
|
||||
use Nsq\Bytes;
|
||||
use function explode;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
|
@@ -5,8 +5,6 @@ declare(strict_types=1);
|
||||
namespace Nsq\Protocol;
|
||||
|
||||
use Nsq\Bytes;
|
||||
use function json_decode;
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
|
@@ -8,7 +8,6 @@ use Nsq\Exception\ConnectionFail;
|
||||
use Psr\Log\LoggerAwareTrait;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Throwable;
|
||||
|
||||
final class ExponentialStrategy implements ReconnectStrategy
|
||||
{
|
||||
@@ -47,7 +46,7 @@ final class ExponentialStrategy implements ReconnectStrategy
|
||||
|
||||
try {
|
||||
$callable();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
$nextDelay = 0 === $this->delay ? $this->minDelay : $this->delay * 2;
|
||||
$this->delay = $nextDelay > $this->maxDelay ? $this->maxDelay : $nextDelay;
|
||||
$this->nextTryAfter = $currentTime + $this->delay;
|
||||
|
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Nsq\Socket;
|
||||
|
||||
use LogicException;
|
||||
|
||||
final class DeflateSocket implements Socket
|
||||
{
|
||||
public function __construct(
|
||||
@@ -18,7 +16,7 @@ final class DeflateSocket implements Socket
|
||||
*/
|
||||
public function write(string $data): void
|
||||
{
|
||||
throw new LogicException('not implemented.');
|
||||
throw new \LogicException('not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,7 +24,7 @@ final class DeflateSocket implements Socket
|
||||
*/
|
||||
public function read(int $length): string
|
||||
{
|
||||
throw new LogicException('not implemented.');
|
||||
throw new \LogicException('not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +32,7 @@ final class DeflateSocket implements Socket
|
||||
*/
|
||||
public function close(): void
|
||||
{
|
||||
throw new LogicException('not implemented.');
|
||||
throw new \LogicException('not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -6,10 +6,6 @@ namespace Nsq\Socket;
|
||||
|
||||
use PHPinnacle\Buffer\ByteBuffer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use function hash;
|
||||
use function pack;
|
||||
use function str_split;
|
||||
use function unpack;
|
||||
|
||||
final class SnappySocket implements Socket
|
||||
{
|
||||
|
Reference in New Issue
Block a user