Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ private function handleArrayNode(ArrayNode $node, ClassBuilder $class, string $n
);
$body = $hasNormalizationClosures ? '
/**
* @template T
* @psalm-param T $value
*
* @return CLASS|$this
* @psalm-return (T is array ? CLASS : static)
*/
public function NAME($value = [])
{
Expand Down Expand Up @@ -262,7 +266,11 @@ public function NAME(string $VAR, $VALUE): self
if (null === $key = $node->getKeyAttribute()) {
$body = $hasNormalizationClosures ? '
/**
* @template T
* @psalm-param T $value
*
* @return CLASS|$this
* @psalm-return (T is array ? CLASS : static)
*/
public function NAME($value = [])
{
Expand All @@ -285,7 +293,11 @@ public function NAME(array $value = []): CLASS
} else {
$body = $hasNormalizationClosures ? '
/**
* @template T
* @psalm-param T $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be $VALUE to be replaced by the appropriate name.

*
* @return CLASS|$this
* @psalm-return (T is array ? CLASS : static)
*/
public function NAME(string $VAR, $VALUE = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
/**
* This class is automatically generated to help in creating a config.
*/
class NestedConfig
class NestedConfig
{
private $nestedObject;
private $nestedListObject;
private $_usedProperties = [];

/**
* @template T
* @psalm-param T $value
*
* @return \Symfony\Config\ScalarNormalizedTypes\Nested\NestedObjectConfig|$this
* @psalm-return (T is array ? \Symfony\Config\ScalarNormalizedTypes\Nested\NestedObjectConfig : static)
*/
public function nestedObject($value = [])
{
Expand All @@ -39,7 +43,11 @@ public function nestedObject($value = [])
}

/**
* @template T
* @psalm-param T $value
*
* @return \Symfony\Config\ScalarNormalizedTypes\Nested\NestedListObjectConfig|$this
* @psalm-return (T is array ? \Symfony\Config\ScalarNormalizedTypes\Nested\NestedListObjectConfig : static)
*/
public function nestedListObject($value = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public function keyedArray(string $name, $value): self
}

/**
* @template T
* @psalm-param T $value
*
* @return \Symfony\Config\ScalarNormalizedTypes\ObjectConfig|$this
* @psalm-return (T is array ? \Symfony\Config\ScalarNormalizedTypes\ObjectConfig : static)
*/
public function object($value = [])
{
Expand All @@ -70,7 +74,11 @@ public function object($value = [])
}

/**
* @template T
* @psalm-param T $value
*
* @return \Symfony\Config\ScalarNormalizedTypes\ListObjectConfig|$this
* @psalm-return (T is array ? \Symfony\Config\ScalarNormalizedTypes\ListObjectConfig : static)
*/
public function listObject($value = [])
{
Expand All @@ -85,7 +93,11 @@ public function listObject($value = [])
}

/**
* @template T
* @psalm-param T $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't these all be just @param?

*
* @return \Symfony\Config\ScalarNormalizedTypes\KeyedListObjectConfig|$this
* @psalm-return (T is array ? \Symfony\Config\ScalarNormalizedTypes\KeyedListObjectConfig : static)
*/
public function keyedListObject(string $class, $value = [])
{
Expand Down