I'm working with a code base where exceptions are occasionally generated dynamically.
Unfortunately this leads to the situation where an exception is marked as not existing, although it will exist during runtime. Is there any way to let PhpStorm know that this class exists, short of defining it? Ideally some PHPDoc extension or something would be great.
Basically the code looks like this (the warning is on the line containing the throw, since PhpStorm can't figure out that this exception is actually dynamically created on the first line):
// only allow numbers and dots
if (preg_match('#[^0-9\.]#', $amount))
throw new AmountInvalidException($this->t['amountinvalid']);