Skip to content

Commit bf9b970

Browse files
committed
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.
1 parent 137c74c commit bf9b970

25 files changed

+25
-41
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
declare(strict_types=1);
99

10-
namespace Respect\Validation\Message\Placeholder;
11-
12-
use Respect\Validation\Rule;
10+
namespace Respect\Validation;
1311

1412
use function lcfirst;
1513
use function strrchr;

library/Message/InterpolationRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use ReflectionClass;
1313
use Respect\Stringifier\Stringifier;
1414
use Respect\Validation\Message\Placeholder\Listed;
15-
use Respect\Validation\Message\Placeholder\Name;
1615
use Respect\Validation\Message\Placeholder\Quoted;
16+
use Respect\Validation\Name;
1717
use Respect\Validation\Result;
1818
use Respect\Validation\Rule;
1919

library/Message/Placeholder/Quoted.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@
1212
final readonly class Quoted
1313
{
1414
public function __construct(
15-
private string $value,
15+
public string $value,
1616
) {
1717
}
18-
19-
public static function fromPath(int|string $path): self
20-
{
21-
return new self('.' . $path);
22-
}
23-
24-
public function getValue(): string
25-
{
26-
return $this->value;
27-
}
2818
}

library/Message/Stringifier/NameStringifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Respect\Validation\Message\Stringifier;
1111

1212
use Respect\Stringifier\Stringifier;
13-
use Respect\Validation\Message\Placeholder\Name;
13+
use Respect\Validation\Name;
1414

1515
use function sprintf;
1616

library/Message/Stringifier/PathStringifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Respect\Stringifier\Quoter;
1313
use Respect\Stringifier\Stringifier;
14-
use Respect\Validation\Message\Placeholder\Path;
14+
use Respect\Validation\Path;
1515

1616
use function array_reverse;
1717
use function implode;

library/Message/Stringifier/QuotedStringifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function stringify(mixed $raw, int $depth): string|null
2626
return null;
2727
}
2828

29-
return $this->quoter->quote($raw->getValue(), $depth);
29+
return $this->quoter->quote($raw->value, $depth);
3030
}
3131
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
declare(strict_types=1);
99

10-
namespace Respect\Validation\Message\Placeholder;
10+
namespace Respect\Validation;
1111

1212
final readonly class Name
1313
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
declare(strict_types=1);
99

10-
namespace Respect\Validation\Message\Placeholder;
10+
namespace Respect\Validation;
1111

1212
final class Path
1313
{

library/Result.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
namespace Respect\Validation;
1111

12-
use Respect\Validation\Message\Placeholder\Id;
13-
use Respect\Validation\Message\Placeholder\Name;
14-
use Respect\Validation\Message\Placeholder\Path;
1512
use Respect\Validation\Rules\Core\Nameable;
1613

1714
use function array_filter;

library/Rules/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Attribute;
1313
use ReflectionAttribute;
1414
use ReflectionObject;
15-
use Respect\Validation\Message\Placeholder\Id;
15+
use Respect\Validation\Id;
1616
use Respect\Validation\Result;
1717
use Respect\Validation\Rule;
1818
use Respect\Validation\Rules\Core\Reducer;

0 commit comments

Comments
 (0)