Closed (fixed)
Project:
Drupal core
Version:
8.1.x-dev
Component:
theme system
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
6 Jun 2015 at 18:46 UTC
Updated:
1 Apr 2016 at 17:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
lokapujyaComment #2
joelpittetJust curious because I don't know when this needs to be used but this one is only throwing because it uses the escapeFilter function. So does it need the same @throws or does the escapeFilter() just need it?
Comment #4
lokapujyaJust escapeFilter() will satisfy PHPDoc. Since the exception isn't caught by escapePlaceholder, the developer friendly thing to do is document here too. Added throws for new function.
Comment #5
joelpittet{@inheritthrows} :P
Comment #7
alexpottThis exception is only thrown if the parameter is an object. Saying "the object" implies the methods are always dealing with an object - they are not.
Comment #8
lokapujyaImproved throws doc.
Comment #9
joelpittetIt's a grab bag with using parenthesis in core or not. But this looks like it addresses @alexpott's concerns in #7 thanks @lokapujya
I'm sure that () could be added on commit.
Comment #11
alexpottTo be complete we also need to say into which param. And @joelpittet is correct we need a () on the __toString.
Comment #12
lokapujyaTo document which parameter is the object and adding the ().
Comment #13
er.manojsharma commentedComment #14
er.manojsharma commentedPlease check updated patch
Comment #15
joelpittetThough a bit out of scope with the () adding there, it's in the same file and this is still documentation changes only so I think this is fine.
@er.manojsharma could you also mention which param the object that is checked will throw the Exception as @alexpott asked for in #11?
Also, could you please provide an interdiff so we can easily see what changed from the previous patch. @see https://www.drupal.org/documentation/git/interdiff
Comment #16
lokapujya@er.manojsharma thanks for helping out with this!
Comment #17
sdstyles commentedComment #18
visabhishek commentedComment #20
alexpottThis is not strictly true. It is thrown is $arg is an object and that object does not implement RenderableInterface or implement __toString() or implement toString().
This line now exceeds 80 chars
Comment #21
priya.chat commentedHello,
please review the patch as I have removed the extra space chars and also trying to change the doc comment.
Comment #22
lokapujyaI originally made the above change. But, would it be better to say something like "When an object is passed in the $string variable and it cannot be converted to a string." ? Then the more technical details about __toString() can be gotten from looking at the code.
The last patch contains more throws docs and line spacing changes (and some line spacing errors) that are not related to the issue summary.
Comment #23
snehi commentedRemoved all trailing spaces.
@Priya please find attached patch and see the diff where you are wrong.
Comment #24
snehi commentedComment #26
lokapujyaOut of scope.
out of scope.
Out of scope, since this ticket was just for TwigExtension. If you want those other throws docs, I think that a new issue should be opened because now all those have to be reviewed in order to get this issue to RTBC.
Comment #27
priya.chat commentedComment #28
mglamanHere is rolled patch with feedback from #26. Only touches TwigExtension.
Comment #29
joelpittetThanks @mglaman!
Comment #30
lokapujyaThis sentence doesn't make sense anymore.
And, I thought we were keeping the toString() updates. See comment #15.
Comment #31
lokapujyaNM, it sounds ok (I misread it) and the toString() updates can be done separate.
Comment #33
joelpittetBesttot?!
Comment #34
alexpott#20.1 is still not addressed - the documentation is not strictly true. To quote the previous comment...
Comment #35
snehi commented@Alexpott can you please give a hint what should be replaced with text Any suggestion.
Comment #36
lokapujya$string should be $arg here.
I think we should make these documentation changes also since they are related and in the same file. But if you make these changes watch out for the 80 character limit.
A. When $arg is an object and that object does not implement RenderableInterface or implement __toString() or implement toString().
B. When an object is passed in the $arg variable that is not a render array and cannot be converted to a string.
Although doing #2 opens up the fact that this one will probably need the same wording change that we make to the @throws doc.
Comment #37
deepak_123 commentedComment #38
imalabyaAdded a patch addressing @lokapujya changes from the previous patch.
Comment #39
imalabyaComment #41
lokapujyathis should be the same as the throws doc.
Please revert the re-wording of this sentence; it is no longer a complete sentence. Just add the ().
The patch did not apply.
Comment #42
chuchunaku commentedComment #43
chuchunaku commentedI've added another patch addressing @lokapujya comments in #41.
Comment #44
chuchunaku commentedComment #45
lokapujyaLooks good to me. Can someone else review this?
Comment #46
alvar0hurtad0Changing the status
Comment #47
joelpittetI think this addresses @alexpott's concerns in #34. Thanks for tidying this up.
Comment #48
catchThis comment no longer makes sense without the mention of the exception getting thrown, especially the first sentence.
Comment #49
ankit agrawal commentedComment #50
ankit agrawal commentedComment #51
snehi commentedComment #52
snehi commentedAdded exception things.
Comment #53
lokapujyaI am not sure this is needed?
The review from #48 was because the sentence used to be like "If an object is passed ... an exception is thrown.", but got changed in #43. That part was fine, it's just the "which does not implement __toString(), RenderableInterface or toString()" part that should be the same as the throws doc.
Comment #54
snehi commentedSorry i did not get you.
Comment #55
lokapujyaI think the @throws comment changes are good, but the regular method comment:
Instead of this, shouldn't we just change that first sentence like below (and adjust it to fix the 80 chars.) ?
* If an object is passed which does not implement __toString(), RenderableInterface or toString() method an exception is thrown;Comment #56
snehi commented@lokapujya thanks for the review. PFA attached patch and interdiff.
Comment #57
lokapujyaI don't get why we are adding "If it already implements __toString(), it will throw an exception."
Sorry, I know this is what I gave you, but something still sound funny here. I think the word method should be replaced with "then")? If we keep "method", it should be "the __toString() method" and "the toString() method".
Comment #58
snehi commentedThanks for correcting me.
Comment #59
snehi commentedComment #60
lokapujyaComment #61
catchNeeds a re-roll for 8.1.x.
Comment #62
imalabyaWorking on the reroll
Comment #63
imalabyaAdded a patch against 8.1.x branch.
Comment #64
imalabyaComment #66
imalabyaComment #67
lokapujyaback to RTBC.
Comment #69
catchCommitted/pushed to 8.0.x, thanks!
Comment #73
andypostComment #74
andypostproper status