Needs work
Project:
SimpleTest
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
23 Oct 2015 at 10:03 UTC
Updated:
24 Apr 2021 at 11:36 UTC
Jump to comment: Most recent, Most recent file
Many of the function docblocks in WebTestBase are incomplete. Some @return missing or incorrect.
Review the docblocks and fix any incorrect tags.
None.
None.
None
| Comment | File | Size | Author |
|---|---|---|---|
| #46 | interdiff-2599634-40-46.txt | 20.15 KB | aditya_anurag |
| #46 | webtestbase-function-docblocks-2599634-46.patch | 31.28 KB | aditya_anurag |
| #40 | interdiff-2599634-34-40.txt | 2.87 KB | aneeshthankachan |
| #40 | webtestbase-function-docblocks-2599634-40.patch | 11.95 KB | aneeshthankachan |
| #36 | 2599634-36.patch | 21.39 KB | kaushalkishorejaiswal |
Comments
Comment #2
peacog commentedComment #3
peacog commentedHaving trouble adding a related issue...
Comment #4
peacog commentedI've made the patch and addressed the problems identified in the related issue #2502867: Document all drupal(Post|Get)(*) methods $path parameter.
From that other issue:
1.
+++ b/core/modules/simpletest/src/WebTestBase.php<br>@@ -1311,7 +1314,7 @@ protected function curlInitialize() {<br>+ * @return mixed<br> * The content returned from the call to curl_exec().As far as I can see, curlExec() will always return a string, so I've changed its return type to string, and also the return type of the other functions that use it (drupalPost(), drupalPostWithFormat() etc)
8.
+++ b/core/modules/simpletest/src/WebTestBase.php<br>@@ -1311,7 +1314,7 @@ protected function curlInitialize() {<br>+ * @return mixed<br> * The content returned from the call to curl_exec().Yes, it didn't make any sense that it could return decoded JSON and an array. That was a copy&paste from the method description. I've removed that sentence and fixed the return type.
9. See 1. above.
Comment #5
rakesh.gectcr@throws patch already coming with issue https://www.drupal.org/node/2595999
@Here the attached patch having
Figure out the correct return types for each method.[done]
Add missing @throws tags.[done]
Roll a patch to fix the docblocks[done]
Comment #8
rakesh.gectcrComment #9
rakesh.gectcr@here
It is related issue to https://www.drupal.org/node/2595999#comment-10483912
Please see the #points 8,9 & 10, @jhodgdon has mentioned.
So i am changing the issue to update the doc comment without @throws
I am attaching the patch that updating the comment docs without @throws
Comment #10
rakesh.gectcrComment #14
rakesh.gectcrComment #15
rakesh.gectcrComment #19
kekkisNoticed some inaccuracies in the @return tags, so taking this patch a bit further.
Comment #20
rakesh.gectcr@kekkis,
Can you please leave the review comment here, Something like where you feeling inaccuracies.
Comment #21
rakesh.gectcrComment #25
kekkisI'm working on a new patch as we speak, that will show you what I mean. Will include an interdiff as well.
Comment #26
kekkisHere. Fixed a few return types, even added one IIRC. The most notable changes involve return values of
Json::decode(), which may return whateverjson_decode()returns.Comment #27
kekkisComment #28
kekkisActually, according to https://www.drupal.org/coding-standards/docs#types (which I discovered just now) there are still opportunities for improvement here. Specifically, one could use the notation
string[]at some places.Comment #29
jhodgdonThanks for the issue/patch!
Mostly good; a few things to address:
In this case, use "false" instead of "bool", since at least according to the docs line, TRUE cannot be returned, only FALSE.
I've marked some other places like this in the patch but not all of them, by the way.
We usually leave a blank line between @return and @see, although this may not be a strict standard.
Also rather than "renderable" we usually call these things "render arrays".
See above note on bool -> false
This line exceeds 80 characters.
Also I think it could use a comma before the "or".
What does that mean? This is a comparison, presumably for use in a sort operation? So I suspect (not having looked at the code) that it would return 1, 0, or -1 depending on if the first or second file is "greater than" the other, meaning... well you'd need to look at the code.
So I would say something like:
Which file should come first, based on ....
or something like that.
And make sure it is clear what will cause it to return 1 and 0 and -1 (or whatever the return values actually are).
Needs grammar/punctuation update...
"else" => "; otherwise, "
There may be a possibility of this returning FALSE or something else as well? Please check on this in the code.
I suspect this is actually "mixed" since the format is variable?
always string really? And what content?
really never NULL or FALSE or something?
Yeah see this one should be string|false, and I think all those other get/post methods can also be string|false right?
Too short wrapping - please make the lines closer to 80 characters
I think the previous doc line of "Assertion result" is actually better than the new text. I'm not saying the text couldn't be improved, but... maybe not like this... the previous text is clearer and more concise. Probably just leave it as it was.
When you put a class in a @return type, include the namespace.
Nice. :)
Comment #30
sdstyles commentedComment #31
jhodgdonYou did not really address my comments about the return values of the drupalGet* and drupalPost* functions.
Either address them by fixing the patch, or explain why you didn't address them.
Comment #32
rakesh.gectcr@kekkis
Can you work on the changes mentioned by @jhodgdon
Comment #33
rakesh.gectcrComment #34
rakesh.gectcr@jhodgdon
I have worked on your points
Comment #35
jhodgdonI have asked repeatedly to please look at the return values of the drupalGet* and drupalPost* functions. This has *still* not been done. I am pretty sure these functions can also return a FALSE value, and this is NOT documented in the patch.
If you are going to write PHP documentation for return values, you need to read the PHP code that you are documenting *carefully* and check carefully what the return value is. Especially after someone reviewing your patch points out that she thinks the return docs are wrong.
Then you need to either fix the patch, or if my review comment is wrong, you need to respond to it in a comment by posting some of the code in the function and an explanation of why your patch is correct.
If you need help in making a fix to the patch, or in analyzing the code, please ask for help. There are mentoring hours when you can always get help with patches, and even outside of mentoring hours, if you are in #drupal-contribute IRC channel and ask for advice or help, you can probably find someone to help. You might also find
https://www.drupal.org/node/1354#types
I have asked repeatedly for this change to happen and it has not happened. I feel that you are not respecting the time and effort I have been spending reviewing your patches carefully.
So... I stopped at this line of the patch and didn't read any more of it. But I also found some things to fix higher up in the patch before I stopped looking at it.
Please change this to:
A render array for [whatever it is for].
Also just below here, please take out the @see drupal_render().
The correct capitalization is:
XPath
Please fix this in documentation and comments throughout the file.
Do not use @return array unless you do not know what type of things are in the array.
You want to do something like
@return string[]
@return int[]
@return \Some\Class\Name[]
etc.
Look at the code. These are not strings.
This is still wrong.
Files are not "less than" or "greater than" other files.
You need to be more specific about explaining the conditions.
Also please use English words/phraing, like "The return value is an integer that is less than zero" rather than "The return value < 0".
Add a ; after "in".
Comment #36
kaushalkishorejaiswal commentedAdded void return docblocks
Comment #37
rakesh.gectcr@kaushalkishorejaiswal Please provide the interdiff files also
Comment #38
sdstyles commentedPlease remove all trailing whitespace.
Comment #39
jhodgdonWhy did you add
@return void
doc blocks? We do not do that. If there is no return value for a function, we do not put in @return.
Also I cannot see that any of my previous review comments were addressed, although with no interdiff file it is hard to tell... Anyway we should probably go back to the patch in #34 because we do NOT want @return void doc blocks.
Comment #40
aneeshthankachan commented@jhodgdon
I am rolled back the patch on #34.
1) About this I have added the
Comment #41
rakesh.gectcrComment #42
jhodgdonReviewing the interdiff...
Sorry. You've taken one of my review comments a bit too literally. When I said:
A render array for [whatever it is for].
I didn't mean you should put anything in [] brackets! :)
What is "resource"? Don't make up return types. Use the actual class/interface name, with the namespace, if there is one. Otherwise, use "array" for an array, or "object" for a PHP standard object.
See
https://www.drupal.org/node/1354#types
for more information.
This is not accurate at all. The file sizes are compared first, and only if the sizes are the same are the file names compared.
I would also not advise saying that a file's name is "less than" another -- this is ambiguous. Say it comes before/after in alphabetical order or something like that.
I think this return value documentation would probably be easier to read, anyway, if it were formatted as a list. Something like:
An integer suitable for sorting the files, with value:
- first condition and result
- second condition and result
- etc.
Good. Now this needs to be done for
ALL OF THE get* and post* methods on this class
not just this one.
I have said this about 5 times in previous comments. ALL of the get* and post* methods need to be checked over. I believe all of them can return FALSE -- I could be wrong, but if so you need to show code samples for the methods that cannot return FALSE and document all of the other ones properly.
Really, how many times do I need to say the same thing in a review? Please do not submit another patch without checking over all of these methods.
Sorry for shouting here but this is getting really annoying... Whoever makes the next patch, you'll need to read the code in all of the get* and post* methods on this class and carefully figure out what they can return. Documenting return values is only valuable if it's accurate, and to be accurate sometimes you really need to read the code carefully. If you have time, please do it. If you don't, please find another issue to work on that is easier -- there are plenty out there that can be done without as much effort.
Comment #43
snehi commented@rakesh.gectcr Please follow all the comment threads written for each issue.
Don't make issues for small errors, please concatenate them all and make one issue.
It will helpful for reviewer and tester to review and test the patch.
On the other hand if you are not solving issue or unable to solve it please unassigned yourself from the issue.
So that anyone else can pick this issue and can work on it.
Comment #44
rakesh.gectcrComment #45
aditya_anurag commentedI am working on this.
Comment #46
aditya_anurag commentedChanges done in patch.
As mentioned in comment #42.
1. Changed to "A render array for view entity."
2. Changed to object.
3. Changed as mentioned.
4. Changed all of the get* and post* methods on this class.
Comment #47
aditya_anurag commentedComment #48
jhodgdonUm. The last patch here has too many problems to even review. Please go back to #40 and start over. Sorry.
Comment #49
snehi commentedComment #58
quietone commentedSince simpletest was removed from core in #3110862: Remove simpletest module from core moving this to the Simpletest Module.