Skip to content

Commit 3b7af3a

Browse files
committed
deprecate HeaderBag::get and fix tests and dependencies
1 parent fad5ccb commit 3b7af3a

File tree

71 files changed

+361
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+361
-343
lines changed

src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function onKernelResponse(FilterResponseEvent $event)
4040
return;
4141
}
4242

43-
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
43+
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->getValue('User-Agent'))) {
4444
$this->sendHeaders = false;
4545
$this->headers = [];
4646

src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function onKernelResponse(FilterResponseEvent $event)
4141
}
4242

4343
$request = $event->getRequest();
44-
if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $request->headers->get('User-Agent'))
44+
if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $request->headers->getValue('User-Agent'))
4545
&& !$request->headers->has('X-FirePHP-Version')) {
4646
self::$sendHeaders = false;
4747
$this->headers = [];

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"conflict": {
3030
"symfony/console": "<3.4",
31-
"symfony/http-foundation": "<3.4"
31+
"symfony/http-foundation": "<4.4"
3232
},
3333
"suggest": {
3434
"symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.",

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ public function testFile()
186186
$response = $controller->file(new File(__FILE__));
187187
$this->assertInstanceOf(BinaryFileResponse::class, $response);
188188
$this->assertSame(200, $response->getStatusCode());
189-
if ($response->headers->get('content-type')) {
190-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
189+
if ($response->headers->getValue('content-type')) {
190+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
191191
}
192-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
193-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
192+
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->getValue('content-disposition'));
193+
$this->assertContains(basename(__FILE__), $response->headers->getValue('content-disposition'));
194194
}
195195

196196
public function testFileAsInline()
@@ -202,11 +202,11 @@ public function testFileAsInline()
202202

203203
$this->assertInstanceOf(BinaryFileResponse::class, $response);
204204
$this->assertSame(200, $response->getStatusCode());
205-
if ($response->headers->get('content-type')) {
206-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
205+
if ($response->headers->getValue('content-type')) {
206+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
207207
}
208-
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
209-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
208+
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->getValue('content-disposition'));
209+
$this->assertContains(basename(__FILE__), $response->headers->getValue('content-disposition'));
210210
}
211211

212212
public function testFileWithOwnFileName()
@@ -219,11 +219,11 @@ public function testFileWithOwnFileName()
219219

220220
$this->assertInstanceOf(BinaryFileResponse::class, $response);
221221
$this->assertSame(200, $response->getStatusCode());
222-
if ($response->headers->get('content-type')) {
223-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
222+
if ($response->headers->getValue('content-type')) {
223+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
224224
}
225-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
226-
$this->assertContains($fileName, $response->headers->get('content-disposition'));
225+
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->getValue('content-disposition'));
226+
$this->assertContains($fileName, $response->headers->getValue('content-disposition'));
227227
}
228228

229229
public function testFileWithOwnFileNameAsInline()
@@ -236,11 +236,11 @@ public function testFileWithOwnFileNameAsInline()
236236

237237
$this->assertInstanceOf(BinaryFileResponse::class, $response);
238238
$this->assertSame(200, $response->getStatusCode());
239-
if ($response->headers->get('content-type')) {
240-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
239+
if ($response->headers->getValue('content-type')) {
240+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
241241
}
242-
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
243-
$this->assertContains($fileName, $response->headers->get('content-disposition'));
242+
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->getValue('content-disposition'));
243+
$this->assertContains($fileName, $response->headers->getValue('content-disposition'));
244244
}
245245

246246
public function testFileFromPath()
@@ -252,11 +252,11 @@ public function testFileFromPath()
252252

253253
$this->assertInstanceOf(BinaryFileResponse::class, $response);
254254
$this->assertSame(200, $response->getStatusCode());
255-
if ($response->headers->get('content-type')) {
256-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
255+
if ($response->headers->getValue('content-type')) {
256+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
257257
}
258-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
259-
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
258+
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->getValue('content-disposition'));
259+
$this->assertContains(basename(__FILE__), $response->headers->getValue('content-disposition'));
260260
}
261261

262262
public function testFileFromPathWithCustomizedFileName()
@@ -268,11 +268,11 @@ public function testFileFromPathWithCustomizedFileName()
268268

269269
$this->assertInstanceOf(BinaryFileResponse::class, $response);
270270
$this->assertSame(200, $response->getStatusCode());
271-
if ($response->headers->get('content-type')) {
272-
$this->assertSame('text/x-php', $response->headers->get('content-type'));
271+
if ($response->headers->getValue('content-type')) {
272+
$this->assertSame('text/x-php', $response->headers->getValue('content-type'));
273273
}
274-
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
275-
$this->assertContains('test.php', $response->headers->get('content-disposition'));
274+
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->getValue('content-disposition'));
275+
$this->assertContains('test.php', $response->headers->getValue('content-disposition'));
276276
}
277277

278278
/**

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,6 @@ private function createRedirectController($httpPort = null, $httpsPort = null)
304304

305305
private function assertRedirectUrl(Response $returnResponse, $expectedUrl)
306306
{
307-
$this->assertTrue($returnResponse->isRedirect($expectedUrl), "Expected: $expectedUrl\nGot: ".$returnResponse->headers->get('Location'));
307+
$this->assertTrue($returnResponse->isRedirect($expectedUrl), "Expected: $expectedUrl\nGot: ".$returnResponse->headers->getValue('Location'));
308308
}
309309
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testCorrectCacheControlHeadersForCacheableAction($config, $insul
139139
$client->request('GET', '/cacheable');
140140

141141
$response = $client->getResponse();
142-
$this->assertSame('public, s-maxage=100', $response->headers->get('cache-control'));
142+
$this->assertSame('public, s-maxage=100', $response->headers->getValue('cache-control'));
143143
}
144144

145145
public function getConfigs()

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class WebTestCase extends BaseWebTestCase
1919
public static function assertRedirect($response, $location)
2020
{
2121
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode());
22-
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
22+
self::assertEquals('http://localhost'.$location, $response->headers->getValue('Location'));
2323
}
2424

2525
public static function setUpBeforeClass()

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/cache": "^4.3|^5.0",
2222
"symfony/config": "^4.2|^5.0",
2323
"symfony/dependency-injection": "^4.4|^5.0",
24-
"symfony/http-foundation": "^4.3|^5.0",
24+
"symfony/http-foundation": "^4.4|^5.0",
2525
"symfony/http-kernel": "^4.3|^5.0",
2626
"symfony/polyfill-mbstring": "~1.0",
2727
"symfony/filesystem": "^3.4|^4.0|^5.0",
@@ -79,7 +79,8 @@
7979
"symfony/translation": "<4.3",
8080
"symfony/twig-bridge": "<4.1.1",
8181
"symfony/validator": "<4.1",
82-
"symfony/workflow": "<4.3"
82+
"symfony/workflow": "<4.3",
83+
"symfony/http-foundation": "<4.4"
8384
},
8485
"suggest": {
8586
"ext-apcu": "For best performance of the system caches",

src/Symfony/Bundle/SecurityBundle/Tests/Functional/JsonLoginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testDefaultJsonLoginBadRequest()
6969
$response = $client->getResponse();
7070

7171
$this->assertSame(400, $response->getStatusCode());
72-
$this->assertSame('application/json', $response->headers->get('Content-Type'));
72+
$this->assertSame('application/json', $response->headers->getValue('Content-Type'));
7373
$this->assertArraySubset(['error' => ['code' => 400, 'message' => 'Bad Request']], json_decode($response->getContent(), true));
7474
}
7575
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class WebTestCase extends BaseWebTestCase
1919
public static function assertRedirect($response, $location)
2020
{
2121
self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.substr($response, 0, 2000));
22-
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
22+
self::assertEquals('http://localhost'.$location, $response->headers->getValue('Location'));
2323
}
2424

2525
public static function setUpBeforeClass()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy