branch: externals/phps-mode commit e639ea3ff067683339ae2833d6ffb13eebb2365d Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Indent passing new concatenation tests --- phps-mode-functions.el | 9 ++++++--- phps-mode-test-functions.el | 13 +++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/phps-mode-functions.el b/phps-mode-functions.el index 315894d..3285027 100644 --- a/phps-mode-functions.el +++ b/phps-mode-functions.el @@ -459,13 +459,16 @@ (if in-assignment (when (or (string= token ";") (and (string= token ")") - (<= round-bracket-level in-assignment-round-bracket-level)) + (< round-bracket-level (car in-assignment-round-bracket-level))) (and (string= token ",") - (<= round-bracket-level in-assignment-round-bracket-level)) + (= round-bracket-level (car in-assignment-round-bracket-level))) (and (string= token"]") (<= square-bracket-level in-assignment-square-bracket-level))) (when phps-mode-functions-verbose (message "Ended assignment")) + (when first-token-on-line + ) + (pop in-assignment-round-bracket-level) (setq in-assignment nil) (setq in-assignment-level 0)) (when (and (not after-special-control-structure) @@ -473,7 +476,7 @@ (when phps-mode-functions-verbose (message "Started assignment")) (setq in-assignment t) - (setq in-assignment-round-bracket-level round-bracket-level) + (push round-bracket-level in-assignment-round-bracket-level) (setq in-assignment-square-bracket-level square-bracket-level) (setq in-assignment-level 1))) diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el index 95a1cf0..80e9e68 100644 --- a/phps-mode-test-functions.el +++ b/phps-mode-test-functions.el @@ -211,19 +211,19 @@ (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 0)) (7 (0 0)) (8 (0 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (0 0)) (13 (1 0)) (14 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) (phps-mode-test-with-buffer - "<?php\nnamespace Vendor\Package;\n\nclass ClassName\n{\n public $foo = null;\n}" + "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n public $foo = null;\n}" "PSR-2 : 4.2. Properties" ;; (message "Indent: %s" (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))) (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 0)) (7 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) (phps-mode-test-with-buffer - "<?php\nnamespace Vendor\Package;\n\nclass ClassName\n{\n public function fooBarBaz($arg1, &$arg2, $arg3 = [])\n {\n // method body\n }\n}" + "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n public function fooBarBaz($arg1, &$arg2, $arg3 = [])\n {\n // method body\n }\n}" "PSR-2 : 4.3. Methods" ;; (message "Indent: %s" (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))) (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) (phps-mode-test-with-buffer - "<?php\nnamespace Vendor\Package;\n\nclass ClassName\n{\n public function foo($arg1, &$arg2, $arg3 = [])\n {\n // method body\n }\n}" + "<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n public function foo($arg1, &$arg2, $arg3 = [])\n {\n // method body\n }\n}" "PSR-2 : 4.4. Method Arguments : Example 1" ;; (message "Indent: %s" (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))) (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) @@ -235,7 +235,7 @@ (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 0)) (7 (2 0)) (8 (2 0)) (9 (2 0)) (10 (1 0)) (11 (2 0)) (12 (1 0)) (13 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) (phps-mode-test-with-buffer - "<?php\nnamespace Vendor\Package;\n\nabstract class ClassName\n{\n protected static $foo;\n\n abstract protected function zim();\n\n final public static function bar()\n {\n // method body\n }\n}" + "<?php\nnamespace Vendor\\Package;\n\nabstract class ClassName\n{\n protected static $foo;\n\n abstract protected function zim();\n\n final public static function bar()\n {\n // method body\n }\n}" "PSR-2 ; 4.5. abstract, final, and static" (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1 0)) (7 (1 0)) (8 (1 0)) (9 (1 0)) (10 (1 0)) (11 (1 0)) (12 (2 0)) (13 (1 0)) (14 (0 0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))) @@ -292,7 +292,8 @@ (phps-mode-test-with-buffer "<?php\n$longArgs_noVars = function (\n $longArgument,\n $longerArgument,\n $muchLongerArgument\n) {\n // body\n};\n\n$noArgs_longVars = function () use (\n $longVar1,\n $longerVar2,\n $muchLongerVar3\n) {\n // body\n};\n\n$longArgs_longVars = function (\n $longArgument,\n $longerArgument,\n $muchLongerArgument\n) use (\n $longVar1,\n $longerVar2,\n $muchLongerVar3\n) {\n // body\n};\n\n$longArgs_shortVars = function (\n $longArgument,\n [...] "PSR-2 : 6. Closures : Example 2" - (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (0 0)) (7 (1 0)) (8 (0 0)) (9 (0 0)) (10 (0 0)) (11 (1 0)) (12 (1 0)) (13 (1 0)) (14 (0 0)) (15 (1 0)) (16 (0 0)) (17 (0 0)) (18 (0 0)) (19 (1 0)) (20 (1 0)) (21 (1 0)) (22 (0 0)) (23 (1 0)) (24 (1 0)) (25 (1 0)) (26 (0 0)) (27 (1 0)) (28 (0 0)) (29 (0 0)) (30 (0 0)) (31 (1 0)) (32 (1 0)) (33 (1 0)) (34 (0 0)) (35 (1 0)) (36 (0 0)) (37 (0 0)) (38 (0 0)) (39 (1 0)) (40 (1 0)) (41 (1 0)) (42 (0 0)) (43 (1 0)) (44 (0 0 [...] + ;; (message "Indent: %s" (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))) + (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (1 0)) (7 (1 0)) (8 (0 0)) (9 (0 0)) (10 (0 0)) (11 (1 0)) (12 (1 0)) (13 (1 0)) (14 (1 0)) (15 (1 0)) (16 (0 0)) (17 (0 0)) (18 (0 0)) (19 (1 0)) (20 (1 0)) (21 (1 0)) (22 (1 0)) (23 (1 0)) (24 (1 0)) (25 (1 0)) (26 (1 0)) (27 (1 0)) (28 (0 0)) (29 (0 0)) (30 (0 0)) (31 (1 0)) (32 (1 0)) (33 (1 0)) (34 (1 0)) (35 (1 0)) (36 (0 0)) (37 (0 0)) (38 (0 0)) (39 (1 0)) (40 (1 0)) (41 (1 0)) (42 (1 0)) (43 (1 0)) (44 (0 0 [...] (phps-mode-test-with-buffer "<?php\n$foo->bar(\n $arg1,\n function ($arg2) use ($var1) {\n // body\n },\n $arg3\n);" @@ -773,7 +774,7 @@ (defun phps-mode-test-functions () "Run test for functions." ;; (setq debug-on-error t) - (setq phps-mode-functions-verbose t) + ;; (setq phps-mode-functions-verbose t) (phps-mode-test-functions-get-lines-lindent-if) (phps-mode-test-functions-get-lines-indent-classes) (phps-mode-test-functions-get-lines-indent-inline-if)