Skip to content

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-daubois alexandre-daubois commented Nov 14, 2024

By limiting the number of results that explode() returns, we're fine dealing with values containing a :. Also, it ease the check of the parts validity as the result is way more deterministic compared to calling to explode() without limit.

@asgrim asgrim self-requested a review November 15, 2024 09:36
@asgrim asgrim added the enhancement New feature or request label Nov 15, 2024
@asgrim asgrim added this to the 0.2.0 milestone Nov 15, 2024
@asgrim asgrim merged commit aad15d8 into php:main Nov 15, 2024
19 checks passed
// @todo probably process this better
$headerParts = explode(':', $v);
$request = $request->withHeader(trim($headerParts[0]), trim($headerParts[1]));
$headerParts = array_map('trim', explode(':', $v, 2));

Choose a reason for hiding this comment

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

nit: 'trim' can be replaced with trim(...), first callable syntax is available since php 8.1

Copy link
Member Author

Choose a reason for hiding this comment

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

That's true! But by using the "string syntax", the callable is resolved at the engine level instead of the language level which can be a bit faster. But if the project coding standards has a rule to use first class callable, let's update this part 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants