Skip to content

Commit 63de87e

Browse files
[7.0] Remove remaining deprecated code paths
1 parent a3ac5f6 commit 63de87e

File tree

6 files changed

+8
-30
lines changed

6 files changed

+8
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Remove classes `RequestMatcher` and `ExpressionRequestMatcher`
1010
* Remove `Request::getContentType()`, use `Request::getContentTypeFormat()` instead
1111
* Throw an `InvalidArgumentException` when calling `Request::create()` with a malformed URI
12+
* Require explicit argument when calling `JsonResponse::setCallback()`, `Response::setExpires/setLastModified/setEtag()`, `MockArraySessionStorage/NativeSessionStorage::setMetadataBag()`, `NativeSessionStorage::setSaveHandler()`
1213

1314
6.4
1415
---

JsonResponse.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ public static function fromJsonString(string $data, int $status = 200, array $he
7575
*
7676
* @throws \InvalidArgumentException When the callback name is not valid
7777
*/
78-
public function setCallback(string $callback = null): static
78+
public function setCallback(?string $callback): static
7979
{
80-
if (1 > \func_num_args()) {
81-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
82-
}
8380
if (null !== $callback) {
8481
// partially taken from https://geekality.net/2011/08/03/valid-javascript-identifier/
8582
// partially taken from https://github.com/willdurand/JsonpCallbackValidator

Response.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,8 @@ public function getExpires(): ?\DateTimeImmutable
761761
*
762762
* @final
763763
*/
764-
public function setExpires(\DateTimeInterface $date = null): static
764+
public function setExpires(?\DateTimeInterface $date): static
765765
{
766-
if (1 > \func_num_args()) {
767-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
768-
}
769766
if (null === $date) {
770767
$this->headers->remove('Expires');
771768

@@ -942,11 +939,8 @@ public function getLastModified(): ?\DateTimeImmutable
942939
*
943940
* @final
944941
*/
945-
public function setLastModified(\DateTimeInterface $date = null): static
942+
public function setLastModified(?\DateTimeInterface $date): static
946943
{
947-
if (1 > \func_num_args()) {
948-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
949-
}
950944
if (null === $date) {
951945
$this->headers->remove('Last-Modified');
952946

@@ -980,11 +974,8 @@ public function getEtag(): ?string
980974
*
981975
* @final
982976
*/
983-
public function setEtag(string $etag = null, bool $weak = false): static
977+
public function setEtag(?string $etag, bool $weak = false): static
984978
{
985-
if (1 > \func_num_args()) {
986-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
987-
}
988979
if (null === $etag) {
989980
$this->headers->remove('Etag');
990981
} else {

Session/Storage/MockArraySessionStorage.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,8 @@ public function isStarted(): bool
192192
/**
193193
* @return void
194194
*/
195-
public function setMetadataBag(MetadataBag $bag = null)
195+
public function setMetadataBag(?MetadataBag $bag)
196196
{
197-
if (1 > \func_num_args()) {
198-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
199-
}
200197
$this->metadataBag = $bag ?? new MetadataBag();
201198
}
202199

Session/Storage/NativeSessionStorage.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,8 @@ public function getBag(string $name): SessionBagInterface
317317
/**
318318
* @return void
319319
*/
320-
public function setMetadataBag(MetadataBag $metaBag = null)
320+
public function setMetadataBag(?MetadataBag $metaBag)
321321
{
322-
if (1 > \func_num_args()) {
323-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
324-
}
325322
$this->metadataBag = $metaBag ?? new MetadataBag();
326323
}
327324

@@ -396,12 +393,8 @@ public function setOptions(array $options)
396393
*
397394
* @throws \InvalidArgumentException
398395
*/
399-
public function setSaveHandler(AbstractProxy|\SessionHandlerInterface $saveHandler = null)
396+
public function setSaveHandler(AbstractProxy|\SessionHandlerInterface|null $saveHandler)
400397
{
401-
if (1 > \func_num_args()) {
402-
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
403-
}
404-
405398
// Wrap $saveHandler in proxy and prevent double wrapping of proxy
406399
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
407400
$saveHandler = new SessionHandlerProxy($saveHandler);

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
],
1818
"require": {
1919
"php": ">=8.2",
20-
"symfony/deprecation-contracts": "^2.5|^3",
2120
"symfony/polyfill-mbstring": "~1.1",
2221
"symfony/polyfill-php83": "^1.27"
2322
},

0 commit comments

Comments
 (0)