改名
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ namespace PHPSTORM_META {
|
||||
use Kiri\Di\Container;
|
||||
|
||||
override(Container::get(0), map('@'));
|
||||
override(Container::newObject(0), map('@'));
|
||||
override(Container::create(0), map('@'));
|
||||
// override(\Hyperf\Utils\Context::get(0), map('@'));
|
||||
// override(\make(0), map('@'));
|
||||
override(\di(0), map('@'));
|
||||
|
||||
@@ -460,7 +460,7 @@ class ServerManager
|
||||
*/
|
||||
private function getNewInstance(string $class): object
|
||||
{
|
||||
return $this->container->newObject($class);
|
||||
return $this->container->create($class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class Container extends BaseObject implements ContainerInterface
|
||||
* @return object
|
||||
* @throws
|
||||
*/
|
||||
public function newObject($class, array $constrict = [], array $config = []): object
|
||||
public function create($class, array $constrict = [], array $config = []): object
|
||||
{
|
||||
return $this->resolve($class, $constrict, $config);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class Kiri
|
||||
} else if (is_array($className) && isset($className['class'])) {
|
||||
$class = $className['class'];
|
||||
unset($className['class']);
|
||||
return static::$container->newObject($class, $construct, $className);
|
||||
return static::$container->create($class, $construct, $className);
|
||||
} else if (is_callable($className, TRUE)) {
|
||||
return call_user_func($className, $construct);
|
||||
} else {
|
||||
|
||||
@@ -109,7 +109,7 @@ class Connection extends Component
|
||||
public function create($coroutineName, $config): Closure
|
||||
{
|
||||
return static function () use ($coroutineName, $config) {
|
||||
return Kiri::getDi()->newObject(PDO::class, [
|
||||
return Kiri::getDi()->create(PDO::class, [
|
||||
$config['database'], $config['cds'], $config['username'], $config['password'], $config['charset'] ?? 'utf8mb4'
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ class Redis extends Component
|
||||
public function create(string $name, mixed $config): Closure
|
||||
{
|
||||
return static function () use ($name, $config) {
|
||||
return Kiri::getDi()->newObject(\Kiri\Cache\Base\Redis::class, [
|
||||
return Kiri::getDi()->create(\Kiri\Cache\Base\Redis::class, [
|
||||
$config['host'], (int)$config['port'], $config['databases'] ?? 0,
|
||||
$config['auth'], $config['prefix'] ?? '', $config['timeout'] ?? 30,
|
||||
$config['read_timeout'] ?? 30
|
||||
|
||||
@@ -94,7 +94,7 @@ use ReflectionProperty;
|
||||
{
|
||||
if (!Kiri::app()->has($this->value)) {
|
||||
if (!empty($this->construct)) {
|
||||
return Kiri::getDi()->newObject($this->value, $this->construct);
|
||||
return Kiri::getDi()->create($this->value, $this->construct);
|
||||
}
|
||||
return Kiri::getDi()->get($this->value);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user