I have an assert method that can fail or log an error when a $silent parameter is set. So my function looks like this.
/**
* @param mixed $actual
* @param string $elementName
* @param bool $silent
* @return ($actual is null ? ($silent is true ? false : never-return) : true)
* @phpstan-assert-if-true !null $actual
*/
public static function assertNotNullWithLogging(mixed $actual, string $elementName, bool $silent = false): bool
I want to use this function like this.
public function useTheMethod(): string
{
$element = $this->getElement();
$dateString = RegexUtil::getDateString($element->getText());
Assert::assertNotNullWithLogging($dateString, 'Date');
return $dateString;
}
Is never-return not supported in conditional return typ?
The method works like expected, but the static analysis is not working like expected. I did not finde any related issues or something in the PHPStan documentation.
Please link anything relating. Thanks for the help. :)