Skip to content

Fix bc compatiblity between ErrorRenderer FlattenException and Debug FlattenException #33916

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
wants to merge 3 commits into from
Closed
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
10 changes: 10 additions & 0 deletions src/Symfony/Component/ErrorRenderer/Exception/FlattenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ class FlattenException
private $file;
private $line;

/**
* @deprecated since Symfony 4.4, use createFromThrowable() instead.
*/
public static function create(\Exception $exception, $statusCode = null, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use "createFromThrowable()" instead.', __METHOD__), E_USER_DEPRECATED);

return static::createFromThrowable($exception, $statusCode, $headers);
}

public static function createFromThrowable(\Throwable $exception, int $statusCode = null, array $headers = []): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about renaming this one to create instead? that would make the most sense to me as the current name is due to history - but this is a new component now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if somebody did use createFromThrowable which did also exist on the Debug FlattenException it will get there an error. I think in 4.4 we still should provide both functions.

{
$e = new static();
Expand Down