-
-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for WordPress.PHP.DevelopmentFunctions #2490
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||
<?xml version="1.0"?> | ||||||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||||||
title="Development Functions" | ||||||
> | ||||||
<standard> | ||||||
<![CDATA[ | ||||||
Debug code should not normally be used in production. | ||||||
|
||||||
Typically, this rule verifies if function calls to the PHP native `error_log()`, `var_dump()`, `var_export()`, `print_r()`, `trigger_error()`, `set_error_handler()`, `debug_backtrace`, `debug_print_backtrace` and `wp_debug_backtrace_summary()` functions are present in the code. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I'm suggesting the removal of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe instead of |
||||||
]]> | ||||||
</standard> | ||||||
<code_comparison> | ||||||
<code title="Valid: (Not) using var_dump()."> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why Also, I wonder if the message should be more generic and mention debug code/functions instead of singling out |
||||||
<![CDATA[ | ||||||
// var_dump() should not be used. | ||||||
]]> | ||||||
</code> | ||||||
<code title="Invalid: Calling the PHP native `var_dump()` function."> | ||||||
<![CDATA[ | ||||||
<em>var_dump( $bar );</em> | ||||||
]]> | ||||||
</code> | ||||||
</code_comparison> | ||||||
<standard> | ||||||
<![CDATA[ | ||||||
Please refrain from using functions that can lead to full path disclosure. | ||||||
|
||||||
Typically, this rule verifies if function calls to the PHP native `error_reporting()` and `phpinfo()` functions are present in the code. | ||||||
]]> | ||||||
</standard> | ||||||
<code_comparison> | ||||||
<code title="Valid: (Not) using `phpinfo()`."> | ||||||
<![CDATA[ | ||||||
// php_info() should not be used. | ||||||
]]> | ||||||
</code> | ||||||
<code title="Invalid: Calling the PHP native `phpinfo()` function."> | ||||||
<![CDATA[ | ||||||
<em>phpinfo();</em> | ||||||
]]> | ||||||
</code> | ||||||
</code_comparison> | ||||||
</documentation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is the warning message displayed by the sniff, but I believe that the documentation (and maybe also the sniff messages) usually only uses
should
/should not
when describing an error. Since this is a warning, maybe we could say that it is recommended or something like that?