Skip to content

Commit bbf0d69

Browse files
committed
feat(Laravel): Improve compability support with Laravel 11 and higher.
1 parent 6ec32e7 commit bbf0d69

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"ext-simplexml": "*",
2323
"guzzlehttp/guzzle": "^7.4",
2424
"http-interop/http-factory-guzzle": "^1.2",
25-
"laravel/framework": "^9.25",
25+
"laravel/framework": "^9.25 || ^10 || ^12",
2626
"laravel/telescope": "v4.14.2",
2727
"league/flysystem": "^3.14",
2828
"mockery/mockery": "^1.5.1",

phpstan.neon

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ parameters:
1717
# The level 8 is the highest level
1818
level: 9
1919

20-
# it is impossible to map toArray()
21-
checkMissingIterableValueType: false
20+
ignoreErrors:
21+
- identifier: missingType.iterableValue
22+
# Laravel 9 vs 10/11/12 compability
23+
-
24+
message: "#^Class Illuminate\\\\Http\\\\Client\\\\Events\\\\ConnectionFailed constructor invoked with 2 parameters, 1 required\\.$#"
25+
count: 1
26+
path: src/Laravel/LaravelServiceProvider.php
27+
reportUnmatched: false

src/Laravel/LaravelServiceProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Contracts\Events\Dispatcher;
1010
use Illuminate\Filesystem\FilesystemAdapter;
1111
use Illuminate\Filesystem\FilesystemManager;
12+
use Illuminate\Http\Client\ConnectionException;
1213
use Illuminate\Http\Client\Events\ConnectionFailed;
1314
use Illuminate\Http\Client\Events\ResponseReceived;
1415
use Illuminate\Http\Client\Request;
@@ -206,7 +207,12 @@ private function passEventsToTelescopeHttpCatcher(ApiSdkConfig $config): void
206207
listener: function (RequestConnectionFailedEvent $event): void {
207208
$events = $this->getEventDispatcher();
208209

209-
$events->dispatch(new ConnectionFailed(new Request($event->request)));
210+
$innerException = new ConnectionException(
211+
$event->exception->getMessage(),
212+
$event->exception->getCode(),
213+
$event->exception
214+
);
215+
$events->dispatch(new ConnectionFailed(new Request($event->request), $innerException));
210216
}
211217
);
212218

0 commit comments

Comments
 (0)