Skip to content

Commit a1a2b34

Browse files
committed
Review fixes
1 parent 4ccd097 commit a1a2b34

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

code_samples/discounts/src/Discounts/ExpressionProvider/CurrentUserRegistrationDateResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public function __construct(PermissionResolver $permissionResolver, UserService
1919
$this->userService = $userService;
2020
}
2121

22-
/** @return array{current_user_registration_date: \DateTimeInterface}
22+
/**
23+
* @return array{current_user_registration_date: \DateTimeInterface}
2324
*/
2425
public function getVariables(PriceContextInterface $priceContext): array
2526
{

code_samples/discounts/src/Discounts/ExpressionProvider/IsAnniversaryResolver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use DateTimeImmutable;
66
use DateTimeInterface;
7-
use EzSystems\EzPlatformGraphQL\GraphQL\Mutation\InputHandler\FieldType\Date;
87

98
final class IsAnniversaryResolver
109
{
@@ -28,15 +27,15 @@ public function __invoke(DateTimeInterface $date, int $tolerance = 0): bool
2827
private function unifyYear(DateTimeInterface $date): DateTimeImmutable
2928
{
3029
// Create a new date using the reference year but with the same month and day
31-
$date = DateTimeImmutable::createFromFormat(
30+
$newDate = DateTimeImmutable::createFromFormat(
3231
self::YEAR_MONTH_DAY_FORMAT,
3332
self::REFERENCE_YEAR . '-' . $date->format(self::MONTH_DAY_FORMAT)
3433
);
3534

36-
if ($date === false) {
35+
if ($newDate === false) {
3736
throw new \RuntimeException('Failed to unify year for date.');
3837
}
3938

40-
return $date;
39+
return $newDate;
4140
}
4241
}

docs/discounts/extend_discounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ To do it, create a class implementing the [`DiscountValueFormatterInterface`](/a
175175

176176
## Change discount priority
177177

178-
You can change the [the defualt discount priority](discounts_guide.md#discounts-priority) by creating a class implementing the [`DiscountPrioritizationStrategyInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountPrioritizationStrategyInterface.html) and aliasing to it the default implementation.
178+
You can change the [the default discount priority](discounts_guide.md#discounts-priority) by creating a class implementing the [`DiscountPrioritizationStrategyInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountPrioritizationStrategyInterface.html) and aliasing to it the default implementation.
179179

180180
The example below decorates the default implementation to prioritize recently updated discounts above all the others.
181181
It uses one of the existing [discount search criterions](discounts_criteria.md).

0 commit comments

Comments
 (0)