Skip to content

Commit

Permalink
Rename parameter in the UpdateValidatorMethod attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Feb 16, 2024
1 parent 953e860 commit 6234a71
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"roadrunner-php/roadrunner-api-dto": "^1.4",
"roadrunner-php/version-checker": "^1.0",
"spiral/attributes": "^3.1.4",
"spiral/roadrunner": "^v2023.2",
"spiral/roadrunner": "^v2023.3.11",
"spiral/roadrunner-cli": "^2.5",
"spiral/roadrunner-kv": "^4.0",
"spiral/roadrunner-worker": "^3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/Declaration/Reader/WorkflowReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private function withSignalsAndQueries(ClassNode $graph, WorkflowPrototype $prot
);
}

$prototype->addValidateUpdateHandler($validate->name, $ctx);
$prototype->addValidateUpdateHandler($validate->forUpdate, $ctx);
}

/** @var SignalMethod|null $signal */
Expand Down
4 changes: 2 additions & 2 deletions src/Workflow/UpdateValidatorMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
final class UpdateValidatorMethod
{
/**
* @param non-empty-string $name Name of the update handler the validator should be used for.
* @param non-empty-string $forUpdate Name of the update handler the validator should be used for.
* Be careful about names that contain special characters. These names can be used as metric tags.
* And systems like prometheus ignore metrics which have tags with unsupported characters.
*/
public function __construct(
#[Immutable]
public string $name,
public string $forUpdate,
) {
}
}
2 changes: 1 addition & 1 deletion tests/Fixtures/src/Workflow/UpdateWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function addName(string $name): mixed
return $this->greetings;
}

#[Workflow\UpdateValidatorMethod(name: 'addName')]
#[Workflow\UpdateValidatorMethod(forUpdate: 'addName')]
public function validateName(string $name): void
{
if (\preg_match('/\\d/', $name) === 1) {
Expand Down

0 comments on commit 6234a71

Please sign in to comment.