diff --git a/src/Ruleset.php b/src/Ruleset.php index f6b6d5a74b..2082cb5505 100644 --- a/src/Ruleset.php +++ b/src/Ruleset.php @@ -861,11 +861,17 @@ private function processRule($rule, $newSniffs, $depth=0) $ref = (string) $rule['ref']; $todo = [$ref]; - $parts = explode('.', $ref); - if (count($parts) <= 2) { - // We are processing a standard or a category of sniffs. + $parts = explode('.', $ref); + $partsCount = count($parts); + if ($partsCount <= 2 || $partsCount > count(array_filter($parts))) { + // We are processing a standard, a category of sniffs or a relative path inclusion. foreach ($newSniffs as $sniffFile) { - $parts = explode(DIRECTORY_SEPARATOR, $sniffFile); + $parts = explode(DIRECTORY_SEPARATOR, $sniffFile); + if (count($parts) === 1 && DIRECTORY_SEPARATOR === '\\') { + // Path using forward slashes while running on Windows. + $parts = explode('/', $sniffFile); + } + $sniffName = array_pop($parts); $sniffCategory = array_pop($parts); array_pop($parts);