Skip to content

Commit df77819

Browse files
OskarStarkxabbuh
authored andcommitted
[Filesystem][Finder][Form] Use CPP
1 parent 8533622 commit df77819

15 files changed

+86
-102
lines changed

Chunk/DataChunk.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
*/
2121
class DataChunk implements ChunkInterface
2222
{
23-
private int $offset = 0;
24-
private string $content = '';
25-
26-
public function __construct(int $offset = 0, string $content = '')
27-
{
28-
$this->offset = $offset;
29-
$this->content = $content;
23+
public function __construct(
24+
private int $offset = 0,
25+
private string $content = '',
26+
) {
3027
}
3128

3229
public function isTimeout(): bool

Chunk/ErrorChunk.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
class ErrorChunk implements ChunkInterface
2424
{
2525
private bool $didThrow = false;
26-
private int $offset;
2726
private string $errorMessage;
2827
private ?\Throwable $error = null;
2928

30-
public function __construct(int $offset, \Throwable|string $error)
31-
{
32-
$this->offset = $offset;
33-
29+
public function __construct(
30+
private int $offset,
31+
\Throwable|string $error,
32+
) {
3433
if (\is_string($error)) {
3534
$this->errorMessage = $error;
3635
} else {

Internal/AmpBody.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ class AmpBody implements RequestBody, InputStream
2727
{
2828
private ResourceInputStream|\Closure|string $body;
2929
private array $info;
30-
private \Closure $onProgress;
3130
private ?int $offset = 0;
3231
private int $length = -1;
3332
private ?int $uploaded = null;
3433

3534
/**
3635
* @param \Closure|resource|string $body
3736
*/
38-
public function __construct($body, &$info, \Closure $onProgress)
39-
{
37+
public function __construct(
38+
$body,
39+
&$info,
40+
private \Closure $onProgress,
41+
) {
4042
$this->info = &$info;
41-
$this->onProgress = $onProgress;
4243

4344
if (\is_resource($body)) {
4445
$this->offset = ftell($body);

Internal/AmpClientState.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,15 @@ final class AmpClientState extends ClientState
4747

4848
private array $clients = [];
4949
private \Closure $clientConfigurator;
50-
private int $maxHostConnections;
51-
private int $maxPendingPushes;
52-
private ?LoggerInterface $logger;
5350

54-
public function __construct(?callable $clientConfigurator, int $maxHostConnections, int $maxPendingPushes, ?LoggerInterface &$logger)
55-
{
51+
public function __construct(
52+
?callable $clientConfigurator,
53+
private int $maxHostConnections,
54+
private int $maxPendingPushes,
55+
private ?LoggerInterface &$logger,
56+
) {
5657
$clientConfigurator ??= static fn (PooledHttpClient $client) => new InterceptedHttpClient($client, new RetryRequests(2));
5758
$this->clientConfigurator = $clientConfigurator(...);
58-
59-
$this->maxHostConnections = $maxHostConnections;
60-
$this->maxPendingPushes = $maxPendingPushes;
61-
$this->logger = &$logger;
6259
}
6360

6461
/**

Internal/AmpListener.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
class AmpListener implements EventListener
2727
{
2828
private array $info;
29-
private array $pinSha256;
30-
private \Closure $onProgress;
31-
/** @var resource|null */
32-
private $handle;
3329

34-
public function __construct(array &$info, array $pinSha256, \Closure $onProgress, &$handle)
35-
{
30+
/**
31+
* @param resource|null $handle
32+
*/
33+
public function __construct(
34+
array &$info,
35+
private array $pinSha256,
36+
private \Closure $onProgress,
37+
private &$handle,
38+
) {
3639
$info += [
3740
'connect_time' => 0.0,
3841
'pretransfer_time' => 0.0,
@@ -44,9 +47,6 @@ public function __construct(array &$info, array $pinSha256, \Closure $onProgress
4447
];
4548

4649
$this->info = &$info;
47-
$this->pinSha256 = $pinSha256;
48-
$this->onProgress = $onProgress;
49-
$this->handle = &$handle;
5050
}
5151

5252
public function startRequest(Request $request): Promise

Internal/AmpResolver.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@
2525
*/
2626
class AmpResolver implements Dns\Resolver
2727
{
28-
private array $dnsMap;
29-
30-
public function __construct(array &$dnsMap)
31-
{
32-
$this->dnsMap = &$dnsMap;
28+
public function __construct(
29+
private array &$dnsMap,
30+
) {
3331
}
3432

3533
public function resolve(string $name, int $typeRestriction = null): Promise

Internal/Canary.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
*/
1919
final class Canary
2020
{
21-
private \Closure $canceller;
22-
23-
public function __construct(\Closure $canceller)
24-
{
25-
$this->canceller = $canceller;
21+
public function __construct(
22+
private \Closure $canceller,
23+
) {
2624
}
2725

2826
public function cancel(): void

Internal/HttplugWaitLoop.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,15 @@
3030
*/
3131
final class HttplugWaitLoop
3232
{
33-
private HttpClientInterface $client;
34-
private ?\SplObjectStorage $promisePool;
35-
private ResponseFactoryInterface $responseFactory;
36-
private StreamFactoryInterface $streamFactory;
37-
3833
/**
3934
* @param \SplObjectStorage<ResponseInterface, array{Psr7RequestInterface, Promise}>|null $promisePool
4035
*/
41-
public function __construct(HttpClientInterface $client, ?\SplObjectStorage $promisePool, ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)
42-
{
43-
$this->client = $client;
44-
$this->promisePool = $promisePool;
45-
$this->responseFactory = $responseFactory;
46-
$this->streamFactory = $streamFactory;
36+
public function __construct(
37+
private HttpClientInterface $client,
38+
private ?\SplObjectStorage $promisePool,
39+
private ResponseFactoryInterface $responseFactory,
40+
private StreamFactoryInterface $streamFactory,
41+
) {
4742
}
4843

4944
public function wait(?ResponseInterface $pendingResponse, float $maxDuration = null, float $idleTimeout = null): int

Response/AmpResponse.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
4545

4646
private static string $nextId = 'a';
4747

48-
private AmpClientState $multi;
4948
private ?array $options;
5049
private \Closure $onProgress;
5150

@@ -54,9 +53,12 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
5453
/**
5554
* @internal
5655
*/
57-
public function __construct(AmpClientState $multi, Request $request, array $options, ?LoggerInterface $logger)
58-
{
59-
$this->multi = $multi;
56+
public function __construct(
57+
private AmpClientState $multi,
58+
Request $request,
59+
array $options,
60+
?LoggerInterface $logger,
61+
) {
6062
$this->options = &$options;
6163
$this->logger = $logger;
6264
$this->timeout = $options['timeout'];

Response/CurlResponse.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
3232
}
3333
use TransportResponseTrait;
3434

35-
private CurlClientState $multi;
36-
3735
/**
3836
* @var resource
3937
*/
@@ -42,10 +40,16 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
4240
/**
4341
* @internal
4442
*/
45-
public function __construct(CurlClientState $multi, \CurlHandle|string $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null, string $originalUrl = null)
46-
{
47-
$this->multi = $multi;
48-
43+
public function __construct(
44+
private CurlClientState $multi,
45+
\CurlHandle|string $ch,
46+
array $options = null,
47+
LoggerInterface $logger = null,
48+
string $method = 'GET',
49+
callable $resolveRedirect = null,
50+
int $curlVersion = null,
51+
string $originalUrl = null,
52+
) {
4953
if ($ch instanceof \CurlHandle) {
5054
$this->handle = $ch;
5155
$this->debugBuffer = fopen('php://temp', 'w+');

0 commit comments

Comments
 (0)