Skip to content

Commit b979df2

Browse files
HQD-21: fixing "Optional parameter $plan declared before required parameter $price is implicitly treated as a required parameter" deprecation warning in SinglePrice
1 parent a4ac782 commit b979df2

8 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/charge/modifiers/Installment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function buildPrice(Money $sum)
3939
$target = $this->getTarget();
4040
$prepaid = Quantity::create('items', 0);
4141

42-
return new SinglePrice(null, $type, $target, null, $prepaid, $sum);
42+
return new SinglePrice(null, $type, $target, $prepaid, $sum);
4343
}
4444

4545
public function getType()

src/price/PriceFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function createRatePrice(PriceCreationDto $dto)
8989

9090
public function createSinglePrice(PriceCreationDto $dto)
9191
{
92-
return new SinglePrice($dto->id, $dto->type, $dto->target, $dto->plan, $dto->prepaid, $dto->price);
92+
return new SinglePrice($dto->id, $dto->type, $dto->target, $dto->prepaid, $dto->price, $dto->plan);
9393
}
9494

9595
public function createProgressivePrice(PriceCreationDto $dto): ProgressivePrice

src/price/SinglePrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public function __construct(
3636
$id,
3737
TypeInterface $type,
3838
TargetInterface $target,
39-
?PlanInterface $plan = null,
4039
QuantityInterface $prepaid,
41-
Money $price
40+
Money $price,
41+
?PlanInterface $plan = null,
4242
) {
4343
parent::__construct($id, $type, $target, $plan);
4444
$this->prepaid = $prepaid;

tests/behat/bootstrap/FeatureContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function priceIs($target, $type, $sum, $currency, $unit, $quantity = 0)
100100
$target = new Target(Target::ANY, $target);
101101
$quantity = Quantity::create($unit, $quantity);
102102
$sum = $this->moneyParser->parse($sum, new Currency($currency));
103-
$this->setPrice(new SinglePrice(null, $type, $target, null, $quantity, $sum));
103+
$this->setPrice(new SinglePrice(null, $type, $target, $quantity, $sum));
104104
}
105105

106106
protected array $progressivePrice = [];

tests/unit/action/ActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function setUp(): void
8787
$this->target = new Target(2, 'server');
8888
$this->prepaid = Quantity::gigabyte(1);
8989
$this->money = Money::USD(10000);
90-
$this->price = new SinglePrice(5, $this->type, $this->target, null, $this->prepaid, $this->money);
90+
$this->price = new SinglePrice(5, $this->type, $this->target, $this->prepaid, $this->money);
9191
$this->customer = new Customer(2, 'client');
9292
$this->time = new DateTimeImmutable('now');
9393
$this->generalizer = new Generalizer();

tests/unit/charge/modifiers/InstallmentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
{
3131
parent::setUp();
3232
$this->type = Type::anyId('monthly,installment');
33-
$this->price = new SinglePrice(5, $this->type, $this->target, null, $this->prepaid, $this->money);
33+
$this->price = new SinglePrice(5, $this->type, $this->target, $this->prepaid, $this->money);
3434
}
3535

3636
protected function buildInstallment($term)

tests/unit/charge/modifiers/OnceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private function createType(string $name): TypeInterface
3737

3838
private function createPrice(TypeInterface $type): PriceInterface
3939
{
40-
return new SinglePrice(5, $type, $this->target, null, $this->prepaid, $this->money);
40+
return new SinglePrice(5, $type, $this->target, $this->prepaid, $this->money);
4141
}
4242

4343
#[\PHPUnit\Framework\Attributes\DataProvider('periodCreationProvider')]

tests/unit/price/SinglePriceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function setUp(): void
4040
$this->type = new Type(null, 'server_traf');
4141
$this->quantity = Quantity::gigabyte(10);
4242
$this->money = Money::USD(15);
43-
$this->price = new SinglePrice(null, $this->type, $this->target, null, $this->quantity, $this->money);
43+
$this->price = new SinglePrice(null, $this->type, $this->target, $this->quantity, $this->money);
4444
}
4545

4646
protected function tearDown(): void

0 commit comments

Comments
 (0)