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

Add ErrorData and HeaderRenderer classes #26

Merged
merged 11 commits into from Feb 20, 2021
Merged

Add ErrorData and HeaderRenderer classes #26

merged 11 commits into from Feb 20, 2021

Conversation

devanych
Copy link
Member

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️
Fixed issues #12, #13

@devanych devanych changed the title Add new classes Add ErrorData and HeaderRenderer classes Feb 17, 2021
@devanych devanych added the status:code review The pull request needs review. label Feb 17, 2021
*
* @return ResponseInterface The response with error data.
*/
public function setToResponse(ResponseInterface $response): ResponseInterface
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function setToResponse(ResponseInterface $response): ResponseInterface
public function addToResponse(ResponseInterface $response): ResponseInterface

That's how it's usually named.

use Psr\Http\Message\ResponseInterface;

/**
* ErrorData stores content and headers that are suitable for displaying.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* ErrorData stores content and headers that are suitable for displaying.
* ErrorData stores content and headers that are suitable for adding to response.

private string $content;

/**
* @var array<string, string|string[]> The headers of error data to add to the response.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @var array<string, string|string[]> The headers of error data to add to the response.
* @var array<string, string|string[]> The headers to add to the response.

Comment on lines 14 to 17
/**
* @var string The content of error data.
*/
private string $content;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* @var string The content of error data.
*/
private string $content;
/**
* @var string The content to use as response body.
*/
private string $content;

Comment on lines 25 to 26
* @param string $content The content of error data.
* @param array<string, string|string[]> $headers The headers of error data to add to the response.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param string $content The content of error data.
* @param array<string, string|string[]> $headers The headers of error data to add to the response.
* @param string $content The content to use as response body.
* @param array<string, string|string[]> $headers The headers to add to the response.

src/ErrorData.php Show resolved Hide resolved
return $new;
}

/**
* @param string[] $mimeTypes MIME types or, if not specified, all will be removed.
* @param string[] $contentTypes MIME types or, if not specified, all will be removed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param string[] $contentTypes MIME types or, if not specified, all will be removed.
* @param string[] $contentTypes MIME types to remove associated renderers for. If not specified, all renderers will be removed.

@@ -8,27 +8,29 @@
use Throwable;

/**
* ThrowableRendererInterface converts throwable into its string representation
* ThrowableRendererInterface converts throwable into error data suitable for displaying.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* ThrowableRendererInterface converts throwable into error data suitable for displaying.
* ThrowableRendererInterface converts throwable into error data suitable for adding it to response.

@samdark samdark added status:under development Someone is working on a pull request. and removed status:code review The pull request needs review. labels Feb 17, 2021
@devanych devanych added status:code review The pull request needs review. and removed status:under development Someone is working on a pull request. labels Feb 18, 2021
@samdark samdark merged commit d71e561 into yiisoft:master Feb 20, 2021
@samdark
Copy link
Member

samdark commented Feb 20, 2021

👍

@devanych devanych deleted the add-new-classes branch February 20, 2021 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants