Skip to content

Commit

Permalink
Rename 'withPrefixedId' to 'withPrefix'
Browse files Browse the repository at this point in the history
That makes the name shorter and it has the same meaning.
  • Loading branch information
henriquemoody committed Dec 20, 2024
1 parent 33e6341 commit 0e40917
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions library/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function fromAdjacent(
): Result {
if ($adjacent->allowsAdjacent()) {
return (new Result($adjacent->isValid, $input, $rule, $parameters, $template, id: $adjacent->id))
->withPrefixedId($prefix)
->withPrefix($prefix)
->withAdjacent($adjacent->withInput($input));
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public function withUnchangeableId(string $id): self
return $this->clone(id: $id, unchangeableId: true);
}

public function withPrefixedId(string $prefix): self
public function withPrefix(string $prefix): self
{
if ($this->id === $this->name || $this->unchangeableId) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion library/Rules/Not.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ final class Not extends Wrapper
{
public function evaluate(mixed $input): Result
{
return $this->rule->evaluate($input)->withInvertedMode()->withPrefixedId('not');
return $this->rule->evaluate($input)->withInvertedMode()->withPrefix('not');
}
}
2 changes: 1 addition & 1 deletion library/Rules/NullOr.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private function enrichResult(Result $result): Result
{
if ($result->allowsAdjacent()) {
return $result
->withPrefixedId('nullOr')
->withPrefix('nullOr')
->withAdjacent(new Result($result->isValid, $result->input, $this));
}

Expand Down
2 changes: 1 addition & 1 deletion library/Rules/UndefOr.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private function enrichResult(Result $result): Result
{
if ($result->allowsAdjacent()) {
return $result
->withPrefixedId('undefOr')
->withPrefix('undefOr')
->withAdjacent(new Result($result->isValid, $result->input, $this));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Rules/NotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function shouldInvertTheResultOfWrappedRule(): void

self::assertEquals(
$rule->evaluate('input'),
$wrapped->evaluate('input')->withPrefixedId('not')->withInvertedMode()
$wrapped->evaluate('input')->withPrefix('not')->withInvertedMode()
);
}

Expand Down

0 comments on commit 0e40917

Please sign in to comment.