Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8e5235

Browse files
committed
[BrowserKit] deprecated Response::getStatus() in favor of Response::getStatusCode()
1 parent33dbf1a commite8e5235

File tree

7 files changed

+32
-3
lines changed

7 files changed

+32
-3
lines changed

‎UPGRADE-4.3.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 4.2 to 4.3
22
=======================
33

4+
BrowserKit
5+
----------
6+
7+
* Deprecated`Response::getStatus()`, use`Response::getStatusCode()` instead
8+
49
Config
510
------
611

‎UPGRADE-5.0.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ UPGRADE FROM 4.x to 5.0
44
BrowserKit
55
----------
66

7+
* Removed`Response::getStatus()`, use`Response::getStatusCode()` instead
78
* The`Client::submit()` method has a new`$serverParameters` argument.
89

910
Cache

‎src/Symfony/Component/BrowserKit/CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.3.0
5+
-----
6+
7+
* Deprecated`Response::getStatus()`, use`Response::getStatusCode()` instead
8+
49
4.2.0
510
-----
611

‎src/Symfony/Component/BrowserKit/Client.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function request(string $method, string $uri, array $parameters = array()
409409

410410
$this->cookieJar->updateFromResponse($this->internalResponse,$uri);
411411

412-
$status =$this->internalResponse->getStatus();
412+
$status =$this->internalResponse->getStatusCode();
413413

414414
if ($status >=300 &&$status <400) {
415415
$this->redirect =$this->internalResponse->getHeader('Location');
@@ -599,7 +599,7 @@ public function followRedirect()
599599

600600
$request =$this->internalRequest;
601601

602-
if (\in_array($this->internalResponse->getStatus(),array(301,302,303))) {
602+
if (\in_array($this->internalResponse->getStatusCode(),array(301,302,303))) {
603603
$method ='GET';
604604
$files =array();
605605
$content =null;

‎src/Symfony/Component/BrowserKit/Response.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,17 @@ public function getContent()
8383
* Gets the response status code.
8484
*
8585
* @return int The response status code
86+
*
87+
* @deprecated since Symfony 4.3, use getStatusCode() instead
8688
*/
8789
publicfunctiongetStatus()
90+
{
91+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.3, use getStatusCode() instead.',__METHOD__),E_USER_DEPRECATED);
92+
93+
return$this->status;
94+
}
95+
96+
publicfunctiongetStatusCode():int
8897
{
8998
return$this->status;
9099
}

‎src/Symfony/Component/BrowserKit/Tests/ClientTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function doRequest($request)
5252
protectedfunctionfilterResponse($response)
5353
{
5454
if ($responseinstanceof SpecialResponse) {
55-
returnnewResponse($response->getContent(),$response->getStatus(),$response->getHeaders());
55+
returnnewResponse($response->getContent(),$response->getStatusCode(),$response->getHeaders());
5656
}
5757

5858
return$response;

‎src/Symfony/Component/BrowserKit/Tests/ResponseTest.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,21 @@ public function testGetUri()
2222
$this->assertEquals('foo',$response->getContent(),'->getContent() returns the content of the response');
2323
}
2424

25+
/**
26+
* @group legacy
27+
*/
2528
publicfunctiontestGetStatus()
2629
{
2730
$response =newResponse('foo',304);
2831
$this->assertEquals('304',$response->getStatus(),'->getStatus() returns the status of the response');
2932
}
3033

34+
publicfunctiontestGetStatusCode()
35+
{
36+
$response =newResponse('foo',304);
37+
$this->assertEquals('304',$response->getStatusCode(),'->getStatusCode() returns the status of the response');
38+
}
39+
3140
publicfunctiontestGetHeaders()
3241
{
3342
$response =newResponse('foo',200,array('foo' =>'bar'));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp