Skip to content

Commit

Permalink
Fix various PHPDoc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Jan 25, 2024
1 parent eeac27e commit 6dac0e1
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 66 deletions.
40 changes: 0 additions & 40 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,6 @@ parameters:
count: 2
path: plugins/markasjunk/drivers/email_learn.php

-
message: "#^Access to an undefined property object\\:\\:\\$mime_id\\.$#"
count: 1
path: plugins/markasjunk/drivers/sa_detach.php

-
message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
count: 2
Expand Down Expand Up @@ -1059,31 +1054,6 @@ parameters:
count: 1
path: program/lib/Roundcube/rcube_ldap.php

-
message: "#^Access to an undefined property object\\:\\:\\$content_id\\.$#"
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Access to an undefined property object\\:\\:\\$content_location\\.$#"
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Access to an undefined property object\\:\\:\\$mime_id\\.$#"
count: 2
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Access to an undefined property object\\:\\:\\$mimetype\\.$#"
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Cannot access property \\$parts on bool\\|object\\.$#"
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Method rcube\\:\\:url\\(\\) invoked with 4 parameters, 1 required\\.$#"
count: 1
Expand All @@ -1099,11 +1069,6 @@ parameters:
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Method rcube_message\\:\\:get_part_content\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: program/lib/Roundcube/rcube_message.php

-
message: "#^Method rcube_storage\\:\\:get_message_part\\(\\) invoked with 8 parameters, 1\\-6 required\\.$#"
count: 3
Expand All @@ -1124,11 +1089,6 @@ parameters:
count: 1
path: program/lib/Roundcube/rcube_mime.php

-
message: "#^Cannot access property \\$size on object\\|true\\.$#"
count: 1
path: program/lib/Roundcube/rcube_mime_decode.php

-
message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/cache/memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct($userid, $prefix = '', $ttl = 0, $packed = true, $in
/**
* Get global handle for memcache access
*
* @return object Memcache
* @return Memcache
*/
public static function engine()
{
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/cache/memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct($userid, $prefix = '', $ttl = 0, $packed = true, $in
/**
* Get global handle for memcache access
*
* @return object Memcache
* @return Memcache
*/
public static function engine()
{
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/cache/redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($userid, $prefix = '', $ttl = 0, $packed = true, $in
/**
* Get global handle for redis access
*
* @return object Redis
* @return Redis
*/
public static function engine()
{
Expand Down
5 changes: 3 additions & 2 deletions program/lib/Roundcube/rcube_imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ public function get_message_headers($uid, $folder = null, $force = false)
* @param int $uid Message UID to fetch
* @param string $folder Folder to read from
*
* @return object rcube_message_header Message data
* @return rcube_message_header Message data
*/
public function get_message($uid, $folder = null)
{
Expand Down Expand Up @@ -2401,7 +2401,7 @@ protected function structure_charset($structure)
* @param int $max_bytes Only read this number of bytes
* @param bool $formatted Enables formatting of text/* parts bodies
*
* @return string Message/part body if not printed
* @return string|true|null Message/part body if not printed
*/
public function get_message_part($uid, $part = 1, $o_part = null, $print = null, $fp = null,
$skip_charset_conv = false, $max_bytes = 0, $formatted = true)
Expand Down Expand Up @@ -2452,6 +2452,7 @@ public function get_message_part($uid, $part = 1, $o_part = null, $print = null,
$o_part->charset = $this->default_charset;
}
}

$body = rcube_charset::convert($body, $o_part->charset);
}
}
Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ public function search($fields, $value, $mode = 0, $select = true, $nocount = fa
/**
* Count number of available contacts in database
*
* @return object rcube_result_set Resultset with values for 'count' and 'first'
* @return rcube_result_set Resultset with values for 'count' and 'first'
*/
public function count()
{
Expand Down Expand Up @@ -1070,7 +1070,7 @@ protected function extended_search($count = false)
/**
* Return the last result set
*
* @return object rcube_result_set Current resultset or NULL if nothing selected yet
* @return rcube_result_set Current resultset or NULL if nothing selected yet
*/
public function get_result()
{
Expand Down
27 changes: 18 additions & 9 deletions program/lib/Roundcube/rcube_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,23 @@ class rcube_message
public $sender;
public $context;
public $body;
public $parts = [];
public $mime_parts = [];
public $inline_parts = [];
public $attachments = [];
public $subject = '';
public $is_safe = false;
public $pgp_mime = false;
public $subject = '';
public $is_safe = false;
public $pgp_mime = false;
public $encrypted_part;

/** @var array<rcube_message_part> */
public $parts = [];

/** @var array<rcube_message_part> */
public $mime_parts = [];

/** @var array<rcube_message_part> */
public $inline_parts = [];

/** @var array<rcube_message_part> */
public $attachments = [];

public const BODY_MAX_SIZE = 1048576; // 1MB

/**
Expand Down Expand Up @@ -645,6 +653,7 @@ private function parse_structure($structure, $recursive = false)
return;
}

/** @var rcube_message_part $structure */
$structure = $plugin['structure'];
$mimetype = $plugin['mimetype'];
$recursive = $plugin['recursive'];
Expand Down Expand Up @@ -801,8 +810,7 @@ private function parse_structure($structure, $recursive = false)
// message contains multiple parts
elseif (is_array($structure->parts) && !empty($structure->parts)) {
// iterate over parts
for ($i = 0; $i < count($structure->parts); $i++) {
$mail_part = &$structure->parts[$i];
foreach ($structure->parts as $mail_part) {
$primary_type = $mail_part->ctype_primary;
$secondary_type = $mail_part->ctype_secondary;
$part_mimetype = $mail_part->mimetype;
Expand Down Expand Up @@ -890,6 +898,7 @@ private function parse_structure($structure, $recursive = false)

// add winmail.dat to the list if it's content is unknown
if (empty($tnef_parts) && !empty($mail_part->filename)) {
// @phpstan-ignore-next-line
$this->mime_parts[$mail_part->mime_id] = $mail_part;
$this->add_part($mail_part, 'attachment');
}
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/rcube_message_part.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class rcube_message_part
/**
* Sub-Parts
*
* @var array
* @var array<rcube_message_part>
*/
public $parts = [];

Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/rcube_mime.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function get_charset()
*
* @param string $raw_body The message source
*
* @return object rcube_message_part The message structure
* @return rcube_message_part The message structure
*/
public static function parse_message($raw_body)
{
Expand Down
12 changes: 6 additions & 6 deletions program/lib/Roundcube/rcube_mime_decode.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct($params = [])
* @param string $input The input to decode
* @param bool $convert Convert result to rcube_message_part structure
*
* @return object|bool Decoded results or False on failure
* @return rcube_message_part|false Decoded results or False on failure
*/
public function decode($input, $convert = true)
{
Expand Down Expand Up @@ -91,7 +91,7 @@ public function decode($input, $convert = true)
* @param string $body Body section
* @param string $default_ctype Default content type
*
* @return object|bool Decoded results or False on error
* @return rcube_message_part|false Decoded results or False on error
*/
protected function do_decode($headers, $body, $default_ctype = 'text/plain')
{
Expand Down Expand Up @@ -352,11 +352,11 @@ protected function decodeHeader($input)
* Recursive method to convert a rcube_mime_decode structure
* into a rcube_message_part object.
*
* @param object $part A message part struct
* @param int $count Part count
* @param string $parent Parent MIME ID
* @param rcube_message_part $part A message part struct
* @param int $count Part count
* @param string $parent Parent MIME ID
*
* @return object rcube_message_part
* @return rcube_message_part
*
* @see self::decode()
*/
Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube_storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ abstract public function refresh_search();
* @param int $uid Message UID to fetch
* @param string $folder Folder to read from
*
* @return object rcube_message_header Message data
* @return rcube_message_header Message data
*/
abstract public function get_message($uid, $folder = null);

Expand All @@ -464,7 +464,7 @@ abstract public function get_message_headers($uid, $folder = null, $force = fals
* @param resource $fp File pointer to save the message part
* @param bool $skip_charset_conv Disables charset conversion
*
* @return string Message/part body if not printed
* @return string|true|null Message/part body if not printed
*/
abstract public function get_message_part($uid, $part = 1, $o_part = null, $print = null, $fp = null, $skip_charset_conv = false);

Expand Down

0 comments on commit 6dac0e1

Please sign in to comment.