Completed
Pull Request — master (#5)
by Steve
02:04
created
tests/RangeDifferenceTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function testGetters(): void
19 19
     {
20
-        $diff = new RangeDifference(0, 1, 2, 3, 4, 5,6);
20
+        $diff = new RangeDifference(0, 1, 2, 3, 4, 5, 6);
21 21
 
22 22
         $this->assertSame(0, $diff->getKind());
23 23
         $this->assertSame(1, $diff->getRightStart());
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function testGetMaxLength(): void
35 35
     {
36
-        $diff = new RangeDifference(0, 1, 2, 3, 4, 5,6);
36
+        $diff = new RangeDifference(0, 1, 2, 3, 4, 5, 6);
37 37
 
38 38
         $this->assertSame(6, $diff->getMaxLength());
39 39
     }
40 40
 
41 41
     public function testIsEqual(): void
42 42
     {
43
-        $diff1 = new RangeDifference(0, 1, 2, 3, 4, 5,6);
44
-        $diff2 = new RangeDifference(0, 1, 2, 3, 4, 5,6);
45
-        $diff3 = new RangeDifference(1, 1, 2, 3, 4, 5,6);
43
+        $diff1 = new RangeDifference(0, 1, 2, 3, 4, 5, 6);
44
+        $diff2 = new RangeDifference(0, 1, 2, 3, 4, 5, 6);
45
+        $diff3 = new RangeDifference(1, 1, 2, 3, 4, 5, 6);
46 46
 
47 47
         $this->assertTrue($diff1->isEqual($diff2));
48 48
         $this->assertFalse($diff1->isEqual($diff3));
Please login to merge, or discard this patch.
tests/Tag/TagSaxDiffOutput.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $attrs = [
88 88
             'class' => 'diff-tag-removed',
89
-            'id'    => 'removed' . $this->removedId,
90
-            'title' => '#removed' . $this->removedId,
89
+            'id'    => 'removed'.$this->removedId,
90
+            'title' => '#removed'.$this->removedId,
91 91
         ];
92 92
         $this->removedId++;
93 93
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $attrs = [
105 105
             'class' => 'diff-tag-added',
106
-            'id'    => 'removed' . $this->addedId,
107
-            'title' => '#removed' . $this->addedId,
106
+            'id'    => 'removed'.$this->addedId,
107
+            'title' => '#removed'.$this->addedId,
108 108
         ];
109 109
         $this->addedId++;
110 110
 
Please login to merge, or discard this patch.
tests/Tag/ArgumentComparator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
                     $this->atoms[] = new TextAtom($currentWord);
47 47
                 }
48 48
 
49
-                $this->atoms[] = new TextAtom('' . $c);
49
+                $this->atoms[] = new TextAtom(''.$c);
50 50
                 $currentWord   = '';
51
-            } else if (DelimiterAtom::isValidDelimiter('' . $c)) {
51
+            } else if (DelimiterAtom::isValidDelimiter(''.$c)) {
52 52
                 // A delimiter.
53 53
                 if (mb_strlen($currentWord) > 0) {
54 54
                     $this->atoms[] = new TextAtom($currentWord);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function getAtom(int $i): AtomInterface
75 75
     {
76 76
         if ($i < 0 || $i >= count($this->atoms)) {
77
-            throw new OutOfBoundsException('There is no Atom with index ' . $i);
77
+            throw new OutOfBoundsException('There is no Atom with index '.$i);
78 78
         }
79 79
 
80 80
         return $this->atoms[$i];
Please login to merge, or discard this patch.
tests/TextLineLCS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
             $begin = $end + 1;
154 154
             $end = static::getEOL($text, $begin);
155 155
 
156
-            if ($end === $begin && "\r" === \mb_substr($text, $begin - 1, 1)  && "\n" === \mb_substr($text, $begin, 1)) {
156
+            if ($end === $begin && "\r" === \mb_substr($text, $begin - 1, 1) && "\n" === \mb_substr($text, $begin, 1)) {
157 157
                 // We have \r followed by \n, skip it.
158 158
                 $begin = $end + 1;
159 159
                 $end = static::getEOL($text, $begin);
Please login to merge, or discard this patch.
tests/DiffTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function testLineAdditions(): void
19 19
     {
20
-        $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . 'xyz';
21
-        $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123' . PHP_EOL . 'xyz';
20
+        $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'xyz';
21
+        $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'.PHP_EOL.'xyz';
22 22
 
23 23
         $l1 = TextLineLCS::getTextLines($s1);
24 24
         $l2 = TextLineLCS::getTextLines($s2);
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function testLineDeletion(): void
40 40
     {
41
-        $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123' . PHP_EOL . 'xyz';
42
-        $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . 'xyz';
41
+        $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123'.PHP_EOL.'xyz';
42
+        $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'xyz';
43 43
 
44 44
         $l1 = TextLineLCS::getTextLines($s1);
45 45
         $l2 = TextLineLCS::getTextLines($s2);
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function testLineAppendEnd(): void
67 67
     {
68
-        $s1 = 'abc' . PHP_EOL . 'def';
69
-        $s2 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123';
68
+        $s1 = 'abc'.PHP_EOL.'def';
69
+        $s2 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123';
70 70
 
71 71
         $l1 = TextLineLCS::getTextLines($s1);
72 72
         $l2 = TextLineLCS::getTextLines($s2);
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function testLineDeleteEnd(): void
93 93
     {
94
-        $s1 = 'abc' . PHP_EOL . 'def' . PHP_EOL . '123';
95
-        $s2 = 'abc' . PHP_EOL . 'def';
94
+        $s1 = 'abc'.PHP_EOL.'def'.PHP_EOL.'123';
95
+        $s2 = 'abc'.PHP_EOL.'def';
96 96
 
97 97
         $l1 = TextLineLCS::getTextLines($s1);
98 98
         $l2 = TextLineLCS::getTextLines($s2);
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 
118 118
     public function testLineAppendStart(): void
119 119
     {
120
-        $s1 = 'abc' . PHP_EOL . 'def';
121
-        $s2 = '123' . PHP_EOL . 'abc' . PHP_EOL . 'def';
120
+        $s1 = 'abc'.PHP_EOL.'def';
121
+        $s2 = '123'.PHP_EOL.'abc'.PHP_EOL.'def';
122 122
 
123 123
         $l1 = TextLineLCS::getTextLines($s1);
124 124
         $l2 = TextLineLCS::getTextLines($s2);
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 
144 144
     public function testLineDeleteStart(): void
145 145
     {
146
-        $s1 = '123' . PHP_EOL . 'abc' . PHP_EOL . 'def';
147
-        $s2 = 'abc' . PHP_EOL . 'def';
146
+        $s1 = '123'.PHP_EOL.'abc'.PHP_EOL.'def';
147
+        $s2 = 'abc'.PHP_EOL.'def';
148 148
 
149 149
         $l1 = TextLineLCS::getTextLines($s1);
150 150
         $l2 = TextLineLCS::getTextLines($s2);
Please login to merge, or discard this patch.
src/AbstractLCS.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
             return;
56 56
         }
57 57
 
58
-        $this->maxDifferences = (int)(($length1 + $length2 + 1) / 2);
58
+        $this->maxDifferences = (int) (($length1 + $length2 + 1) / 2);
59 59
 
60 60
         if ($length1 * $length2 > self::TOO_LONG) {
61 61
             // Limit complexity to D^POW_LIMIT for long sequences.
62
-            $this->maxDifferences = (int)\pow($this->maxDifferences, self::POW_LIMIT - 1.0);
62
+            $this->maxDifferences = (int) \pow($this->maxDifferences, self::POW_LIMIT - 1.0);
63 63
         }
64 64
 
65 65
         $this->initializeLcs($length1);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $delta = $N - $M;
170 170
         $isEven = ($delta & 1) === 1 ? false : true;
171 171
 
172
-        $limit = \min($this->maxDifferences, (int)(($N + $M + 1) / 2));
172
+        $limit = \min($this->maxDifferences, (int) (($N + $M + 1) / 2));
173 173
 
174 174
         // Offset to make it odd/even.
175 175
         // a 0 or 1 that we add to the start offset to make it odd/even
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
         $maxProgress = array_fill(
318 318
             0,
319
-            (int)(\max($forwardEndDiag - $forwardStartDiag, $backwardEndDiag - $backwardStartDiag) / 2 + 1),
319
+            (int) (\max($forwardEndDiag - $forwardStartDiag, $backwardEndDiag - $backwardStartDiag) / 2 + 1),
320 320
             [0, 0, 0]);
321 321
         // The first entry is current, it is initialized with 0s.
322 322
         $numProgress = 0;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             }
374 374
         }
375 375
 
376
-        return $maxProgress[(int)($numProgress / 2)];
376
+        return $maxProgress[(int) ($numProgress / 2)];
377 377
     }
378 378
 
379 379
     /**
Please login to merge, or discard this patch.