Commaaab
This commit is contained in:
@@ -14,6 +14,9 @@ use ReflectionException;
|
||||
use ReflectionParameter;
|
||||
use TypeError;
|
||||
|
||||
use ReturnTypeWillChange; // Aggiungi questa riga in cima al file se non è già presente
|
||||
|
||||
|
||||
class Container implements ArrayAccess, ContainerContract
|
||||
{
|
||||
/**
|
||||
@@ -182,8 +185,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
public function bound($abstract)
|
||||
{
|
||||
return isset($this->bindings[$abstract]) ||
|
||||
isset($this->instances[$abstract]) ||
|
||||
$this->isAlias($abstract);
|
||||
isset($this->instances[$abstract]) ||
|
||||
$this->isAlias($abstract);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +212,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
}
|
||||
|
||||
return isset($this->resolved[$abstract]) ||
|
||||
isset($this->instances[$abstract]);
|
||||
isset($this->instances[$abstract]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,8 +224,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
public function isShared($abstract)
|
||||
{
|
||||
return isset($this->instances[$abstract]) ||
|
||||
(isset($this->bindings[$abstract]['shared']) &&
|
||||
$this->bindings[$abstract]['shared'] === true);
|
||||
(isset($this->bindings[$abstract]['shared']) &&
|
||||
$this->bindings[$abstract]['shared'] === true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +265,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
// up inside its own Closure to give us more convenience when extending.
|
||||
if (! $concrete instanceof Closure) {
|
||||
if (! is_string($concrete)) {
|
||||
throw new TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
|
||||
throw new \TypeError(self::class . '::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
|
||||
}
|
||||
|
||||
$concrete = $this->getClosure($abstract, $concrete);
|
||||
@@ -293,7 +296,9 @@ class Container implements ArrayAccess, ContainerContract
|
||||
}
|
||||
|
||||
return $container->resolve(
|
||||
$concrete, $parameters, $raiseEvents = false
|
||||
$concrete,
|
||||
$parameters,
|
||||
$raiseEvents = false
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -330,7 +335,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
protected function parseBindMethod($method)
|
||||
{
|
||||
if (is_array($method)) {
|
||||
return $method[0].'@'.$method[1];
|
||||
return $method[0] . '@' . $method[1];
|
||||
}
|
||||
|
||||
return $method;
|
||||
@@ -943,8 +948,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
// primitive type which we can not resolve since it is not a class and
|
||||
// we will just bomb out with an error since we have no-where to go.
|
||||
$result = is_null(Util::getParameterClassName($dependency))
|
||||
? $this->resolvePrimitive($dependency)
|
||||
: $this->resolveClass($dependency);
|
||||
? $this->resolvePrimitive($dependency)
|
||||
: $this->resolveClass($dependency);
|
||||
|
||||
if ($dependency->isVariadic()) {
|
||||
$results = array_merge($results, $result);
|
||||
@@ -965,7 +970,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
protected function hasParameterOverride($dependency)
|
||||
{
|
||||
return array_key_exists(
|
||||
$dependency->name, $this->getLastParameterOverride()
|
||||
$dependency->name,
|
||||
$this->getLastParameterOverride()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1000,7 +1006,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
*/
|
||||
protected function resolvePrimitive(ReflectionParameter $parameter)
|
||||
{
|
||||
if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) {
|
||||
if (! is_null($concrete = $this->getContextualConcrete('$' . $parameter->getName()))) {
|
||||
return $concrete instanceof Closure ? $concrete($this) : $concrete;
|
||||
}
|
||||
|
||||
@@ -1023,8 +1029,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
{
|
||||
try {
|
||||
return $parameter->isVariadic()
|
||||
? $this->resolveVariadicClass($parameter)
|
||||
: $this->make(Util::getParameterClassName($parameter));
|
||||
? $this->resolveVariadicClass($parameter)
|
||||
: $this->make(Util::getParameterClassName($parameter));
|
||||
}
|
||||
|
||||
// If we can not resolve the class instance, we will check to see if the value
|
||||
@@ -1209,7 +1215,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
$this->fireCallbackArray($object, $this->globalResolvingCallbacks);
|
||||
|
||||
$this->fireCallbackArray(
|
||||
$object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
|
||||
$object,
|
||||
$this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
|
||||
);
|
||||
|
||||
$this->fireAfterResolvingCallbacks($abstract, $object);
|
||||
@@ -1227,7 +1234,8 @@ class Container implements ArrayAccess, ContainerContract
|
||||
$this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks);
|
||||
|
||||
$this->fireCallbackArray(
|
||||
$object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks)
|
||||
$object,
|
||||
$this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1414,7 +1422,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($key)
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->make($key);
|
||||
}
|
||||
@@ -1427,7 +1435,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($key, $value)
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
$this->bind($key, $value instanceof Closure ? $value : function () use ($value) {
|
||||
return $value;
|
||||
|
||||
Reference in New Issue
Block a user