This commit is contained in:
paoloar77
2024-08-13 10:56:34 +02:00
parent 07840476c1
commit a1ad996bf8
2 changed files with 31 additions and 19 deletions

View File

@@ -9,7 +9,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.2.5|^8.0", "php": "^7.2.5|^8.0",
"codexshaper/laravel-woocommerce": "^3.0", "codexshaper/laravel-woocommerce": "^3.0.4",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1", "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"laravel/framework": "^7.29", "laravel/framework": "^7.29",

View File

@@ -12,6 +12,9 @@ use ReflectionClass;
use ReflectionException; use ReflectionException;
use ReflectionParameter; use ReflectionParameter;
use ReturnTypeWillChange; // Aggiungi questa riga in cima al file se non è già presente
class Container implements ArrayAccess, ContainerContract class Container implements ArrayAccess, ContainerContract
{ {
/** /**
@@ -235,7 +238,7 @@ class Container implements ArrayAccess, ContainerContract
// up inside its own Closure to give us more convenience when extending. // up inside its own Closure to give us more convenience when extending.
if (! $concrete instanceof Closure) { if (! $concrete instanceof Closure) {
if (! is_string($concrete)) { 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); $concrete = $this->getClosure($abstract, $concrete);
@@ -266,7 +269,9 @@ class Container implements ArrayAccess, ContainerContract
} }
return $container->resolve( return $container->resolve(
$concrete, $parameters, $raiseEvents = false $concrete,
$parameters,
$raiseEvents = false
); );
}; };
} }
@@ -303,7 +308,7 @@ class Container implements ArrayAccess, ContainerContract
protected function parseBindMethod($method) protected function parseBindMethod($method)
{ {
if (is_array($method)) { if (is_array($method)) {
return $method[0].'@'.$method[1]; return $method[0] . '@' . $method[1];
} }
return $method; return $method;
@@ -897,7 +902,8 @@ class Container implements ArrayAccess, ContainerContract
protected function hasParameterOverride($dependency) protected function hasParameterOverride($dependency)
{ {
return array_key_exists( return array_key_exists(
$dependency->name, $this->getLastParameterOverride() $dependency->name,
$this->getLastParameterOverride()
); );
} }
@@ -932,7 +938,7 @@ class Container implements ArrayAccess, ContainerContract
*/ */
protected function resolvePrimitive(ReflectionParameter $parameter) 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; return $concrete instanceof Closure ? $concrete($this) : $concrete;
} }
@@ -1084,7 +1090,8 @@ class Container implements ArrayAccess, ContainerContract
$this->fireCallbackArray($object, $this->globalResolvingCallbacks); $this->fireCallbackArray($object, $this->globalResolvingCallbacks);
$this->fireCallbackArray( $this->fireCallbackArray(
$object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) $object,
$this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
); );
$this->fireAfterResolvingCallbacks($abstract, $object); $this->fireAfterResolvingCallbacks($abstract, $object);
@@ -1102,7 +1109,8 @@ class Container implements ArrayAccess, ContainerContract
$this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks);
$this->fireCallbackArray( $this->fireCallbackArray(
$object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) $object,
$this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks)
); );
} }
@@ -1267,6 +1275,7 @@ class Container implements ArrayAccess, ContainerContract
* @param string $key * @param string $key
* @return bool * @return bool
*/ */
#[\ReturnTypeWillChange]
public function offsetExists($key) public function offsetExists($key)
{ {
return $this->bound($key); return $this->bound($key);
@@ -1278,6 +1287,7 @@ class Container implements ArrayAccess, ContainerContract
* @param string $key * @param string $key
* @return mixed * @return mixed
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($key) public function offsetGet($key)
{ {
return $this->make($key); return $this->make($key);
@@ -1290,6 +1300,7 @@ class Container implements ArrayAccess, ContainerContract
* @param mixed $value * @param mixed $value
* @return void * @return void
*/ */
#[\ReturnTypeWillChange]
public function offsetSet($key, $value) public function offsetSet($key, $value)
{ {
$this->bind($key, $value instanceof Closure ? $value : function () use ($value) { $this->bind($key, $value instanceof Closure ? $value : function () use ($value) {
@@ -1303,6 +1314,7 @@ class Container implements ArrayAccess, ContainerContract
* @param string $key * @param string $key
* @return void * @return void
*/ */
#[\ReturnTypeWillChange]
public function offsetUnset($key) public function offsetUnset($key)
{ {
unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]);