PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
← All changes | vendor_prefixed/guzzlehttp/psr7/src/Response.php +14 -3 27.8 → trunk View file →
@@ -26,8 +26,9 @@
26 26 */
27 27 public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
28 28 {
29 29 $this->assertStatusCodeRange($status);
30 + $this->assertProtocolVersion($version);
30 31 $this->statusCode = $status;
31 32 if ($body !== '' && $body !== null) {
32 33 $this->stream = \YoastSEO_Vendor\GuzzleHttp\Psr7\Utils::streamFor($body);
33 34 }
@@ -32,12 +33,14 @@
32 33 $this->stream = \YoastSEO_Vendor\GuzzleHttp\Psr7\Utils::streamFor($body);
33 34 }
34 35 $this->setHeaders($headers);
35 36 if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
36 - $this->reasonPhrase = self::PHRASES[$this->statusCode];
37 + $reasonPhrase = self::PHRASES[$this->statusCode];
37 38 } else {
38 - $this->reasonPhrase = (string) $reason;
39 + $reasonPhrase = (string) $reason;
39 40 }
41 + $this->assertNoLineSeparators($reasonPhrase, 'Reason phrase');
42 + $this->reasonPhrase = $reasonPhrase;
40 43 $this->protocol = $version;
41 44 }
42 45 public function getStatusCode() : int
43 46 {
@@ -48,8 +51,14 @@
48 51 return $this->reasonPhrase;
49 52 }
50 53 public function withStatus($code, $reasonPhrase = '') : \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface
51 54 {
55 + if (!\is_int($code) && \filter_var($code, \FILTER_VALIDATE_INT) !== \false) {
56 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to ResponseInterface::withStatus() is deprecated; guzzlehttp/psr7 3.0 requires int for $code.', \get_debug_type($code));
57 + }
58 + if (!\is_string($reasonPhrase)) {
59 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to ResponseInterface::withStatus() is deprecated; guzzlehttp/psr7 3.0 requires string for $reasonPhrase.', \get_debug_type($reasonPhrase));
60 + }
52 61 $this->assertStatusCodeIsInteger($code);
53 62 $code = (int) $code;
54 63 $this->assertStatusCodeRange($code);
55 64 $new = clone $this;
@@ -56,9 +65,11 @@
56 65 $new->statusCode = $code;
57 66 if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
58 67 $reasonPhrase = self::PHRASES[$new->statusCode];
59 68 }
60 - $new->reasonPhrase = (string) $reasonPhrase;
69 + $reasonPhrase = (string) $reasonPhrase;
70 + $this->assertNoLineSeparators($reasonPhrase, 'Reason phrase');
71 + $new->reasonPhrase = $reasonPhrase;
61 72 return $new;
62 73 }
63 74 /**
64 75 * @param mixed $statusCode