Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #78 from fountainhead-solutions/master

Support multi-line arrays within chained calls
  • Loading branch information...
commit b32bc79821db5f66b6ab8c5264b3e2107d41d124 2 parents 4ba6d80 + aeba35f
@nateabele nateabele authored
View
11 test/rules/HasCorrectTabIndention.php
@@ -140,6 +140,17 @@ protected function _getPredictedIndent($lineIndex, $testable) {
$expectedTab += 1;
}
+ if ($inArray) {
+ $grandParent = $parent['parent'] > -1 ? $tokens[$parent['parent']] : null;
+ if ($grandParent !== null) {
+ $grandParentLine = trim($lines[$grandParent['line'] - 1]);
+
+ if (preg_match('/^->/', $grandParentLine)) {
+ $expectedTab += 1;
+ }
+ }
+ }
+
return array(
'minSpace' => $minExpectedSpace,
'tab' => $expectedTab
View
12 tests/cases/test/rules/HasCorrectTabIndentionTest.php
@@ -477,6 +477,18 @@ public function testMultiLineChaining() {
$this->assertRulePass($code, $this->rule);
}
+ public function testMultiLineChainingWithArrays() {
+ $code = <<<EOD
+\$result = \$chain->called('method1')
+ ->called('method2')
+ ->with('first', array(
+ 'id' => 100
+ ))
+ ->success();
+EOD;
+ $this->assertRulePass($code, $this->rule);
+ }
+
public function testMutlilineAssignment() {
$code = <<<EOD
return true ||
Please sign in to comment.
Something went wrong with that request. Please try again.