1 | <?php |
||
9 | class BaseFilesystemItem extends \SplFileInfo |
||
10 | { |
||
11 | /** @var string The path relative to the site's working directory. */ |
||
12 | protected $relativePath; |
||
13 | |||
14 | /** @var string The original raw path given to the constructor. */ |
||
15 | protected $rawPath; |
||
16 | |||
17 | /** |
||
18 | * @param string $filePath an absolute file path or a path relative to the current working directory |
||
19 | * |
||
20 | * @since 0.2.0 |
||
21 | * |
||
22 | * @throws FileNotFoundException |
||
23 | */ |
||
24 | 180 | public function __construct($filePath) |
|
40 | |||
41 | /** |
||
42 | * Whether or not this file exists on the filesystem. |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | 158 | public function exists() |
|
50 | |||
51 | /** |
||
52 | * Get the absolute path to this file. |
||
53 | * |
||
54 | * @since 0.2.0 |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 177 | public function getAbsolutePath() |
|
62 | |||
63 | /** |
||
64 | * Get the path to the parent folder of this file. |
||
65 | * |
||
66 | * @since 0.2.0 |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 1 | public function getParentFolder() |
|
74 | |||
75 | /** |
||
76 | * Get the file path to this file, relative to where it was created; likely the current working directory. |
||
77 | * |
||
78 | * @since 0.2.0 |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 150 | public function getRelativeFilePath() |
|
86 | |||
87 | /** |
||
88 | * Get the path to the parent folder this file, relative to where it was created; likely the current working directory. |
||
89 | * |
||
90 | * @since 0.2.0 |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 2 | public function getRelativeParentFolder() |
|
98 | |||
99 | /** |
||
100 | * Gets the last modified time. |
||
101 | * |
||
102 | * @return int The last modified time for the file, in a Unix timestamp |
||
103 | */ |
||
104 | 1 | public function getLastModified() |
|
108 | |||
109 | /** |
||
110 | * Get the full name of this file or folder. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | 101 | protected function getFullName() |
|
118 | |||
119 | /** |
||
120 | * Check if a file is safe to read. |
||
121 | * |
||
122 | * @throws FileNotFoundException |
||
123 | */ |
||
124 | 177 | protected function isSafeToRead() |
|
136 | |||
137 | 5 | protected function buildNotFoundException() |
|
146 | } |
||
147 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: