diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-24 14:13:40 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-24 14:13:40 +0200 |
commit | b3a04840b54464457298807d6609d525d68d8953 (patch) | |
tree | 408d7c8103a788cbb7c714f64649be180f54ed4d /apps/files/lib | |
parent | 77b8e1543a697dbc5fad0bdbbc6bb6c271448066 (diff) | |
download | nextcloud-server-b3a04840b54464457298807d6609d525d68d8953.tar.gz nextcloud-server-b3a04840b54464457298807d6609d525d68d8953.zip |
Add type hinting to functions
It's only reasonable to have proper type hinting here which might even help us to catch bugs.
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/helper.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index e4bfcb4e9ee..aa5a2f8c68a 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -8,6 +8,8 @@ namespace OCA\Files; +use OCP\Files\FileInfo; + /** * Helper class for manipulating file information */ @@ -58,7 +60,7 @@ class Helper * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ - public static function compareFileNames($a, $b) { + public static function compareFileNames(FileInfo $a, FileInfo $b) { $aType = $a->getType(); $bType = $b->getType(); if ($aType === 'dir' and $bType !== 'dir') { @@ -77,7 +79,7 @@ class Helper * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ - public static function compareTimestamp($a, $b) { + public static function compareTimestamp(FileInfo $a, FileInfo $b) { $aTime = $a->getMTime(); $bTime = $b->getMTime(); return $aTime - $bTime; @@ -90,7 +92,7 @@ class Helper * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ - public static function compareSize($a, $b) { + public static function compareSize(FileInfo $a, FileInfo $b) { $aSize = $a->getSize(); $bSize = $b->getSize(); return ($aSize < $bSize) ? -1 : 1; @@ -102,7 +104,7 @@ class Helper * @param \OCP\Files\FileInfo $i * @return array formatted file info */ - public static function formatFileInfo($i) { + public static function formatFileInfo(FileInfo $i) { $entry = array(); $entry['id'] = $i['fileid']; @@ -147,6 +149,7 @@ class Helper /** * Format file info for JSON * @param \OCP\Files\FileInfo[] $fileInfos file infos + * @return array */ public static function formatFileInfos($fileInfos) { $files = array(); |