Skip to content

Commit 3646880

Browse files
authored
Merge pull request #1796 from deguif/static-closure
Use static closures when suitable
2 parents 574130c + 3e54668 commit 3646880

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
@@ -658,7 +658,7 @@ private function loadTypeFinder(array $typeConfig, ContainerBuilder $container,
658658
*/
659659
private function loadIndexManager(ContainerBuilder $container): void
660660
{
661-
$indexRefs = \array_map(function ($index) {
661+
$indexRefs = \array_map(static function ($index) {
662662
return $index['reference'];
663663
}, $this->indexConfigs);
664664

@@ -671,7 +671,7 @@ private function loadIndexManager(ContainerBuilder $container): void
671671
*/
672672
private function loadIndexTemplateManager(ContainerBuilder $container): void
673673
{
674-
$indexTemplateRefs = \array_map(function ($index) {
674+
$indexTemplateRefs = \array_map(static function ($index) {
675675
return $index['reference'];
676676
}, $this->indexTemplateConfigs);
677677

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
@@ -111,7 +111,7 @@ protected function transformNested($objects, array $fields)
111111
*/
112112
protected function normalizeValue($value)
113113
{
114-
$normalizeValue = function (&$v) {
114+
$normalizeValue = static function (&$v) {
115115
if ($v instanceof \DateTimeInterface) {
116116
$v = $v->format('c');
117117
} elseif (!\is_scalar($v) && null !== $v) {

0 commit comments

Comments
 (0)