You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
In PHP 8.2 and later, passing a nullable parameter without explicitly marking it as ?callable is deprecated. The Tymon\JWTAuth\Claims\Collection::getByClaimName() method currently defines $callback as callable $callback = null, which triggers a deprecation warning.
Error Message:
PHP Deprecated: Tymon\JWTAuth\Claims\Collection::getByClaimName(): Implicitly marking parameter $callback as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/tymon/jwt-auth/src/Claims/Collection.php on line 38
Affected Code:
/** * Get a Claim instance by its unique name. * * @param string $name * @param callable $callback * @param mixed $default * @return \Tymon\JWTAuth\Claims\Claim */publicfunctiongetByClaimName($name, callable$callback = null, $default = null)
{
return$this->filter(function (Claim$claim) use ($name) {
return$claim->getName() === $name;
})->first($callback, $default);
}
Suggested Fix:
Modify the function signature to explicitly mark $callback as nullable:
Description:
In PHP 8.2 and later, passing a nullable parameter without explicitly marking it as
?callable
is deprecated. TheTymon\JWTAuth\Claims\Collection::getByClaimName()
method currently defines$callback
ascallable $callback = null
, which triggers a deprecation warning.Error Message:
Affected Code:
Suggested Fix:
Modify the function signature to explicitly mark
$callback
as nullable:Steps to Reproduce:
tymon/jwt-auth
and attempt to callgetByClaimName()
.Environment Details:
Impact:
This deprecation warning will become a fatal error in future PHP versions, making it necessary to update the function signature.
Would appreciate a fix for this issue! Thanks for maintaining this library. 🚀
The text was updated successfully, but these errors were encountered: