Skip to content

Commit

Permalink
PHP 8.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkGhostHunter committed Jan 29, 2025
1 parent d1fd316 commit 464d59a
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
/tests export-ignore
/.editorconfig export-ignore
/.styleci.yml export-ignore
/composer.lock export-ignore
/composer.lock export-ignore
/phpstan.neon export-ignore
1 change: 1 addition & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- 8.1
- 8.2
- 8.3
- 8.4
laravel-constraint:
- 10.*
- 11.*
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
},
"require-dev": {
"ext-sodium": "*",
"orchestra/testbench": "8.*|9.*"
"orchestra/testbench": "8.*|9.*",
"livewire/livewire": "3.*"
},
"suggest": {
"paragonie/sodium_compat": "To enable EdDSA 25519 keys from authenticators, if `ext-sodium` is unavailable."
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
ignoreErrors:
- '#Trait Laragear\\WebAuthn\\WebAuthnAuthentication is used zero times and is not analysed\.#'
Empty file.
2 changes: 1 addition & 1 deletion src/Assertion/Validator/AssertionValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
/**
* Create a new Assertion Validation instance from a WebAuthn request data.
*/
public static function fromRequest(Request $request = null): static
public static function fromRequest(?Request $request = null): static
{
// @phpstan-ignore-next-line
return new static(new JsonTransport(($request ?? app('request'))->only(static::REQUEST_KEYS)));
Expand Down
2 changes: 1 addition & 1 deletion src/Attestation/Validator/AttestationValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
/**
* Create a new Attestation Creation instance from a request and a user.
*/
public static function fromRequest(Request $request = null, WebAuthnAuthenticatable $user = null): static
public static function fromRequest(?Request $request = null, ?WebAuthnAuthenticatable $user = null): static
{
// @phpstan-ignore-next-line
return new static($user, new JsonTransport(($request ?? app('request'))->only(static::REQUEST_KEYS)));
Expand Down
2 changes: 1 addition & 1 deletion src/ByteBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function hashNotEqual(self|string $buffer): bool
/**
* Returns a certain portion of these bytes.
*/
public function getBytes(int $offset = 0, int $length = null): string
public function getBytes(int $offset = 0, ?int $length = null): string
{
$length ??= $this->dataLength;

Expand Down
6 changes: 3 additions & 3 deletions src/Http/Requests/AssertedRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public function hasRemember(): bool
* @return \Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable|\Illuminate\Contracts\Auth\Authenticatable|null
*/
public function login(

Check failure on line 52 in src/Http/Requests/AssertedRequest.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static Analysis

PHPDoc tag @return with type Illuminate\Contracts\Auth\Authenticatable|Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable|null is not subtype of native type Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable|null.
string $guard = null,
bool $remember = null,
?string $guard = null,
?bool $remember = null,
bool $destroySession = false,
callable|array $callbacks = null
callable|array|null $callbacks = null
): ?WebAuthnAuthenticatable {
/** @var \Illuminate\Contracts\Auth\StatefulGuard $auth */
$auth = auth()->guard($guard);
Expand Down
2 changes: 1 addition & 1 deletion src/JsonTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function set(string $key, mixed $value): void
/**
* Retrieves a value from the underlying JSON array.
*/
public function get(string $key, string|int $default = null): mixed
public function get(string $key, string|int|null $default = null): mixed
{
return Arr::get($this->json, $key, $default);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Models/WebAuthnCredential.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstOrNew(array $attributes = [], array $values = [])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstOrFail($columns = ['*'])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstOrCreate(array $attributes, array $values = [])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstOr($columns = ['*'], \Closure $callback = null)
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstOr($columns = ['*'], \Closure|null $callback = null)
* @method \Laragear\WebAuthn\Models\WebAuthnCredential firstWhere($column, $operator = null, $value = null, $boolean = 'and')
* @method \Laragear\WebAuthn\Models\WebAuthnCredential updateOrCreate(array $attributes, array $values = [])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential createOrFirst(array $attributes, array $values = [])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential sole($columns = ['*'])
* @method \Laragear\WebAuthn\Models\WebAuthnCredential findOrNew($id, $columns = ['*'])
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[]|\static|null find($id, $columns = ['*'])
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[]|\static findOrFail($id, $columns = ['*'])
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[]|\static findOr($id, $columns = ['*'], \Closure $callback = null)
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[]|\static findOr($id, $columns = ['*'], \Closure|null $callback = null)
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[] findMany($id, $columns = ['*'])
* @method \Illuminate\Database\Eloquent\Collection<int, \static>|\static[] fromQuery($query, $bindings = [])
* @method \Illuminate\Support\LazyCollection<int, \static>|\static[] lazy(int $chunkSize = 1000)
Expand Down
9 changes: 9 additions & 0 deletions src/WebAuthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@
class WebAuthn extends Http\Routes
{
//

public function something()
{
$some = ['foo', 'bar'];

foreach ($some as $key => $value) {
# code...
}
}
}

0 comments on commit 464d59a

Please sign in to comment.