diff --git a/src/Parser/ViolationParser.php b/src/Parser/ViolationParser.php index cabab9c..e9d27f5 100644 --- a/src/Parser/ViolationParser.php +++ b/src/Parser/ViolationParser.php @@ -27,8 +27,8 @@ public function parse(string $xmlFilePath): Violation private function getErrorCode(string $xmlFilePath): string { - $part = '([^\/]*)'; - preg_match("/$part\/Docs\/$part\/{$part}Standard\/$part\.xml/", $xmlFilePath, $matches); + $part = '([^/]*)'; + preg_match("`$part/Docs/$part/{$part}Standard/$part\.xml$`", $xmlFilePath, $matches); if ($matches === []) { throw NotAViolationPath::fromPath($xmlFilePath); } diff --git a/src/SniffFinder/FilesystemSniffFinder.php b/src/SniffFinder/FilesystemSniffFinder.php index 58f744f..d310f5f 100644 --- a/src/SniffFinder/FilesystemSniffFinder.php +++ b/src/SniffFinder/FilesystemSniffFinder.php @@ -43,7 +43,7 @@ private function recursiveSearch(Folder $folder): Iterator $dirs = new RecursiveDirectoryIterator($folder->getPath()); $files = new RecursiveIteratorIterator($dirs); return new CallbackFilterIterator($files, function (SplFileInfo $fileInfo) { - return preg_match('/\.php$/', $fileInfo->getPathname()) && !preg_match('/\/Tests\//', $fileInfo->getPathname()); + return preg_match('/\.php$/', $fileInfo->getPathname()) && !preg_match('`/Tests/`', $fileInfo->getPathname()); }); }