Follow-up to #2555825: Remove SafeMarkup::set call from TranslationManager::translate, where @catch said:
[Replacing a call to SafeMarkup::set() with SafeMarkup::setMultiple()] is an obvious hack but I think removing SafeMarkup::set() is more important than removing SafeMarkup::setMultiple() - the very difficulty getting it to work is at least some discouragement to use it - although I think we could add a follow-up to mark SafeMarkup::setMultiple() @internal - really no contrib or custom code should ever be using that.
Problem/Motivation
No contrib/custom module should use SafeMarkup::setMultiple().
Proposed resolution
Mark as @internal to translate(), the batch API and the form cache
Remaining tasks
Decide on internal notice & patch.
User interface changes
N/A
API changes
N/A
Beta evaluation
Documentation is unfrozen.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | mark-2557893-28.patch | 712 bytes | cilefen |
| #26 | mark-2557893-25.patch | 713 bytes | ianthomas_uk |
Comments
Comment #2
cilefen commentedComment #3
star-szrComment #4
ianthomas_uk@internal is a step towards removal, and would allow removal in 8.x.
Comment #5
cilefen commentedComment #6
luklambrechts commentedI will bey trying this today at core mentoring
Comment #7
cilefen commentedI suggest something like:
Comment #8
luklambrechts commentedpatch which marks the Safemarkup:setMultiple() @internal
Comment #9
cilefen commented@luklambrechts Great job on your first patch!
This is an unrelated change. Please remove it.
There are spaces at the end of the lines above and below that must be removed.
One line comments must start with a capital letter, so "Should", not "should", and they must end with a period. Also, they must not exceed 80 characters. Refer to https://www.drupal.org/coding-standards/docs on that.
Finally, and this is my opinion, I think we need something more specific like I mentioned in #7. Our only example of that is in \Drupal\Core\TypedData\Validation\ExecutionContext:
Be sure to mark the issue status "Needs review" when you post the next patch.
Comment #10
sdstyles commentedComment #11
stefan.r commentedLet's put in the internal notice from #7?
Comment #12
sdstyles commentedChanged.
Comment #13
stefan.r commentedThanks!
Comment #15
stefan.r commentedSetting back to RTBC assuming this was an unrelated test fail:
PHPUnit.Drupal\Tests\Component\DrupalComponentTest
✗
testNoCoreInComponent
fail: [Other] Line 23 of core/tests/Drupal/Tests/Component/DrupalComponentTest.php:
Failed asserting that an array is empty.
Comment #17
cilefen commentedActually "Should not be used in user code." is not firm enough. It should not be used by anything except the listed things.
Comment #18
stefan.r commentedso,
s/Should not be used in user code/Should not be used anywhere else/?Comment #20
cilefen commentedYes, and even though the example did not use complete sentences, we should.
Comment #23
ianthomas_ukTweaked text looks good, patch should pass, it's just a docs change, so back to RTBC.
Added the original comment that prompted this issue.
Comment #26
ianthomas_ukHmm, a bit of an ideological failure that. The test asserts that the string "Drupal\Core" does not appear anywhere in the Component directory. Technically Components should have no knowledge of Core, so shouldn't be documenting where Core is using the method, but I think it sends a good message for there to be an explicit list of files that are allowed to call the function.
This just removes the qualification from the class names, as a hack to get around the test.
Comment #27
cilefen commentedOh, I didn't even look at the test failure! I thought it was one of those random things. I'm glad somebody checks.
Comment #28
cilefen commentedThe line can wrap tighter.
Comment #31
stefan.r commentedBack to RTBC
Comment #32
alexpottCommitted 749466c and pushed to 8.0.x. Thanks!