Skip to content

Commit f527d04

Browse files
Refactor: Reduce indent and improve code using ternary instead of 'if-else' structure (#47478)
1 parent f3bc33e commit f527d04

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/Illuminate/Container/Container.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -791,11 +791,9 @@ protected function resolve($abstract, $parameters = [], $raiseEvents = true)
791791
// We're ready to instantiate an instance of the concrete type registered for
792792
// the binding. This will instantiate the types, as well as resolve any of
793793
// its "nested" dependencies recursively until all have gotten resolved.
794-
if ($this->isBuildable($concrete, $abstract)) {
795-
$object = $this->build($concrete);
796-
} else {
797-
$object = $this->make($concrete);
798-
}
794+
$object = $this->isBuildable($concrete, $abstract)
795+
? $this->build($concrete)
796+
: $this->make($concrete);
799797

800798
// If we defined any extenders for this type, we'll need to spin through them
801799
// and apply them to the object being built. This allows for the extension

src/Illuminate/Support/Traits/ForwardsCalls.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ protected function forwardDecoratedCallTo($object, $method, $parameters)
5151
{
5252
$result = $this->forwardCallTo($object, $method, $parameters);
5353

54-
if ($result === $object) {
55-
return $this;
56-
}
57-
58-
return $result;
54+
return $result === $object ? $this : $result;
5955
}
6056

6157
/**

0 commit comments

Comments
 (0)