Skip to content

Commit d56d591

Browse files
phpcs fixes.
Signed-off-by: Johannes Tegnér <[email protected]>
1 parent 4189a41 commit d56d591

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

ruleset.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114

115115
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
116116
<rule ref="Squiz.Commenting.FunctionComment"/>
117-
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
118117
<rule ref="Squiz.Commenting.InlineComment"/>
119118
<rule ref="Squiz.Commenting.VariableComment"/>
120119
<rule ref="Squiz.Operators.ValidLogicalOperators"/>

src/Container.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public function clear() {
6161
* @return boolean
6262
* @throws ContainerException Thrown in case the entry already exist.
6363
*/
64-
public function set(string $abstract, $concrete, bool $singleton = false) : bool {
64+
public function set(string $abstract,
65+
$concrete,
66+
bool $singleton = false): bool {
6567
if ($this->has($abstract)) {
6668
throw new ContainerException(
6769
sprintf('An entry with the id "%s" already exists.', $abstract)

src/Injector.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ public function create(string $className, array $bindings = []) {
6464

6565
// Does the class have a constructor?
6666
if ($class->getConstructor() !== null) {
67-
$ctr = $class->getConstructor();
68-
$params = $ctr->getParameters();
67+
$ctr = $class->getConstructor();
68+
$params = $ctr->getParameters();
6969

7070
// Create the new class from the parameters.
71-
return $class->newInstanceArgs($this->getParameters($params, $bindings));
71+
return $class->newInstanceArgs(
72+
$this->getParameters($params, $bindings)
73+
);
7274
}
7375

7476
// No constructor, so just return a new instance.
@@ -86,18 +88,20 @@ public function create(string $className, array $bindings = []) {
8688
*/
8789
private function getParameters(array $params, array $bindings): array {
8890
// Get all the parameters that the class require, if any.
89-
return array_map(function ($param) use ($bindings) {
90-
$type = $this->getTypeHint($param);
91-
if (array_key_exists($type, $bindings)) {
92-
return $bindings[$type];
93-
}
91+
return array_map(
92+
function ($param) use ($bindings) {
93+
$type = $this->getTypeHint($param);
94+
if (array_key_exists($type, $bindings)) {
95+
return $bindings[$type];
96+
}
9497

95-
if ($this->container->has($type)) {
96-
return $this->container->get($type);
97-
}
98+
if ($this->container->has($type)) {
99+
return $this->container->get($type);
100+
}
98101

99-
return $this->create($type, $bindings);
100-
}, $params);
102+
return $this->create($type, $bindings);
103+
}, $params
104+
);
101105
}
102106

103107
/**

0 commit comments

Comments
 (0)