Skip to content

Commit 1c02905

Browse files
committed
Updated phpstan to use level 9
1 parent 784a8a1 commit 1c02905

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
parameters:
2-
level: 8
2+
level: 9
33
paths:
44
- src
55
- tests
6-
treatPhpDocTypesAsCertain: false

src/Suhock/DependencyInjection/AbstractFactoryContainer.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ public function __construct(
5252
*/
5353
public function get(string $className): object
5454
{
55-
return $this->has($className) ?
56-
$this->injector->call($this->factory, [$className]) :
57-
throw new ClassNotFoundException($className);
55+
if (!$this->has($className)) {
56+
return throw new ClassNotFoundException($className);
57+
}
58+
59+
/** @var TClass $instance */
60+
$instance = $this->injector->call($this->factory, [$className]);
61+
62+
return $instance;
5863
}
5964

6065
/**

src/Suhock/DependencyInjection/AttributeContainer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ public function get(string $className): object
8282
throw new ClassNotFoundException($className);
8383
}
8484

85-
return $this->injector->call($this->factory, [$className, $rAttr->newInstance()]);
85+
/** @var TClass $instance */
86+
$instance = $this->injector->call($this->factory, [$className, $rAttr->newInstance()]);
87+
88+
return $instance;
8689
}
8790

8891
/**

0 commit comments

Comments
 (0)