Skip to content
Merged
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
29 changes: 29 additions & 0 deletions WordPress/Docs/PHP/NoSilencedErrorsStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="No Silenced Errors"
>
<standard>
<![CDATA[
The error silencing operator (@) should not be used. In the vast majority of cases, there is no need for the error silencing operator if the parameters passed to a function are checked ahead of the call.

As an exception, the operator is allowed for certain functions where warnings cannot be prevented.
]]>
</standard>
<code_comparison>
<code title="Valid: Calling a function without error silencing.">
<![CDATA[
if ( isset( $replace_pairs[''] ) ) {
unset( $replace_pairs[''] );
}

$result = <em></em>strtr( $str, $replace_pairs );
]]>
</code>
<code title="Invalid: Using the @ operator to silence warnings.">
<![CDATA[
$result = <em>@</em>strtr( $str, $replace_pairs );
]]>
</code>
</code_comparison>
</documentation>
Loading