From fb3a3ea7e667316627c7b25761796d6f2a540653 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 1 Dec 2024 22:53:53 +0000 Subject: [PATCH] Fix errors in Content namespace --- src/Content/ContactSelector.php | 3 +-- src/Content/Conversation.php | 5 +++-- src/Content/Image.php | 9 +++------ src/Content/Item.php | 13 +++++-------- src/Content/OEmbed.php | 2 ++ src/Content/Post/Entity/PostMedia.php | 2 +- src/Content/Text/BBCode.php | 7 +------ src/Content/Text/HTML.php | 2 +- 8 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 4e75ea34d1..1bd891a844 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -106,10 +106,9 @@ class ContactSelector * Determines network name * * @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 Server id - * @return string + * * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function networkToName(string $network, string $protocol = '', int $gsid = null): string diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index f765e39e31..bef3603809 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -41,6 +41,7 @@ use Friendica\Util\DateTimeFormat; use Friendica\Util\Profiler; use Friendica\Util\Strings; use Friendica\Util\Temporal; +use ImagickException; use Psr\Log\LoggerInterface; class Conversation @@ -112,7 +113,7 @@ class Conversation * @param array &$conv_responses (already created with builtin activity structure) * @return void * @throws ImagickException - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public function builtinActivityPuller(array $activity, array &$conv_responses) { @@ -598,7 +599,7 @@ class Conversation * @param string $formSecurityToken A 'contact_action' form security token * @return array * @throws InternalServerErrorException - * @throws \ImagickException + * @throws ImagickException */ public function getThreadList(array $items, string $mode, bool $preview, bool $pagedrop, string $formSecurityToken): array { diff --git a/src/Content/Image.php b/src/Content/Image.php index 8b84ad4512..4e5d025ad8 100644 --- a/src/Content/Image.php +++ b/src/Content/Image.php @@ -11,6 +11,7 @@ use Friendica\Content\Image\Collection\MasonryImageRow; use Friendica\Content\Image\Entity\MasonryImage; use Friendica\Content\Post\Collection\PostMedias; use Friendica\Core\Renderer; +use Friendica\Network\HTTPException\ServiceUnavailableException; class Image { @@ -42,9 +43,7 @@ class Image } /** - * @param PostMedias $images - * @return string - * @throws \Friendica\Network\HTTPException\ServiceUnavailableException + * @throws ServiceUnavailableException */ private static function getImageGridHtml(PostMedias $images): string { @@ -70,9 +69,7 @@ class Image * For each row, we calculate how much of the total width each picture will take depending on their aspect ratio * and how much relative height it needs to accomodate all pictures next to each other with their height normalized. * - * @param array $images - * @return string - * @throws \Friendica\Network\HTTPException\ServiceUnavailableException + * @throws ServiceUnavailableException */ private static function getHorizontalMasonryHtml(PostMedias $images): string { diff --git a/src/Content/Item.php b/src/Content/Item.php index 66a3328b04..7343c06aff 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -32,6 +32,7 @@ use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; use Friendica\Network\HTTPException; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Object\EMail\ItemCCEMail; use Friendica\Protocol\Activity; use Friendica\Util\ACLFormatter; @@ -42,6 +43,7 @@ use Friendica\Util\Profiler; use Friendica\Util\Proxy; use Friendica\Util\XML; use GuzzleHttp\Psr7\Uri; +use ImagickException; /** * A content helper class for displaying items @@ -174,8 +176,8 @@ class Item * @param string $network The network of the post * * @return array|bool ['replaced' => $replaced, 'contact' => $contact] or "false" on if already replaced - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @throws \ImagickException + * @throws InternalServerErrorException + * @throws ImagickException */ public static function replaceTag(string &$body, int $profile_uid, string $tag, string $network = '') { @@ -275,7 +277,7 @@ class Item * @param array $item * @return void * @throws ImagickException - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public function localize(array &$item) { @@ -645,11 +647,6 @@ class Item /** * Add a share block for the given guid - * - * @param string $guid - * @param integer $uid - * @param bool $add_media - * @return string */ private function createSharedPostByGuid(string $guid, bool $add_media): string { diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index e5841ea22e..599d3dc8f7 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -8,6 +8,7 @@ namespace Friendica\Content; use DOMDocument; +use DOMElement; use DOMXPath; use Exception; use Friendica\Content\Text\BBCode; @@ -83,6 +84,7 @@ class OEmbed $xpath->query("//link[@type='application/json+oembed'] | //link[@type='text/json+oembed']") as $link) { + /** @var DOMElement $link */ $href = $link->getAttributeNode('href')->nodeValue; // Both Youtube and Vimeo output OEmbed endpoint URL with HTTP // but their OEmbed endpoint is only accessible by HTTPS ¯\_(ツ)_/¯ diff --git a/src/Content/Post/Entity/PostMedia.php b/src/Content/Post/Entity/PostMedia.php index 0dd3309176..0dbbc54d2e 100644 --- a/src/Content/Post/Entity/PostMedia.php +++ b/src/Content/Post/Entity/PostMedia.php @@ -165,7 +165,7 @@ class PostMedia extends BaseEntity * Get preview path for given media id relative to the base URL * * @param string $size One of the Proxy::SIZE_* constants - * @param bool $vlurred If "true", the preview will be blurred + * @param bool $blurred If "true", the preview will be blurred * @return string preview link */ public function getPreviewPath(string $size = '', bool $blurred = false): string diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index bcac088e7e..900032c33e 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -824,11 +824,6 @@ class BBCode /** * Convert complex IMG and ZMG elements - * - * @param [type] $text - * @param integer $simplehtml - * @param integer $uriid - * @return string */ private static function convertImages(string $text, int $simplehtml, int $uriid = 0): string { @@ -1113,7 +1108,7 @@ class BBCode /** * Removes links * - * @param string $text HTML/BBCode string + * @param string $bbcode HTML/BBCode string * @return string Cleaned HTML/BBCode */ public static function removeLinks(string $bbcode): string diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 57b3cc1def..ba992e4a8f 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -966,7 +966,7 @@ class HTML $text = $HTMLPurifier->purify($text); - /** @var \HTMLPurifier_ErrorCollector $errorCollector */ + ///** @var \HTMLPurifier_ErrorCollector $errorCollector */ // Uncomment to debug HTML Purifier behavior //$errorCollector = $HTMLPurifier->context->get('ErrorCollector'); //var_dump($errorCollector->getRaw());