This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
10
public $old_declaration;
11
public $new_declaration;
12
13
function __construct( $old_declaration, $new_declaration ) {
14
$this->old_declaration = $old_declaration;
15
$this->new_declaration = $new_declaration;
16
}
17
18
function to_csv_array() {
19
return array(
20
$this->type(),
21
$this->old_declaration->path,
22
$this->old_declaration->line,
23
$this->old_declaration->display_name(),
24
);
25
}
26
27
public function type() {
28
return 'function_missing';
29
}
30
31
public function display_name() {
32
return $this->old_declaration->display_name();
33
}
34
35
public function find_invocation_warnings( $invocation, $warnings ) {
36
if ( $invocation instanceof Function_Call ) {
37
// check if it's instantiating this missing class
38
if ( $invocation->func_name === $this->old_declaration->func_name ) {
39
$warnings->add( new Warning( $invocation->path, $invocation->line, 'Function ' . $this->old_declaration->display_name() . ' was moved from ' . $this->old_declaration->path . ' to ' . $this->new_declaration->path ) );
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.