You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found yet another edge case for the ArrayIndentation sniff:
$array = array(
'notes' => array(
'<p><strong>Please note:</strong> <code>min() / max()</code> will evaluate a non-numeric string as 0 if compared to integer, but still return the string if it\'s seen as the numerically lowest/highest value.</p>',
'<p><code>max()</code> returns the numerically highest of the parameter values. If multiple values can be considered of the same size, the one that is listed first will be returned.<br /> If <code>max()</code> is given multiple arrays, the longest array is returned. If all the arrays have the same length, <code>max()</code> will use lexicographic ordering to find the return value.</p>',
),
);
will throw a Multi-line array item not aligned correctly; expected 8 spaces, but found 0 (WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned) error.
This is caused by multi-line strings (the second <p> + subsequent line) being tokenized as T_CONSTANT_ENCAPSED_STRING, T_WHITESPACE (new line), T_CONSTANT_ENCAPSED_STRING where the second T_CONSTANT_ENCAPSED_STRING contains the indentation for the next line.
I haven't tested this, but I believe this will also cause a fixer loop as the additional whitespace would be added before the second T_CONSTANT_ENCAPSED_STRING, but in the next round of the fixer would be tokenized as part of the string - similar to what was happening in another sniff (#1017).
The text was updated successfully, but these errors were encountered:
Found yet another edge case for the ArrayIndentation sniff:
will throw a
Multi-line array item not aligned correctly; expected 8 spaces, but found 0 (WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned)
error.This is caused by multi-line strings (the second
<p>
+ subsequent line) being tokenized asT_CONSTANT_ENCAPSED_STRING
,T_WHITESPACE
(new line),T_CONSTANT_ENCAPSED_STRING
where the secondT_CONSTANT_ENCAPSED_STRING
contains the indentation for the next line.I haven't tested this, but I believe this will also cause a fixer loop as the additional whitespace would be added before the second
T_CONSTANT_ENCAPSED_STRING
, but in the next round of the fixer would be tokenized as part of the string - similar to what was happening in another sniff (#1017).The text was updated successfully, but these errors were encountered: