Login
Put the cheapest test ("is it a tie?") as the first thing to check
authorAndy Lester <andy@petdance.com>
Mon, 17 Jul 2006 18:08:47 +0000 (18:08 +0000)
committerAndy Lester <andy@petdance.com>
Mon, 17 Jul 2006 18:08:47 +0000 (18:08 +0000)
lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm

index 2c3d823..678097d 100644 (file)
@@ -29,15 +29,13 @@ sub applies_to { return 'PPI::Token::Word' }
 
 sub violates {
     my ( $self, $elem, $doc ) = @_;
+
+    return unless $elem eq 'tie';
     return if is_hash_key( $elem );
     return if is_method_call( $elem );
     return if is_subroutine_name($elem);
 
-    if ( $elem eq 'tie' ) { # XXX This looks like it should be the FIRST thing we check.
-        return $self->violation( $desc, $expl, $elem );
-    }
-
-    return;  #ok!
+    return $self->violation( $desc, $expl, $elem );
 }