Skip to content

Commit 7a31372

Browse files
Fix CS/WS issues
1 parent 6899b3e commit 7a31372

8 files changed

+106
-31
lines changed

.php_cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
$finder = Symfony\CS\Finder\DefaultFinder::create()
3+
->files()
4+
->in('src')
5+
->in('tests')
6+
->name('*.php');
7+
8+
return Symfony\CS\Config\Config::create()
9+
->level(\Symfony\CS\FixerInterface::NONE_LEVEL)
10+
->fixers(
11+
array(
12+
'align_double_arrow',
13+
'align_equals',
14+
'braces',
15+
'concat_with_spaces',
16+
'duplicate_semicolon',
17+
'elseif',
18+
'empty_return',
19+
'encoding',
20+
'eof_ending',
21+
'extra_empty_lines',
22+
'function_call_space',
23+
'function_declaration',
24+
'indentation',
25+
'join_function',
26+
'line_after_namespace',
27+
'linefeed',
28+
'list_commas',
29+
'lowercase_constants',
30+
'lowercase_keywords',
31+
'method_argument_space',
32+
'multiple_use',
33+
'namespace_no_leading_whitespace',
34+
'no_blank_lines_after_class_opening',
35+
'no_empty_lines_after_phpdocs',
36+
'parenthesis',
37+
'php_closing_tag',
38+
'phpdoc_indent',
39+
'phpdoc_no_access',
40+
'phpdoc_no_empty_return',
41+
'phpdoc_no_package',
42+
'phpdoc_params',
43+
'phpdoc_scalar',
44+
'phpdoc_separation',
45+
'phpdoc_to_comment',
46+
'phpdoc_trim',
47+
'phpdoc_types',
48+
'phpdoc_var_without_name',
49+
'remove_lines_between_uses',
50+
'return',
51+
'self_accessor',
52+
'short_tag',
53+
'single_line_after_imports',
54+
'single_quote',
55+
'spaces_before_semicolon',
56+
'spaces_cast',
57+
'ternary_spaces',
58+
'trailing_spaces',
59+
'trim_array_spaces',
60+
'unused_use',
61+
'visibility',
62+
'whitespacy_lines'
63+
)
64+
)
65+
->finder($finder);
66+

src/Differ.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ public function __construct($header = "--- Original\n+++ New\n", $showNonDiffLin
4141
/**
4242
* Returns the diff between two arrays or strings as string.
4343
*
44-
* @param array|string $from
45-
* @param array|string $to
46-
* @param LongestCommonSubsequence $lcs
44+
* @param array|string $from
45+
* @param array|string $to
46+
* @param LongestCommonSubsequence $lcs
47+
*
4748
* @return string
4849
*/
4950
public function diff($from, $to, LongestCommonSubsequence $lcs = null)
@@ -125,9 +126,10 @@ public function diff($from, $to, LongestCommonSubsequence $lcs = null)
125126
* - 1: ADDED: $token was added to $from
126127
* - 0: OLD: $token is not changed in $to
127128
*
128-
* @param array|string $from
129-
* @param array|string $to
130-
* @param LongestCommonSubsequence $lcs
129+
* @param array|string $from
130+
* @param array|string $to
131+
* @param LongestCommonSubsequence $lcs
132+
*
131133
* @return array
132134
*/
133135
public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null)
@@ -222,8 +224,9 @@ public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null)
222224
}
223225

224226
/**
225-
* @param array $from
226-
* @param array $to
227+
* @param array $from
228+
* @param array $to
229+
*
227230
* @return LongestCommonSubsequence
228231
*/
229232
private function selectLcsImplementation(array $from, array $to)
@@ -244,8 +247,9 @@ private function selectLcsImplementation(array $from, array $to)
244247
/**
245248
* Calculates the estimated memory footprint for the DP-based method.
246249
*
247-
* @param array $from
248-
* @param array $to
250+
* @param array $from
251+
* @param array $to
252+
*
249253
* @return int
250254
*/
251255
private function calculateEstimatedFootprint(array $from, array $to)

src/LCS/LongestCommonSubsequence.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ interface LongestCommonSubsequence
1818
/**
1919
* Calculates the longest common subsequence of two arrays.
2020
*
21-
* @param array $from
22-
* @param array $to
21+
* @param array $from
22+
* @param array $to
23+
*
2324
* @return array
2425
*/
2526
public function calculate(array $from, array $to);

src/LCS/MemoryEfficientLongestCommonSubsequenceImplementation.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class MemoryEfficientImplementation implements LongestCommonSubsequence
1818
/**
1919
* Calculates the longest common subsequence of two arrays.
2020
*
21-
* @param array $from
22-
* @param array $to
21+
* @param array $from
22+
* @param array $to
23+
*
2324
* @return array
2425
*/
2526
public function calculate(array $from, array $to)
@@ -64,8 +65,9 @@ public function calculate(array $from, array $to)
6465
}
6566

6667
/**
67-
* @param array $from
68-
* @param array $to
68+
* @param array $from
69+
* @param array $to
70+
*
6971
* @return array
7072
*/
7173
private function length(array $from, array $to)

src/LCS/TimeEfficientLongestCommonSubsequenceImplementation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class TimeEfficientImplementation implements LongestCommonSubsequence
1818
/**
1919
* Calculates the longest common subsequence of two arrays.
2020
*
21-
* @param array $from
22-
* @param array $to
21+
* @param array $from
22+
* @param array $to
23+
*
2324
* @return array
2425
*/
2526
public function calculate(array $from, array $to)

src/Parser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
class Parser
1717
{
1818
/**
19-
* @param string $string
19+
* @param string $string
20+
*
2021
* @return Diff[]
2122
*/
2223
public function parse($string)

tests/DifferTest.php

121 Bytes
Binary file not shown.

tests/LCS/TimeEfficientImplementationTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testIsStrictComparison()
4949
false, 0, 0.0, '', null, array(),
5050
true, 1, 1.0, 'foo', array('foo', 'bar'), array('foo' => 'bar')
5151
);
52-
$to = $from;
52+
$to = $from;
5353
$common = $this->implementation->calculate($from, $to);
5454

5555
$this->assertEquals($from, $common);
@@ -81,35 +81,35 @@ public function testEqualSequences()
8181

8282
public function testDistinctSequences()
8383
{
84-
$from = array('A');
85-
$to = array('B');
84+
$from = array('A');
85+
$to = array('B');
8686
$common = $this->implementation->calculate($from, $to);
8787
$this->assertEquals(array(), $common);
8888

89-
$from = array('A', 'B', 'C');
90-
$to = array('D', 'E', 'F');
89+
$from = array('A', 'B', 'C');
90+
$to = array('D', 'E', 'F');
9191
$common = $this->implementation->calculate($from, $to);
9292
$this->assertEquals(array(), $common);
9393

9494
foreach ($this->stress_sizes as $size) {
95-
$from = range(1, $size);
96-
$to = range($size + 1, $size * 2);
95+
$from = range(1, $size);
96+
$to = range($size + 1, $size * 2);
9797
$common = $this->implementation->calculate($from, $to);
9898
$this->assertEquals(array(), $common);
9999
}
100100
}
101101

102102
public function testCommonSubsequence()
103103
{
104-
$from = array('A', 'C', 'E', 'F', 'G' );
104+
$from = array('A', 'C', 'E', 'F', 'G');
105105
$to = array('A', 'B', 'D', 'E', 'H');
106-
$expected = array('A', 'E' );
106+
$expected = array('A', 'E');
107107
$common = $this->implementation->calculate($from, $to);
108108
$this->assertEquals($expected, $common);
109109

110-
$from = array('A', 'C', 'E', 'F', 'G' );
111-
$to = array( 'B', 'C', 'D', 'E', 'F', 'H');
112-
$expected = array('C', 'E', 'F' );
110+
$from = array('A', 'C', 'E', 'F', 'G');
111+
$to = array('B', 'C', 'D', 'E', 'F', 'H');
112+
$expected = array('C', 'E', 'F');
113113
$common = $this->implementation->calculate($from, $to);
114114
$this->assertEquals($expected, $common);
115115

0 commit comments

Comments
 (0)