Skip to content

Commit

Permalink
Doc generation is now working again for installed standards
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 27, 2013
1 parent 5c54e3c commit e5bdaad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions CodeSniffer/DocGenerators/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions CodeSniffer/DocGenerators/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' <div class="tag-line">';
echo 'Documentation generated on '.date('r');
echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer @package_version@</a>';
echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.'</a>';
echo '</div>'.PHP_EOL;
error_reporting(E_ALL | E_STRICT);

Expand Down
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- 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"
Expand Down

0 comments on commit e5bdaad

Please sign in to comment.