Skip to content
Snippets Groups Projects

Draft: Symfony 7 without ContainerAwareInterface

Open Dave Long requested to merge issue/drupal-3394694:3394694-sf7-no-containeraware into 11.x
1 unresolved thread

$ vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist --generate-baseline core/.phpstan-baseline.php

Closes #3394694

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
161 160 $this->flood->register('user.password_request_ip', $flood_config->get('ip_window'));
162 161 // First, see if the input is possibly valid as a username.
163 162 $name = trim($form_state->getValue('name'));
164 $definition = BaseFieldDefinition::create('string')
165 ->addConstraint('UserName', []);
166 $data = $this->typedDataManager->create($definition);
167 $data->setValue($name);
168 $violations = $data->validate();
169 163 // Usernames have a maximum length shorter than email addresses. Only print
170 164 // this error if the input is not valid as a username or email address.
171 if ($violations->count() > 0 && !$this->emailValidator->isValid($name)) {
165 if (!is_null(user_validate_name($name)) && !$this->emailValidator->isValid($name)) {
  • This seems like it could be unrelated. The code in user_validate_name() looks more-or-less identical to the removed code here. So +1 for DRY, however it seems that this shouldn't then be necessary for Symfony 7 compatibility and could/should be done in a separate issue that deprecates the function version, or refactors this as proposed here?

  • at least the function needs protected helper

  • Author Maintainer

    Yeah, maybe this was the wrong thing to do here, but if we don't do this then we have to add a label to the BaseFieldDefinition, otherwise this page crashes when Symfony Validator casts TranslatableMarkup to a string and the label is NULL.

  • Please register or sign in to reply
Please register or sign in to reply
Loading