8000 [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes by SpacePossum · Pull Request #21010 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes #21010

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

Closed
Changes from 1 commit
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
Prev Previous commit
Update after review.
  • Loading branch information
SpacePossum committed Dec 27, 2016
commit 591b2cad06811e8940ec0ab4aba0f3e27b176e2b
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function handleError(array $error, FatalErrorException $exception)

$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);

if (null === $methods = get_class_methods($className)) {
if (!class_exists($className) || null === $methods = get_class_methods($className)) {
// failed to get the class or its methods on which an unknown method was called (for example on an anonymous class)
return new UndefinedMethodException($message, $exception);
}

Expand All @@ -56,6 +57,7 @@ public function handleError(array $error, FatalErrorException $exception)
} else {
$candidates = '"'.$last;
}

$message .= "\nDid you mean to call ".$candidates;
}

Expand Down
0