Skip to content

Commit 6998612

Browse files
committed
minor #4201 [7.3] MultilineWhitespaceBeforeSemicolonsFixer - add tests for PHP 7.3 (kubawerlos)
This PR was merged into the 2.12 branch. Discussion ---------- [7.3] MultilineWhitespaceBeforeSemicolonsFixer - add tests for PHP 7.3 Commits ------- 4c3e8a0 MultilineWhitespaceBeforeSemicolonsFixer - add tests for PHP 7.3
2 parents d7a1e6a + 4c3e8a0 commit 6998612

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixerTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,4 +847,31 @@ public function provideMessyWhitespacesSemicolonForChainedCallsFixCases()
847847
],
848848
];
849849
}
850+
851+
/**
852+
* @param string $expected
853+
* @param string $input
854+
*
855+
* @requires PHP 7.3
856+
* @dataProvider provideFix73Cases
857+
*/
858+
public function testFix73($expected, $input)
859+
{
860+
$this->fixer->configure(['strategy' => MultilineWhitespaceBeforeSemicolonsFixer::STRATEGY_NEW_LINE_FOR_CHAINED_CALLS]);
861+
$this->doTest($expected, $input);
862+
}
863+
864+
public function provideFix73Cases()
865+
{
866+
return [
867+
[
868+
"<?php\n\$this\n ->one()\n ->two(2, )\n;",
869+
"<?php\n\$this\n ->one()\n ->two(2, );",
870+
],
871+
[
872+
"<?php\n\$this\n ->one(1, )\n ->two()\n;",
873+
"<?php\n\$this\n ->one(1, )\n ->two();",
874+
],
875+
];
876+
}
850877
}

tests/Fixtures/Integration/misc/PHP7_3.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ null === $var; // `is_null` rule
4141
mb_strpos($a, $b, ); // `mb_str_functions` rule
4242
sample('foo', 'foobarbaz', 'baz', ); // `method_argument_space` rule
4343
$a = (int) $b; // `modernize_types_casting` rule
44+
$this->method1() // `multiline_whitespace_before_semicolons` rule
45+
->method2(3, );
4446
mb_strlen($str, ); // `native_function_casing` rule
4547
$c = \get_class($d, ); // `native_function_invocation` rule
4648
$a = rtrim($b, ); // `no_alias_functions` rule
@@ -84,6 +86,9 @@ is_null($var, ); // `is_null` rule
8486
strpos($a, $b, ); // `mb_str_functions` rule
8587
sample('foo', 'foobarbaz', 'baz' , ); // `method_argument_space` rule
8688
$a = intval($b, ); // `modernize_types_casting` rule
89+
$this->method1() // `multiline_whitespace_before_semicolons` rule
90+
->method2(3, )
91+
;
8792
STRLEN($str, ); // `native_function_casing` rule
8893
$c = get_class($d, ); // `native_function_invocation` rule
8994
$a = chop($b, ); // `no_alias_functions` rule

0 commit comments

Comments
 (0)