Skip to content

Commit ebdf697

Browse files
HP-1631: renamed ActionState::isFinished() into ActionState::isNotActive() and removed ActionState::expired() because it is the same as ActionState::finished()
1 parent 6a368f5 commit ebdf697

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

src/action/AbstractAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ public function setFinished(): void
169169
$this->state = ActionState::finished();
170170
}
171171

172-
public function isFinished(): ?bool
172+
public function isNotActive(): ?bool
173173
{
174-
return $this->state === null ? null : $this->state->isFinished();
174+
return $this->state === null ? null : $this->state->isNotActive();
175175
}
176176

177177
/**

src/action/ActionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getSale(): ?SaleInterface;
7070
/**
7171
* Returns null if the action state is not set.
7272
*/
73-
public function isFinished(): ?bool;
73+
public function isNotActive(): ?bool;
7474

7575
public function getParent(): ?ActionInterface;
7676

src/action/ActionState.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class ActionState
2727

2828
private const STATE_CANCELED = 'canceled';
2929

30-
private const STATE_EXPIRED = 'expired';
31-
3230
private function __construct(protected string $state = self::STATE_NEW)
3331
{
3432
}
@@ -43,7 +41,7 @@ public function isNew(): bool
4341
return $this->state === self::STATE_NEW;
4442
}
4543

46-
public function isFinished(): bool
44+
public function isNotActive(): bool
4745
{
4846
return !$this->isNew();
4947
}
@@ -53,10 +51,6 @@ public static function new(): self
5351
return new self(self::STATE_NEW);
5452
}
5553

56-
/**
57-
* @deprecated use ActionState::expired()
58-
* @return self
59-
*/
6054
public static function finished(): self
6155
{
6256
return new self(self::STATE_FINISHED);
@@ -77,11 +71,6 @@ public static function canceled(): self
7771
return new self(self::STATE_CANCELED);
7872
}
7973

80-
public static function expired(): self
81-
{
82-
return new self(self::STATE_EXPIRED);
83-
}
84-
8574
public static function fromString(string $name): self
8675
{
8776
$allowedStates = [
@@ -90,7 +79,6 @@ public static function fromString(string $name): self
9079
self::STATE_PREMATURE,
9180
self::STATE_FUTURE,
9281
self::STATE_CANCELED,
93-
self::STATE_EXPIRED,
9482
];
9583
foreach ($allowedStates as $state) {
9684
if ($state === $name) {

src/order/Calculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function calculatePrice(PriceInterface $price, ActionInterface $action):
106106
$charges = [$charge];
107107
}
108108

109-
if ($action->isFinished()) {
109+
if ($action->isNotActive()) {
110110
foreach ($charges as $charge) {
111111
$charge->setFinished();
112112
}

0 commit comments

Comments
 (0)