Skip to content

Commit

Permalink
Ignore HTML Processor until PHPCS bug is resolved.
Browse files Browse the repository at this point in the history
See squizlabs/PHP_CodeSniffer#3685

PHP Code Sniffer mistakes the following code, thinking that it
throws an exception even though the exception is caught in place.

```php
try {
	throw new WP_HTML_Unsupported_Exception( 'The outside never sees me.' );
} catch ( WP_HTML_Unsupported_Excepted $e ) {
	return false;
}
```

This patch adds an exclude for the HTML Processor where PHPCS is confused.
Until that bug is fixed this is a pragmatic solution to avoiding the need
to change actual code around a bug in a linting tool. When that bug is
fixed and it no longer gets confused this exclusion should be removed.
  • Loading branch information
dmsnell committed Aug 8, 2023
1 parent b17188e commit 63b1f40
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag.Missing">
<!-- Ignore until squizlabs/PHP_CodeSniffer#3685 is fixed: it thinks that a caught exception escapes the function. -->
<exclude-pattern>lib/compat/wordpress-6.4/html-api/class-wp-html-processor.php</exclude-pattern>
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>

Expand Down

0 comments on commit 63b1f40

Please sign in to comment.