1 | <?php |
||
7 | abstract class Process implements ProcessInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var OutputInterface |
||
11 | */ |
||
12 | protected $output; |
||
13 | |||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | protected $pid; |
||
18 | |||
19 | /** |
||
20 | * Process constructor. |
||
21 | * @param OutputInterface $output |
||
22 | */ |
||
23 | public function __construct(OutputInterface $output, $worker) |
||
29 | |||
30 | /** |
||
31 | * @return string |
||
32 | */ |
||
33 | protected function getFormattedTime() : string |
||
38 | |||
39 | /** |
||
40 | * @return int |
||
41 | */ |
||
42 | public function getPid() : int |
||
46 | } |
||
47 |
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: