Continued:

- added more type-hints
- some methods in Diaspora returned void but integer was documented so I
  changed it to -1 to have a proper type-hint
This commit is contained in:
Roland Häder 2022-06-17 10:44:13 +02:00
parent 0c9aff8a09
commit 605e7d55b3
3 changed files with 142 additions and 112 deletions

View file

@ -48,7 +48,7 @@ class APContact
* @param string $addr Address
* @return array webfinger data
*/
private static function fetchWebfingerData(string $addr)
private static function fetchWebfingerData(string $addr): array
{
$addr_parts = explode('@', $addr);
if (count($addr_parts) != 2) {
@ -117,7 +117,7 @@ class APContact
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function getByURL(string $url, $update = null)
public static function getByURL(string $url, $update = null): array
{
if (empty($url) || Network::isUrlBlocked($url)) {
Logger::info('Domain is blocked', ['url' => $url]);
@ -527,7 +527,7 @@ class APContact
* @param string $url inbox url
* @param boolean $shared Shared Inbox
*/
private static function unarchiveInbox($url, $shared)
private static function unarchiveInbox(string $url, bool $shared)
{
if (empty($url)) {
return;

View file

@ -40,7 +40,7 @@ class FContact
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function getByURL($handle, $update = null)
public static function getByURL(string $handle, $update = null): array
{
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (!DBA::isResult($person)) {
@ -90,7 +90,7 @@ class FContact
* @param array $arr The fcontact data
* @throws \Exception
*/
public static function updateFromProbeArray($arr)
public static function updateFromProbeArray(array $arr)
{
$uriid = ItemURI::insert(['uri' => $arr['url'], 'guid' => $arr['guid']]);
@ -122,12 +122,12 @@ class FContact
* get a url (scheme://domain.tld/u/user) from a given Diaspora*
* fcontact guid
*
* @param mixed $fcontact_guid Hexadecimal string guid
* @param string $fcontact_guid Hexadecimal string guid
*
* @return string the contact url or null
* @return string|null the contact url or null
* @throws \Exception
*/
public static function getUrlByGuid($fcontact_guid)
public static function getUrlByGuid(string $fcontact_guid)
{
Logger::info('fcontact', ['guid' => $fcontact_guid]);