Skip to content

Commit 3e54668

Browse files
committed
Use static closures when suitable
1 parent 7f3d131 commit 3e54668

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/Command/ProgressClosureBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function build(OutputInterface $output, string $action, string $in
2727
{
2828
$progress = null;
2929

30-
return function ($increment, $totalObjects, $message = null) use (&$progress, $output, $action, $index, $offset) {
30+
return static function ($increment, $totalObjects, $message = null) use (&$progress, $output, $action, $index, $offset) {
3131
if (null === $progress) {
3232
$progress = new ProgressBar($output, $totalObjects);
3333
$progress->start();

src/DependencyInjection/FOSElasticaExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ private function loadTypeFinder(array $typeConfig, ContainerBuilder $container,
654654
**/
655655
private function loadIndexManager(ContainerBuilder $container): void
656656
{
657-
$indexRefs = \array_map(function ($index) {
657+
$indexRefs = \array_map(static function ($index) {
658658
return $index['reference'];
659659
}, $this->indexConfigs);
660660

@@ -667,7 +667,7 @@ private function loadIndexManager(ContainerBuilder $container): void
667667
*/
668668
private function loadIndexTemplateManager(ContainerBuilder $container): void
669669
{
670-
$indexTemplateRefs = \array_map(function ($index) {
670+
$indexTemplateRefs = \array_map(static function ($index) {
671671
return $index['reference'];
672672
}, $this->indexTemplateConfigs);
673673

src/Doctrine/AbstractElasticaToModelTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function transform(array $elasticaObjects)
9292
$propertyAccessor = $this->propertyAccessor;
9393
$identifier = $this->options['identifier'];
9494
if (!$this->options['ignore_missing'] && $objectsCnt < $elasticaObjectsCnt) {
95-
$missingIds = \array_diff($ids, \array_map(function ($object) use ($propertyAccessor, $identifier) {
95+
$missingIds = \array_diff($ids, \array_map(static function ($object) use ($propertyAccessor, $identifier) {
9696
return $propertyAccessor->getValue($object, $identifier);
9797
}, $objects));
9898

src/Paginator/RawPartialResults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(ResultSet $resultSet)
3131
*/
3232
public function toArray(): array
3333
{
34-
return \array_map(function (Result $result) {
34+
return \array_map(static function (Result $result) {
3535
return $result->getSource();
3636
}, $this->resultSet->getResults());
3737
}

src/Transformer/ModelToElasticaAutoTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function transformNested($objects, array $fields)
109109
*/
110110
protected function normalizeValue($value)
111111
{
112-
$normalizeValue = function (&$v) {
112+
$normalizeValue = static function (&$v) {
113113
if ($v instanceof \DateTimeInterface) {
114114
$v = $v->format('c');
115115
} elseif (!\is_scalar($v) && null !== $v) {

0 commit comments

Comments
 (0)