-
-
Notifications
You must be signed in to change notification settings - Fork 73
Generic/RequireStrictTypes: add XML documentation #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic/RequireStrictTypes: add XML documentation #236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rodrigoprimo for this PR.
When looking at the actual sniff code and at the code samples, I'm wondering why you've elected to go for one standards block with one code comparison block ?
Some extra context about this sniff: #51 (recent change included in the 3.8.0 release)
Thanks for checking this PR, @jrfnl!
Even though the sniff shows different errors/warnings for missing required strict_types and for strict_types found but disabled, I opted to use one
Upon seeing this PR, I realized that there are some valid cases that are not covered in the examples (case-insensitive execution directives, docblocks at the top of the file). Would you like me to add those? |
The difference between those sniffs and this sniff is one of PHP functionality. The other sniffs where checking for exactly one space in a certain place and whether there is too much space or too little space, the basic principle of the check is still the same. That's not the case for this sniff. This sniff is checking for two closely related, but distinctly different things:
It could be perfectly valid for a project to require In my mind, that means these two different rules need to be separated in the docs.
No, those kind of things are implementation details for the sniff to function correctly and do not belong in the docs. |
Thanks for the additional details, @jrfnl. After seeing your response, I agree that there is a significant difference between this sniff and the ones that I mentioned.
There is one more thing that is making me unsure about separating these two rules in the docs that I want to check with you before proceeding with your suggestion. To facilitate the conversation, I pushed a temporary commit with a rough draft of how the XML documentation would look after the separation (3975274). Is this more or less what you have in mind?
So far, all the documentation that I created for the sniffs describes only the default behavior of the sniff. I might be missing something, but I believe the behavior you described above is valid, but not possible without altering the default behavior and disabling |
@rodrigoprimo Sorry, I just realized I never got back to you after your comment. I'm going to leave some suggestions inline to see if we can move this PR forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions inline. Does that answer your questions sufficiently ?
Oh and I'm not sure the PHP open tags are needed in the code samples. The sniff (currently) just tries to find a |
Thanks for the review, @jrfnl! I pushed a commit implementing your suggestions and another one with two minor changes that occurred to me while checking the docs again. Similar to your suggestion here, I removed a redundant example and also changed the
I believe I had added the PHP open tags wrongly assuming that the sniff checked the
I'm still unsure about adding an example that will throw an error when the sniff is run with the default configuration. But if that is not a problem, we can proceed. |
I probably should have opened an issue about that after merging PR #51. Note: updating the sniff for this should not be underestimated. There are some notes under "Future scope" in PR #51 which detail some things to take into account/choices which would need to be made. |
Remove one redundant invalid example and make one highlight more meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit implementing your suggestions and another one with two minor changes that occurred to me while checking the docs again. Similar to your suggestion here, I removed a redundant example and also changed the
<em>
tag position in one of the examples.I'm still unsure about adding an example that will throw an error when the sniff is run with the default configuration. But if that is not a problem, we can proceed.
@rodrigoprimo Thanks for the update. LGTM! I think the examples as they are now are clear and instructive.
I'll rebase (without changes) and will merge this once the build has passed.
f8e7859
to
c7f8834
Compare
* Generic/RequireStrictTypes: add XML documentation * Rough draft of how the docs look like separating the two rules * Generic/RequireStrictTypes: improve docs based on PR review suggestions * Generic/RequireStrictTypes: further improvements to the docs Remove one redundant invalid example and make one highlight more meaningful.
Description
This PR adds documentation for the Generic.PHP.RequireStrictTypes sniff.
Suggested changelog entry
Add XML documentation for the Generic.PHP.RequireStrictTypes sniff.
Related issues/external references
Part of #148
Types of changes
PR checklist