-
-
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
Adds documentation for PregQuoteDelimiter #2487
base: develop
Are you sure you want to change the base?
Changes from 2 commits
4424121
1ad4251
5265fff
b2f9aaa
a237136
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,24 @@ | ||
<?xml version="1.0"?> | ||
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" | ||
title="Preg Quote Delimiter" | ||
> | ||
<standard> | ||
<![CDATA[ | ||
Passing the $delimiter parameter to preg_quote() is strongly recommended to ensure the delimiter required by the PCRE functions are escaped. | ||
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.
I haven't looked deeply into this so I might be missing something, but I'm not sure this is the reason to recommend that the I got this from the issue where this sniff was introduced:
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. Updated the description and changed the example valid code to be one from WordPress core. |
||
]]> | ||
</standard> | ||
|
||
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. This newline is not necessary. 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. Removed unnecessary newlines. |
||
<code_comparison> | ||
<code title="Valid: The delimiter is included."> | ||
<![CDATA[ | ||
preg_quote( $str, '/' ); | ||
]]> | ||
</code> | ||
<code title="Invalid: The delimiter is not included."> | ||
<![CDATA[ | ||
preg_quote( $str ); | ||
]]> | ||
</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.
<![CDATA
should be aligned with<standard>
. Here is an example of a recently added documentation: https://github.com/rodrigoprimo/WordPress-Coding-Standards/blob/694bdf514d518004cefc0a22923fedeb0091eaca/WordPress/Docs/WP/GetMetaSingleStandard.xml#L7Here and in the other places where
<![CDATA
is used.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.
Aligned items.