Repository: symfony/symfony
File: src/Symfony/Component/JsonStreamer/Mapping/PropertyMetadata.php (PHP)

Code before:

namespace Symfony\Component\JsonStreamer\Mapping;

use Symfony\Component\TypeInfo\Type;

/**
 * Holds stream reading/writing metadata about a given property.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
final class PropertyMetadata
{
    private ?array $streamToNativeValueTransformers;

    /**
     * @param list<string|\Closure>      $valueTransformers
     * @param list<string|\Closure>|null $streamToNativeValueTransformers
     */
    public function __construct(
        private string $name,
        private Type $type,
        private array $valueTransformers = [],
        ?array $streamToNativeValueTransformers = null,
    ) {
        if (null !== $streamToNativeValueTransformers) {
            trigger_deprecation('symfony/json-streamer', '7.4', 'The "streamToNativeValueTransformers " parameter of the "%s()" method is deprecated. Use "valueTransformers" instead.', __METHOD__);
        }

        $this->streamToNativeValueTransformers = $streamToNativeValueTransformers;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function withName(string $name): self
    {
        return new self($name, $this->type, $this->valueTransformers, $this->streamToNativeValueTransformers);
    }

    public function getType(): Type
    {
        return $this->type;
    }

    public function withType(Type $type): self
    {
        return new self($this->name, $type, $this->valueTransformers, $this->streamToNativeValueTransformers);
    }


Review comment (suggestion):
```suggestion
            trigger_deprecation('symfony/json-streamer', '7.4', 'The "streamToNativeValueTransformers" parameter of the "%s()" method is deprecated. Use "valueTransformers" instead.', __METHOD__);
```

Code after:

namespace Symfony\Component\JsonStreamer\Mapping;

use Symfony\Component\TypeInfo\Type;

/**
 * Holds stream reading/writing metadata about a given property.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
final class PropertyMetadata
{
    private ?array $streamToNativeValueTransformers;

    /**
     * @param list<string|\Closure>      $valueTransformers
     * @param list<string|\Closure>|null $streamToNativeValueTransformers
     */
    public function __construct(
        private ?string $name,
        private Type $type,
        private array $valueTransformers = [],
        ?array $streamToNativeValueTransformers = null,
    ) {
        if (null !== $streamToNativeValueTransformers) {
            trigger_deprecation('symfony/json-streamer', '7.4', 'The "streamToNativeValueTransformers" parameter of the "%s()" method is deprecated. Use "valueTransformers" instead.', __METHOD__);
        }

        $this->streamToNativeValueTransformers = $streamToNativeValueTransformers;
    }

    /**
     * @param list<string|\Closure> $nativeToStreamValueTransformers
     * @param list<string|\Closure> $streamToNativeValueTransformers
     */
    public static function createSynthetic(
        Type $type,
        array $nativeToStreamValueTransformers = [],
        array $streamToNativeValueTransformers = [],
    ): self {
        return new self(null, $type, $nativeToStreamValueTransformers, $streamToNativeValueTransformers);
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function withName(?string $name): self
    {
        return new self($name, $this->type, $this->valueTransformers, $this->streamToNativeValueTransformers);