1 | <?php |
||
5 | trait IncrementsPath |
||
6 | { |
||
7 | /** |
||
8 | * @param $filePath |
||
9 | * @return string |
||
10 | */ |
||
11 | 30 | private function getIncrementedPath($filePath) |
|
23 | |||
24 | /** |
||
25 | * @param $filePath |
||
26 | * @return bool |
||
27 | */ |
||
28 | 30 | private function fileExists($filePath) |
|
35 | |||
36 | /** |
||
37 | * @param $originalFilePath |
||
38 | * @param $increment |
||
39 | * @return null|string|string[] |
||
40 | */ |
||
41 | 30 | private function incrementPath($originalFilePath, $increment) |
|
49 | |||
50 | /** |
||
51 | * @param $filePath |
||
52 | * @return bool|int |
||
53 | */ |
||
54 | 30 | private function pathHasExtension($filePath) |
|
58 | } |
||
59 |
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: