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

Micro optimization: Declare closures in BodyParsingMiddleware as static #2959

Merged
merged 1 commit into from
May 6, 2020
Merged

Micro optimization: Declare closures in BodyParsingMiddleware as static #2959

merged 1 commit into from
May 6, 2020

Conversation

Ayesh
Copy link
Contributor

@Ayesh Ayesh commented May 6, 2020

All three anonymous functions used in BodyParsingMiddleware::registerDefaultBodyParsers() method never uses $this, so we can declare them static to apply a micro-optimization, which makes engine not bind the $this object to the closure.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling cfc6f10 on Ayesh:static-closures-pr into b081ebd on slimphp:4.x.

@l0gicgate l0gicgate added this to the 4.6.0 milestone May 6, 2020
@l0gicgate l0gicgate merged commit 212c00e into slimphp:4.x May 6, 2020
@l0gicgate l0gicgate mentioned this pull request Nov 15, 2020
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.

None yet

3 participants