Skip to content

Commit 40b20bd

Browse files
sergix44github-actions[bot]
authored andcommitted
Fix styling
1 parent 39ce4fa commit 40b20bd

10 files changed

Lines changed: 15 additions & 28 deletions

File tree

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private function websocketLoop(Endpoint $endpoint, array $payload): ?Output
160160
} elseif ($message instanceof QueueFull) {
161161
$this->fireEvent(Event::QUEUE_FULL, [$message]);
162162
$ws->close();
163-
throw new QueueFullException();
163+
throw new QueueFullException;
164164
} elseif ($message instanceof Estimation) {
165165
$this->fireEvent(Event::QUEUE_ESTIMATION, [$message]);
166166
} elseif ($message instanceof SendData) {
@@ -205,7 +205,7 @@ private function sseLoop(Endpoint $endpoint, array $payload, string $protocol, ?
205205
]);
206206

207207
if ($response->getStatusCode() === 503) {
208-
throw new QueueFullException();
208+
throw new QueueFullException;
209209
}
210210

211211
if ($response->getStatusCode() !== 200) {

src/Client/Endpoint.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ public function __construct(
1010
private Config $config,
1111
public int $index,
1212
private readonly array $data
13-
) {
14-
}
13+
) {}
1514

1615
public function __get(string $name): mixed
1716
{

src/Client/RemoteClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public function __construct(string $src, ?string $hfToken = null, array $httpCli
3333
$this->src = str_ends_with($src, '/') ? $src : "{$src}/";
3434
$this->hfToken = $hfToken;
3535

36-
$this->hydrator = new Hydrator();
36+
$this->hydrator = new Hydrator;
3737

3838
$defaultHeaders = [
3939
'User-Agent' => 'gradio_client_php/1.0',
4040
'Accept' => 'application/json',
4141
];
4242

4343
if ($this->hfToken !== null) {
44-
$defaultHeaders['Authorization'] = 'Bearer ' . $this->hfToken;
44+
$defaultHeaders['Authorization'] = 'Bearer '.$this->hfToken;
4545
}
4646

4747
$mergedHeaders = array_merge($defaultHeaders, $httpClientOptions['headers'] ?? []);
@@ -72,7 +72,7 @@ protected function httpRaw(string $method, string $uri, array $params = [], arra
7272
protected function ws(string $uri, array $options = []): EnhancedClient
7373
{
7474
if ($this->hfToken !== null && ! isset($options['headers']['Authorization'])) {
75-
$options['headers']['Authorization'] = 'Bearer ' . $this->hfToken;
75+
$options['headers']['Authorization'] = 'Bearer '.$this->hfToken;
7676
}
7777

7878
return new EnhancedClient(preg_replace('/^http(s?):/', 'ws$1:', $this->src).$uri, $options);

src/DTO/Messages/ProcessStarts.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
namespace SergiX44\Gradio\DTO\Messages;
44

5-
class ProcessStarts extends Message
6-
{
7-
}
5+
class ProcessStarts extends Message {}

src/DTO/Messages/QueueFull.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
namespace SergiX44\Gradio\DTO\Messages;
44

5-
class QueueFull extends Message
6-
{
7-
}
5+
class QueueFull extends Message {}

src/DTO/Messages/SendHash.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
namespace SergiX44\Gradio\DTO\Messages;
44

5-
class SendHash extends Message
6-
{
7-
}
5+
class SendHash extends Message {}

src/DTO/Resolvers/MessageResolver.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public function concreteFor(array $data): ?string
2929
MessageType::PROCESS_GENERATING->value => ProcessGenerating::class,
3030
MessageType::PROCESS_COMPLETED->value => ProcessCompleted::class,
3131
MessageType::LOG->value => Log::class,
32-
default => (new class extends Message
33-
{
34-
})::class,
32+
default => (new class extends Message {})::class,
3533
};
3634
}
3735
}

src/Event/EventHandler.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
class EventHandler
66
{
7-
public function __construct(private Event $event, private $callback)
8-
{
9-
}
7+
public function __construct(private Event $event, private $callback) {}
108

119
public function __invoke()
1210
{

src/Exception/GradioException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use Exception;
66

7-
class GradioException extends Exception
8-
{
9-
}
7+
class GradioException extends Exception {}

tests/ClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function createClientWithMock(array $responses, ?string $hfToken = null, array &
9595
});
9696

9797
it('constructs client with pre-supplied config', function () {
98-
$config = new Config();
98+
$config = new Config;
9999
$config->version = '4.0.0';
100100
$config->dependencies = [];
101101
$config->protocol = 'sse_v3';
@@ -261,7 +261,7 @@ function createClientWithMock(array $responses, ?string $hfToken = null, array &
261261
});
262262

263263
it('handles extra config properties via magic methods', function () {
264-
$config = new Config();
264+
$config = new Config;
265265
$config->custom_property = 'test_value';
266266

267267
expect($config->custom_property)->toBe('test_value')
@@ -271,7 +271,7 @@ function createClientWithMock(array $responses, ?string $hfToken = null, array &
271271
});
272272

273273
it('returns outputs from output dto', function () {
274-
$output = new Output();
274+
$output = new Output;
275275
$output->data = ['first', 'second', 'third'];
276276

277277
expect($output->getOutputs())->toBe(['first', 'second', 'third'])

0 commit comments

Comments
 (0)