Skip to content

Commit 9fc0627

Browse files
committed
Update PHP minimum version to 8.0 and dependencies to latest compatible version
1 parent e667b30 commit 9fc0627

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Entity/BaseToken.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
namespace Platine\OAuth2\Entity;
3434

35+
use DateMalformedStringException;
3536
use DateTime;
3637
use DateTimeInterface;
3738

@@ -233,9 +234,18 @@ protected static function createNew(
233234

234235
$expireAt = null;
235236
if ($ttl > 0) {
236-
$res = (new DateTime())->modify(sprintf('%+d seconds', $ttl));
237-
if ($res !== false) {
238-
$expireAt = $res;
237+
// Since PHP >= 8.3 DateTime::modify() now throws
238+
// DateMalformedStringException if an invalid string is passed.
239+
if (PHP_VERSION_ID >= 80300) {
240+
try {
241+
$expireAt = (new DateTime())->modify(sprintf('%+d seconds', $ttl));
242+
} catch (DateMalformedStringException $ex) {
243+
}
244+
} else {
245+
$res = (new DateTime())->modify(sprintf('%+d seconds', $ttl));
246+
if ($res !== false) {
247+
$expireAt = $res;
248+
}
239249
}
240250
}
241251

src/Entity/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ final public function __construct()
8787
*/
8888
public static function createNewClient(
8989
string $name,
90-
string|array $redirectUris = null,
90+
string|array|null $redirectUris = null,
9191
?array $scopes = null
9292
): self {
9393
if (is_string($redirectUris)) {

0 commit comments

Comments
 (0)