diff --git a/src/FileMatchers/EndsWith.php b/src/FileMatchers/EndsWith.php index 0d85174..4f26882 100644 --- a/src/FileMatchers/EndsWith.php +++ b/src/FileMatchers/EndsWith.php @@ -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); } diff --git a/tests/PhpMndTest.php b/tests/PhpMndTest.php index 202c81d..9c632f3 100644 --- a/tests/PhpMndTest.php +++ b/tests/PhpMndTest.php @@ -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);