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

Do not cast integer as string ids + Fix Zero ID + PHP Coduo #93

Merged
merged 6 commits into from
May 6, 2023

Conversation

yoanm
Copy link
Owner

@yoanm yoanm commented May 5, 2023

No description provided.

@@ -50,11 +50,7 @@ protected function bindIdIfProvided(JsonRpcRequest $request, array $item) : void
{
/** If no id defined => request is a notification */
if (isset($item[self::KEY_ID])) {
$request->setId(
$item[self::KEY_ID] == (string)((int)$item[self::KEY_ID])
? (int)$item[self::KEY_ID] // Convert it in case it's a string containing an int
Copy link
Owner Author

@yoanm yoanm May 5, 2023

Choose a reason for hiding this comment

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

Unsure why I did that 🤔 Saw nothing on JSON-RPC specification regarding that point => removed

EDIT: Most likely a matter of typehint, but there is already a check on setId method to ensure id is either a string or an interger

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #93 (746ae8d) into master (a9b7bc6) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##              master       #93   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
+ Complexity       170       169    -1     
===========================================
  Files             28        28           
  Lines            454       450    -4     
===========================================
- Hits             454       450    -4     
Flag Coverage Δ
functional-tests 99.55% <100.00%> (-0.01%) ⬇️
php-8.2 100.00% <100.00%> (ø)
unit-tests 18.88% <50.00%> (-0.94%) ⬇️
Impacted Files Coverage Δ
src/App/Creator/ResponseCreator.php 100.00% <100.00%> (ø)
...c/App/Serialization/JsonRpcRequestDenormalizer.php 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yoanm yoanm linked an issue May 6, 2023 that may be closed by this pull request
@yoanm yoanm changed the title Do not cast integer as string ids + PHP Coduo Do not cast integer as string ids + Fix Zero ID + PHP Coduo May 6, 2023
@yoanm yoanm force-pushed the feature/php-coduo branch from b220ec4 to 746ae8d Compare May 6, 2023 06:02
@yoanm yoanm marked this pull request as ready for review May 6, 2023 06:09
@yoanm yoanm merged commit 3bd886b into master May 6, 2023
@yoanm yoanm deleted the feature/php-coduo branch May 6, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for zero IDs; notifications are only NULL
2 participants