Skip to content

Commit 8c04967

Browse files
xurshudyanValodia
andauthored
Convert closures to arrow functions (#45777)
Co-authored-by: Valodia <[email protected]>
1 parent 519831d commit 8c04967

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/Illuminate/Container/Container.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,7 @@ protected function getReboundCallbacks($abstract)
631631
*/
632632
public function wrap(Closure $callback, array $parameters = [])
633633
{
634-
return function () use ($callback, $parameters) {
635-
return $this->call($callback, $parameters);
636-
};
634+
return fn () => $this->call($callback, $parameters);
637635
}
638636

639637
/**
@@ -677,9 +675,7 @@ public function call($callback, array $parameters = [], $defaultMethod = null)
677675
*/
678676
public function factory($abstract)
679677
{
680-
return function () use ($abstract) {
681-
return $this->make($abstract);
682-
};
678+
return fn () => $this->make($abstract);
683679
}
684680

685681
/**
@@ -1083,9 +1079,7 @@ protected function resolveVariadicClass(ReflectionParameter $parameter)
10831079
return $this->make($className);
10841080
}
10851081

1086-
return array_map(function ($abstract) {
1087-
return $this->resolve($abstract);
1088-
}, $concrete);
1082+
return array_map(fn ($abstract) => $this->resolve($abstract), $concrete);
10891083
}
10901084

10911085
/**
@@ -1446,9 +1440,7 @@ public function offsetGet($key): mixed
14461440
*/
14471441
public function offsetSet($key, $value): void
14481442
{
1449-
$this->bind($key, $value instanceof Closure ? $value : function () use ($value) {
1450-
return $value;
1451-
});
1443+
$this->bind($key, $value instanceof Closure ? $value : fn () => $value);
14521444
}
14531445

14541446
/**

0 commit comments

Comments
 (0)