Closed (fixed)
Project:
Drupal core
Version:
main
Component:
language.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 May 2022 at 01:08 UTC
Updated:
8 Apr 2026 at 09:15 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tstoecklerComment #3
tstoecklerSorry about that, this should be better.
Comment #5
tstoecklerRe-testing, see #3278215: (Not so) Random test failures SettingsTrayIntegrationTest.
Comment #7
tstoecklerNext try now that #3278215: (Not so) Random test failures SettingsTrayIntegrationTest has actually been fixed.
Comment #10
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
Currently running against 10.1 tests.
Comment #11
smustgrave commentedTests passed in D10.1
Looks like a simple change to clean things up.
Comment #12
xjmThanks for working on this cleanup.
This could use a little more justification for why
getEntity()can never be null. I drilled down awhile into the typed data API, and it seemed like there were plenty of places it could at least theoretically be null. The part about the default value of the langcode is more interesting.With
git log -L, we can see this was introduced in #1966436: Default *content* entity languages are not set for entities created with the API which seems, apparently, to be fixing the bug that this issue says can never exist.I think this could use test coverage proving that the existing code is dead code, either new test coverage or a failing patch for existing test coverage.
Comment #13
xjmProbably should do this too.
Comment #16
penyaskito\Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::testEntityTranslationDefaultLanguageViaCodealready tests the bug where this was introduced. I think that if that passes we can ensure this is dead code. See\Drupal\Tests\language\Kernel\EntityDefaultLanguageTest::createNode. Feel free to add back the Needs tests if you think I'm wrong.This implements
\Drupal\Core\Field\FieldItemInterface, which defines@return \Drupal\Core\Entity\FieldableEntityInterface.NULLis not a valid return type (I'm really looking forward to having return types everywhere + a higher level of phpstan in core)\Drupal\Core\Field\FieldItemListis the other only instance I could find that usesgetEntity()inapplyDefaultValue, and it doesn't check forNULL.I think those are valid enough arguments to do this safely.
Comment #18
penyaskitoComment #19
smustgrave commentedJustification makes sense to me.not sure this needs tests
Comment #20
catchYeah agreed #16 is a good explanation of the existing test coverage.
Committed/pushed to main, thanks!
Comment #24
catch