Repository navigation
Multiple code quality improvements - #40
Merged
Merged
Conversation
- document fact that `respondNoContent` method signature will change in future releases (per RFC 9110, a 204 response MUST NOT include content), add deprecated tag - remove magic number from `apiResponse` method signature - Use \Throwable instead of Exception (`morphMessage(string|Exception $message)` misses Error subclasses (TypeError, ValueError, etc.). As the package is now PHP 8.2+, use string|\Throwable) - fix indentation in `respondCreated` and `respondTeapot` methods - fix `morphToArray` method. `jsonSerialize()` returns mixed, not array `JsonSerializable::jsonSerialize()` has a return type of mixed in PHP 8.0+. If an object returns a scalar, the `?array` return type annotation is a lie and `apiResponse(array $data)` will throw a TypeError at runtime - redundant null coalescing in `respondCreated` and `respondNoContent` methods
- add `respondTooManyRequests()`, `respondConflict()` and `respondAccepted()` methods
- refactor data providers to use generators - add missing tests for new helper methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
respondNoContent()method signature will change in future releases (per RFC 9110, a 204 response MUST NOT include content), add deprecated tagapiResponse()method signaturemorphMessage(string|Exception $message)misses Error subclasses (TypeError, ValueError, etc.) - package is now PHP 8.2+, use string|\Throwable)respondCreated()andrespondTeapot()methodsmorphToArray()method -jsonSerialize()returns mixed, not arrayJsonSerializable::jsonSerialize()has a return type of mixed in PHP 8.0+. If an object returns a scalar, the?arrayreturn type annotation is a lie andapiResponse(array $data)will throw a TypeError at runtimerespondCreated()andrespondNoContent()methodsrespondAccepted(),respondConflict()andrespondTooManyRequests()(with tests)testSuccessResponseDefaults()within testsrespondAccepted()methodrespondFailedValidation()methodrespondNotFound()method^5.0for the checkout and cache actions within the GitHub actions file