@@ -33,31 +33,34 @@ public function testRestartChain(PluginClient $client, string $method, string $r
33
33
34
34
public function clientAndMethodProvider ()
35
35
{
36
- $ syncClient = new class implements ClientInterface {
36
+ $ syncClient = new class () implements ClientInterface {
37
37
public function sendRequest (RequestInterface $ request ): ResponseInterface
38
38
{
39
39
return new Response ();
40
40
}
41
41
};
42
42
43
- $ asyncClient = new class implements HttpAsyncClient {
43
+ $ asyncClient = new class () implements HttpAsyncClient {
44
44
public function sendAsyncRequest (RequestInterface $ request )
45
45
{
46
46
return new HttpFulfilledPromise (new Response ());
47
47
}
48
48
};
49
49
50
- $ headerAppendPlugin = new HeaderAppendPlugin (['Content-Type ' => 'text/html ' ]);
50
+ $ headerAppendPlugin = new HeaderAppendPlugin (['Content-Type ' => 'text/html ' ]);
51
51
$ redirectPlugin = new RedirectPlugin ();
52
- $ restartOncePlugin = new class implements Plugin {
52
+ $ restartOncePlugin = new class () implements Plugin {
53
53
private $ firstRun = true ;
54
54
55
55
public function handleRequest (RequestInterface $ request , callable $ next , callable $ first ): Promise
56
56
{
57
57
if ($ this ->firstRun ) {
58
58
$ this ->firstRun = false ;
59
- return $ first ($ request )->wait ();
59
+
60
+ return $ first ($ request );
60
61
}
62
+ $ this ->firstRun = true ;
63
+
61
64
return $ next ($ request );
62
65
}
63
66
};
@@ -73,4 +76,4 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
73
76
yield [$ pluginClient , 'sendRequest ' , ResponseInterface::class];
74
77
yield [$ pluginClient , 'sendAsyncRequest ' , Promise::class];
75
78
}
76
- }
79
+ }
0 commit comments