Skip to content

Commit

Permalink
Merge pull request #6 from exussum12/phpmndFix
Browse files Browse the repository at this point in the history
Use the longest string for the haystack in phpmnd
  • Loading branch information
exussum12 authored Aug 9, 2017
2 parents 33fa735 + a3762f9 commit 53b32df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/FileMatchers/EndsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function match($needle, array $haystack)
protected function fileEndsWith($haystack, $needle)
{
$length = strlen($needle);
if (strlen($haystack) < $length) {
return $this->fileEndsWith($needle, $haystack);
}

return (substr($haystack, -$length) === $needle);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PhpMndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PhpMndTest extends TestCase
{
public function setUp()
{
$file = __DIR__ . "/fixtures/phpmnd.txt";
$file = __DIR__ . "/fixtures/phpmnd.txt";
$this->mnd = new PhpMndLoader($file);

$this->assertInstanceOf(PhpMndLoader::class, $this->mnd);
Expand Down

0 comments on commit 53b32df

Please sign in to comment.