Skip to content

Commit ccf560e

Browse files
Use InvocationStubber in return type declarations instead of InvocationStubberImplementation (self)
1 parent e2c31b7 commit ccf560e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Framework/MockObject/Runtime/InvocationStubberImplementation.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(InvocationHandler $handler, Matcher $matcher, Config
6565
*
6666
* @return $this
6767
*/
68-
public function id(string $id): self
68+
public function id(string $id): InvocationStubber
6969
{
7070
$this->invocationHandler->registerMatcher($id, $this->matcher);
7171

@@ -75,7 +75,7 @@ public function id(string $id): self
7575
/**
7676
* @return $this
7777
*/
78-
public function will(Stub $stub): self
78+
public function will(Stub $stub): InvocationStubber
7979
{
8080
$this->matcher->setStub($stub);
8181

@@ -85,7 +85,7 @@ public function will(Stub $stub): self
8585
/**
8686
* @throws IncompatibleReturnValueException
8787
*/
88-
public function willReturn(mixed $value, mixed ...$nextValues): self
88+
public function willReturn(mixed $value, mixed ...$nextValues): InvocationStubber
8989
{
9090
if (count($nextValues) === 0) {
9191
$this->ensureTypeOfReturnValues([$value]);
@@ -104,14 +104,14 @@ public function willReturn(mixed $value, mixed ...$nextValues): self
104104
return $this->will($stub);
105105
}
106106

107-
public function willReturnReference(mixed &$reference): self
107+
public function willReturnReference(mixed &$reference): InvocationStubber
108108
{
109109
$stub = new ReturnReference($reference);
110110

111111
return $this->will($stub);
112112
}
113113

114-
public function willReturnMap(array $valueMap): self
114+
public function willReturnMap(array $valueMap): InvocationStubber
115115
{
116116
$method = $this->configuredMethod();
117117

@@ -156,35 +156,35 @@ public function willReturnMap(array $valueMap): self
156156
return $this->will($stub);
157157
}
158158

159-
public function willReturnArgument(int $argumentIndex): self
159+
public function willReturnArgument(int $argumentIndex): InvocationStubber
160160
{
161161
$stub = new ReturnArgument($argumentIndex);
162162

163163
return $this->will($stub);
164164
}
165165

166-
public function willReturnCallback(callable $callback): self
166+
public function willReturnCallback(callable $callback): InvocationStubber
167167
{
168168
$stub = new ReturnCallback($callback);
169169

170170
return $this->will($stub);
171171
}
172172

173-
public function willReturnSelf(): self
173+
public function willReturnSelf(): InvocationStubber
174174
{
175175
$stub = new ReturnSelf;
176176

177177
return $this->will($stub);
178178
}
179179

180-
public function willReturnOnConsecutiveCalls(mixed ...$values): self
180+
public function willReturnOnConsecutiveCalls(mixed ...$values): InvocationStubber
181181
{
182182
$stub = new ConsecutiveCalls($values);
183183

184184
return $this->will($stub);
185185
}
186186

187-
public function willThrowException(Throwable $exception): self
187+
public function willThrowException(Throwable $exception): InvocationStubber
188188
{
189189
$stub = new Exception($exception);
190190

@@ -194,7 +194,7 @@ public function willThrowException(Throwable $exception): self
194194
/**
195195
* @return $this
196196
*/
197-
public function after(string $id): self
197+
public function after(string $id): InvocationStubber
198198
{
199199
$this->matcher->setAfterMatchBuilderId($id);
200200

@@ -208,7 +208,7 @@ public function after(string $id): self
208208
*
209209
* @return $this
210210
*/
211-
public function with(mixed ...$arguments): self
211+
public function with(mixed ...$arguments): InvocationStubber
212212
{
213213
$this->ensureParametersCanBeConfigured();
214214

@@ -223,7 +223,7 @@ public function with(mixed ...$arguments): self
223223
*
224224
* @return $this
225225
*/
226-
public function withAnyParameters(): self
226+
public function withAnyParameters(): InvocationStubber
227227
{
228228
$this->ensureParametersCanBeConfigured();
229229

@@ -239,7 +239,7 @@ public function withAnyParameters(): self
239239
*
240240
* @return $this
241241
*/
242-
public function method(Constraint|PropertyHook|string $constraint): self
242+
public function method(Constraint|PropertyHook|string $constraint): InvocationStubber
243243
{
244244
if ($this->matcher->hasMethodNameRule()) {
245245
throw new MethodNameAlreadyConfiguredException;

0 commit comments

Comments
 (0)