Skip to content

Commit cc2e030

Browse files
Declare new parameters on interfaces and methods explicitly
1 parent dc34dbd commit cc2e030

23 files changed

+31
-110
lines changed

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/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/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/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

src/Symfony/Component/HttpFoundation/UriSigner.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,8 @@ public function __construct(
5757
*
5858
* The expiration is added as a query string parameter.
5959
*/
60-
public function sign(string $uri/* , \DateTimeInterface|\DateInterval|int|null $expiration = null */): string
60+
public function sign(string $uri, \DateTimeInterface|\DateInterval|int|null $expiration = null): string
6161
{
62-
$expiration = null;
63-
64-
if (1 < \func_num_args()) {
65-
$expiration = func_get_arg(1);
66-
}
67-
68-
if (null !== $expiration && !$expiration instanceof \DateTimeInterface && !$expiration instanceof \DateInterval && !\is_int($expiration)) {
69-
throw new \TypeError(\sprintf('The second argument of "%s()" must be an instance of "%s" or "%s", an integer or null (%s given).', __METHOD__, \DateTimeInterface::class, \DateInterval::class, get_debug_type($expiration)));
70-
}
71-
7262
$url = parse_url($uri);
7363
$params = [];
7464

src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,9 @@ public static function getSubscribedEvents(): array
159159
];
160160
}
161161

162-
/**
163-
* Logs an exception.
164-
*
165-
* @param ?string $logChannel
166-
*/
167-
protected function logException(\Throwable $exception, string $message, ?string $logLevel = null/* , ?string $logChannel = null */): void
162+
protected function logException(\Throwable $exception, string $message, ?string $logLevel = null, ?string $logChannel = null): void
168163
{
169-
$logChannel = (3 < \func_num_args() ? func_get_arg(3) : null) ?? $this->resolveLogChannel($exception);
170-
164+
$logChannel ??= $this->resolveLogChannel($exception);
171165
$logLevel ??= $this->resolveLogLevel($exception);
172166

173167
if (!$logger = $this->getLogger($logChannel)) {

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ interface AccessDecisionManagerInterface
2727
* @param mixed $object The object to secure
2828
* @param AccessDecision|null $accessDecision Should be used to explain the decision
2929
*/
30-
public function decide(TokenInterface $token, array $attributes, mixed $object = null/* , ?AccessDecision $accessDecision = null */): bool;
30+
public function decide(TokenInterface $token, array $attributes, mixed $object = null, ?AccessDecision $accessDecision = null): bool;
3131
}

src/Symfony/Component/Security/Core/Authorization/AuthorizationCheckerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ interface AuthorizationCheckerInterface
2424
* @param mixed $attribute A single attribute to vote on (can be of any type; strings, Expression and Closure instances are supported by the core)
2525
* @param AccessDecision|null $accessDecision Should be used to explain the decision
2626
*/
27-
public function isGranted(mixed $attribute, mixed $subject = null/* , ?AccessDecision $accessDecision = null */): bool;
27+
public function isGranted(mixed $attribute, mixed $subject = null, ?AccessDecision $accessDecision = null): bool;
2828
}

src/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,8 @@ public function __construct(
4040
) {
4141
}
4242

43-
/**
44-
* @param Vote|null $vote Should be used to explain the vote
45-
*/
46-
public function vote(TokenInterface $token, mixed $subject, array $attributes/* , ?Vote $vote = null */): int
43+
public function vote(TokenInterface $token, mixed $subject, array $attributes, ?Vote $vote = null): int
4744
{
48-
$vote = 3 < \func_num_args() ? func_get_arg(3) : null;
49-
5045
if ($attributes === [self::PUBLIC_ACCESS]) {
5146
$vote?->addReason('Access is public.');
5247

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