eee
This commit is contained in:
+10
-10
@@ -87,7 +87,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param string $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
* @throws
|
||||
*/
|
||||
public function get(string $id): object
|
||||
{
|
||||
@@ -103,7 +103,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param string $id
|
||||
* @return object
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function parse(string $id): object
|
||||
{
|
||||
@@ -140,7 +140,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param string $className
|
||||
* @return ReflectionClass
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function getReflectionClass(string $className): ReflectionClass
|
||||
{
|
||||
@@ -156,7 +156,7 @@ class Container implements ContainerInterface
|
||||
* @param array $construct
|
||||
* @param array $config
|
||||
* @return object|null
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function make(string $className, array $construct = [], array $config = []): ?object
|
||||
{
|
||||
@@ -253,7 +253,7 @@ class Container implements ContainerInterface
|
||||
* @param string $className
|
||||
* @param string $method
|
||||
* @return ReflectionMethod
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function getMethod(string $className, string $method): ReflectionMethod
|
||||
{
|
||||
@@ -266,7 +266,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param string $className
|
||||
* @return ReflectionMethod[]
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function getMethods(string $className): array
|
||||
{
|
||||
@@ -279,7 +279,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param ReflectionMethod $parameters
|
||||
* @return array
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function getMethodParams(ReflectionMethod $parameters): array
|
||||
{
|
||||
@@ -297,7 +297,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param Closure $parameters
|
||||
* @return array
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function getFunctionParams(Closure $parameters): array
|
||||
{
|
||||
@@ -308,7 +308,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param ReflectionMethod|ReflectionFunction $parameters
|
||||
* @return array
|
||||
* @throws ReflectionException|Exception
|
||||
* @throws
|
||||
*/
|
||||
public function resolveMethodParams(ReflectionMethod|ReflectionFunction $parameters): array
|
||||
{
|
||||
@@ -335,7 +335,7 @@ class Container implements ContainerInterface
|
||||
/**
|
||||
* @param $parameter
|
||||
* @return bool|int|mixed|object|string|null
|
||||
* @throws Exception
|
||||
* @throws
|
||||
*/
|
||||
protected function contractParams($parameter): mixed
|
||||
{
|
||||
|
||||
+18
-19
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
namespace Kiri\Di\Inject;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Kiri\Di\Interface\InjectPropertyInterface;
|
||||
use Kiri\Di\Container as DContainer;
|
||||
|
||||
@@ -13,26 +12,26 @@ class Container implements InjectPropertyInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param string $service
|
||||
* @param mixed|null $default
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(readonly public string $service, public mixed $default = null)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param string $service
|
||||
* @param mixed|null $default
|
||||
* @throws
|
||||
*/
|
||||
public function __construct(readonly public string $service, public mixed $default = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $property
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dispatch(object $class, string $property): void
|
||||
{
|
||||
$class->{$property} = DContainer::instance()->get($this->service);
|
||||
}
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $property
|
||||
* @return void
|
||||
* @throws
|
||||
*/
|
||||
public function dispatch(object $class, string $property): void
|
||||
{
|
||||
$class->{$property} = DContainer::instance()->get($this->service);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
-4
@@ -9,7 +9,6 @@ use Kiri\Di\Inject\Container;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Di\Inject\Skip;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
|
||||
class Scanner extends Component
|
||||
@@ -26,7 +25,7 @@ class Scanner extends Component
|
||||
/**
|
||||
* @param string $path
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public function load_directory(string $path): void
|
||||
{
|
||||
@@ -67,7 +66,7 @@ class Scanner extends Component
|
||||
/**
|
||||
* @param string $path
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
private function load_file(string $path): void
|
||||
{
|
||||
@@ -85,7 +84,7 @@ class Scanner extends Component
|
||||
/**
|
||||
* @param $file
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
protected function parseFile($file): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user