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.
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
[11.x] Add ability to customize or disable
Http\Client\RequestException
message truncation #53734[11.x] Add ability to customize or disable
Http\Client\RequestException
message truncation #53734Changes from 3 commits
3bbd7dc
5317e05
db9b318
20b4122
2f4a756
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Isn't that a little redundant as you already set the property to this value by default? Or is that for resetting purposes? If it is needed, I personally don't like magic numbers being set on properties with no indication why they are the default
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.
Yea this is to reset the value back to the default.
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.
just a suggestion
withoutTruncate
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.
force as
int
instead ofint|false
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.
This is counterintuitive as this implies truncating the message entirely instead of not truncating at all.
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.
what do you think about
-1
?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.
Slightly better, yet I prefer to use a distinct type to indicate a behavioral flag.
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.
Is it intentional, that
truncateAt()
can take anything as a parameter because it is only type-hinted in the PHPDoc? If that is true, wouldn't it make sense, to calltruncateAt()
fromtruncate()
anddontTruncate()
so that, if the variable name changes, you only have to change it in one other place?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.
This is the case with various setters in Laravel and first party packages. I also didn't want to apply a parameter or property type as the existing property in the class doesn't have a type. Happy to change it if the team wants it changed 👍
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.
Didn't you add
$truncateAt
yourself? From the changed files, it looks like it. Or did you mean the other properties of the class?Afaik, this is mostly for historical reasons coming from a time when PHP didn't have (much) native typing. But the codebase is improved towards typing, so I'd say, newly introduced functionality tends to have types when possible.
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 other properties of the class
I think this is the case with new classes but not new properties on existing classes that already have properties with undefined types. Otherwise there'd be a mishmash of some properties with and without types. Happy to be corrected by the team though of course 👍
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.
This mismatch would be in looks only but not in functionality
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.
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.
See #53734 (comment)