|
|
|
@ -23,7 +23,7 @@ class Loader
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Registered classes.
|
|
|
|
|
* @var array<string, array{class-string, array<int, mixed>, ?callable}> $classes
|
|
|
|
|
* @var array<string, array{class-string|Closure(): object, array<int, mixed>, ?callable}> $classes
|
|
|
|
|
*/
|
|
|
|
|
protected array $classes = [];
|
|
|
|
|
|
|
|
|
@ -44,11 +44,11 @@ class Loader
|
|
|
|
|
* @template T of object
|
|
|
|
|
*
|
|
|
|
|
* @param string $name Registry name
|
|
|
|
|
* @param class-string<T> $class Class name or function to instantiate class
|
|
|
|
|
* @param class-string<T>|Closure(): T $class Class name or function to instantiate class
|
|
|
|
|
* @param array<int, mixed> $params Class initialization parameters
|
|
|
|
|
* @param ?callable(T $instance): void $callback $callback Function to call after object instantiation
|
|
|
|
|
*/
|
|
|
|
|
public function register(string $name, string $class, array $params = [], ?callable $callback = null): void
|
|
|
|
|
public function register(string $name, $class, array $params = [], ?callable $callback = null): void
|
|
|
|
|
{
|
|
|
|
|
unset($this->instances[$name]);
|
|
|
|
|
|
|
|
|
|