Skip to content

Commit a0f5f36

Browse files
SpacePossumsebastianbergmann
authored andcommitted
MemoryEfficientLongestCommonSubsequenceImplementation::calculate - strict.
1 parent 1f3a7f1 commit a0f5f36

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/LCS/MemoryEfficientLongestCommonSubsequenceImplementation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function calculate(array $from, array $to)
3333
}
3434

3535
if ($cFrom === 1) {
36-
if (\in_array($from[0], $to)) {
36+
if (\in_array($from[0], $to, true)) {
3737
return array($from[0]);
3838
}
3939

tests/LCS/LongestCommonSubsequenceTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,12 @@ public function testReversedSequences()
185185
$this->assertEquals(array(1), $common);
186186
}
187187
}
188+
189+
public function testStrictTypeCalculate()
190+
{
191+
$diff = $this->implementation->calculate(array('5'), array('05'));
192+
193+
$this->assertInternalType('array', $diff);
194+
$this->assertCount(0, $diff);
195+
}
188196
}

0 commit comments

Comments
 (0)