-
Notifications
You must be signed in to change notification settings - Fork 119
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
Problem with indentation if code is chained #237
Comments
Would you tell me where is document about this ? |
There is point "Code MUST use 4 spaces for indenting, not tabs." in this document. |
From section 2.4.:
I interpret that to me mean that aligning |
@syohex Assuming that Krzysztof's configuration states somewhere that // with php-lineup-cascaded-calls nil
$longvarname = $this->get()
->another();
// with php-lineup-cascaded-calls t
$bar = $this->get()
->another(); This is different from the proposed new behaviour in PR #239. My understanding is that this PR changes the indentation to match // with php-lineup-cascaded-calls t
$bar = $this->get()
->another();
// with php-lineup-cascaded-calls nil
$bar = $this->get()
->another(); I don't think that this PR answers Krzysztof request. I think a solution that would keep everybody happy is to allow this behaviour to be customised in the following way:
Obviously when using option 3. the indentation to the Finally, PSR-2 does not define how cascading method calls should be indented, so as @ejmr suggested the current php-mode behaviour is also acceptable. |
Hm, I've just found that symfony2 style follows PSR2 + chains methods in 4 spaces, so at the moment it resolves my issue. Majority of editors put 4 spaces in such cases, so even if using more spaces is acceptable by psr2 ability to configure as proposed by trashofmasters would be really nice. Many companies add own points to internal coding standards where psr2 lacks information. |
Those four varieties of customization are already supported via (c-add-style
"psr2"
'("php"
(c-offsets-alist . ((statement-cont . +))))) And we could explain how to create a new style from scratch, what are the common things worth configuring, et cetera.
In my opinion this is another reason we should consider expanding our documentation about how to modify/create styles like PSR-2, Symfony, Drupal, and so on. |
I wasn't aware of the ability to do this, but now I totally agree with On Mon, Apr 13, 2015 at 11:22 AM, Eric James Michael Ritz <
|
I also didn't know about that. |
I have merged #239. |
Hi,
For unknown reason -> is being aligned with = from previous line.
In PSR2 mode it should be always aligned to 4 spaces.
The text was updated successfully, but these errors were encountered: