diff --git a/lib/Perl/Critic/Policy/ValuesAndExpressions/PreventSQLInjection.pm b/lib/Perl/Critic/Policy/ValuesAndExpressions/PreventSQLInjection.pm index 0199ed0..d9c1cdf 100644 --- a/lib/Perl/Critic/Policy/ValuesAndExpressions/PreventSQLInjection.pm +++ b/lib/Perl/Critic/Policy/ValuesAndExpressions/PreventSQLInjection.pm @@ -372,27 +372,18 @@ sub detect_sql_injections push( @$sql_injections, @{ analyze_string_injections( $self, $token ) || [] } ); } # If it is a concatenation operator, continue to the next token. - elsif ( $token->isa('PPI::Token::Operator') && $token->content() eq '.' ) + elsif ( $token->isa('PPI::Token::Operator') && grep { $token->content() eq $_ } qw{ . .= } ) { # Skip to the next token. } - # If it is a semicolon, we're at the end of the statement and we can finish - # the process. - elsif ( $token->isa('PPI::Token::Structure') && $token->content() eq ';' ) + # If it is other operator, finish the process. + elsif ( $token->isa('PPI::Token::Operator') ) { last; } - # If we detect a ':' operator, we're at the end of the second argument in a - # ternary "... ? ... : ..." and we need to finish the process here as the - # third argument is not concatenated to the this string and will be - # analyzed separately. - elsif ( $token->isa('PPI::Token::Operator') && $token->content() eq ':' ) - { - last; - } - # If it is a list-separating comma, this list element ends here and we can - # finish the process. - elsif ( $token->isa('PPI::Token::Operator') && $token->content() eq ',' ) + # If it is a semicolon, we're at the end of the statement and we can finish + # the process. + elsif ( $token->isa('PPI::Token::Structure') && $token->content() eq ';' ) { last; }