diff --git a/.project/tests/phpstan-baseline.neon b/.project/tests/phpstan-baseline.neon index 882eeb57c..5891dba20 100644 --- a/.project/tests/phpstan-baseline.neon +++ b/.project/tests/phpstan-baseline.neon @@ -2510,11 +2510,6 @@ parameters: count: 1 path: ../../Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php - - - message: "#^Cannot call method getValue\\(\\) on object\\|null\\.$#" - count: 2 - path: ../../Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php - - message: "#^Method In2code\\\\Powermail\\\\Domain\\\\Validator\\\\SpamShield\\\\ValueBlacklistMethod\\:\\:getValues\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php b/Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php index fa238e82f..3c6284727 100644 --- a/Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php +++ b/Classes/Domain/Validator/SpamShield/ValueBlacklistMethod.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace In2code\Powermail\Domain\Validator\SpamShield; +use In2code\Powermail\Domain\Model\Answer; use In2code\Powermail\Utility\ObjectUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -23,12 +24,16 @@ class ValueBlacklistMethod extends AbstractMethod */ public function spamCheck(): bool { + /** @var Answer $answer */ foreach ($this->mail->getAnswers() as $answer) { if (is_array($answer->getValue())) { continue; } + if (is_bool($answer->getValue())) { + continue; + } foreach ($this->getValues() as $blackword) { - if ($this->isStringInString($answer->getValue(), $blackword)) { + if ($this->isStringInString((string)$answer->getValue(), $blackword)) { return true; } }