-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
PSR2 #2
Comments
|
PSR-2 overviewExpected 0 spaces after opening bracketIt turns out to be there are many people using PHPCS having questions about the After the following readings, I currently decide NOT to change my coding style about multiline if (
$a &&
$b &&
$c &&
$d
) {
// ...
} I don't think the following one is more readable, seriously. if ($a &&
$b &&
$c &&
$d) {
// ...
} References
Line exceeds 120 charactersThey are indeed too long because they evolves long URLs in comments. PSR-2 states |
The one in \src\Renderer\Html\LineRenderer\Word.php line 34 is left ;) 7 characters too long. But I can live with that. |
The rule that you excluded could like in Unified.php Could be fixed like if ($tag === SequenceMatcher::OP_REP ||
$tag === SequenceMatcher::OP_DEL
) {
$ret .= $this->renderContext('-', $this->diff->getA($i1, $i2));
}
if ($tag === SequenceMatcher::OP_REP ||
$tag === SequenceMatcher::OP_INS
) {
$ret .= $this->renderContext('+', $this->diff->getB($j1, $j2));
} |
Because the first condition after the ( bracket, there is no space. if ($tag expected.. While |
That is okay, I tested it against the phpcs.xml without the excluded rule. Not saying that it is understandable. |
That is a weird one that causing so many people having problems on it unfortunately :/ Thanks god that while ($a &&
$b &&
$c
) {
// ...
} is just ugly. |
PSR is not the only way to format code ;) ./vendor/bin/phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend |
PSR-12 is not accepted yet. I wish I could follow PSR as much as possible since it's the most well-known currently. |
@jfcherng it could be worse :D |
I dont think your screenshot could even pass PSR-2. Any way, my codes would pass PSR-12's multiline |
For sure is doen't pass PSR2, it was a joke. |
Just a FYI. PSR-12 is adopted now, which resolves the argument in this issue. |
There are some code violations to PSR2
You use phpcs.xml with
example
The text was updated successfully, but these errors were encountered: