You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Cookie.php
+19-25Lines changed: 19 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -53,13 +53,6 @@ final class Cookie
53
53
*/
54
54
private$expires;
55
55
56
-
/**
57
-
* Validation state.
58
-
*
59
-
* @var bool
60
-
*/
61
-
private$valid;
62
-
63
56
/**
64
57
* @param string $name
65
58
* @param string|null $value
@@ -68,8 +61,7 @@ final class Cookie
68
61
* @param string|null $path
69
62
* @param bool $secure
70
63
* @param bool $httpOnly
71
-
* @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
72
-
* @param bool $requireValidation deprecated since version 1.5. Will be removed in 2.0
64
+
* @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
73
65
*
74
66
* @throws \InvalidArgumentException If name, value or max age is not valid. Attributes validation during instantiation is deprecated since 1.5 and will be removed in 2.0.
75
67
*/
@@ -81,15 +73,15 @@ public function __construct(
81
73
$path = null,
82
74
$secure = false,
83
75
$httpOnly = false,
84
-
\DateTime$expires = null,
85
-
$requireValidation = true
76
+
\DateTime$expires = null
86
77
) {
87
-
if ($requireValidation) {
88
-
@trigger_error('Attributes validation during instantiation is deprecated since 1.5 and will be removed in 2.0', E_USER_DEPRECATED);
78
+
try {
89
79
$this->validateName($name);
90
80
$this->validateValue($value);
91
81
$this->validateMaxAge($maxAge);
92
-
$this->valid = true;
82
+
} catch (\InvalidArgumentException$e) {
83
+
@trigger_error('Attributes validation during instantiation is deprecated since 1.5 and will be removed in 2.0', E_USER_DEPRECATED);
84
+
throw$e;
93
85
}
94
86
95
87
$this->name = $name;
@@ -112,7 +104,12 @@ public static function createWithoutValidation(
0 commit comments