8000 defer addition of new method argument to 8.0 · symfony/symfony@8fadaca · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fadaca

Browse files
committed
defer addition of new method argument to 8.0
1 parent 44e4699 commit 8fadaca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/HttpFoundation/UriSigner.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ public function __construct(#[\SensitiveParameter] string $secret, string $hashP
5151
*
5252
* The expiration is added as a query string parameter.
5353
*/
54-
public function sign(string $uri, \DateTimeInterface|\DateInterval|int|null $expiration = null): string
54+
public function sign(string $uri/*, \DateTimeInterface|\DateInterval|int|null $expiration = null*/): string
5555
{
56+
$expiration = null;
57+
58+
if (1 < \func_num_args()) {
59+
$expiration = func_get_arg(1);
60+
}
61+
62+
if (null !== $expiration && !$expiration instanceof \DateTimeInterface && !$expiration instanceof \DateInterval && !\is_int($expiration)) {
63+
throw new \TypeError(sprintf('The second argument of %s() must be an instance of %s or %s, an integer or null (%s given).', __METHOD__, \DateTimeInterface::class, \DateInterval::class, get_debug_type($expiration)));
64+
}
65+
5666
$url = parse_url($uri);
5767
$params = [];
5868

0 commit comments

Comments
 (0)
0