Skip to content

Commit

Permalink
Upgrade to Psalm 5.14
Browse files Browse the repository at this point in the history
  • Loading branch information
mstilkerich committed Aug 19, 2023
1 parent bd2abfe commit 8f5b4c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dealerdirect/phpcodesniffer-composer-installer": ">= 0.7.0",
"phpunit/phpunit": "~9",
"phpunit/phpcov": "*",
"vimeo/psalm": "~5.13.0",
"vimeo/psalm": "~5.14.0",
"psalm/plugin-phpunit": "*",
"aodto/phasher": "dev-master"
},
Expand Down
10 changes: 8 additions & 2 deletions src/Frontend/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* 'active'|'refresh_time'|'use_categories'|'readonly'|'require_always_email'|
* 'name'|'preemptive_basic_auth'|'ssl_noverify'
* @psalm-type SpecialAbookType = 'collected_recipients'|'collected_senders'|'default_addressbook'
* @psalm-type SpecialAbookMatch = array{preset: string, matchname?: string, matchurl?: string}
* @psalm-type SpecialAbookMatch = array{preset: string, matchname?: non-empty-string, matchurl?: non-empty-string}
*
* @psalm-type PresetExtraAbook = array{
* url: string,
Expand Down Expand Up @@ -272,9 +272,14 @@ public function __construct(string $configfile, LoggerInterface $logger, LoggerI
foreach (['matchname', 'matchurl'] as $matchType) {
if (isset($matchSettings[$matchType]) && is_string($matchSettings[$matchType])) {
$matchexpr = $matchSettings[$matchType];
$matchSettings2[$matchType] = Utils::replacePlaceholdersUrl($matchexpr, true);
$matchexpr = Utils::replacePlaceholdersUrl($matchexpr, true);
if (strlen($matchexpr) > 0) {
/** @psalm-var non-empty-string $matchexpr */
$matchSettings2[$matchType] = $matchexpr;
}
}
}

$this->specialAbookMatchers[$setting] = $matchSettings2;
} else {
$logger->error("Setting for $setting must include a valid preset attribute");
Expand Down Expand Up @@ -709,6 +714,7 @@ public function getSpecialAddressbooks(AddressbookManager $abMgr, Config $infra)
foreach (['matchname', 'matchurl'] as $matchType) {
$matchexpr = $matchSettings[$matchType] ?? 0;
if (is_string($matchexpr)) {
/** @psalm-var non-empty-string $matchexpr */
if (!preg_match($matchexpr, $abookCfg[substr($matchType, 5)])) {
continue 2;
}
Expand Down

0 comments on commit 8f5b4c7

Please sign in to comment.