Operators and linebreaks question
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- php
- Domain
- documentation
Research direction
Review the PER-CS 3.0 sections 6.4 and 5.1 mentioned in the issue, then compare the three formatting examples with the behavior of php-cs-fixer's @PER-CS3.0 ruleset. Done means documenting whether each example satisfies the standard and explaining any difference between the standard and the fixer.
Written by the indexing model from the issue text.
Description
Problem
Before 3.0 we could write something like
$sum =
$amount
+ $tax
- $discount;
3.0 is much stricter, and we should write
// the added values now have different indents, which makes it harder to read stack of variables
$sum = $amount
+ $tax
- $discount;
or
// operators with different precedence have the same indentation,
// but the execution order does not correspond to the reading sequence from top to bottom
$sum
= $amount
+ $tax
- $discount;
Both versions are worse than the original in terms of readability. Thereforce i'm looking for a way to make it as readable, as it was before. But currently i cannot understand, if some cases obey standard rules or not.
I find this way of writing the best (operators with different precedence have different indents, all variables in sum are stacked whell). But php-cs-fixer disallow me to write such way in @PER-CS3.0 ruleset, requring to write = and $amount on same line. I examined standard (firstly 6.4 and 5.1 sections), but cannot find such a requirements.
$sum
=
$amount
+ $tax
- $discount;
Please clarify whether this example meets the requirements of the standard.
php-cs-fixer accepted this option
$sum
= $amount
+ $tax
- $discount;
please clarify, if it meets the requirements and original idea of standard.
- Dominant language
- No language data
- Stars
- 284
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from php-fig/per-coding-style
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
php-fig/per-coding-style#154 · 3 comments ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 35/100
php-fig/per-coding-style#131 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
php-fig/per-coding-style#119 · 8 comments ·
All issues in php-fig/per-coding-style
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·