Skip to content

Commit 2609e5d

Browse files
committed
Fix container call for Laravel 10, ref: laravel/framework#45500
1 parent 733b7aa commit 2609e5d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

phpstan.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ parameters:
1515
- ./src/Overrides
1616

1717
ignoreErrors:
18-
- '#Parameter (\#)(\d) \$callback of method Illuminate\\Container\\Container::call\(\) expects \(callable\(\): (.*)#'
18+
- '#Parameter \#2 \$callback of static method Illuminate\\Container\\BoundMethod\:\:call\(\) expects \(callable\(\)\: mixed\)\|string, array\{object, string\} given\.#'
1919
- '#Property MichaelRubel\\EnhancedContainer\\Exceptions\\InstanceInteractionException\:\:\$message has no type specified\.#'
20-
- '#Cannot call method pipe\(\) on mixed.#'
2120
- '#(.*)getDependencies\(\) expects class\-string, string given\.#'
2221
- '#(.*)resolvePassedClass\(\) expects string, object\|string given\.#'
2322

src/Core/CallProxy.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace MichaelRubel\EnhancedContainer\Core;
66

7+
use Illuminate\Container\BoundMethod;
8+
use Illuminate\Container\Container;
79
use Illuminate\Support\Str;
810
use Illuminate\Support\Traits\ForwardsCalls;
911
use MichaelRubel\EnhancedContainer\Call;
@@ -120,9 +122,8 @@ public function enableForwarding(): static
120122
protected function containerCall(object $service, string $method, array $parameters): mixed
121123
{
122124
try {
123-
return app()->call(
124-
[$service, $method],
125-
$this->getParameters($service, $method, $parameters)
125+
return BoundMethod::call(
126+
Container::getInstance(), [$service, $method], $this->getParameters($service, $method, $parameters)
126127
);
127128
} catch (\ReflectionException) {
128129
return $this->forwardCallTo($service, $method, $parameters);

0 commit comments

Comments
 (0)