Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return type error for unexpected method calls #518

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/Prophecy/Call/CallCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Prophecy\Call;

use Prophecy\Exception\Prophecy\MethodProphecyException;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Argument\ArgumentsWildcard;
use Prophecy\Util\StringUtil;
Expand Down Expand Up @@ -81,12 +82,10 @@ public function makeCall(ObjectProphecy $prophecy, $methodName, array $arguments
// There are method prophecies, so it's a fake/stub. Searching prophecy for this call
$matches = $this->findMethodProphecies($prophecy, $methodName, $arguments);

// If fake/stub doesn't have method prophecy for this call - throw exception
// If fake/stub doesn't have method prophecy for this call - remember it as unexpected method call
if (!count($matches)) {
$this->unexpectedCalls->attach(new Call($methodName, $arguments, null, null, $file, $line), $prophecy);
$this->recordedCalls[] = new Call($methodName, $arguments, null, null, $file, $line);

return null;
$matches = [[1, new MethodProphecy($prophecy, $methodName, $arguments)]];
}

// Sort matches by their score value
Expand Down