@@ -82,7 +82,7 @@ public function initialize()
8282 /**
8383 * {@inheritDoc}
8484 */
85- public function get (string $ key )
85+ public function get (string $ key ): mixed
8686 {
8787 $ key = static ::validateKey ($ key , $ this ->prefix );
8888 $ data = $ this ->getItem ($ key );
@@ -93,7 +93,7 @@ public function get(string $key)
9393 /**
9494 * {@inheritDoc}
9595 */
96- public function save (string $ key , $ value , int $ ttl = 60 )
96+ public function save (string $ key , $ value , int $ ttl = 60 ): bool
9797 {
9898 $ key = static ::validateKey ($ key , $ this ->prefix );
9999
@@ -122,7 +122,7 @@ public function save(string $key, $value, int $ttl = 60)
122122 /**
123123 * {@inheritDoc}
124124 */
125- public function delete (string $ key )
125+ public function delete (string $ key ): bool
126126 {
127127 $ key = static ::validateKey ($ key , $ this ->prefix );
128128
@@ -148,7 +148,7 @@ public function deleteMatching(string $pattern): int
148148 /**
149149 * {@inheritDoc}
150150 */
151- public function increment (string $ key , int $ offset = 1 )
151+ public function increment (string $ key , int $ offset = 1 ): bool | int
152152 {
153153 $ prefixedKey = static ::validateKey ($ key , $ this ->prefix );
154154 $ tmp = $ this ->getItem ($ prefixedKey );
@@ -171,36 +171,36 @@ public function increment(string $key, int $offset = 1)
171171 /**
172172 * {@inheritDoc}
173173 */
174- public function decrement (string $ key , int $ offset = 1 )
174+ public function decrement (string $ key , int $ offset = 1 ): bool | int
175175 {
176176 return $ this ->increment ($ key , -$ offset );
177177 }
178178
179179 /**
180180 * {@inheritDoc}
181181 */
182- public function clean ()
182+ public function clean (): bool
183183 {
184184 return delete_files ($ this ->path , false , true );
185185 }
186186
187187 /**
188188 * {@inheritDoc}
189189 */
190- public function getCacheInfo ()
190+ public function getCacheInfo (): array
191191 {
192192 return get_dir_file_info ($ this ->path );
193193 }
194194
195195 /**
196196 * {@inheritDoc}
197197 */
198- public function getMetaData (string $ key )
198+ public function getMetaData (string $ key ): ? array
199199 {
200200 $ key = static ::validateKey ($ key , $ this ->prefix );
201201
202202 if (false === $ data = $ this ->getItem ($ key )) {
203- return false ; // @TODO This will return null in a future release
203+ return null ;
204204 }
205205
206206 return [
@@ -224,7 +224,7 @@ public function isSupported(): bool
224224 *
225225 * @return array{data: mixed, ttl: int, time: int}|false
226226 */
227- protected function getItem (string $ filename )
227+ protected function getItem (string $ filename ): array | false
228228 {
229229 if (! is_file ($ this ->path . $ filename )) {
230230 return false ;
@@ -271,10 +271,8 @@ protected function getItem(string $filename)
271271 * @param string $path
272272 * @param string $data
273273 * @param string $mode
274- *
275- * @return bool
276274 */
277- protected function writeFile ($ path , $ data , $ mode = 'wb ' )
275+ protected function writeFile ($ path , $ data , $ mode = 'wb ' ): bool
278276 {
279277 if (($ fp = @fopen ($ path , $ mode )) === false ) {
280278 return false ;
@@ -353,7 +351,7 @@ protected function deleteFiles(string $path, bool $delDir = false, bool $htdocs
353351 * relative_path: string,
354352 * }>|false
355353 */
356- protected function getDirFileInfo (string $ sourceDir , bool $ topLevelOnly = true , bool $ _recursion = false )
354+ protected function getDirFileInfo (string $ sourceDir , bool $ topLevelOnly = true , bool $ _recursion = false ): array | false
357355 {
358356 static $ filedata = [];
359357
@@ -412,7 +410,7 @@ protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true,
412410 * fileperms?: int
413411 * }|false
414412 */
415- protected function getFileInfo (string $ file , $ returnedValues = ['name ' , 'server_path ' , 'size ' , 'date ' ])
413+ protected function getFileInfo (string $ file , $ returnedValues = ['name ' , 'server_path ' , 'size ' , 'date ' ]): array | false
416414 {
417415 if (! is_file ($ file )) {
418416 return false ;
0 commit comments