diff --git a/src/Contact/Avatar.php b/src/Contact/Avatar.php index 60981485e8..f43ed7b8c7 100644 --- a/src/Contact/Avatar.php +++ b/src/Contact/Avatar.php @@ -123,7 +123,7 @@ class Avatar return $fields; } - private static function getFilename(string $url) + private static function getFilename(string $url): string { $guid = Item::guidFromUri($url, parse_url($url, PHP_URL_HOST)); diff --git a/src/Content/BoundariesPager.php b/src/Content/BoundariesPager.php index 358539794c..a8b873f22a 100644 --- a/src/Content/BoundariesPager.php +++ b/src/Content/BoundariesPager.php @@ -49,7 +49,7 @@ class BoundariesPager extends Pager * @param string $last_item_id The id† of the last item in the displayed item list * @param integer $itemsPerPage An optional number of items per page to override the default value */ - public function __construct(L10n $l10n, $queryString, $first_item_id = null, $last_item_id = null, $itemsPerPage = 50) + public function __construct(L10n $l10n, string $queryString, string $first_item_id = null, string $last_item_id = null, int $itemsPerPage = 50) { parent::__construct($l10n, $queryString, $itemsPerPage); @@ -102,7 +102,7 @@ class BoundariesPager extends Pager * @return string HTML string of the pager * @throws \Exception */ - public function renderMinimal(int $itemCount) + public function renderMinimal(int $itemCount): string { $displayedItemCount = max(0, intval($itemCount)); diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 6c7e09945f..fd574889e6 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -41,7 +41,7 @@ class ContactSelector * @param boolean $disabled optional, default false * @return string */ - public static function pollInterval($current, $disabled = false) + public static function pollInterval(string $current, bool $disabled = false): string { $dis = (($disabled) ? ' disabled="disabled" ' : ''); $o = ''; @@ -84,7 +84,7 @@ class ContactSelector * @return string Server URL * @throws \Exception */ - private static function getServerURLForProfile($profile) + private static function getServerURLForProfile(string $profile): string { if (!empty(self::$server_url[$profile])) { return self::$server_url[$profile]; @@ -114,10 +114,11 @@ class ContactSelector * @param string $network network of the contact * @param string $profile optional, default empty * @param string $protocol (Optional) Protocol that is used for the transmission + * @param int $gsid ??? (@TODO) * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function networkToName($network, $profile = '', $protocol = '', $gsid = 0) + public static function networkToName(string $network, string $profile = '', string $protocol = '', int $gsid = 0): string { $nets = [ Protocol::DFRN => DI::l10n()->t('DFRN'), @@ -181,10 +182,11 @@ class ContactSelector /** * @param string $network network * @param string $profile optional, default empty + * @param int $gsid ??? (@TODO) * @return string * @throws \Exception */ - public static function networkToIcon($network, $profile = "", $gsid = 0) + public static function networkToIcon(string $network, string $profile = "", int $gsid = 0): string { $nets = [ Protocol::DFRN => 'friendica', diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 952b80e768..1088497983 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -189,7 +189,7 @@ class Conversation * @return string formatted text * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function formatActivity(array $links, $verb, $id) + public function formatActivity(array $links, string $verb, int $id): string { $this->profiler->startRecording('rendering'); $o = ''; @@ -275,7 +275,7 @@ class Conversation return $o; } - public function statusEditor(array $x = [], $notes_cid = 0, $popup = false) + public function statusEditor(array $x = [], int $notes_cid = 0, bool $popup = false): string { $user = User::getById($this->app->getLoggedInUserId(), ['uid', 'nickname', 'allow_location', 'default-location']); if (empty($user['uid'])) { @@ -414,8 +414,8 @@ class Conversation * figures out how to determine page owner and other contextual items * that are based on unique features of the calling module. * @param array $items - * @param $mode - * @param $update + * @param string $mode + * @param $update @TODO Which type? * @param bool $preview * @param string $order * @param int $uid @@ -423,7 +423,7 @@ class Conversation * @throws ImagickException * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function create(array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) + public function create(array $items, string $mode, $update, bool $preview = false, string $order = 'commented', int $uid = 0): string { $this->profiler->startRecording('rendering'); @@ -784,7 +784,7 @@ class Conversation return $o; } - private function getBlocklist() + private function getBlocklist(): array { if (!local_user()) { return []; @@ -816,7 +816,7 @@ class Conversation * * @return array items with parents and comments */ - private function addRowInformation(array $row, array $activity, array $thr_parent) + private function addRowInformation(array $row, array $activity, array $thr_parent): array { $this->profiler->startRecording('rendering'); @@ -911,7 +911,7 @@ class Conversation * @return array items with parents and comments * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode) + private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode): array { $this->profiler->startRecording('rendering'); if (count($parents) > 1) { @@ -1005,7 +1005,7 @@ class Conversation * @param bool $recursive * @return array */ - private function getItemChildren(array &$item_list, array $parent, $recursive = true) + private function getItemChildren(array &$item_list, array $parent, bool $recursive = true): array { $this->profiler->startRecording('rendering'); $children = []; @@ -1040,7 +1040,7 @@ class Conversation * @param array $items * @return array */ - private function sortItemChildren(array $items) + private function sortItemChildren(array $items): array { $this->profiler->startRecording('rendering'); $result = $items; @@ -1086,7 +1086,7 @@ class Conversation * @param array $parent A tree-like array of items * @return array */ - private function smartFlattenConversation(array $parent) + private function smartFlattenConversation(array $parent): array { $this->profiler->startRecording('rendering'); if (!isset($parent['children']) || count($parent['children']) == 0) { @@ -1142,7 +1142,7 @@ class Conversation * @return array * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - private function convSort(array $item_list, $order) + private function convSort(array $item_list, string $order): array { $this->profiler->startRecording('rendering'); $parents = []; @@ -1222,7 +1222,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrFeaturedReceived(array $a, array $b) + private function sortThrFeaturedReceived(array $a, array $b): int { if ($b['featured'] && !$a['featured']) { return 1; @@ -1240,7 +1240,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrFeaturedCommented(array $a, array $b) + private function sortThrFeaturedCommented(array $a, array $b): int { if ($b['featured'] && !$a['featured']) { return 1; @@ -1258,7 +1258,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrReceived(array $a, array $b) + private function sortThrReceived(array $a, array $b): int { return strcmp($b['received'], $a['received']); } @@ -1270,7 +1270,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrReceivedRev(array $a, array $b) + private function sortThrReceivedRev(array $a, array $b): int { return strcmp($a['received'], $b['received']); } @@ -1282,7 +1282,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrCommented(array $a, array $b) + private function sortThrCommented(array $a, array $b): int { return strcmp($b['commented'], $a['commented']); } @@ -1294,7 +1294,7 @@ class Conversation * @param array $b * @return int */ - private function sortThrCreated(array $a, array $b) + private function sortThrCreated(array $a, array $b): int { return strcmp($b['created'], $a['created']); } diff --git a/src/Model/Log/ParsedLogIterator.php b/src/Model/Log/ParsedLogIterator.php index 711391cb01..d3a5650397 100644 --- a/src/Model/Log/ParsedLogIterator.php +++ b/src/Model/Log/ParsedLogIterator.php @@ -60,7 +60,7 @@ class ParsedLogIterator implements \Iterator * @param string $filename File to open * @return $this */ - public function open(string $filename) + public function open(string $filename): ParsedLogIterator { $this->reader->open($filename); return $this; @@ -70,7 +70,7 @@ class ParsedLogIterator implements \Iterator * @param int $limit Max num of lines to read * @return $this */ - public function withLimit(int $limit) + public function withLimit(int $limit): ParsedLogIterator { $this->limit = $limit; return $this; @@ -80,7 +80,7 @@ class ParsedLogIterator implements \Iterator * @param array $filters filters per column * @return $this */ - public function withFilters(array $filters) + public function withFilters(array $filters): ParsedLogIterator { $this->filters = $filters; return $this; @@ -90,7 +90,7 @@ class ParsedLogIterator implements \Iterator * @param string $search string to search to filter lines * @return $this */ - public function withSearch(string $search) + public function withSearch(string $search): ParsedLogIterator { $this->search = $search; return $this; @@ -100,10 +100,10 @@ class ParsedLogIterator implements \Iterator * Check if parsed log line match filters. * Always match if no filters are set. * - * @param ParsedLogLine $parsedlogline - * @return bool + * @param ParsedLogLine $parsedlogline ParsedLogLine instance + * @return bool Wether the parse log line matches */ - private function filter($parsedlogline) + private function filter(ParsedLogLine $parsedlogline): bool { $match = true; foreach ($this->filters as $filter => $filtervalue) { @@ -126,7 +126,7 @@ class ParsedLogIterator implements \Iterator * @param ParsedLogLine $parsedlogline * @return bool */ - private function search($parsedlogline) + private function search(ParsedLogLine $parsedlogline): bool { if ($this->search != "") { return strstr($parsedlogline->logline, $this->search) !== false; diff --git a/src/Profile/ProfileField/Collection/ProfileFields.php b/src/Profile/ProfileField/Collection/ProfileFields.php index 0520103d76..906b690fa2 100644 --- a/src/Profile/ProfileField/Collection/ProfileFields.php +++ b/src/Profile/ProfileField/Collection/ProfileFields.php @@ -33,9 +33,9 @@ class ProfileFields extends BaseCollection /** * @param callable $callback - * @return ProfileFields + * @return ProfileFields (as an extended form of BaseCollection) */ - public function map(callable $callback): ProfileFields + public function map(callable $callback): BaseCollection { return parent::map($callback); }