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

Code before:
     *
     * @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;
    }

    /**
     * Sets the node as deprecated.
     *
     * @param string $package The name of the composer package that is triggering the deprecation
     * @param string $version The version of the package that introduced the deprecation
     * @param string $message the deprecation message to use
     *
     * You can use %node% and %path% placeholders in your message to display,
     * respectively, the node name and its complete path
     *
     * @return $this
     */
    public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.'): static
    {
        $this->deprecation = [
            'package' => $package,
            'version' => $version,
            'message' => $message,

Review comment (suggestion):
```suggestion
            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);
```

Code after:
     *
     * @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;
    }

    /**
     * Sets the node as deprecated.
     *
     * @param string $package The name of the composer package that is triggering the deprecation
     * @param string $version The version of the package that introduced the deprecation
     * @param string $message the deprecation message to use
     *
     * You can use %node% and %path% placeholders in your message to display,
     * respectively, the node name and its complete path
     *
     * @return $this
     */
    public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.'): static
    {
        $this->deprecation = [
            'package' => $package,
            'version' => $version,
            'message' => $message,