Static closures should be employed whenever $this
is not used
#728
Labels
Infrastructure
Issues for the overall performance plugin infrastructure
[Plugin] Performance Lab
Issue relates to work in the Performance Lab Plugin only
[Type] Bug
An existing feature is broken
Milestone
Bug Description
There closures being used in the codebase which do not use
$this
. Granted, in most cases clases aren't even involved, but in those that are, usingstatic
is better for memory usage since the$this
reference can be garbage collected. See SO answer.I suggest that we do the following:
static
to all closures that don't use$this
.SlevomatCodingStandard.Functions.StaticClosure
sniff to catch this automatically.The text was updated successfully, but these errors were encountered: