Skip to content

Commit d361dc7

Browse files
Apply suggestions from code review
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
1 parent 096a798 commit d361dc7

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function handleArrayNode(ArrayNode $node, ClassBuilder $class, string $n
132132

133133
$hasNormalizationClosures = $this->hasNormalizationClosures($node);
134134
$comment = $this->getComment($node);
135-
if ($hasNormalizationClosures && $paramType !== 'array') {
135+
if ($hasNormalizationClosures && 'array' !== $paramType) {
136136
$comment = sprintf(" * @template TValue of %s\n * @param TValue \$value\n%s", $paramType, $comment);
137137
$comment .= sprintf(' * @return %s|$this'."\n", $childClass->getFqcn());
138138
$comment .= sprintf(' * @psalm-return (TValue is array ? %s : static)'."\n ", $childClass->getFqcn());
@@ -145,7 +145,7 @@ private function handleArrayNode(ArrayNode $node, ClassBuilder $class, string $n
145145
$node->getName(),
146146
$this->getType($childClass->getFqcn(), $hasNormalizationClosures)
147147
);
148-
$body = $hasNormalizationClosures && $paramType !== 'array' ? '
148+
$body = $hasNormalizationClosures && 'array' !== $paramType ? '
149149
COMMENTpublic function NAME(PARAM_TYPE $value = []): CLASS|static
150150
{
151151
if (!\is_array($value)) {
@@ -286,7 +286,7 @@ public function NAME(string $VAR, TYPE $VALUE): static
286286
$paramType = $this->getParamType($noKey ? $nodeParameterTypes : $prototypeParameterTypes);
287287

288288
$comment = $this->getComment($node);
289-
if ($hasNormalizationClosures && $paramType !== 'array') {
289+
if ($hasNormalizationClosures && 'array' !== $paramType) {
290290
$comment = sprintf(" * @template TValue of %s\n * @param TValue \$value\n%s", $paramType, $comment);
291291
$comment .= sprintf(' * @return %s|$this'."\n", $childClass->getFqcn());
292292
$comment .= sprintf(' * @psalm-return (TValue is array ? %s : static)'."\n ", $childClass->getFqcn());
@@ -296,7 +296,7 @@ public function NAME(string $VAR, TYPE $VALUE): static
296296
}
297297

298298
if ($noKey) {
299-
$body = $hasNormalizationClosures && $paramType !== 'array' ? '
299+
$body = $hasNormalizationClosures && 'array' !== $paramType ? '
300300
COMMENTpublic function NAME(PARAM_TYPE $value = []): CLASS|static
301301
{
302302
$this->_usedProperties[\'PROPERTY\'] = true;
@@ -321,7 +321,7 @@ public function NAME(string $VAR, TYPE $VALUE): static
321321
'PARAM_TYPE' => $paramType,
322322
]);
323323
} else {
324-
$body = $hasNormalizationClosures && $paramType !== 'array' ? '
324+
$body = $hasNormalizationClosures && 'array' !== $paramType ? '
325325
COMMENTpublic function NAME(string $VAR, PARAM_TYPE $VALUE = []): CLASS|static
326326
{
327327
if (!\is_array($VALUE)) {

src/Symfony/Component/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValues/ErrorPagesConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(array $value = [])
5454
unset($value['with_trace']);
5555
}
5656

57-
if ([] !== $value) {
57+
if ($value) {
5858
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($value)));
5959
}
6060
}

src/Symfony/Component/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValues/TransportsConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(array $value = [])
3434
unset($value['dsn']);
3535
}
3636

37-
if ([] !== $value) {
37+
if ($value) {
3838
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($value)));
3939
}
4040
}

src/Symfony/Component/Config/Tests/Builder/Fixtures/ArrayValues/Symfony/Config/ArrayValuesConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(array $value = [])
7575
unset($value['error_pages']);
7676
}
7777

78-
if ([] !== $value) {
78+
if ($value) {
7979
throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($value)));
8080
}
8181
}

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