diff --git a/phpstan.neon b/phpstan.neon index 5304a5e..35f4f64 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -15,9 +15,8 @@ parameters: - ./src/Overrides ignoreErrors: - - '#Parameter (\#)(\d) \$callback of method Illuminate\\Container\\Container::call\(\) expects \(callable\(\): (.*)#' + - '#Parameter \#2 \$callback of static method Illuminate\\Container\\BoundMethod\:\:call\(\) expects \(callable\(\)\: mixed\)\|string, array\{object, string\} given\.#' - '#Property MichaelRubel\\EnhancedContainer\\Exceptions\\InstanceInteractionException\:\:\$message has no type specified\.#' - - '#Cannot call method pipe\(\) on mixed.#' - '#(.*)getDependencies\(\) expects class\-string, string given\.#' - '#(.*)resolvePassedClass\(\) expects string, object\|string given\.#' diff --git a/src/Core/CallProxy.php b/src/Core/CallProxy.php index 405b09d..7db11ad 100644 --- a/src/Core/CallProxy.php +++ b/src/Core/CallProxy.php @@ -4,6 +4,8 @@ namespace MichaelRubel\EnhancedContainer\Core; +use Illuminate\Container\BoundMethod; +use Illuminate\Container\Container; use Illuminate\Support\Str; use Illuminate\Support\Traits\ForwardsCalls; use MichaelRubel\EnhancedContainer\Call; @@ -120,9 +122,8 @@ public function enableForwarding(): static protected function containerCall(object $service, string $method, array $parameters): mixed { try { - return app()->call( - [$service, $method], - $this->getParameters($service, $method, $parameters) + return BoundMethod::call( + Container::getInstance(), [$service, $method], $this->getParameters($service, $method, $parameters) ); } catch (\ReflectionException) { return $this->forwardCallTo($service, $method, $parameters);