Skip to content

Commit

Permalink
Fix container call for Laravel 10, ref: laravel/framework#45500
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rubel committed Jan 18, 2023
1 parent 733b7aa commit 2609e5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\.#'

Expand Down
7 changes: 4 additions & 3 deletions src/Core/CallProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2609e5d

Please sign in to comment.