Skip to content

Commit e47d098

Browse files
Narrow types
1 parent 4b7f2a8 commit e47d098

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/Framework/MockObject/Runtime/Interface/InvocationStubber.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ interface InvocationStubber
2424
public function method(Constraint|string $constraint): self;
2525

2626
/**
27+
* @param non-empty-string $id
28+
*
2729
* @return $this
2830
*/
2931
public function id(string $id): self;
3032

3133
/**
34+
* @param non-empty-string $id
35+
*
3236
* @return $this
3337
*/
3438
public function after(string $id): self;

src/Framework/MockObject/Runtime/InvocationHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class InvocationHandler
2727
private array $matchers = [];
2828

2929
/**
30-
* @var array<string,Matcher>
30+
* @var array<non-empty-string, Matcher>
3131
*/
3232
private array $matcherMap = [];
3333

@@ -59,6 +59,8 @@ public function hasMatchers(): bool
5959

6060
/**
6161
* Looks up the match builder with identification $id and returns it.
62+
*
63+
* @param non-empty-string $id
6264
*/
6365
public function lookupMatcher(string $id): ?Matcher
6466
{
@@ -69,6 +71,8 @@ public function lookupMatcher(string $id): ?Matcher
6971
* Registers a matcher with the identification $id. The matcher can later be
7072
* looked up using lookupMatcher() to figure out if it has been invoked.
7173
*
74+
* @param non-empty-string $id
75+
*
7276
* @throws MatcherAlreadyRegisteredException
7377
*/
7478
public function registerMatcher(string $id, Matcher $matcher): void

src/Framework/MockObject/Runtime/InvocationStubberImplementation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ public function method(Constraint|PropertyHook|string $constraint): InvocationSt
9696
}
9797

9898
/**
99+
* @param non-empty-string $id
100+
*
99101
* @throws MatcherAlreadyRegisteredException
100102
*
101103
* @return $this
@@ -108,6 +110,8 @@ public function id(string $id): InvocationStubber
108110
}
109111

110112
/**
113+
* @param non-empty-string $id
114+
*
111115
* @return $this
112116
*/
113117
public function after(string $id): InvocationStubber

src/Framework/MockObject/Runtime/Matcher.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
final class Matcher
3030
{
3131
private readonly InvocationOrder $invocationRule;
32+
33+
/**
34+
* @var ?non-empty-string
35+
*/
3236
private ?string $afterMatchBuilderId = null;
3337
private ?MethodName $methodNameRule = null;
3438
private ?ParametersRule $parametersRule = null;
@@ -74,6 +78,9 @@ public function setStub(Stub $stub): void
7478
$this->stub = $stub;
7579
}
7680

81+
/**
82+
* @param non-empty-string $id
83+
*/
7784
public function setAfterMatchBuilderId(string $id): void
7885
{
7986
$this->afterMatchBuilderId = $id;

0 commit comments

Comments
 (0)