Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EscapeOutput: Fix typos in code comments #2419

Merged
merged 1 commit into from
Jan 3, 2024
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
16 changes: 8 additions & 8 deletions WordPress/Sniffs/Security/EscapeOutputSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function register() {
$this->safe_components += Tokens::$booleanOperators;
$this->safe_components += Collections::incrementDecrementOperators();

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

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

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

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

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

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

// Independently of whether or not the check was succesfull or ran into (parse error) problems,
// Independently of whether or not the check was successful or ran into (parse error) problems,
// always skip to the identified end of the item.
$current = $item_end;
} while ( $current < $end );
Expand Down
Loading