Skip to content

Commit

Permalink
Allow null as $registrationForm in RegisterController
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Feb 23, 2024
1 parent 08c7d47 commit 0fb551b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Controller/Connect/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class RegisterController extends AbstractController
private FormFactoryInterface $formFactory;
private ?RegistrationFormHandlerInterface $formHandler;
private string $grantRule;
private string $registrationForm;
private ?string $registrationForm;

public function __construct(
ResourceOwnerMapLocator $resourceOwnerMapLocator,
Expand All @@ -56,7 +56,7 @@ public function __construct(
FormFactoryInterface $formFactory,
Environment $twig,
string $grantRule,
string $registrationForm,
?string $registrationForm,
?AccountConnectorInterface $accountConnector,
?RegistrationFormHandlerInterface $formHandler
) {
Expand Down Expand Up @@ -112,6 +112,10 @@ public function registrationAction(Request $request, string $key): Response
throw new \RuntimeException('Cannot register an account.', 0, $error instanceof \Exception ? $error : null);
}

if (!$this->registrationForm) {
throw new \InvalidArgumentException('Registration form class must be set.');
}

$userInformation = $this
->getResourceOwnerByName($error->getResourceOwnerName())
->getUserInformation($error->getRawToken())
Expand Down

0 comments on commit 0fb551b

Please sign in to comment.