-
Notifications
You must be signed in to change notification settings - Fork 0
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
Formulate guidelines for phpdoc and inline comments #21
Comments
I really like your list!
I agree with the rest. |
And constants
I do NOT agree here. This is how a @param tag looks line in a PHPDoc:
So I suggest using the following rules:
Example doc block:
Also I strongly suggest to use Markdown in PHPDoc descriptions. |
This is not a sentence and there should be no period at the end. Sentences have verbs.
With regard to the starting capital letter or not question, I've had a look at what other people do. In the Java world, parameters descriptions start in lowercase. This is probably one of the reasons I prefer this format and why the capital letter looks very weird to me. I've also had a look at PHP projects. Symfony and Composer both start in a capital letter, which makes sense if you think of the description part as a table cell as it's shown in PhpDocumentor-generated output. This is probably also why they column-align their param lists. This doesn't look as weird as having a capital right in the middle of a line. Since I seem to be the only one who seems to prefer to avoid starting in uppercase letters, I'm ok with making uppercase letters a requirement. But I propose if we agree on that, we should column-align the parameter list the same way Symfony and Composer do (and Shopware, too, btw). One thing I dislike about @windaishi's example is this:
This looks too random. We should only use real paragraphs (separated by blank lines), not half-paragraphs (i.e. single linefeeds), and instead wrap all text within a paragraph to 120 cols. Otherwise, you end up with two different levels of paragraph demarcations, which is just too distracting to read. Also, I'm pretty sure those linefeeds won't be in the generated PhpDocumentor output. |
I slightly prefer lowercase for parameter descriptions because they rarely are complete sentences. I could live with uppercase, though. |
Good point. Anyway you can format your description with markdown (and especially github-flavoured markdown). |
I aggree with @fixpunkt. No TODOs and FIXMEs in code. TODOs are only for the developement process and should never be commited to master. Actually TODO means (imho) "I'm currently too lazy TODO it now, so I wait for someone other TODO it". FIXME is always an issue. I don't know anything that needs to be fixed and is not worth an issue. |
This is one example of what TODOs can be used for: https://github.com/VIISON/ShopwareCommon/blob/bf6686698796c5af29c7c6bced8f0a57ee77ef67/Classes/TryWithFinally.php#L14 Are you really suggesting we create an issue for any such instance? What exactly is it that you're proposing? I think grepping the code for TODOs/@todo/FIXME every once in a while is much less heavyweight than a filled issue tracker full of unimportant issues. Please only require column alignment of docs if a hook can do it. Though I prefer indented multi-line descriptions where supported. Column-aligning has the tendency to make lines really long. |
Okay, that special case is different. This is not one of the classic TODOs order FIXMEs. We should then allow @todo as PHPDoc tag. |
It's an opaque extra process, issues are visible to everyone. And if our issue tracker is full of refactoring issues, that is very important to know so we can make appropriate plans to remove technical debt. |
In my example, grepping for something like '@todo.*PHP.*5.5' reveals all related TODOs. How would a corresponding issue look? Manually link each line of code that could be changed? I propose we at most create an issue with strings to grep for :) |
That's still not visible to the half of the company that doesn't |
So what's the alternative? Manually maintain dozens of Markdown links to specific lines of code? |
Just not committing half-assed code should be the best course of action for most cases where people use |
What's half-assed about my example about a TODO to change code once we can depend on PHP >= 5.5? Please be really specific how you would handle this case. I haven't seen a reasonable alternative approach for this example, yet. Make a permalink to what? |
I explicitly stated that the half-assedness refers to most cases, but not to your example. You can just link the GitHub blob like you did in your commenbt above: https://github.com/VIISON/ShopwareCommon/blob/bf6686698796c5af29c7c6bced8f0a57ee77ef67/Classes/TryWithFinally.php#L14 Put that in an issue, add the refactoring label and you're done. This really doesn't happen so much that it's a problem, that's how we've been handling this case for some time now. |
Proposal:
The text was updated successfully, but these errors were encountered: