Repository: symfony/symfony
File: src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php (PHP)

Code before:
            $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before);
            $this->normalization->declaredTypes = $allowedTypes;
        }

        if (isset($this->validation)) {
            $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules);
        }

        $node = $this->createNode();
        if ($node instanceof BaseNode) {
            $node->setAttributes($this->attributes);
        }

        return $node;
    }

    /**
     * Sets the default value.
     *
     * @return $this
     */
    public function defaultValue(mixed $value): static
    {
        if ($this->required) {
            // throw new InvalidDefinitionException(sprintf('You cannot set a default value to the node "%s" as it is required.', $this->name));
            trigger_deprecation('symfony/config', '7.4', 'Setting a default value to the node "%s" is deprecated when it is required.', $this->name);
        }

        $this->default = true;
        $this->defaultValue = $value;

        return $this;
    }

    /**
     * Sets the node as required.
     *
     * @return $this
     */
    public function isRequired(): static
    {
        if ($this->default) {
            // throw new InvalidDefinitionException(sprintf('You cannot set the node "%s" as required as it has a default value.', $this->name));
            trigger_deprecation('symfony/config', '7.4', 'Setting the node "%s" as required is deprecated when it has a default value.', $this->name);
        }

        $this->required = true;

        return $this;
    }


Review comment (suggestion):
"it" is a bit ambigous in this context.

```suggestion
            trigger_deprecation('symfony/config', '7.4', 'Setting a default value to a required node is deprecated. Remove the default from node "%s" or make it optional.', $this->name);
```

Code after:
            $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before);
            $this->normalization->declaredTypes = $allowedTypes;
        }

        if (isset($this->validation)) {
            $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules);
        }

        $node = $this->createNode();
        if ($node instanceof BaseNode) {
            $node->setAttributes($this->attributes);
        }

        return $node;
    }

    /**
     * Sets the default value.
     *
     * @return $this
     */
    public function defaultValue(mixed $value): static
    {
        if ($this->required) {
            // throw new InvalidDefinitionException(sprintf('The node "%s" cannot be required and have a default value.', $this->name));
            trigger_deprecation('symfony/config', '7.4', 'Setting a default value to a required node is deprecated. Remove the default value from the node "%s" or make it optional.', $this->name);
        }

        $this->default = true;
        $this->defaultValue = $value;

        return $this;
    }

    /**
     * Sets the node as required.
     *
     * @return $this
     */
    public function isRequired(): static
    {
        if ($this->default) {
            // throw new InvalidDefinitionException(sprintf('The node "%s" cannot be required and have a default value.', $this->name));
            trigger_deprecation('symfony/config', '7.4', 'Flagging a node with a default value as required is deprecated. Remove the default from node "%s" or make it optional.', $this->name);
        }

        $this->required = true;

        return $this;
    }