Skip to content

Commit

Permalink
OP-282: PHP8 Constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
GracjanJozefczyk committed Jun 20, 2024
1 parent 038f1a8 commit 51162df
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/Validator/InStockWishlistValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,11 @@

final class InStockWishlistValidator extends ConstraintValidator
{
public RequestStack $request;

public Router $router;

public AvailabilityCheckerInterface $availabilityChecker;

public function __construct(
AvailabilityCheckerInterface $availabilityChecker,
RequestStack $requestStack,
Router $router,
private AvailabilityCheckerInterface $availabilityChecker,
private RequestStack $requestStack,
private Router $router,
) {
$this->request = $requestStack;
$this->availabilityChecker = $availabilityChecker;
$this->router = $router;
}

public function validate(mixed $value, Constraint $constraint): void
Expand All @@ -50,7 +41,7 @@ public function validate(mixed $value, Constraint $constraint): void

Assert::isInstanceOf($constraint, CartItemAvailability::class);

$request = $this->request->getCurrentRequest();
$request = $this->requestStack->getCurrentRequest();

Assert::notNull($request);

Expand Down

0 comments on commit 51162df

Please sign in to comment.