| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::MigrateToTest2V0::Rule::ReplaceIsaOkHASHOrArrayToRefOk; |
|
2
|
4
|
|
|
4
|
|
1272
|
use strict; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
187
|
|
|
3
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
132
|
|
|
4
|
4
|
|
|
4
|
|
24
|
use parent 'App::MigrateToTest2V0::Rule'; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
28
|
|
|
5
|
4
|
|
|
4
|
|
1660
|
use PPIx::Utils qw(parse_arg_list); |
|
|
4
|
|
|
|
|
46192
|
|
|
|
4
|
|
|
|
|
1133
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub apply { |
|
8
|
14
|
|
|
14
|
0
|
54
|
my ($class, $doc) = @_; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $stmts = $doc->find(sub { |
|
11
|
339
|
|
|
339
|
|
4635
|
my (undef, $elem) = @_; |
|
12
|
339
|
|
100
|
|
|
1436
|
return $elem->isa('PPI::Statement') && $elem->first_token && $elem->first_token->content eq 'isa_ok'; |
|
13
|
14
|
|
|
|
|
91
|
}); |
|
14
|
14
|
100
|
|
|
|
300
|
return unless $stmts; |
|
15
|
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
10
|
for my $stmt (@$stmts) { |
|
17
|
4
|
|
|
|
|
12
|
my $second_arg = (parse_arg_list($stmt->first_token))[1]->[0]; |
|
18
|
4
|
50
|
|
|
|
967
|
next unless $second_arg; |
|
19
|
4
|
50
|
|
|
|
14
|
next unless $second_arg->isa('PPI::Token::Quote'); |
|
20
|
|
|
|
|
|
|
|
|
21
|
4
|
100
|
|
|
|
12
|
if ($second_arg->content =~ /HASH|ARRAY/) { |
|
22
|
2
|
|
|
|
|
20
|
$stmt->first_token->set_content('ref_ok'); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |