Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 582025e

Browse files
committed
Merge branch '2.2'
# Conflicts: # src/WhitespacesFixerConfig.php # tests/WhitespacesFixerConfigTest.php
2 parents 8313df2 + fcb75f4 commit 582025e

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/WhitespacesFixerConfig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ final class WhitespacesFixerConfig
2727
public function __construct($indent = ' ', $lineEnding = "\n")
2828
{
2929
if (!in_array($indent, [' ', ' ', "\t"], true)) {
30-
throw new \InvalidArgumentException('Invalid "indent" param.');
30+
throw new \InvalidArgumentException('Invalid "indent" param, expected tab or two or four spaces.');
3131
}
3232

3333
if (!in_array($lineEnding, ["\n", "\r\n"], true)) {
34-
throw new \InvalidArgumentException('Invalid "lineEnding" param.');
34+
throw new \InvalidArgumentException('Invalid "lineEnding" param, expected "\n" or "\r\n".');
3535
}
3636

3737
$this->indent = $indent;

tests/WhitespacesFixerConfigTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ final class WhitespacesFixerConfigTest extends TestCase
3434
public function testCases($indent, $lineEnding, $exceptionRegExp = null)
3535
{
3636
if (null !== $exceptionRegExp) {
37-
$this->setExpectedExceptionRegExp(\InvalidArgumentException::class, $exceptionRegExp);
37+
$this->setExpectedExceptionRegExp(
38+
\InvalidArgumentException::class,
39+
'%^'.preg_quote($exceptionRegExp, '%').'$%'
40+
);
3841
}
3942

4043
$config = new WhitespacesFixerConfig($indent, $lineEnding);
@@ -50,10 +53,10 @@ public function provideTestCases()
5053
["\t", "\n"],
5154
[' ', "\r\n"],
5255
["\t", "\r\n"],
53-
[' ', 'asd', '/lineEnding/'],
54-
[' ', [], '/lineEnding/'],
55-
['std', "\n", '/indent/'],
56-
[[], "\n", '/indent/'],
56+
[' ', 'asd', 'Invalid "lineEnding" param, expected "\n" or "\r\n".'],
57+
[' ', [], 'Invalid "lineEnding" param, expected "\n" or "\r\n".'],
58+
['std', "\n", 'Invalid "indent" param, expected tab or two or four spaces.'],
59+
[[], "\n", 'Invalid "indent" param, expected tab or two or four spaces.'],
5760
];
5861
}
5962
}

0 commit comments

Comments
 (0)