Skip to content

Commit 2c0dd69

Browse files
feature #61187 Declare new parameters on interfaces and methods explicitly (nicolas-grekas)
This PR was merged into the 8.0 branch. Discussion ---------- Declare new parameters on interfaces and methods explicitly | Q | A | ------------- | --- | Branch? | 8.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT * Add argument `$info` to `ArrayNodeDefinition::canBeDisabled()` and `canBeEnabled()` * Add argument `$finishedIndicator` to `ProgressIndicator::finish()` * Add argument `$target` to `ContainerBuilder::registerAliasForArgument()` * Add arguments `$v4Bytes` and `$v6Bytes` to `IpUtils::anonymize()` * Add argument `$partitioned` to `ResponseHeaderBag::clearCookie()` * Add argument `$expiration` to `UriSigner::sign()` * Add argument `$logChannel` to `ErrorListener::logException()` * Add argument `$accessDecision` to `AccessDecisionManagerInterface::decide()` and `AuthorizationCheckerInterface::isGranted()` * Add argument `$vote` to `VoterInterface::vote()` and `Voter::voteOnAttribute()` * Add argument `$token` to `UserCheckerInterface::checkPostAuth()` * Add argument `$attributes` to `UserAuthenticatorInterface::authenticateUser()` * Add argument `$format` to `Uuid::isValid()` * Add argument `$request` to `RequestParserInterface::createSuccessfulResponse()` and `RequestParserInterface::createRejectedResponse()` * Add `$nbToken` argument to `Marking::mark()` and `Marking::unmark()` Commits ------- 827e593 Declare new parameters on interfaces and methods explicitly
2 parents dc34dbd + 827e593 commit 2c0dd69

34 files changed

+88
-116
lines changed

UPGRADE-8.0.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Cache
1919

2020
* Remove `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter` instead
2121

22+
Config
23+
------
24+
25+
* Add argument `$info` to `ArrayNodeDefinition::canBeDisabled()` and `canBeEnabled()`
26+
2227
Console
2328
-------
2429

@@ -56,7 +61,7 @@ Console
5661
// ...
5762
}
5863
```
59-
64+
* Add argument `$finishedIndicator` to `ProgressIndicator::finish()`
6065
* Ensure closures set via `Command::setCode()` method have proper parameter and return types
6166

6267
*Before*
@@ -124,6 +129,7 @@ DependencyInjection
124129
```
125130
* Remove `!tagged` tag, use `!tagged_iterator` instead
126131
* Remove the `ContainerBuilder::getAutoconfiguredAttributes()` method, use `getAttributeAutoconfigurators()` instead to retrieve all the callbacks for a specific attribute class
132+
* Add argument `$target` to `ContainerBuilder::registerAliasForArgument()`
127133

128134
DoctrineBridge
129135
--------------
@@ -220,6 +226,9 @@ HttpFoundation
220226

221227
* Remove the following deprecated session options from `NativeSessionStorage`: `referer_check`, `use_only_cookies`, `use_trans_sid`, `sid_length`, `sid_bits_per_character`, `trans_sid_hosts`, `trans_sid_tags`
222228
* Trigger PHP warning when using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead
229+
* Add arguments `$v4Bytes` and `$v6Bytes` to `IpUtils::anonymize()`
230+
* Add argument `$partitioned` to `ResponseHeaderBag::clearCookie()`
231+
* Add argument `$expiration` to `UriSigner::sign()`
223232

224233
HttpClient
225234
----------
@@ -234,6 +243,7 @@ HttpKernel
234243
* Remove `Extension::getAnnotatedClassesToCompile()` and `Extension::addAnnotatedClassesToCompile()`
235244
* Remove `Kernel::getAnnotatedClassesToCompile()` and `Kernel::setAnnotatedClassCache()`
236245
* Make `ServicesResetter` class `final`
246+
* Add argument `$logChannel` to `ErrorListener::logException()`
237247

238248
Intl
239249
----
@@ -415,6 +425,10 @@ Security
415425
* Remove `AbstractListener::__invoke`
416426
* Remove `LazyFirewallContext::__invoke()`
417427
* Remove `RememberMeToken::getSecret()`
428+
* Add argument `$accessDecision` to `AccessDecisionManagerInterface::decide()` and `AuthorizationCheckerInterface::isGranted()`
429+
* Add argument `$vote` to `VoterInterface::vote()` and `Voter::voteOnAttribute()`
430+
* Add argument `$token` to `UserCheckerInterface::checkPostAuth()`
431+
* Add argument `$attributes` to `UserAuthenticatorInterface::authenticateUser()`
418432

419433
SecurityBundle
420434
--------------
@@ -541,6 +555,11 @@ TypeInfo
541555
+$type = Type::list(Type::string());
542556
```
543557

558+
Uid
559+
---
560+
561+
* Add argument `$format` to `Uuid::isValid()`
562+
544563
Validator
545564
---------
546565

@@ -553,6 +572,11 @@ VarExporter
553572
* Remove `LazyGhostTrait` and `LazyProxyTrait`, use native lazy objects instead
554573
* Remove `ProxyHelper::generateLazyGhost()`, use native lazy objects instead
555574

575+
Webhook
576+
-------
577+
578+
* Add argument `$request` to `RequestParserInterface::createSuccessfulResponse()` and `RequestParserInterface::createRejectedResponse()`
579+
556580
WebProfilerBundle
557581
-----------------
558582

@@ -561,6 +585,7 @@ WebProfilerBundle
561585
Workflow
562586
--------
563587

588+
* Add `$nbToken` argument to `Marking::mark()` and `Marking::unmark()`
564589
* Remove `Event::getWorkflow()` method
565590

566591
*Before*

src/Symfony/Component/Config/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+
8.0
5+
---
6+
7+
* Add argument `$info` to `ArrayNodeDefinition::canBeDisabled()` and `canBeEnabled()`
8+
49
7.4
510
---
611

src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function canBeUnset(bool $allow = true): static
243243
*
244244
* @return $this
245245
*/
246-
public function canBeEnabled(/* ?string $info = null */): static
246+
public function canBeEnabled(?string $info = null): static
247247
{
248248
$disabledNode = $this
249249
->addDefaultsIfNotSet()
@@ -263,7 +263,6 @@ public function canBeEnabled(/* ?string $info = null */): static
263263
->defaultFalse()
264264
;
265265

266-
$info = 1 <= \func_num_args() ? func_get_arg(0) : null;
267266
if ($info) {
268267
$disabledNode->info($info);
269268
}
@@ -280,7 +279,7 @@ public function canBeEnabled(/* ?string $info = null */): static
280279
*
281280
* @return $this
282281
*/
283-
public function canBeDisabled(/* ?string $info = null */): static
282+
public function canBeDisabled(?string $info = null): static
284283
{
285284
$enabledNode = $this
286285
->addDefaultsIfNotSet()
@@ -292,7 +291,6 @@ public function canBeDisabled(/* ?string $info = null */): static
292291
->defaultTrue()
293292
;
294293

295-
$info = 1 <= \func_num_args() ? func_get_arg(0) : null;
296294
if ($info) {
297295
$enabledNode->info($info);
298296
}

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Ensure closures set via `Command::setCode()` method have proper parameter and return types
1010
* Add method `isSilent()` to `OutputInterface`
1111
* Remove deprecated `Symfony\Component\Console\Application::add()` method in favor of `Symfony\Component\Console\Application::addCommand()`
12+
* Add argument `$finishedIndicator` to `ProgressIndicator::finish()`
1213

1314
7.4
1415
---

src/Symfony/Component/Console/Helper/ProgressIndicator.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,9 @@ public function advance(): void
128128

129129
/**
130130
* Finish the indicator with message.
131-
*
132-
* @param ?string $finishedIndicator
133131
*/
134-
public function finish(string $message/* , ?string $finishedIndicator = null */): void
132+
public function finish(string $message, ?string $finishedIndicator = null): void
135133
{
136-
$finishedIndicator = 1 < \func_num_args() ? func_get_arg(1) : null;
137-
if (null !== $finishedIndicator && !\is_string($finishedIndicator)) {
138-
throw new \TypeError(\sprintf('Argument 2 passed to "%s()" must be of the type string or null, "%s" given.', __METHOD__, get_debug_type($finishedIndicator)));
139-
}
140-
141134
if (!$this->started) {
142135
throw new LogicException('Progress indicator has not yet been started.');
143136
}

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Remove `#[TaggedIterator]` and `#[TaggedLocator]` attributes, replaced by `#[AutowireLocator]` and `#[AutowireIterator]`
88
* Remove `ContainerBuilder::getAutoconfiguredAttributes()`, replaced by `ContainerBuilder::getAttributeAutoconfigurators()`
99
* Remove `!tagged` tag, use `!tagged_iterator` instead
10+
* Add argument `$target` to `ContainerBuilder::registerAliasForArgument()`
1011

1112
7.4
1213
---

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,13 +1459,11 @@ public function registerAttributeForAutoconfiguration(string $attributeClass, ca
14591459
* using camel case: "foo.bar" or "foo_bar" creates an alias bound to
14601460
* "$fooBar"-named arguments with $type as type-hint. Such arguments will
14611461
* receive the service $id when autowiring is used.
1462-
*
1463-
* @param ?string $target
14641462
*/
1465-
public function registerAliasForArgument(string $id, string $type, ?string $name = null/* , ?string $target = null */): Alias
1463+
public function registerAliasForArgument(string $id, string $type, ?string $name = null, ?string $target = null): Alias
14661464
{
14671465
$parsedName = (new Target($name ??= $id))->getParsedName();
1468-
$target = (\func_num_args() > 3 ? func_get_arg(3) : null) ?? $name;
1466+
$target ??= $name;
14691467

14701468
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $parsedName)) {
14711469
if ($id !== $name) {

src/Symfony/Component/HttpFoundation/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ CHANGELOG
66

77
* Remove the following deprecated session options from `NativeSessionStorage`: `referer_check`, `use_only_cookies`, `use_trans_sid`, `sid_length`, `sid_bits_per_character`, `trans_sid_hosts`, `trans_sid_tags`
88
* Trigger PHP warning when using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead
9+
* Add arguments `$v4Bytes` and `$v6Bytes` to `IpUtils::anonymize()`
10+
* Add argument `$partitioned` to `ResponseHeaderBag::clearCookie()`
11+
* Add argument `$expiration` to `UriSigner::sign()`
912

1013
7.4
1114
---

src/Symfony/Component/HttpFoundation/IpUtils.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,8 @@ public static function checkIp6(string $requestIp, string $ip): bool
183183
* @param int<0, 4> $v4Bytes
184184
* @param int<0, 16> $v6Bytes
185185
*/
186-
public static function anonymize(string $ip/* , int $v4Bytes = 1, int $v6Bytes = 8 */): string
186+
public static function anonymize(string $ip, int $v4Bytes = 1, int $v6Bytes = 8): string
187187
{
188-
$v4Bytes = 1 < \func_num_args() ? func_get_arg(1) : 1;
189-
$v6Bytes = 2 < \func_num_args() ? func_get_arg(2) : 8;
190-
191188
if ($v4Bytes < 0 || $v6Bytes < 0) {
192189
throw new \InvalidArgumentException('Cannot anonymize less than 0 bytes.');
193190
}

src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,9 @@ public function getCookies(string $format = self::COOKIES_FLAT): array
216216

217217
/**
218218
* Clears a cookie in the browser.
219-
*
220-
* @param bool $partitioned
221219
*/
222-
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null /* , bool $partitioned = false */): void
220+
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null, bool $partitioned = false): void
223221
{
224-
$partitioned = 6 < \func_num_args() ? func_get_arg(6) : false;
225-
226222
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite, $partitioned));
227223
}
228224

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