Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Add support for Laravel 10 #70

Merged
merged 7 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.0 ]
laravel: [ 9.*, 8.* ]
php: [ '8.0', 8.1 ]
laravel: [ 8.*, 9.*, 10.* ]
stability: [ prefer-stable ]
os: [ ubuntu-latest, windows-latest ]
exclude:
- php: 8.0
laravel: 10.*
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
"wrapper"
],
"type": "library",
"minimum-stability": "dev",
"require": {
"php": "^8.0.2",
"laravel/framework": "^8.40.0|^9.0",
"laravel/framework": "^8.40.0|^9.0|^10.0",
"guzzlehttp/guzzle": "~6.0|~7.0",
"nesbot/carbon": "^2.53.1",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.5.4",
"orchestra/testbench": "^6.23|^7.0",
"orchestra/testbench": "^6.23|^7.0|^8.0",
"nunomaduro/collision": "^5.3|^6.1",
"roave/security-advisories": "dev-latest",
"nunomaduro/larastan": "^1.0|^2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public static function retrieveAccessToken(): string
{
$accessTokenCacheKey = 'igdb_cache.access_token';

$accessToken = Cache::get($accessTokenCacheKey, false);
$accessToken = Cache::get($accessTokenCacheKey, '');

if ($accessToken && is_string($accessToken)) {
if ($accessToken) {
return $accessToken;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ protected function setEndpoint(mixed $model): void
$parents->push($class);
}

if (is_bool($parents->last()) || is_null($parents->last())) {
if (!$parents->last()) {
throw new InvalidParamsException('Last parent element is either null or false. String or {} required.');
}

Expand Down
4 changes: 3 additions & 1 deletion src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public function __construct(Request $request)
{
$this->class = get_class($this);
$this->url = $request->fullUrl();
$this->method = (string) $request->route('method');
/** @var string $method */
$method = $request->route('method');
$this->method = $method;
$this->created_at = new Carbon();
}
}
6 changes: 4 additions & 2 deletions src/Models/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ public static function handle(Request $request): mixed

$data = json_decode((string) $request->getContent(), true, 512, JSON_THROW_ON_ERROR);

$endpoint = (string) $request->route('model');
/** @var string $endpoint */
$endpoint = $request->route('model');

if (!$endpoint) {
return $data;
Expand All @@ -159,7 +160,8 @@ public static function handle(Request $request): mixed
return $data;
}

$method = (string) $request->route('method');
/** @var string $method */
$method = $request->route('method');
$entity = new $fullClassName($data);

$reflectionClass = new ReflectionClass(Method::class);
Expand Down