Skip to content

Commit eaa70fe

Browse files
authored
Merge pull request #2419 from WordPress/fix/escape-output-code-comment-typos
EscapeOutput: Fix typos in code comments
2 parents c49b8c3 + ec26b0e commit eaa70fe

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: WordPress/Sniffs/Security/EscapeOutputSniff.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function register() {
141141
$this->safe_components += Tokens::$booleanOperators;
142142
$this->safe_components += Collections::incrementDecrementOperators();
143143

144-
// Set up the tokens the sniff should listen too.
144+
// Set up the tokens the sniff should listen to.
145145
$targets = array_merge( parent::register(), $this->target_keywords );
146146
$targets[] = \T_ECHO;
147147
$targets[] = \T_OPEN_TAG_WITH_ECHO;
@@ -157,7 +157,7 @@ public function register() {
157157
* @return array
158158
*/
159159
public function getGroups() {
160-
// Make sure all array keys are lowercase (could contain user provided function names).
160+
// Make sure all array keys are lowercase (could contain user-provided function names).
161161
$printing_functions = array_change_key_case( $this->get_printing_functions(), \CASE_LOWER );
162162

163163
// Remove the unsafe printing functions to prevent duplicate notices.
@@ -237,7 +237,7 @@ public function process_token( $stackPtr ) {
237237
if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $next_relevant ]['code']
238238
|| isset( $this->tokens[ $next_relevant ]['parenthesis_closer'] ) === false
239239
) {
240-
// Live codind/parse error or a pre-created exception. Nothing to do for us.
240+
// Live coding/parse error or a pre-created exception. Nothing to do for us.
241241
return;
242242
}
243243

@@ -470,7 +470,7 @@ protected function check_code_is_escaped( $start, $end, $code = 'OutputNotEscape
470470
&& $this->tokens[ $next_non_empty ]['parenthesis_closer'] !== $last_non_empty
471471
)
472472
) {
473-
// If there is a (long) ternary skip over the part before the ?.
473+
// If there is a (long) ternary, skip over the part before the ?.
474474
$ternary = $this->find_long_ternary( $start, $end );
475475
if ( false !== $ternary ) {
476476
$start = ( $ternary + 1 );
@@ -503,7 +503,7 @@ protected function check_code_is_escaped( $start, $end, $code = 'OutputNotEscape
503503
}
504504

505505
if ( $in_cast ) {
506-
// Skip to the end of a function call if it has been casted to a safe value.
506+
// Skip to the end of a function call if it has been cast to a safe value.
507507
$i = $this->tokens[ $i ]['parenthesis_closer'];
508508
$in_cast = false;
509509

@@ -625,7 +625,7 @@ protected function check_code_is_escaped( $start, $end, $code = 'OutputNotEscape
625625
if ( isset( ContextHelper::get_safe_cast_tokens()[ $this->tokens[ $i ]['code'] ] ) ) {
626626
/*
627627
* If the next thing is a match expression, skip over it as whatever is
628-
* being returned will be safe casted.
628+
* being returned will be safely cast.
629629
* Do not set `$in_cast` to `true`.
630630
*/
631631
$next_non_empty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), $end, true );
@@ -660,7 +660,7 @@ protected function check_code_is_escaped( $start, $end, $code = 'OutputNotEscape
660660
continue;
661661
}
662662

663-
// Now check that next token is a function call.
663+
// Now check that the next token is a function call.
664664
if ( \T_STRING === $this->tokens[ $i ]['code'] ) {
665665
$ptr = $i;
666666
$functionName = $this->tokens[ $i ]['content'];
@@ -893,7 +893,7 @@ private function walk_match_expression( $stackPtr, $code ) {
893893
// Now check that the value returned by this match "leaf" is correctly escaped.
894894
$this->check_code_is_escaped( $item_start, $item_end, $code );
895895

896-
// Independently of whether or not the check was succesfull or ran into (parse error) problems,
896+
// Independently of whether or not the check was successful or ran into (parse error) problems,
897897
// always skip to the identified end of the item.
898898
$current = $item_end;
899899
} while ( $current < $end );

0 commit comments

Comments
 (0)