uuid
uuid copied to clipboard
Static lambda
Description
Lambdas not (indirect) referencing $this must be declared static.
Motivation and context
How has this been tested?
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
PR checklist
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING.md document.
- [ ] I have added tests to cover my changes.
Is this a coding standard or best practice that's defined somewhere?
It is best practice as these lambdas can then not be bound to an object.
For reference, see https://www.designcise.com/web/tutorial/what-are-static-anonymous-functions-in-php