Skip to content

Commit

Permalink
Rename render static method to previous in StepIsNotSubmitted exception
Browse files Browse the repository at this point in the history
  • Loading branch information
lexalium committed Dec 17, 2023
1 parent 947e889 commit 1f20469
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Exception/StepIsNotSubmittedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public static function finish(StepKey $key, ?StepKey $renderable): self
return new self(sprintf('The Step [%s] is not submitted yet.', $key), $key, $renderable);
}

public static function render(StepKey $key, ?StepKey $renderable): self
public static function previous(StepKey $key, ?StepKey $renderable): self
{
return new self(sprintf('Cannot render step if previous step [%s] is not submitted.', $key), $key, $renderable);
return new self(sprintf('Previous step [%s] is not submitted.', $key), $key, $renderable);
}
}
2 changes: 1 addition & 1 deletion src/SteppedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private function throwIfPreviousNotSubmitted(Step $step): void
$previous = $this->steps->previous($step->key);

if ($previous !== null && !$previous->isSubmitted()) {
throw StepIsNotSubmittedException::render(
throw StepIsNotSubmittedException::previous(
$previous->key,
$this->steps->currentOrPreviousRenderable($previous)?->key,
);
Expand Down
4 changes: 2 additions & 2 deletions tests/SteppedFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function testRenderThrowIfNotStarted(): void

public function testRenderThrowIfPreviousNotSubmitted(): void
{
$this->expectExceptionObject(StepIsNotSubmittedException::render(new StepKey('key2'), new StepKey('key')));
$this->expectExceptionObject(StepIsNotSubmittedException::previous(new StepKey('key2'), new StepKey('key')));

$this->stepControl->setCurrent(new StepKey('key'));

Expand Down Expand Up @@ -346,7 +346,7 @@ public function testHandleThrowIfNotStarted(): void

public function testHandleThrowIfPreviousNotSubmitted(): void
{
$this->expectExceptionObject(StepIsNotSubmittedException::render(new StepKey('key2'), new StepKey('key')));
$this->expectExceptionObject(StepIsNotSubmittedException::previous(new StepKey('key2'), new StepKey('key')));

$this->stepControl->setCurrent(new StepKey('key3'));

Expand Down

0 comments on commit 1f20469

Please sign in to comment.