8000 [HttpFoundation] Allow to not pass a parameter to Request::isMethodSa… · symfony/symfony@e819256 · GitHub
[go: up one dir, main page]

Skip to content

Commit e819256

Browse files
dunglasnicolas-grekas
authored andcommitted
[HttpFoundation] Allow to not pass a parameter to Request::isMethodSafe()
1 parent ee4b99f commit e819256

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,14 +1447,11 @@ public function isMethod($method)
14471447
*
14481448
* @see https://tools.ietf.org/html/rfc7231#section-4.2.1
14491449
*
1450-
* @param bool $andCacheable Adds the additional condition that the method should be cacheable. True by default.
1451-
*
14521450
* @return bool
14531451
*/
1454-
public function isMethodSafe(/* $andCacheable = true */)
1452+
public function isMethodSafe()
14551453
{
1456-
if (!\func_num_args() || func_get_arg(0)) {
1457-
// setting $andCacheable to false should be deprecated in 4.1
1454+
if (\func_num_args() > 0 && func_get_arg(0)) {
14581455
throw new \BadMethodCallException('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is not supported.');
14591456
}
14601457

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,7 @@ public function testMethodSafeChecksCacheable()
21322132
$this->expectException('BadMethodCallException');
21332133
$request = new Request();
21342134
$request->setMethod('OPTIONS');
2135-
$request->isMethodSafe();
2135+
$request->isMethodSafe(true);
21362136
}
21372137

21382138
/**

0 commit comments

Comments
 (0)
0