phpstan fixes
This commit is contained in:
parent
b9c690cb6e
commit
822b796d40
@ -39,6 +39,8 @@ $key = new JWTDerivedKey("secret", "salt");
|
||||
$key = new JWTPlaintextKey("This Should Be Binary Data..");
|
||||
```
|
||||
|
||||
`JWTDerivedKey` uses hash_pbkdf2.
|
||||
|
||||
### Generating tokens
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@ class PropertyBag
|
||||
/**
|
||||
* Add a property value, fails if the property exists
|
||||
*
|
||||
* @param string Property name
|
||||
* @param mixed Value
|
||||
* @param string $prop Property name
|
||||
* @param mixed $value Value
|
||||
* @throws PropertyException if the property already exists
|
||||
*/
|
||||
public function add(string $prop, $value)
|
||||
@ -37,14 +37,19 @@ class PropertyBag
|
||||
* Set a property value, create the property if it doesn't
|
||||
* exist.
|
||||
*
|
||||
* @param string Property name
|
||||
* @param mixed Value
|
||||
* @param string $prop Property name
|
||||
* @param mixed $value Value
|
||||
*/
|
||||
public function set(string $prop, $value)
|
||||
{
|
||||
$this->props[$prop] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply properties without removing anything.
|
||||
*
|
||||
* @param array $props The properties to apply
|
||||
*/
|
||||
public function setAll(array $props)
|
||||
{
|
||||
$this->props = array_merge(
|
||||
@ -57,7 +62,7 @@ class PropertyBag
|
||||
* Get the value of a property, fails if the property does not exist.
|
||||
* Use the value() method to get with a default value
|
||||
*
|
||||
* @param string Property name
|
||||
* @param string $prop Property name
|
||||
* @return mixed
|
||||
* @throws PropertyException if the property does not exist
|
||||
*/
|
||||
@ -92,8 +97,8 @@ class PropertyBag
|
||||
/**
|
||||
* Get the value of the property, or use the provided default value.
|
||||
*
|
||||
* @param string Property name
|
||||
* @param mixed Default value
|
||||
* @param string $prop Property name
|
||||
* @param mixed|null $default Default value
|
||||
* @return mixed
|
||||
*/
|
||||
public function valueOf(string $prop, $default=null)
|
||||
@ -105,6 +110,8 @@ class PropertyBag
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
*
|
||||
* @param string $prop Property name
|
||||
*/
|
||||
public function delete(string $prop)
|
||||
{
|
||||
@ -113,6 +120,8 @@ class PropertyBag
|
||||
|
||||
/**
|
||||
* Check if a property is present
|
||||
*
|
||||
* @param string $prop Property name
|
||||
*/
|
||||
public function has(string $prop): bool
|
||||
{
|
||||
@ -121,6 +130,8 @@ class PropertyBag
|
||||
|
||||
/**
|
||||
* Check if all the provided properties are present
|
||||
*
|
||||
* @param array $props Property names
|
||||
*/
|
||||
public function hasAll(array $props)
|
||||
{
|
||||
|
@ -10,8 +10,8 @@ use NoccyLabs\SimpleJWT\Key\KeyInterface;
|
||||
*
|
||||
*
|
||||
*
|
||||
* @property-read header PropertyBag
|
||||
* @property-read claim PropertyBag
|
||||
* @property-read PropertyBag $header
|
||||
* @property-read PropertyBag $claims
|
||||
*/
|
||||
class JWTToken
|
||||
{
|
||||
@ -30,7 +30,8 @@ class JWTToken
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param KeyInterface The key used to sign the token
|
||||
* @param KeyInterface $key The key used to sign the token
|
||||
* @param string|null $token Token data
|
||||
*/
|
||||
public function __construct(KeyInterface $key, ?string $token=null)
|
||||
{
|
||||
@ -127,6 +128,8 @@ class JWTToken
|
||||
case 'm':
|
||||
$fact = 60;
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
$this->header->set('exp', time() + (intval($match[1]) * $fact));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user