-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Log error response message #221
Conversation
Infection CI failures unrelated: seems to be a regression from #220 which somehow didn't trip during PR phase 🤷 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 here meanwhile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Urgh, wait, no - I was bamboozled by CTRL+F
not working in github logs 🤦
9) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] Concat
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation(PHP_EOL . 'Failed to create release through GitHub API;' . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
}
}
10) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] ConcatOperandRemoval
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation(PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
}
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . PHP_EOL . 'Status code: %s' . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
}
}
15) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] ConcatOperandRemoval
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
}
}
16) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] Concat
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . 'Message: %s' . PHP_EOL . PHP_EOL, $statusCode, $errorResponseData['message']);
}
}
17) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] ConcatOperandRemoval
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . PHP_EOL, $statusCode, $errorResponseData['message']);
}
}
18) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] Concat
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . PHP_EOL . 'Message: %s', $statusCode, $errorResponseData['message']);
}
}
19) /github/workspace/src/Github/Api/V3/CreateReleaseThroughApiCall.php:74 [M] ConcatOperandRemoval
--- Original
+++ New
@@ @@
return new Uri($responseData['html_url']);
}
$errorResponseData = typed($responseBody, shape(['message' => non_empty_string()]));
- invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s' . PHP_EOL, $statusCode, $errorResponseData['message']);
+ invariant_violation('Failed to create release through GitHub API;' . PHP_EOL . 'Status code: %s' . PHP_EOL . 'Message: %s', $statusCode, $errorResponseData['message']);
}
}
In practice, my reccomendation:
- remove most concatenations, especially no need for
PHP_EOL
- make sure that code path is covered - seems to really not be hit
The code path is covered, infection doesn’t recognize it was recently fixed sebastianbergmann/php-code-coverage#969 but not yet released. Correct me if I'm wrong, If |
I can also wait for sebastianbergmann/php-code-coverage#969 Doing the same for Roave/BetterReflection#1320 |
Sounds good to me. |
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
/** @return iterable<int, array<array-key,array<string, mixed>>> */ | ||
public function provideInvalidPayload(): iterable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why this was failing is that list<>
contains an "empty" list type too.
As suggested, this can be iterable<int, array{array<string, mixed>}>`, which enforces the existence of the first array key inside each data provider entry 👍
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ghostwriter!
>= 200 && <= 299
the application will return thehtml_url
for the release.message
field describing the error