Skip to content

Commit babd790

Browse files
author
Eric James Michael Ritz
committed
Merge branch 'ejmr/issue-102'
* ejmr/issue-102: Fix indentation error involving magic constants GitHub-Issue: 102 (Unit Test)
2 parents 883568f + a5fd4b5 commit babd790

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

php-mode.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ This variable can take one of the following symbol values:
305305
(brace-list-entry . c-lineup-cascaded-calls)
306306
(arglist-close . php-lineup-arglist-close)
307307
(arglist-intro . php-lineup-arglist-intro)
308+
(knr-argdecl . [0])
308309
(statement-cont . (first c-lineup-cascaded-calls +))))))
309310

310311
(defun php-enable-pear-coding-style ()
@@ -325,6 +326,7 @@ code and modules."
325326
(arglist-close . php-lineup-arglist-close)
326327
(arglist-intro . php-lineup-arglist-intro)
327328
(arglist-cont-nonempty . c-lineup-math)
329+
(knr-argdecl . [0])
328330
(statement-cont . (first c-lineup-cascaded-calls +))))))
329331

330332
(defun php-enable-drupal-coding-style ()
@@ -351,6 +353,7 @@ working with Drupal."
351353
(arglist-close . 0)
352354
(defun-close . 0)
353355
(defun-block-intro . +)
356+
(knr-argdecl . [0])
354357
(statement-cont . (first c-lineup-cascaded-calls +))))))
355358

356359
(defun php-enable-wordpress-coding-style ()
@@ -376,6 +379,7 @@ working with Wordpress."
376379
(statement-case-intro . 4)
377380
(defun-close . 0)
378381
(defun-block-intro . +)
382+
(knr-argdecl . [0])
379383
(statement-cont . php-lineup-hanging-semicolon)))))
380384

381385
(defun php-enable-symfony2-coding-style ()

tests/issue-102.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/**
4+
* Github Issue: https://github.com/ejmr/php-mode/issues/102
5+
*
6+
* Every line of code in the form of
7+
*
8+
* $broken = true;
9+
*
10+
* in the code below should have no indentation. This test makes sure
11+
* that files containing magic constants, e.g. __FILE__, do not
12+
* incorrectly affect the indentation of following lines.
13+
*
14+
*/
15+
16+
$x = some_function(__FILE__) . '';
17+
$broken = true;
18+
19+
some_function(__FILE__) . '';
20+
$broken = true;
21+
22+
some_function(__FILE__) + 1;
23+
$broken = true;

0 commit comments

Comments
 (0)