Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class Email
/**
* Properties from the last successful send.
*
* @var array|null
* @var array<string, mixed>|null
*/
public $archive;

/**
* Properties to be added to the next archive.
*
* @var array
* @var array<string, list<string>|string>
*/
protected $tmpArchive = [];

Expand Down Expand Up @@ -298,7 +298,7 @@ class Email
*
* @see Email::printDebugger()
*
* @var array
* @var list<string>
*/
protected $debugMessage = [];

Expand All @@ -312,35 +312,42 @@ class Email
/**
* Recipients
*
* @var array|string
* @var list<string>
*/
protected $recipients = [];

/**
* CC Recipients
*
* @var array
* @var list<string>
*/
protected $CCArray = [];

/**
* BCC Recipients
*
* @var array
* @var list<string>
*/
protected $BCCArray = [];

/**
* Message headers
*
* @var array
* @var array<string, string>
*/
protected $headers = [];

/**
* Attachment data
*
* @var array
* @var list<array{
* name: array{0: string, 1: string|null},
* disposition: string,
* type: string,
* content: string,
* multipart: 'mixed'|'related',
* cid?: string,
* }>
*/
protected $attachments = [];

Expand Down Expand Up @@ -405,7 +412,7 @@ class Email
protected static $func_overload;

/**
* @param array|\Config\Email|null $config
* @param array<string, mixed>|\Config\Email|null $config
*/
public function __construct($config = null)
{
Expand All @@ -419,7 +426,7 @@ public function __construct($config = null)
/**
* Initialize preferences
*
* @param array|\Config\Email|null $config
* @param array<string, mixed>|\Config\Email|null $config
*
* @return $this
*/
Expand Down Expand Up @@ -554,7 +561,7 @@ public function setReplyTo($replyto, $name = '')
}

/**
* @param array|string $to
* @param list<string>|string $to
*
* @return $this
*/
Expand Down Expand Up @@ -933,7 +940,7 @@ protected function getMimeMessage()
}

/**
* @param array|string $email
* @param list<string>|string $email
*
* @return bool
*/
Expand Down Expand Up @@ -972,9 +979,9 @@ public function isValidEmail($email)
}

/**
* @param array|string $email
* @param list<string>|string $email
*
* @return array|string
* @return ($email is array ? list<string> : string)
*/
public function cleanEmail($email)
{
Expand Down Expand Up @@ -2121,8 +2128,8 @@ protected function getHostname()
}

/**
* @param array|string $include List of raw data chunks to include in the output
* Valid options are: 'headers', 'subject', 'body'
* @param list<string>|string $include List of raw data chunks to include in the output
* Valid options are: 'headers', 'subject', 'body'
*
* @return string
*/
Expand Down Expand Up @@ -2229,7 +2236,7 @@ protected static function substr($str, $start, $length = null)
/**
* Determines the values that should be stored in $archive.
*
* @return array The updated archive values
* @return array<string, mixed> The updated archive values
*/
protected function setArchiveValues(): array
{
Expand Down
3 changes: 3 additions & 0 deletions tests/system/Email/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public function testEmailSendWithClearance($autoClear): void
}
}

/**
* @return iterable<string, list<bool>>
*/
public static function provideEmailSendWithClearance(): iterable
{
return [
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 419 errors
# total 402 errors

includes:
- argument.type.neon
Expand Down
87 changes: 1 addition & 86 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 282 errors
# total 265 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -317,86 +317,6 @@ parameters:
count: 1
path: ../../system/DataConverter/DataConverter.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:__construct\(\) has parameter \$config with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:cleanEmail\(\) has parameter \$email with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:cleanEmail\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:initialize\(\) has parameter \$config with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:printDebugger\(\) has parameter \$include with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:setArchiveValues\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:setTo\(\) has parameter \$to with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Email\\Email\:\:validateEmail\(\) has parameter \$email with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$BCCArray type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$CCArray type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$archive type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$attachments type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$debugMessage type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$headers type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$recipients type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Property CodeIgniter\\Email\\Email\:\:\$tmpArchive type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Email/Email.php

-
message: '#^Method CodeIgniter\\Encryption\\EncrypterInterface\:\:decrypt\(\) has parameter \$params with no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -982,11 +902,6 @@ parameters:
count: 1
path: ../../tests/system/Database/Live/UpdateTest.php

-
message: '#^Method CodeIgniter\\Email\\EmailTest\:\:provideEmailSendWithClearance\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
path: ../../tests/system/Email/EmailTest.php

-
message: '#^Method CodeIgniter\\Filters\\FiltersTest\:\:provideBeforeExcept\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
Expand Down
Loading