Skip to content

Commit 8cae063

Browse files
committed
Solve psalm issues only present in CI
Signed-off-by: George Steel <george@net-glue.co.uk>
1 parent 8351b3a commit 8cae063

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

psalm-baseline.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@
5454
<code>is_object($emailOrAddress)</code>
5555
</RedundantConditionGivenDocblockType>
5656
</file>
57-
<file src="src/ConfigProvider.php">
58-
<MixedArrayOffset occurrences="1"/>
59-
<UndefinedClass occurrences="1">
60-
<code>SmtpPluginManager</code>
61-
</UndefinedClass>
62-
</file>
6357
<file src="src/Header/AbstractAddressList.php">
6458
<DocblockTypeContradiction occurrences="1">
6559
<code>null === $this-&gt;addressList</code>

src/Header/AbstractAddressList.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
use function array_filter;
1111
use function array_map;
12+
use function assert;
1213
use function idn_to_ascii;
1314
use function implode;
15+
use function is_array;
16+
use function is_string;
1417
use function preg_match;
1518
use function preg_match_all;
1619
use function preg_replace;
@@ -146,13 +149,16 @@ public function getFieldName()
146149
*/
147150
protected function idnToAscii($domainName): string
148151
{
152+
/** @psalm-var string|false $ascii */
149153
$ascii = idn_to_ascii($domainName, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $conversionInfo);
150-
if (false !== $ascii) {
154+
if (is_string($ascii)) {
151155
return $ascii;
152156
}
153157

154158
$messages = [];
155-
$errors = (int) $conversionInfo['errors'];
159+
assert(is_array($conversionInfo));
160+
/* @psalm-var array{errors: numeric-string} $conversionInfo */
161+
$errors = (int) $conversionInfo['errors'];
156162

157163
foreach (self::IDNA_ERROR_MAP as $flag => $message) {
158164
if (($flag & $errors) === $flag) {

0 commit comments

Comments
 (0)