File tree 3 files changed +12
-7
lines changed
CodeSniffer/DocGenerators
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,18 @@ public function generate()
132
132
protected function getStandardFiles ()
133
133
{
134
134
$ phpcs = new PHP_CodeSniffer ();
135
- $ sniffs = $ phpcs ->processRuleset ($ this ->_standard );
135
+ $ phpcs ->process (array (), $ this ->_standard );
136
+ $ sniffs = $ phpcs ->getSniffs ();
136
137
137
138
$ standardFiles = array ();
138
- foreach ($ sniffs as $ sniff ) {
139
+ foreach ($ sniffs as $ className => $ sniffClass ) {
140
+ $ object = new ReflectionObject ($ sniffClass );
141
+ $ sniff = $ object ->getFilename ();
139
142
if (empty ($ this ->_sniffs ) === false ) {
140
143
// We are limiting the docs to certain sniffs only, so filter
141
144
// 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 );
144
147
if (in_array ($ sniffName , $ this ->_sniffs ) === false ) {
145
148
continue ;
146
149
}
Original file line number Diff line number Diff line change @@ -186,12 +186,12 @@ protected function printToc($standardFiles)
186
186
*/
187
187
protected function printFooter ()
188
188
{
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
190
190
// don't have their timezone set.
191
- error_reporting (E_ALL );
191
+ error_reporting (0 );
192
192
echo ' <div class="tag-line"> ' ;
193
193
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> ' ;
195
195
echo '</div> ' .PHP_EOL ;
196
196
error_reporting (E_ALL | E_STRICT );
197
197
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
26
26
</stability >
27
27
<license uri =" https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt" >BSD 3-Clause License</license >
28
28
<notes >
29
+ - Doc generation is now working again for installed standards
30
+ -- Includes a fix for limiting the docs to specific sniffs
29
31
- Generic ScopeIndentSniff now allows for ignored tokens to be set via ruleset.xml files
30
32
-- E.g., to ignore comments, override a property using:
31
33
-- name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"
You can’t perform that action at this time.
0 commit comments