Add documentation for WordPress.WP.AlternativeFunctions.xml#2496
Add documentation for WordPress.WP.AlternativeFunctions.xml#2496pamprn09 wants to merge 1 commit intoWordPress:developfrom
Conversation
rodrigoprimo
left a comment
There was a problem hiding this comment.
Thanks for your contribution, and congratulations on your first WPCS PR, @pamprn09! I'm not a project maintainer, so take my review with a grain of salt.
I started reviewing this PR, and left some comments, but then started questioning if I was checking the right sniff since the code examples don't match what I expected. Could you please check before I continue (more information in one of the inline comments)?
| @@ -0,0 +1,95 @@ | |||
| <?xml version="1.0"?> | |||
There was a problem hiding this comment.
The file name and its location are incorrect. There is more information about it in #1722 and https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/.github/CONTRIBUTING.md#writing-sniff-documentation.
The command below should display the documentation, but it doesn't because of that:
vendor/bin/phpcs --generator=Text --standard=WordPress --sniffs=WordPress.WP.AlternativeFunctions
The correct path should be WordPress/Docs/WP/AlternativeFunctionsStandard.xml
| <![CDATA[ | ||
| _e( 'Hello, World!', 'text-domain' ); | ||
| $greeting = __( 'Hello, World!', 'text-domain' ); | ||
| ]]> |
There was a problem hiding this comment.
| <![CDATA[ | |
| _e( 'Hello, World!', 'text-domain' ); | |
| $greeting = __( 'Hello, World!', 'text-domain' ); | |
| ]]> | |
| <![CDATA[ | |
| _e( 'Hello, World!', 'text-domain' ); | |
| $greeting = __( 'Hello, World!', 'text-domain' ); | |
| ]]> |
The indentation for code samples should start at the beginning of the line. Otherwise, code samples with multiple lines will have incorrect indentation.
Also, per the #1722 description, each line within the code sample should be a maximum of 48 characters.
| </code> | ||
| <code title="Invalid: Using PHP's header() function for redirection."> | ||
| <
Related to: #1722