Code Duplication    Length = 9-10 lines in 3 locations

packages/analyzer/src/Differences/Class_Const_Moved.php 1 location

@@ 31-39 (lines=9) @@
28
		return 'property_moved';
29
	}
30
31
	public function find_invocation_warnings( $invocation, $warnings ) {
32
		if ( $invocation instanceof Static_Const ) {
33
			// check if it's using this missing property
34
			if ( $invocation->class_name === $this->old_declaration->class_name
35
				&& $invocation->const_name === $this->old_declaration->const_name ) {
36
				$warnings->add( new Warning( $this->type(), $invocation->path, $invocation->line, 'Class const ' . $this->old_declaration->display_name() . ' was moved from ' . $this->old_declaration->path . ' to ' . $this->new_declaration->path, $this->old_declaration ) );
37
			}
38
		}
39
	}
40
}
41

packages/analyzer/src/Differences/Class_Method_Moved.php 1 location

@@ 35-44 (lines=10) @@
32
		return $this->old_declaration->display_name();
33
	}
34
35
	public function find_invocation_warnings( $invocation, $warnings ) {
36
		if ( $invocation instanceof Static_Call ) {
37
			// check if it's instantiating this missing class
38
			if ( $invocation->class_name === $this->old_declaration->class_name
39
				&& $invocation->method_name === $this->old_declaration->method_name
40
				&& $this->old_declaration->static ) {
41
				$warnings->add( new Warning( $this->type(), $invocation->path, $invocation->line, 'Class static method ' . $this->old_declaration->display_name() . ' was moved from ' . $this->old_declaration->path . ' to ' . $this->new_declaration->path, $this->old_declaration ) );
42
			}
43
		}
44
	}
45
}
46

packages/analyzer/src/Differences/Class_Property_Moved.php 1 location

@@ 31-40 (lines=10) @@
28
		return 'property_moved';
29
	}
30
31
	public function find_invocation_warnings( $invocation, $warnings ) {
32
		if ( $invocation instanceof Static_Property ) {
33
			// check if it's using this missing property
34
			if ( $invocation->class_name === $this->old_declaration->class_name
35
				&& $invocation->prop_name === $this->old_declaration->prop_name
36
				&& $this->old_declaration->static ) {
37
				$warnings->add( new Warning( $this->type(), $invocation->path, $invocation->line, 'Class static property ' . $this->old_declaration->display_name() . ' was moved from ' . $this->old_declaration->path . ' to ' . $this->new_declaration->path, $this->old_declaration ) );
38
			}
39
		}
40
	}
41
}
42