fix errors in Protocoll namespace

This commit is contained in:
Art4 2024-12-06 22:55:58 +00:00
parent d9ab7efcd6
commit 99603d3d90
10 changed files with 59 additions and 54 deletions

View file

@ -52,6 +52,26 @@ use Psr\Http\Message\UriInterface;
* @property-read string $user_agent
* @property-read bool $trusted
* @property-read string|null $last_used
* @property-read string $guid
* @property-read string $addr
* @property-read UriInterface $alias
* @property-read string $nick
* @property-read string $givenName
* @property-read string $familyName
* @property-read UriInterface $photoMedium
* @property-read UriInterface $photoSmall
* @property-read UriInterface $batch
* @property-read UriInterface $notify
* @property-read UriInterface $poll
* @property-read string $subscribe
* @property-read bool $searchable
* @property-read string $pubKey
* @property-read UriInterface $baseurl
* @property-read int $gsid
* @property-read \DateTime $updated
* @property-read int $interacting_count
* @property-read int $interacted_count
* @property-read int $post_count
*/
abstract class BaseEntity extends BaseDataTransferObject
{

View file

@ -307,7 +307,6 @@ class ClientToServer
* @param integer $page Page number
* @param integer $max_id Maximum ID
* @param string $requester URL of requesting account
* @param boolean $nocache Wether to bypass caching
* @return array of posts
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException

View file

@ -29,8 +29,6 @@ class Fetch
/**
* Set the worker id for the queue entry
*
* @param array $activity
* @param int $wid
* @return void
*/
public static function setWorkerId(string $url, int $wid)
@ -45,9 +43,6 @@ class Fetch
/**
* Check if there is an assigned worker task
*
* @param array $activity
* @return bool
*/
public static function hasWorker(string $url): bool
{

View file

@ -1449,7 +1449,7 @@ class Processor
* @return int|bool New mail table row id or false on error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function postMail(array $item): bool
private static function postMail(array $item)
{
if (($item['gravity'] != Item::GRAVITY_PARENT) && !DBA::exists('mail', ['uri' => $item['thr-parent'], 'uid' => $item['uid']])) {
Logger::info('Parent not found, mail will be discarded.', ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);

View file

@ -19,7 +19,6 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Model\GServer;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Post;
@ -904,10 +903,6 @@ class Transmitter
/**
* Get a list of receivers for the provided uri-id
*
* @param array $item
* @param boolean $blindcopy
* @return array
*/
public static function getReceiversForUriId(int $uri_id, bool $blindcopy): array
{
@ -1344,8 +1339,6 @@ class Transmitter
/**
* Creates an activity array for a given URI-Id and uid
*
* @param integer $uri_id
* @param integer $uid
* @param boolean $object_mode true = Create the object, false = create the activity with the object
* @param boolean $api_mode true = used for the API
* @param boolean $announce_activity true = the announced object is the activity, false = we announce the object link
@ -1370,7 +1363,6 @@ class Transmitter
/**
* Creates an activity array for a given item id
*
* @param integer $item_id
* @param boolean $object_mode true = Create the object, false = create the activity with the object
* @param boolean $api_mode true = used for the API
* @param boolean $announce_activity true = the announced object is the activity, false = we announce the object link
@ -2509,15 +2501,14 @@ class Transmitter
* Prepends mentions (@) to $body variable
*
* @param string $body HTML code
* @param int $uriId
* @param string $authorLink Author link
* @return string HTML code with prepended mentions
*/
private static function prependMentions(string $body, int $uriid, string $authorLink): string
private static function prependMentions(string $body, int $uriId, string $authorLink): string
{
$mentions = [];
foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
foreach (Tag::getByURIId($uriId, [Tag::IMPLICIT_MENTION]) as $tag) {
$profile = Contact::getByURL($tag['url'], false, ['addr', 'contact-type', 'nick']);
if (
!empty($profile['addr'])

View file

@ -417,7 +417,7 @@ class DFRN
$t_dob = strtotime($bd);
$now = strtotime(DateTimeFormat::timezoneNow($tz));
if ($t_dob < $now) {
$bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
$bd = (int) $y + 1 . '-' . $tmp_dob . ' 00:00';
}
$birthday = DateTimeFormat::convert($bd, 'UTC', $tz, DateTimeFormat::ATOM);
}

View file

@ -29,6 +29,8 @@ use Friendica\Model\User;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Network\Probe;
use Friendica\Protocol\Delivery;
use Friendica\Util\Crypto;
@ -778,7 +780,7 @@ class Diaspora
* @param WebFingerUri $uri The handle
*
* @return string The public key
* @throws InternalServerErrorException
* @throws NotFoundException
* @throws \ImagickException
*/
private static function key(WebFingerUri $uri): string
@ -786,7 +788,7 @@ class Diaspora
Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr()]);
try {
return DI::dsprContact()->getByAddr($uri)->pubKey;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
} catch (NotFoundException | \InvalidArgumentException $e) {
return '';
}
}
@ -813,7 +815,7 @@ class Diaspora
* @param string $url profile url or WebFinger address
* @param boolean|null $update true = always update, false = never update, null = update when not found or outdated
* @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws InternalServerErrorException
* @throws \ImagickException
*/
public static function isSupportedByContactUrl(string $url, ?bool $update = null): bool
@ -2913,14 +2915,13 @@ class Diaspora
/**
* Transmit a message to a target server
*
* @param array $owner the array of the item owner
* @param array $contact Target of the communication
* @param string $envelope The message that is to be transmitted
* @param bool $public_batch Is it a public post?
* @param string $guid message guid
*
* @return int Result of the transmission
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws InternalServerErrorException
* @throws \ImagickException
*/
private static function transmit(array $contact, string $envelope, bool $public_batch, string $guid = ''): int
@ -3222,7 +3223,7 @@ class Diaspora
/**
* Create an event array
*
* @param integer $event_id The id of the event
* @param string $event_id The id of the event
*
* @return array with event data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException

View file

@ -10,31 +10,31 @@ namespace Friendica\Protocol\Diaspora\Entity;
use Psr\Http\Message\UriInterface;
/**
* @property-read $uriId
* @property-read $url
* @property-read $guid
* @property-read $addr
* @property-read $alias
* @property-read $nick
* @property-read $name
* @property-read $givenName
* @property-read $familyName
* @property-read $photo
* @property-read $photoMedium
* @property-read $photoSmall
* @property-read $batch
* @property-read $notify
* @property-read $poll
* @property-read $subscribe
* @property-read $searchable
* @property-read $pubKey
* @property-read $baseurl
* @property-read $gsid
* @property-read $created
* @property-read $updated
* @property-read $interacting_count
* @property-read $interacted_count
* @property-read $post_count
* @property-read int $uriId
* @property-read UriInterface $url
* @property-read string $guid
* @property-read string $addr
* @property-read UriInterface $alias
* @property-read string $nick
* @property-read string $name
* @property-read string $givenName
* @property-read string $familyName
* @property-read UriInterface $photo
* @property-read UriInterface $photoMedium
* @property-read UriInterface $photoSmall
* @property-read UriInterface $batch
* @property-read UriInterface $notify
* @property-read UriInterface $poll
* @property-read string $subscribe
* @property-read bool $searchable
* @property-read string $pubKey
* @property-read UriInterface $baseurl
* @property-read int $gsid
* @property-read \DateTime $created
* @property-read \DateTime $updated
* @property-read int $interacting_count
* @property-read int $interacted_count
* @property-read int $post_count
*/
class DiasporaContact extends \Friendica\BaseEntity
{

View file

@ -266,7 +266,7 @@ class DiasporaContact extends BaseRepository
/**
* get a url (scheme://domain.tld/u/user) from a given contact guid
*
* @param mixed $guid Hexadecimal string guid
* @param string $guid Hexadecimal string guid
*
* @return string the contact url or null
* @throws \Exception

View file

@ -14,7 +14,7 @@ use Friendica\Content\Text\HTML;
use Friendica\Core\Protocol;
use Friendica\Model\Item;
use Friendica\Util\Strings;
use \IMAP\Connection;
use IMAP\Connection;
/**
* Email class
@ -25,7 +25,7 @@ class Email
* @param string $mailbox The mailbox name
* @param string $username The username
* @param string $password The password
* @return Connection|false
* @return Connection|resource|false
* @throws \Exception
*/
public static function connect(string $mailbox, string $username, string $password)
@ -55,7 +55,6 @@ class Email
/**
* @param Connection|resource $mbox mailbox
* @param string $email_addr email
* @return array
* @throws \Exception
*/
public static function poll($mbox, string $email_addr): array