mirror of
https://github.com/guzzle/guzzle.git
synced 2025-01-29 11:17:44 +01:00
Be strict about array_replace that may return null (#2471)
* Be strict about array_replace that may return null * revert cs changes
This commit is contained in:
parent
45b360e8cb
commit
ece8392e00
@ -165,11 +165,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Cookie/SetCookie.php
|
||||
|
||||
-
|
||||
message: "#^Property GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:\\$data \\(array\\) does not accept array\\|null\\.$#"
|
||||
count: 1
|
||||
path: src/Cookie/SetCookie.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$timestamp of method GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:setExpires\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
|
@ -69,7 +69,12 @@ class SetCookie
|
||||
*/
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
$this->data = \array_replace(self::$defaults, $data);
|
||||
$replaced = \array_replace(self::$defaults, $data);
|
||||
if ($replaced === null) {
|
||||
throw new \InvalidArgumentException('Unable to replace the default values for the Cookie.');
|
||||
}
|
||||
|
||||
$this->data = $replaced;
|
||||
// Extract the Expires value and turn it into a UNIX timestamp if needed
|
||||
if (!$this->getExpires() && $this->getMaxAge()) {
|
||||
// Calculate the Expires date
|
||||
|
Loading…
x
Reference in New Issue
Block a user