1 | <?php |
||
5 | abstract class Declaration { |
||
6 | public $path; |
||
7 | public $line; |
||
8 | |||
9 | function __construct( $path, $line ) { |
||
13 | |||
14 | function match( $other ) { |
||
19 | |||
20 | // a simple name, like 'method' |
||
21 | abstract function type(); |
||
22 | |||
23 | // e.g. Jetpack::get_file_url_for_environment() |
||
24 | abstract function display_name(); |
||
25 | } |
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: