original_string: public function withExpiry(\DateTimeInterface $date): self
      {
          $new = clone $this;
  
          if ($date instanceof \DateTimeImmutable) {
              $new->expiry = $date;
          } elseif ($date instanceof \DateTime) {
              $new->expiry = \DateTimeImmutable::createFromMutable($date);
          } else {
              $new->expiry = new \DateTimeImmutable("@" . $date->getTimestamp());
          }
  
          return $new;
      }
code: public function withExpiry(\DateTimeInterface $date): self
      {
          $new = clone $this;
  
          if ($date instanceof \DateTimeImmutable) {
              $new->expiry = $date;
          } elseif ($date instanceof \DateTime) {
              $new->expiry = \DateTimeImmutable::createFromMutable($date);
          } else {
              $new->expiry = new \DateTimeImmutable("@" . $date->getTimestamp());
          }
  
          return $new;
      }
code_tokens: public function withExpiry ( \ DateTimeInterface $ date ) : self { $ new = clone $ this ; if ( $ date instanceof \ DateTimeImmutable ) { $ new -> expiry = $ date ; } elseif ( $ date instanceof \ DateTime ) { $ new -> expiry = \ DateTimeImmutable :: createFromMutable ( $ date ) ; } else { $ new -> expiry = new \ DateTimeImmutable ( "@" . $ date -> getTimestamp ( ) ) ; } return $ new ; }
docstring: Applies the given expiry to the cookie.
  
  @param \DateTimeInterface $date
  
  @return self Cloned instance with the specified operation applied.
  
  @see self::withMaxAge()
  @see self::withoutExpiry()
  
  @link https://tools.ietf.org/html/rfc6265#section-5.2.1
docstring_tokens: Applies the given expiry to the cookie .