diff --git a/CodeSniffer/DocGenerators/Generator.php b/CodeSniffer/DocGenerators/Generator.php index 8cb38c605f..e686549be4 100644 --- a/CodeSniffer/DocGenerators/Generator.php +++ b/CodeSniffer/DocGenerators/Generator.php @@ -132,15 +132,18 @@ public function generate() protected function getStandardFiles() { $phpcs = new PHP_CodeSniffer(); - $sniffs = $phpcs->processRuleset($this->_standard); + $phpcs->process(array(), $this->_standard); + $sniffs = $phpcs->getSniffs(); $standardFiles = array(); - foreach ($sniffs as $sniff) { + foreach ($sniffs as $className => $sniffClass) { + $object = new ReflectionObject($sniffClass); + $sniff = $object->getFilename(); if (empty($this->_sniffs) === false) { // We are limiting the docs to certain sniffs only, so filter // out any unwanted sniffs. - $sniffName = substr($sniff, (strrpos($sniff, '/') + 1)); - $sniffName = substr($sniffName, 0, -9); + $parts = explode('_', $className); + $sniffName = $parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5); if (in_array($sniffName, $this->_sniffs) === false) { continue; } diff --git a/CodeSniffer/DocGenerators/HTML.php b/CodeSniffer/DocGenerators/HTML.php index f379d9414d..4eab2308d2 100644 --- a/CodeSniffer/DocGenerators/HTML.php +++ b/CodeSniffer/DocGenerators/HTML.php @@ -186,12 +186,12 @@ protected function printToc($standardFiles) */ protected function printFooter() { - // Turn off strict errors so we don't get timezone warnings if people + // Turn off errors so we don't get timezone warnings if people // don't have their timezone set. - error_reporting(E_ALL); + error_reporting(0); echo '
'; echo 'Documentation generated on '.date('r'); - echo ' by PHP_CodeSniffer @package_version@'; + echo ' by PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.''; echo '
'.PHP_EOL; error_reporting(E_ALL | E_STRICT); diff --git a/package.xml b/package.xml index 9628cf0623..9243e28294 100644 --- a/package.xml +++ b/package.xml @@ -26,6 +26,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> BSD 3-Clause License + - Doc generation is now working again for installed standards + -- Includes a fix for limiting the docs to specific sniffs - Generic ScopeIndentSniff now allows for ignored tokens to be set via ruleset.xml files -- E.g., to ignore comments, override a property using: -- name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"