Skip to content

Commit e5bdaad

Browse files
committed
Doc generation is now working again for installed standards
1 parent 5c54e3c commit e5bdaad

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

CodeSniffer/DocGenerators/Generator.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,18 @@ public function generate()
132132
protected function getStandardFiles()
133133
{
134134
$phpcs = new PHP_CodeSniffer();
135-
$sniffs = $phpcs->processRuleset($this->_standard);
135+
$phpcs->process(array(), $this->_standard);
136+
$sniffs = $phpcs->getSniffs();
136137

137138
$standardFiles = array();
138-
foreach ($sniffs as $sniff) {
139+
foreach ($sniffs as $className => $sniffClass) {
140+
$object = new ReflectionObject($sniffClass);
141+
$sniff = $object->getFilename();
139142
if (empty($this->_sniffs) === false) {
140143
// We are limiting the docs to certain sniffs only, so filter
141144
// out any unwanted sniffs.
142-
$sniffName = substr($sniff, (strrpos($sniff, '/') + 1));
143-
$sniffName = substr($sniffName, 0, -9);
145+
$parts = explode('_', $className);
146+
$sniffName = $parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5);
144147
if (in_array($sniffName, $this->_sniffs) === false) {
145148
continue;
146149
}

CodeSniffer/DocGenerators/HTML.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ protected function printToc($standardFiles)
186186
*/
187187
protected function printFooter()
188188
{
189-
// Turn off strict errors so we don't get timezone warnings if people
189+
// Turn off errors so we don't get timezone warnings if people
190190
// don't have their timezone set.
191-
error_reporting(E_ALL);
191+
error_reporting(0);
192192
echo ' <div class="tag-line">';
193193
echo 'Documentation generated on '.date('r');
194-
echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer @package_version@</a>';
194+
echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.'</a>';
195195
echo '</div>'.PHP_EOL;
196196
error_reporting(E_ALL | E_STRICT);
197197

package.xml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
2626
</stability>
2727
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
2828
<notes>
29+
- Doc generation is now working again for installed standards
30+
-- Includes a fix for limiting the docs to specific sniffs
2931
- Generic ScopeIndentSniff now allows for ignored tokens to be set via ruleset.xml files
3032
-- E.g., to ignore comments, override a property using:
3133
-- name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"

0 commit comments

Comments
 (0)