Skip to content

Commit

Permalink
Require Laravel >= v10.32 which has Factory::getGlobalMiddleware()
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Nov 16, 2023
1 parent 2d14266 commit 2072b88
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ jobs:
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.1, 8.2 ]
laravel: [ 9.*, 10.* ]
laravel: [ 10.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"homepage": "https://github.com/sammyjo20",
"require": {
"php": "^8.1",
"illuminate/http": "^9.52 || ^10.0",
"illuminate/http": "^10.32",
"saloonphp/saloon": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.5",
"pestphp/pest": "^1.23",
"phpstan/phpstan": "^1.9",
"spatie/ray": "^1.33",
"orchestra/testbench": "^7.30 || ^8.0"
"orchestra/testbench": "^8.0"
},
"minimum-stability": "stable",
"autoload": {
Expand All @@ -46,4 +46,4 @@
"./vendor/bin/pest"
]
}
}
}
2 changes: 2 additions & 0 deletions src/HttpPendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class HttpPendingRequest extends PendingRequest
{
/**
* Constructor
*
* @param array<int, callable> $middleware
*/
public function __construct(Factory $factory = null, $middleware = [])
{
Expand Down
6 changes: 1 addition & 5 deletions src/HttpSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function send(PendingRequest $pendingRequest): Response
(string)$psrRequest->getUri(),
$this->createRequestOptions($pendingRequest, $psrRequest),
);
} catch (ConnectionException|ConnectException $exception) {
} catch (ConnectionException | ConnectException $exception) {
throw new FatalRequestException($exception, $pendingRequest);
}

Expand Down Expand Up @@ -171,10 +171,6 @@ protected function createLaravelPendingRequest(RequestInterface $psrRequest, boo
/** @var Factory $httpFactory */
$httpFactory = resolve(Factory::class);

if (! $httpFactory->hasMacro('getGlobalMiddleware')) {
$httpFactory->macro('getGlobalMiddleware', fn () => $this->globalMiddleware ?? []);
}

$httpPendingRequest = new HttpPendingRequest($httpFactory, $httpFactory->getGlobalMiddleware());
$httpPendingRequest->setClient($this->client);

Expand Down

0 comments on commit 2072b88

Please sign in to comment.