1 | <?php |
||
7 | abstract class Declaration extends PersistentListItem { |
||
8 | public $path; |
||
9 | public $line; |
||
10 | |||
11 | function __construct( $path, $line ) { |
||
15 | |||
16 | function match( $other ) { |
||
20 | |||
21 | function partial_match( $other ) { |
||
25 | |||
26 | // a simple name, like 'method' |
||
27 | abstract function type(); |
||
28 | |||
29 | // e.g. Jetpack::get_file_url_for_environment() |
||
30 | abstract function display_name(); |
||
31 | |||
32 | // utility function |
||
33 | protected function get_params_as_string() { |
||
47 | } |
||
48 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: