Skip to content

Commit

Permalink
Apply code style rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Jan 14, 2020
1 parent dc539ed commit b139f21
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 38 deletions.
1 change: 1 addition & 0 deletions src/Firebase/Auth/Token/Cache/InMemoryCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function set($key, $value, $ttl = null)

if (!$expires) {
$this->delete($key);

return true;
}

Expand Down
3 changes: 0 additions & 3 deletions src/Firebase/Auth/Token/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ public function __construct(
* Returns a token for the given user and claims.
*
* @param mixed $uid
* @param array $claims
* @param \DateTimeInterface $expiresAt
*
* @throws \BadMethodCallException when a claim is invalid
*
* @return Token
*/
public function createCustomToken($uid, array $claims = [], \DateTimeInterface $expiresAt = null): Token
{
Expand Down
5 changes: 0 additions & 5 deletions src/Firebase/Auth/Token/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ final class Handler implements Domain\Generator, Domain\Verifier

/**
* @deprecated 1.7.0 Use the Generator and Verifier directly instead
*
* @param string $projectId
* @param string $clientEmail
* @param string $privateKey
* @param KeyStore|null $keyStore
*/
public function __construct(string $projectId, string $clientEmail, string $privateKey, KeyStore $keyStore = null)
{
Expand Down
24 changes: 5 additions & 19 deletions src/JWT/Action/VerifyIdToken/WithFirebaseJWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,15 @@ public function handle(VerifyIdToken $action): Token
// This will check kid, nbf, iat, exp and the signature
$token = JWT::decode($tokenString, $this->keys->all(), ['RS256']);
} catch (DomainException $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token could not be decoded.',
$e->getMessage(),
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token could not be decoded.', $e->getMessage()]);
} catch (BeforeValidException $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token has been issued for future use.',
$e->getMessage(),
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token has been issued for future use.', $e->getMessage()]);
} catch (ExpiredException $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token is expired.',
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token is expired.']);
} catch (UnexpectedValueException $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token is invalid.',
$e->getMessage(),
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token is invalid.', $e->getMessage()]);
} catch (Throwable $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token is invalid.',
$e->getMessage(),
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token is invalid.', $e->getMessage()]);
} finally {
$this->restoreJWTStaticVariables($timestampBackup, $leewayBackup);
}
Expand Down
5 changes: 1 addition & 4 deletions src/JWT/Action/VerifyIdToken/WithLcobucciV3JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ public function handle(VerifyIdToken $action): Token
try {
$token = (new Parser())->parse($tokenString);
} catch (Throwable $e) {
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, [
'The token is invalid',
$e->getMessage(),
]);
throw IdTokenVerificationFailed::withTokenAndReasons($tokenString, ['The token is invalid', $e->getMessage()]);
}

$timestamp = $this->clock->now()->getTimestamp();
Expand Down
1 change: 1 addition & 0 deletions src/JWT/Cache/InMemoryCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function set($key, $value, $ttl = null): bool

if (!$expires) {
$this->delete($key);

return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/JWT/Contract/ExpirableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use DateTimeImmutable;
use DateTimeInterface;
use LogicException;

trait ExpirableTrait
{
Expand Down
3 changes: 0 additions & 3 deletions src/JWT/Contract/Keys.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

interface Keys
{
/**
* @return array
*/
public function all(): array;
}
2 changes: 0 additions & 2 deletions src/JWT/Value/Duration.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public static function make($value): self
}

/**
* @param int $seconds
*
* @throws InvalidArgumentException
*/
public static function inSeconds(int $seconds): self
Expand Down
1 change: 0 additions & 1 deletion tests/Firebase/Auth/Token/VerifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public function testItVerifiesTheSignatureNoMatterWhat()
}

/**
* @param Token $token
* @param string $exception
* @dataProvider invalidTokenProvider
*/
Expand Down

0 comments on commit b139f21

Please sign in to comment.