diff --git a/CodeSniffer/DocGenerators/Generator.php b/CodeSniffer/DocGenerators/Generator.php index a2a6809acd..51ba0c6f92 100644 --- a/CodeSniffer/DocGenerators/Generator.php +++ b/CodeSniffer/DocGenerators/Generator.php @@ -132,8 +132,16 @@ public function generate() */ protected function getStandardFiles() { - $standardDir = realpath(dirname(__FILE__).'/../Standards/'.$this->_standard); - $sniffs = PHP_CodeSniffer::getSniffFiles($standardDir, $this->_standard); + if (is_dir($this->_standard) === true) { + // This is a custom standard. + $standardDir = $this->_standard; + $standard = basename($this->_standard); + } else { + $standardDir = realpath(dirname(__FILE__).'/../Standards/'.$this->_standard); + $standard = $this->_standard; + } + + $sniffs = PHP_CodeSniffer::getSniffFiles($standardDir, $standard); $standardFiles = array(); foreach ($sniffs as $sniff) { @@ -147,7 +155,7 @@ protected function getStandardFiles() } } - $standardFile = str_replace('/Sniffs/', '/Docs/', $sniff); + $standardFile = str_replace(DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR.'Docs'.DIRECTORY_SEPARATOR, $sniff); $standardFile = str_replace('Sniff.php', 'Standard.xml', $standardFile); if (is_file($standardFile) === true) {