Skip to content

Commit

Permalink
Merge pull request #548 from stof/add_return_types
Browse files Browse the repository at this point in the history
Add return types in comparator classes
  • Loading branch information
stof committed Dec 8, 2021
2 parents 8aceb6e + 0ccfa8d commit 9765889
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Prophecy/Comparator/ClosureComparator.php
Expand Up @@ -21,13 +21,13 @@
*/
final class ClosureComparator extends Comparator
{
public function accepts($expected, $actual)
public function accepts($expected, $actual): bool
{
return is_object($expected) && $expected instanceof \Closure
&& is_object($actual) && $actual instanceof \Closure;
}

public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array())
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array()): void
{
if ($expected !== $actual) {
throw new ComparisonFailure(
Expand Down
7 changes: 5 additions & 2 deletions src/Prophecy/Comparator/ProphecyComparator.php
Expand Up @@ -14,14 +14,17 @@
use Prophecy\Prophecy\ProphecyInterface;
use SebastianBergmann\Comparator\ObjectComparator;

/**
* @final
*/
class ProphecyComparator extends ObjectComparator
{
public function accepts($expected, $actual)
public function accepts($expected, $actual): bool
{
return is_object($expected) && is_object($actual) && $actual instanceof ProphecyInterface;
}

public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array())
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array()): void
{
parent::assertEquals($expected, $actual->reveal(), $delta, $canonicalize, $ignoreCase, $processed);
}
Expand Down

0 comments on commit 9765889

Please sign in to comment.