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

Fixed "TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, bool given" #1068

Merged
merged 1 commit into from Jun 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/Mockery/Mock.php
Expand Up @@ -612,7 +612,7 @@ public function mockery_getMockableProperties()

public function __isset($name)
{
if (false === stripos($name, '_mockery_') && method_exists(get_parent_class($this), '__isset')) {
if (false === stripos($name, '_mockery_') && get_parent_class($this) && method_exists(get_parent_class($this), '__isset')) {
return call_user_func('parent::__isset', $name);
}

Expand All @@ -635,7 +635,7 @@ public function mockery_getExpectations()
*/
public function mockery_callSubjectMethod($name, array $args)
{
if (!method_exists($this, $name) && method_exists(get_parent_class($this), '__call')) {
if (!method_exists($this, $name) && get_parent_class($this) && method_exists(get_parent_class($this), '__call')) {
return call_user_func('parent::__call', $name, $args);
}
return call_user_func_array('parent::' . $name, $args);
Expand Down Expand Up @@ -890,9 +890,9 @@ protected function _mockery_handleMethodCall($method, array $args)
) {
return call_user_func_array(array($this->_mockery_partial, $method), $args);
} elseif ($this->_mockery_deferMissing && is_callable("parent::$method")
&& (!$this->hasMethodOverloadingInParentClass() || method_exists(get_parent_class($this), $method))) {
&& (!$this->hasMethodOverloadingInParentClass() || (get_parent_class($this) && method_exists(get_parent_class($this), $method)))) {
return call_user_func_array("parent::$method", $args);
} elseif ($this->_mockery_deferMissing && method_exists(get_parent_class($this), '__call')) {
} elseif ($this->_mockery_deferMissing && get_parent_class($this) && method_exists(get_parent_class($this), '__call')) {
return call_user_func('parent::__call', $method, $args);
} elseif ($method == '__toString') {
// __toString is special because we force its addition to the class API regardless of the
Expand Down