-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
[Docs] Add XML doc for Squiz.Classes.ValidClassName sniff #842
[Docs] Add XML doc for Squiz.Classes.ValidClassName sniff #842
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.
Hi @braindawg and welcome to the PHP_CodeSniffer project! Thank you for taking on these documentation tasks.
Generally speaking, this is looking good.
Aside from the one indentation issue, the docs comply with all indent, punctuation and format requirements 👍🏻
The only thing I'm wondering about is whether saying "must be written in Pascal case" is clear enough.
Will all users understand what "Pascal case" is ? Or should the standard description be updated to include the rules which comprise Pascal case ?
Combined with the code samples, the docs now give the impression that the only requirement is that the class name starts with a capital letter, while there are more requirements.
Fair point! I can add a Pascal_Snake_Case example to help. Not sure how far to go with bad examples, but I don't want to overdo it and add too much noise.
Yeah, I debated how much to write out here. I wanted to be clear & concise, but I think it's safe to assume more people are familiar with the terms The rules which comprise Pascal case from a human language standpoint (each word or lexical block is capitalized and all are concatenated) aren't strictly checked (or checkable) by this sniff, so I'd rather describe what will pass the sniff test. Maybe:
Thoughts? |
I updated the standard description to clarify what the sniff is looking for and added a new example for illegal underscores. I didn't add any examples of actual invalid syntax, like other special characters in the filename or starting with a number. If anyone thinks that's necessary, I can create a couple, but I figured they'd be overkill. |
@braindawg Thank you for making that update and sorry I hadn't gotten round to responding to your question before. Looks good to me.
I totally agree. Examples with invalid syntax are needed in the sniff tests, but have no place in the documentation. |
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.
Approved.
FYI - the failing test is not directly related to this PR, but is to do with a test which was not stable enough. I've fixed this now in PR #853.
Once CI for that PR has finished running and that PR has been merged, I will rebase this PR to get a passing build on this one before merging.
Uses `<em>` tags in the code sample for Squiz.Classes.ValidClassName to highlight the critical part of the sample.
Added a friendlier description of the PascalCase requirements. Adds an extra example to clarify that it's not just a leading capital we're looking for - we also need only letters and numbers.
a3cf6bf
to
916b5f8
Compare
* Add XML doc for Squiz\Classes\ValidClassName sniff * [Doc] Use em tags for ValidClassName doc XML Uses `<em>` tags in the code sample for Squiz.Classes.ValidClassName to highlight the critical part of the sample. * Clarify PascalCase class naming requirement Added a friendlier description of the PascalCase requirements. Adds an extra example to clarify that it's not just a leading capital we're looking for - we also need only letters and numbers.
Description
This PR adds documentation for the
Squiz\Classes\ValidClassName
sniff.Suggested changelog entry
Add documentation for the Squiz.Classes.ValidClassName sniff
Related issues/external references
Partial fix for #148
Types of changes
PR checklist