Skip to content

Commit

Permalink
style(src) smaller adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Sep 1, 2023
1 parent 95123e8 commit a7cf889
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Builders/ClassBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use lucatume\DI52\ContainerException;
use lucatume\DI52\NotFoundException;
use ReflectionException;
use ReflectionMethod;

/**
Expand Down Expand Up @@ -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<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
* the class constructor method.
*
* @throws NotFoundException If the class does not exist.
Expand All @@ -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."
);
}

Expand All @@ -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()
{
Expand Down Expand Up @@ -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 [];
Expand All @@ -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)
{
Expand Down

0 comments on commit a7cf889

Please sign in to comment.