mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
General: Add inline PHPCS options to leave regex indentation.
We have a handful of super long regexen that are written over multiple lines, as a collection of strings concatenated together. Each string is indented appropriately for the regex, but PHPCS doesn't recognised this, so defaults to removing the extra whitespace. Disabling the `Squiz.Strings.ConcatenationSpacing.PaddingFound` rule for these blocks stops the extra whitespace from being removed. See #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -235,8 +235,10 @@ function get_shortcode_regex( $tagnames = null ) {
|
||||
|
||||
// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag()
|
||||
// Also, see shortcode_unautop() and shortcode.js.
|
||||
|
||||
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
|
||||
return
|
||||
'\\[' // Opening bracket
|
||||
'\\[' // Opening bracket
|
||||
. '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
|
||||
. "($tagregexp)" // 2: Shortcode name
|
||||
. '(?![\\w-])' // Not followed by word character or hyphen
|
||||
@@ -264,6 +266,7 @@ function get_shortcode_regex( $tagnames = null ) {
|
||||
. ')?'
|
||||
. ')'
|
||||
. '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user