Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function process(ContainerBuilder $container): void

if ($arguments[0] instanceof Definition) {
$class = $arguments[0]->getClass();
$namespace = substr($class, 0, strrpos($class, '\\'));

$id = sprintf('.%d_doctrine_metadata_driver~%s', $i, ContainerBuilder::hash($arguments));
$container->setDefinition($id, $arguments[0]);
Expand Down
7 changes: 3 additions & 4 deletions src/Maker/MakeAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function ($answer) {

$interactiveSecurityHelper = new InteractiveSecurityHelper();
$command->addOption('firewall-name', null, InputOption::VALUE_OPTIONAL);
$input->setOption('firewall-name', $firewallName = $interactiveSecurityHelper->guessFirewallName($io, $securityData));
$input->setOption('firewall-name', $interactiveSecurityHelper->guessFirewallName($io, $securityData));

$command->addOption('entry-point', null, InputOption::VALUE_OPTIONAL);

Expand Down Expand Up @@ -279,7 +279,6 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
$securityYamlUpdated,
$input->getArgument('authenticator-type'),
$input->getArgument('authenticator-class'),
$securityData,
$input->hasArgument('user-class') ? $input->getArgument('user-class') : null,
$input->hasArgument('logout-setup') ? $input->getArgument('logout-setup') : false,
$supportRememberMe,
Expand Down Expand Up @@ -415,7 +414,7 @@ private function generateFormLoginFiles(string $controllerClass, string $userNam
);
}

private function generateNextMessage(bool $securityYamlUpdated, string $authenticatorType, string $authenticatorClass, array $securityData, $userClass, bool $logoutSetup, bool $supportRememberMe, bool $alwaysRememberMe): array
private function generateNextMessage(bool $securityYamlUpdated, string $authenticatorType, string $authenticatorClass, $userClass, bool $logoutSetup, bool $supportRememberMe, bool $alwaysRememberMe): array
{
$nextTexts = ['Next:'];
$nextTexts[] = '- Customize your new authenticator.';
Expand Down Expand Up @@ -449,7 +448,7 @@ private function generateNextMessage(bool $securityYamlUpdated, string $authenti
private function userClassHasEncoder(array $securityData, string $userClass): bool
{
$userNeedsEncoder = false;
$hashersData = $securityData['security']['encoders'] ?? $securityData['security']['encoders'] ?? [];
$hashersData = $securityData['security']['encoders'] ?? [];

foreach ($hashersData as $userClassWithEncoder => $encoder) {
if ($userClass === $userClassWithEncoder || is_subclass_of($userClass, $userClassWithEncoder) || class_implements($userClass, $userClassWithEncoder)) {
Expand Down
6 changes: 2 additions & 4 deletions src/Maker/MakeRegistrationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,9 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma

if ($io->confirm('Do you want to automatically authenticate the user after registration?')) {
$this->interactAuthenticatorQuestions(
$input,
$io,
$interactiveSecurityHelper,
$securityData,
$command
$securityData
);
}

Expand All @@ -192,7 +190,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
}
}

private function interactAuthenticatorQuestions(InputInterface $input, ConsoleStyle $io, InteractiveSecurityHelper $interactiveSecurityHelper, array $securityData, Command $command): void
private function interactAuthenticatorQuestions(ConsoleStyle $io, InteractiveSecurityHelper $interactiveSecurityHelper, array $securityData): void
{
$firewallsData = $securityData['security']['firewalls'] ?? [];
$firewallName = $interactiveSecurityHelper->guessFirewallName(
Expand Down
4 changes: 2 additions & 2 deletions src/Maker/MakeResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
$generator->writeChanges();

$this->writeSuccessMessage($io);
$this->successMessage($input, $io, $requestClassNameDetails->getFullName());
$this->successMessage($io, $requestClassNameDetails->getFullName());
}

private function setBundleConfig(ConsoleStyle $io, Generator $generator, string $repositoryClassFullName): void
Expand Down Expand Up @@ -379,7 +379,7 @@ private function setBundleConfig(ConsoleStyle $io, Generator $generator, string
$generator->dumpFile($path, $manipulator->getContents());
}

private function successMessage(InputInterface $input, ConsoleStyle $io, string $requestClassName): void
private function successMessage(ConsoleStyle $io, string $requestClassName): void
{
$closing[] = 'Next:';
$closing[] = sprintf(' 1) Run <fg=yellow>"%s make:migration"</> to generate a migration for the new <fg=yellow>"%s"</> entity.', CliOutputHelper::getCommandPrefix(), $requestClassName);
Expand Down
2 changes: 1 addition & 1 deletion src/Maker/MakeStimulusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private function askForNextValue(ConsoleStyle $io, array $values, bool $isFirstV
// convert to snake case for simplicity
$snakeCasedField = Str::asSnakeCase($valueName);

if ('_id' === $suffix = substr($snakeCasedField, -3)) {
if ('_id' === substr($snakeCasedField, -3)) {
$defaultType = 'Number';
} elseif (str_starts_with($snakeCasedField, 'is_')) {
$defaultType = 'Boolean';
Expand Down
4 changes: 2 additions & 2 deletions src/Security/SecurityConfigUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function updateForUserClass(string $yamlSource, UserClassConfiguration $u
$this->updateProviders($userConfig, $userClass);

if ($userConfig->hasPassword()) {
$this->updatePasswordHashers($userConfig, $userClass);
$this->updatePasswordHashers($userClass);
}

$contents = $this->manipulator->getContents();
Expand Down Expand Up @@ -243,7 +243,7 @@ private function updateProviders(UserClassConfiguration $userConfig, string $use
$this->manipulator->setData($newData);
}

private function updatePasswordHashers(UserClassConfiguration $userConfig, string $userClass): void
private function updatePasswordHashers(string $userClass): void
{
$newData = $this->manipulator->getData();

Expand Down
4 changes: 2 additions & 2 deletions src/Util/YamlSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private function updateData(array $newData)
// Edge case: if the last item on a multi-line array has a comment,
// we want to move to the end of the line, beyond that comment
if (\count($currentData) < \count($newData) && $this->isCurrentArrayMultiline()) {
$this->advanceBeyondMultilineArrayLastItem($currentData, $newData);
$this->advanceBeyondMultilineArrayLastItem();
}

if (0 === $this->indentationForDepths[$this->depth] && $this->depth > 1) {
Expand Down Expand Up @@ -534,7 +534,7 @@ private function advanceBeyondEndOfPreviousKey($key)
$this->advanceCurrentPosition($this->getEndOfPreviousKeyPosition($key));
}

private function advanceBeyondMultilineArrayLastItem(array $currentData, array $newData)
private function advanceBeyondMultilineArrayLastItem()
{
$this->log('Trying to advance beyond the last item in a multiline array');
$this->advanceBeyondWhitespace();
Expand Down
4 changes: 0 additions & 4 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ public static function validatePropertyName(string $name): string

public static function validateDoctrineFieldName(string $name, ManagerRegistry|LegacyManagerRegistry $registry): string
{
if (!$registry instanceof ManagerRegistry && !$registry instanceof LegacyManagerRegistry) {
throw new \InvalidArgumentException(sprintf('Argument 2 to %s::validateDoctrineFieldName must be an instance of %s, %s passed.', __CLASS__, ManagerRegistry::class, \is_object($registry) ? $registry::class : \gettype($registry)));
}

// check reserved words
if ($registry->getConnection()->getDatabasePlatform()->getReservedKeywordsList()->isKeyword($name)) {
throw new \InvalidArgumentException(sprintf('Name "%s" is a reserved word.', $name));
Expand Down