diff --git a/src/Builder.php b/src/Builder.php index da713b61..4295e3f0 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -18,15 +18,11 @@ interface Builder * Appends new items to audience * * @param non-empty-string ...$audiences - * - * @pure */ public function permittedFor(string ...$audiences): Builder; /** * Configures the expiration time - * - * @pure */ public function expiresAt(DateTimeImmutable $expiration): Builder; @@ -34,15 +30,11 @@ public function expiresAt(DateTimeImmutable $expiration): Builder; * Configures the token id * * @param non-empty-string $id - * - * @pure */ public function identifiedBy(string $id): Builder; /** * Configures the time that the token was issued - * - * @pure */ public function issuedAt(DateTimeImmutable $issuedAt): Builder; @@ -50,15 +42,11 @@ public function issuedAt(DateTimeImmutable $issuedAt): Builder; * Configures the issuer * * @param non-empty-string $issuer - * - * @pure */ public function issuedBy(string $issuer): Builder; /** * Configures the time before which the token cannot be accepted - * - * @pure */ public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): Builder; @@ -66,8 +54,6 @@ public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): Builder; * Configures the subject * * @param non-empty-string $subject - * - * @pure */ public function relatedTo(string $subject): Builder; @@ -75,8 +61,6 @@ public function relatedTo(string $subject): Builder; * Configures a header item * * @param non-empty-string $name - * - * @pure */ public function withHeader(string $name, mixed $value): Builder; @@ -86,8 +70,6 @@ public function withHeader(string $name, mixed $value): Builder; * @param non-empty-string $name * * @throws RegisteredClaimGiven When trying to set a registered claim. - * - * @pure */ public function withClaim(string $name, mixed $value): Builder; diff --git a/src/Token/Builder.php b/src/Token/Builder.php index d92d41e1..355766b7 100644 --- a/src/Token/Builder.php +++ b/src/Token/Builder.php @@ -29,6 +29,10 @@ public function __construct(private readonly Encoder $encoder, private readonly { } + /** + * @inheritDoc + * @pure + */ public function permittedFor(string ...$audiences): BuilderInterface { $configured = $this->claims[RegisteredClaims::AUDIENCE] ?? []; @@ -37,36 +41,64 @@ public function permittedFor(string ...$audiences): BuilderInterface return $this->setClaim(RegisteredClaims::AUDIENCE, array_merge($configured, $toAppend)); } + /** + * @inheritDoc + * @pure + */ public function expiresAt(DateTimeImmutable $expiration): BuilderInterface { return $this->setClaim(RegisteredClaims::EXPIRATION_TIME, $expiration); } + /** + * @inheritDoc + * @pure + */ public function identifiedBy(string $id): BuilderInterface { return $this->setClaim(RegisteredClaims::ID, $id); } + /** + * @inheritDoc + * @pure + */ public function issuedAt(DateTimeImmutable $issuedAt): BuilderInterface { return $this->setClaim(RegisteredClaims::ISSUED_AT, $issuedAt); } + /** + * @inheritDoc + * @pure + */ public function issuedBy(string $issuer): BuilderInterface { return $this->setClaim(RegisteredClaims::ISSUER, $issuer); } + /** + * @inheritDoc + * @pure + */ public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): BuilderInterface { return $this->setClaim(RegisteredClaims::NOT_BEFORE, $notBefore); } + /** + * @inheritDoc + * @pure + */ public function relatedTo(string $subject): BuilderInterface { return $this->setClaim(RegisteredClaims::SUBJECT, $subject); } + /** + * @inheritDoc + * @pure + */ public function withHeader(string $name, mixed $value): BuilderInterface { $new = clone $this; @@ -75,6 +107,10 @@ public function withHeader(string $name, mixed $value): BuilderInterface return $new; } + /** + * @inheritDoc + * @pure + */ public function withClaim(string $name, mixed $value): BuilderInterface { if (in_array($name, RegisteredClaims::ALL, true)) {