diff --git a/src/Builders/ClassBuilder.php b/src/Builders/ClassBuilder.php index 45e378f..f525c70 100644 --- a/src/Builders/ClassBuilder.php +++ b/src/Builders/ClassBuilder.php @@ -9,6 +9,7 @@ use lucatume\DI52\ContainerException; use lucatume\DI52\NotFoundException; +use ReflectionException; use ReflectionMethod; /** @@ -65,11 +66,11 @@ class ClassBuilder implements BuilderInterface, ReinitializableBuilderInterface /** * ClassBuilder constructor. * - * @param string|class-string $id The identifier associated with this builder. - * @param Resolver $resolver A reference to the resolver currently using the builder. - * @param string $className The fully-qualified class name to build instances for. - * @param string[]|null $afterBuildMethods An optional set of methods to call on the built object. - * @param mixed ...$buildArgs An optional set of build arguments that should be provided to + * @param string|class-string $id The identifier associated with this builder. + * @param Resolver $resolver A reference to the resolver currently using the builder. + * @param string $className The fully-qualified class name to build instances for. + * @param array|null $afterBuildMethods An optional set of methods to call on the built object. + * @param mixed ...$buildArgs An optional set of build arguments that should be provided to * the class constructor method. * * @throws NotFoundException If the class does not exist. @@ -78,7 +79,7 @@ public function __construct($id, Resolver $resolver, $className, array $afterBui { if (!class_exists($className)) { throw new NotFoundException( - "nothing is bound to the '{$className}' id and it's not an existing or instantiable class." + "nothing is bound to the '$className' id and it's not an existing or instantiable class." ); } @@ -99,6 +100,8 @@ public function __construct($id, Resolver $resolver, $className, array $afterBui * Builds and returns an instance of the class. * * @return object An instance of the class. + * + * @throws ContainerException */ public function build() { @@ -159,7 +162,7 @@ protected function getResolvedConstructorParameters($className) try { $constructorReflection = new ReflectionMethod($className, '__construct'); - } catch (\ReflectionException $e) { + } catch (ReflectionException $e) { static::$constructorParametersCache[$className] = []; // No constructor method, no args. return []; @@ -186,6 +189,8 @@ protected function getResolvedConstructorParameters($className) * @param mixed $arg The argument id or value to resolve. * * @return mixed The resolved build argument. + * + * @throws NotFoundException */ protected function resolveBuildArg($arg) {