10000 Make `\Request::get` more performant. by KorvinSzanto · Pull Request #12369 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Make \Request::get more performant. #12369

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix typo
  • Loading branch information
KorvinSzanto committed Oct 31, 2014
commit d1f36d681eae7e1cef45279c727795426f7e75cd
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public static function getHttpMethodParameterOverride()
*/
public function get($key, $default = null, $deep = false)
{
$result = $this->query($key, $this, $deep);
$result = $this->query->get($key, $this, $deep);
if ($result === $this) {
Copy link
Member

Choose a reason for hiding this comment

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

I would rather use the opposite conditions and using an early return rather than assigning $result over and over again inside conditions on it (which can be confusing when seeing a list of if ($result === $this) { conditions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'd still need to store them to a variable, the only difference is the return would be within each conditional. I'd rather have a single return no?

$result = $this->attributes->get($key, $this, $deep);
}
Expand Down
0