Skip to content

[make:user] Dont generate UserInterface::eraseCredentials with symfony >= 7.3 #1701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Security/UserClassBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Bundle\MakerBundle\Str;
use Symfony\Bundle\MakerBundle\Util\ClassSource\Model\ClassProperty;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;

Expand All @@ -37,7 +38,10 @@ public function addUserInterfaceImplementation(ClassSourceManipulator $manipulat

$this->addPasswordImplementation($manipulator, $userClassConfig);

$this->addEraseCredentials($manipulator);
/* @legacy - Remove "eraseCredentials()" when Symfony 7.4 is no longer supported */
if (Kernel::VERSION_ID < 70300) {
$this->addEraseCredentials($manipulator);
Copy link
Contributor Author

@alamirault alamirault May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to deal with tests and fixtures in tests/Security/fixtures/expected/*.php

Can tell me what to do (to be compatible with 7.3) ?

}
}

private function addPasswordImplementation(ClassSourceManipulator $manipulator, UserClassConfiguration $userClassConfig): void
Expand Down