Merge pull request #1 from coswat/patch-1

phpcs fix
This commit is contained in:
Daniil Gentili 2023-08-29 15:27:12 +02:00 committed by GitHub
commit 87186112b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,27 +4,32 @@ namespace Reqwest;
use Revolt\EventLoop; use Revolt\EventLoop;
final class Client { final class Client
{
private static ?string $id = null; private static ?string $id = null;
public static function init(): void { public static function init(): void
{
if (self::$id !== null) { if (self::$id !== null) {
return; return;
} }
$f = fopen("php://fd/".\Client::init(), 'r+'); $f = fopen("php://fd/" . \Client::init(), "r+");
stream_set_blocking($f, false); stream_set_blocking($f, false);
self::$id = EventLoop::onReadable($f, fn () => \Client::wakeup()); self::$id = EventLoop::onReadable($f, fn() => \Client::wakeup());
} }
public static function reference(): void{ public static function reference(): void
{
EventLoop::reference(self::$id); EventLoop::reference(self::$id);
} }
public static function unreference(): void { public static function unreference(): void
{
EventLoop::unreference(self::$id); EventLoop::unreference(self::$id);
} }
public static function __callStatic(string $name, array $args): mixed { public static function __callStatic(string $name, array $args): mixed
{
return \Client::$name(...$args); return \Client::$name(...$args);
} }
} }