@@ 17-87 (lines=71) @@ | ||
14 | /** |
|
15 | * Class Class_Method_Deprecated |
|
16 | */ |
|
17 | class Class_Method_Deprecated extends PersistentListItem implements Invocation_Warner { |
|
18 | /** |
|
19 | * Old declaration. |
|
20 | * |
|
21 | * @var object |
|
22 | */ |
|
23 | public $old_declaration; |
|
24 | /** |
|
25 | * New declaration. |
|
26 | * |
|
27 | * @var object |
|
28 | */ |
|
29 | public $new_declaration; |
|
30 | ||
31 | /** |
|
32 | * Class_Method_Deprecated constructor. |
|
33 | * |
|
34 | * @param object $old_declaration Old declaration. |
|
35 | * @param object $new_declaration New declaration. |
|
36 | */ |
|
37 | public function __construct( $old_declaration, $new_declaration ) { |
|
38 | $this->old_declaration = $old_declaration; |
|
39 | $this->new_declaration = $new_declaration; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * Return array of declaration items. |
|
44 | * |
|
45 | * @return array |
|
46 | */ |
|
47 | public function to_csv_array() { |
|
48 | return array( |
|
49 | $this->type(), |
|
50 | $this->old_declaration->path, |
|
51 | $this->old_declaration->line, |
|
52 | $this->old_declaration->display_name(), |
|
53 | ); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Returns type of issue. |
|
58 | * |
|
59 | * @return string 'method_deprecated' |
|
60 | */ |
|
61 | public function type() { |
|
62 | return 'method_deprecated'; |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Display name of issue. |
|
67 | * |
|
68 | * @return string |
|
69 | */ |
|
70 | public function display_name() { |
|
71 | return $this->old_declaration->display_name(); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * Find warnings. |
|
76 | * |
|
77 | * @param object $invocation Invocation. |
|
78 | * @param object $warnings Warnings. |
|
79 | */ |
|
80 | public function find_invocation_warnings( $invocation, $warnings ) { |
|
81 | if ( $invocation->depends_on( $this->old_declaration ) ) { |
|
82 | $warnings->add( |
|
83 | new Warning( $this->type(), $invocation->path, $invocation->line, 'Class method ' . $this->old_declaration->display_name() . ' is deprecated ' . $this->old_declaration->path . ' line ' . $this->old_declaration->line, $this->old_declaration ) |
|
84 | ); |
|
85 | } |
|
86 | } |
|
87 | } |
|
88 |
@@ 17-87 (lines=71) @@ | ||
14 | /** |
|
15 | * Class Class_Method_Moved |
|
16 | */ |
|
17 | class Class_Method_Moved extends PersistentListItem implements Invocation_Warner { |
|
18 | /** |
|
19 | * Old declaration. |
|
20 | * |
|
21 | * @var object |
|
22 | */ |
|
23 | public $old_declaration; |
|
24 | /** |
|
25 | * New declaration. |
|
26 | * |
|
27 | * @var object |
|
28 | */ |
|
29 | public $new_declaration; |
|
30 | ||
31 | /** |
|
32 | * Class_Method_Moved constructor. |
|
33 | * |
|
34 | * @param object $old_declaration Old declaration. |
|
35 | * @param object $new_declaration New declaration. |
|
36 | */ |
|
37 | public function __construct( $old_declaration, $new_declaration ) { |
|
38 | $this->old_declaration = $old_declaration; |
|
39 | $this->new_declaration = $new_declaration; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * Return array of declaration items. |
|
44 | * |
|
45 | * @return array |
|
46 | */ |
|
47 | public function to_csv_array() { |
|
48 | return array( |
|
49 | $this->type(), |
|
50 | $this->old_declaration->path, |
|
51 | $this->old_declaration->line, |
|
52 | $this->old_declaration->display_name(), |
|
53 | ); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Returns type of issue. |
|
58 | * |
|
59 | * @return string 'method_moved' |
|
60 | */ |
|
61 | public function type() { |
|
62 | return 'method_moved'; |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Display name of issue. |
|
67 | * |
|
68 | * @return string |
|
69 | */ |
|
70 | public function display_name() { |
|
71 | return $this->old_declaration->display_name(); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * Find warnings. |
|
76 | * |
|
77 | * @param object $invocation Invocation. |
|
78 | * @param object $warnings Warnings. |
|
79 | */ |
|
80 | public function find_invocation_warnings( $invocation, $warnings ) { |
|
81 | if ( $invocation->depends_on( $this->old_declaration ) ) { |
|
82 | $warnings->add( |
|
83 | 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 ) |
|
84 | ); |
|
85 | } |
|
86 | } |
|
87 | } |
|
88 |
@@ 17-88 (lines=72) @@ | ||
14 | /** |
|
15 | * Class Function_Deprecated |
|
16 | */ |
|
17 | class Function_Deprecated extends PersistentListItem implements Invocation_Warner { |
|
18 | /** |
|
19 | * Old declaration. |
|
20 | * |
|
21 | * @var object |
|
22 | */ |
|
23 | public $old_declaration; |
|
24 | ||
25 | /** |
|
26 | * New declaration. |
|
27 | * |
|
28 | * @var object |
|
29 | */ |
|
30 | public $new_declaration; |
|
31 | ||
32 | /** |
|
33 | * Function_Moved constructor. |
|
34 | * |
|
35 | * @param object $old_declaration Old declaration. |
|
36 | * @param object $new_declaration New declaration. |
|
37 | */ |
|
38 | public function __construct( $old_declaration, $new_declaration ) { |
|
39 | $this->old_declaration = $old_declaration; |
|
40 | $this->new_declaration = $new_declaration; |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * Return array of declaration items. |
|
45 | * |
|
46 | * @return array |
|
47 | */ |
|
48 | public function to_csv_array() { |
|
49 | return array( |
|
50 | $this->type(), |
|
51 | $this->old_declaration->path, |
|
52 | $this->old_declaration->line, |
|
53 | $this->old_declaration->display_name(), |
|
54 | ); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Returns type of issue discovered. |
|
59 | * |
|
60 | * @return string 'function_deprecated' |
|
61 | */ |
|
62 | public function type() { |
|
63 | return 'function_deprecated'; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Returns the display name of the issue. |
|
68 | * |
|
69 | * @return mixed |
|
70 | */ |
|
71 | public function display_name() { |
|
72 | return $this->old_declaration->display_name(); |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Find warnings. |
|
77 | * |
|
78 | * @param object $invocation Invocation. |
|
79 | * @param object $warnings Warnings. |
|
80 | */ |
|
81 | public function find_invocation_warnings( $invocation, $warnings ) { |
|
82 | if ( $invocation->depends_on( $this->old_declaration ) ) { |
|
83 | $warnings->add( |
|
84 | new Warning( $this->type(), $invocation->path, $invocation->line, 'Function ' . $this->old_declaration->display_name() . ' is deprecated ' . $this->old_declaration->path . ' line ' . $this->old_declaration->line, $this->old_declaration ) |
|
85 | ); |
|
86 | } |
|
87 | } |
|
88 | } |
|
89 |
@@ 17-88 (lines=72) @@ | ||
14 | /** |
|
15 | * Class Function_Moved |
|
16 | */ |
|
17 | class Function_Moved extends PersistentListItem implements Invocation_Warner { |
|
18 | /** |
|
19 | * Old declaration. |
|
20 | * |
|
21 | * @var object |
|
22 | */ |
|
23 | public $old_declaration; |
|
24 | ||
25 | /** |
|
26 | * New declaration. |
|
27 | * |
|
28 | * @var object |
|
29 | */ |
|
30 | public $new_declaration; |
|
31 | ||
32 | /** |
|
33 | * Function_Moved constructor. |
|
34 | * |
|
35 | * @param object $old_declaration Old declaration. |
|
36 | * @param object $new_declaration New declaration. |
|
37 | */ |
|
38 | public function __construct( $old_declaration, $new_declaration ) { |
|
39 | $this->old_declaration = $old_declaration; |
|
40 | $this->new_declaration = $new_declaration; |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * Return array of declaration items. |
|
45 | * |
|
46 | * @return array |
|
47 | */ |
|
48 | public function to_csv_array() { |
|
49 | return array( |
|
50 | $this->type(), |
|
51 | $this->old_declaration->path, |
|
52 | $this->old_declaration->line, |
|
53 | $this->old_declaration->display_name(), |
|
54 | ); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Returns type of issue discovered. |
|
59 | * |
|
60 | * @return string 'function_moved' |
|
61 | */ |
|
62 | public function type() { |
|
63 | return 'function_moved'; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Returns the display name of the issue. |
|
68 | * |
|
69 | * @return mixed |
|
70 | */ |
|
71 | public function display_name() { |
|
72 | return $this->old_declaration->display_name(); |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Find warnings. |
|
77 | * |
|
78 | * @param object $invocation Invocation. |
|
79 | * @param object $warnings Warnings. |
|
80 | */ |
|
81 | public function find_invocation_warnings( $invocation, $warnings ) { |
|
82 | if ( $invocation->depends_on( $this->old_declaration ) ) { |
|
83 | $warnings->add( |
|
84 | new Warning( $this->type(), $invocation->path, $invocation->line, 'Function ' . $this->old_declaration->display_name() . ' was moved from ' . $this->old_declaration->path . ' to ' . $this->new_declaration->path, $this->old_declaration ) |
|
85 | ); |
|
86 | } |
|
87 | } |
|
88 | } |
|
89 |