Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Invalid TranslatorInterface type hinting in LanguageRequestSubscriber:
/**
* The translation service.
*
* @var \Drupal\Core\Translation\Translator\TranslatorInterface
*/
protected $translation;
/**
* Constructs a LanguageRequestSubscriber object.
*
* @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
* The language manager service.
* @param \Drupal\language\LanguageNegotiatorInterface
* The language negotiator.
* @param \Drupal\Core\Translation\Translator\TranslatorInterface $translation
* The translation service.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current active user.
*/
public function __construct(ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, TranslatorInterface $translation, AccountInterface $current_user) {
$this->languageManager = $language_manager;
$this->negotiator = $negotiator;
$this->translation = $translation;
$this->currentUser = $current_user;
}
They should be
Drupal\Core\StringTranslation\Translator\TranslatorInterface;
Comments
Comment #1
cs_shadow CreditAttribution: cs_shadow commentedAttaching patch with suggested changes in TranslatorInterface type hinting.
Comment #2
penyaskitoComment #3
alexpottCan we also fix this in TranslationManager too - where there are several instances of incorrect type hinting in the same way.
Comment #4
cs_shadow CreditAttribution: cs_shadow commentedAttached patch fixes the same issue in TranslationManager as well as LanguageRequestSubscriber. Couldn't find any more such instances.
Comment #5
penyaskitoThere are a lot of unrelated changes that shouldn't be in this patch.
Even if they look nice, they should have their own issues.
Comment #6
cs_shadow CreditAttribution: cs_shadow commentedSorry for the last patch. Forgot to checkout after working on another issue. Those extra changes were of another issue. Attached is the correct patch.
Comment #7
MixologicPatch looked good. I did notice that the @return statement in TranslationManager was wrong, so I fixed that as well.
Comment #8
ericski CreditAttribution: ericski commentedPatch no longer applies on latest git pull
error: core/modules/language/lib/Drupal/language/EventSubscriber/LanguageRequestSubscriber.php: No such file or directory
Comment #9
penyaskitoNeeds reroll because of PSR-4 change: link to instructions for the reroll.
Comment #10
penyaskitoActually, probably is easier to just recreate the patch from scratch. Feel free to do it, ericski :)
Comment #11
ericski CreditAttribution: ericski commentedHad to catch a plane yesterday, but that sounds great. I'll give it ago tonight unless someone at the extended sprints wants to take it over.
Comment #12
JacobSanfordI had a few minutes and took this on, recreated from scratch. No interdiff attached.
Comment #13
MixologicLGTM.
Comment #14
alexpottCommitted 7b8d437 and pushed to 8.x. Thanks!