respect-validation/library/Name.php
Henrique Moody bf9b970e24
Move important value objects to the root namespace
The `Id`, `Name`, and `Path` value objects are not only message-related
concerns, they're part of the core of the library, hence it makes sense
to place them at the root namespace.
2025-12-21 11:14:47 +01:00

24 lines
418 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation;
final readonly class Name
{
public function __construct(
public string $value,
public Path|null $path = null,
) {
}
public function withPath(Path $path): Name
{
return new self($this->value, $path);
}
}