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