Skip to content

Commit 5f9f3d0

Browse files
committed
Fixes apply callable default value, improves documentation
1 parent 136afa8 commit 5f9f3d0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Cookie/CookieBuilder.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@ public function __construct(
5454
}
5555

5656
/**
57-
* Apply the Cookie to a callable matching the signature of PHP 7.4+
57+
* Apply the Cookie to `setcookie` a callable matching the signature of PHP 7.4+
5858
* `setcookie(string $name, string $value = "", array $options = []) : bool`
59+
*
60+
* @param callable|null $callee The `setcookie` compatible callback to be used.
61+
* If set to null, the default setcookie()
5962
*/
60-
public function apply( callable $callee = "\\setcookie" ) : bool {
63+
public function apply( ?callable $callee = null ) : bool {
64+
if( $callee === null ) {
65+
$callee = '\\setcookie';
66+
}
67+
6168
return $callee(
6269
$this->name,
6370
$this->value,

0 commit comments

Comments
 (0)