Repository: symfony/symfony
File: src/Symfony/Component/Config/Tests/Definition/ArrayShapeGeneratorTest.php (PHP)

Code before:

    public function testPrototypedArrayNodePhpDocWithKeyAttribute()
    {
        $prototype = new PrototypedArrayNode('proto');
        $prototype->setPrototype(new StringNode('child'));
        $prototype->setKeyAttribute('name');

        $root = new ArrayNode('root');
        $root->addChild($prototype);

        $expected = "array{\n *     proto?: array<string, string|\Symfony\Component\Config\Loader\ParamConfigurator>,\n * }";

        $this->assertStringContainsString($expected, ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandlesRequiredNode()
    {
        $child = new BooleanNode('node');
        $child->setRequired(true);

        $root = new ArrayNode('root');
        $root->addChild($child);

        $expected = 'node?: bool';

        $this->assertStringContainsString($expected, ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandlesRequiredNodeWithNoDeepMerging()
    {
        $child = new BooleanNode('node');
        $child->setRequired(true);

        $root = new ArrayNode('root');
        $root->setPerformDeepMerging(false);
        $root->addChild($child);

        $expected = 'node: bool';

        $this->assertStringContainsString($expected, ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandleAdditionalDocumentation()
    {
        $child = new BooleanNode('node');
        $child->setDeprecated('vendor/package', '1.0', 'The "%path%" option is deprecated.');
        $child->setDefaultValue(true);
        $child->setInfo('This is a boolean node.');

        $root = new ArrayNode('root');
        $root->addChild($child);

Review comment (suggestion):
```suggestion
        $this->assertStringContainsString('node?: bool', ArrayShapeGenerator::generate($root));
```

Code after:

    public function testPrototypedArrayNodePhpDocWithKeyAttribute()
    {
        $prototype = new PrototypedArrayNode('proto');
        $prototype->setPrototype(new StringNode('child'));
        $prototype->setKeyAttribute('name');

        $root = new ArrayNode('root');
        $root->addChild($prototype);

        $expected = "array{\n *     proto?: array<string, string|\Symfony\Component\Config\Loader\ParamConfigurator>,\n * }";

        $this->assertStringContainsString($expected, ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandlesRequiredNode()
    {
        $child = new BooleanNode('node');
        $child->setRequired(true);

        $root = new ArrayNode('root');
        $root->addChild($child);

        $this->assertStringContainsString('node?: bool', ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandlesRequiredNodeWithNoDeepMerging()
    {
        $child = new BooleanNode('node');
        $child->setRequired(true);

        $root = new ArrayNode('root');
        $root->setPerformDeepMerging(false);
        $root->addChild($child);

        $expected = 'node: bool';

        $this->assertStringContainsString($expected, ArrayShapeGenerator::generate($root));
    }

    public function testPhpDocHandleAdditionalDocumentation()
    {
        $child = new BooleanNode('node');
        $child->setDeprecated('vendor/package', '1.0', 'The "%path%" option is deprecated.');
        $child->setDefaultValue(true);
        $child->setInfo('This is a boolean node.');

        $root = new ArrayNode('root');
        $root->addChild($child);

        $this->assertStringContainsString('node?: bool|\Symfony\Component\Config\Loader\ParamConfigurator, // Deprecated: The "node" option is deprecated. // This is a boolean node. // Default: true', ArrayShapeGenerator::generate($root));