Skip to content
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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions WordPress/Docs/PHP/PregQuoteDelimiterStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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. If it is not passed, the default delimiters `/` are presumed, which is often wrong.
]]>
</standard>
<code_comparison>
<code title="Valid: The delimiter is included.">
<![CDATA[
preg_quote( $dir, '#' )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
preg_quote( $dir, '#' )
preg_quote( $dir, <em>'#'</em> )

Use the <em>...</em> to highlight the focus of the code snippet.

]]>
</code>
<code title="Invalid: The delimiter is not included.">
<![CDATA[
preg_quote( $dir );
]]>
</code>
</code_comparison>
</documentation>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a clear line at the end of the file please.

Loading