Skip to content

Commit c2dc716

Browse files
kubawerlossebastianbergmann
authored andcommitted
Do not use the ternary operator
1 parent 1c004af commit c2dc716

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Framework/Constraint/Callback.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function toString(): string
4242
/**
4343
* @psalm-suppress ArgumentTypeCoercion
4444
*/
45-
public function hasVariadicParam(): bool
45+
public function isVariadic(): bool
4646
{
4747
foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) {
4848
if ($parameter->isVariadic()) {
@@ -63,8 +63,10 @@ public function hasVariadicParam(): bool
6363
*/
6464
protected function matches(mixed $other): bool
6565
{
66-
return $this->hasVariadicParam()
67-
? ($this->callback)(...$other)
68-
: ($this->callback)($other);
66+
if ($this->isVariadic()) {
67+
return ($this->callback)(...$other);
68+
}
69+
70+
return ($this->callback)($other);
6971
}
7072
}

src/Framework/MockObject/Runtime/Rule/Parameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function doVerify(): bool
109109
}
110110

111111
foreach ($this->parameters as $i => $parameter) {
112-
if ($parameter instanceof Callback && $parameter->hasVariadicParam()) {
112+
if ($parameter instanceof Callback && $parameter->isVariadic()) {
113113
$other = $this->invocation->parameters();
114114
} else {
115115
$other = $this->invocation->parameters()[$i];

0 commit comments

Comments
 (0)