minor #40314 improve exception message if symfony/security-csrf is missing (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

improve exception message if symfony/security-csrf is missing

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37452
| License       | MIT
| Doc PR        |

Commits
-------

1a26ed43e7 improve exception message if symfony/security-csrf is missing
This commit is contained in:
Nyholm 2021-02-26 13:58:15 +01:00
commit b3c4d639dd
No known key found for this signature in database
GPG Key ID: D6332DE2B6F8FA38
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ class FormRenderer implements FormRendererInterface
public function renderCsrfToken($tokenId)
{
if (null === $this->csrfTokenManager) {
throw new BadMethodCallException('CSRF tokens can only be generated if a CsrfTokenManagerInterface is injected in FormRenderer::__construct().');
throw new BadMethodCallException('CSRF tokens can only be generated if a CsrfTokenManagerInterface is injected in FormRenderer::__construct(). Try running "composer require symfony/security-csrf".');
}
return $this->csrfTokenManager->getToken($tokenId)->getValue();