Skip to content

Commit

Permalink
Merge pull request #52 from jeijei4/patch-1
Browse files Browse the repository at this point in the history
Some optimizations in the Reusable.php class
  • Loading branch information
paragonie-security authored Apr 16, 2024
2 parents e415f98 + c0b92cc commit f0ecdec
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Reusable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Reusable extends AntiCSRF
/**
* @var \DateInterval|null
*/
protected $tokenLifetime = null;
protected ?\DateInterval $tokenLifetime = null;

/**
* @param \DateInterval $interval
Expand Down Expand Up @@ -57,12 +57,9 @@ public function reconfigure(array $options = []): AntiCSRF
/** @var string $opt */
/** @var \DateInterval $val */
foreach ($options as $opt => $val) {
switch ($opt) {
case 'tokenLifetime':
if ($val instanceof \DateInterval) {
$this->tokenLifetime = $val;
}
break;
if ($opt == 'tokenLifetime' && $val instanceof \DateInterval) {
$this->tokenLifetime = $val;
break;
}
}
return parent::reconfigure($options);
Expand Down

0 comments on commit f0ecdec

Please sign in to comment.