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

Use keyword "static" #4436

Merged
merged 1 commit into from
Aug 21, 2022
Merged

Use keyword "static" #4436

merged 1 commit into from
Aug 21, 2022

Conversation

ColonelMoutarde
Copy link
Contributor

@ColonelMoutarde ColonelMoutarde commented Jul 6, 2022

static closure
While methods may be static or not, function has no such alternative : they just can’t be static. Yet, there is one final type of method that may be static : static closures.
Closure are functions that may be stored in a variable : functions may have their name stored in a variable, though. Closure also have the ability to aggregate variables from the context of their creation, for future use. As such, $this is available in a closure that is created inside an object.
See more ... https://www.exakat.io/en/5-usages-of-static-keyword-in-php/

static closure
While methods may be static or not, function has no such alternative : they just can’t be static. Yet, there is one final type of method that may be static : static closures.
Closure are functions that may be stored in a variable : functions may have their name stored in a variable, though. Closure also have the ability to aggregate variables from the context of their creation, for future use. As such, $this is available in a closure that is created inside an object.
See more ... https://www.exakat.io/en/5-usages-of-static-keyword-in-php/
@Alkarex Alkarex added this to the 1.20.0 milestone Jul 6, 2022
@Alkarex
Copy link
Member

Alkarex commented Jul 6, 2022

Fine, and although I am not sure it makes much of a difference in practice, there are several other examples in our codebase with the same case, e.g.:

uasort($categories, function ($a, $b) {

@ColonelMoutarde
Copy link
Contributor Author

That's true, but every little improvement is a step forward

@Alkarex Alkarex merged commit 85991d1 into FreshRSS:edge Aug 21, 2022
@ColonelMoutarde ColonelMoutarde deleted the patch-2 branch April 5, 2023 17:04
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.

2 participants