use Statements are not getting checked for existence during the Generation step. This can create issues where you will get a fatal error During class fetch. I noticed this specifically when working with error exceptions.
namespace My\Stuff;
use Throwable;
use Phalcon\Views\Exception as ViewException // Note the misspelling
use Phalcon\Di\Injectable;
use Phalcon\Events\EventInterface;
use Phalcon\Dispatcher\DispatcherInterface;
class Listener extends Injectable
{
public function beforeException(<EventInterface> event, <DispatcherInterface> dispatcher, <Throwable> exception)
{
try {
throw exception;
} catch ViewException {
throw new \Exception("Reached");
} catch Error {
// Never Reached
}
}
}
In the psudo code above, I am referencing the wrong path for the exception (note the extra 's'). When the throw occurs in the beforeException method, it will cause the fatal error During class fetch with no other details. Normally I would not bother creating an issue for this, except that I have no warnings in the Generate step indicating that the Class doesn't exist at compile time. It took me the better part of several hours to understand what was the issue and a lot of commenting out of code sections.
use
Statements are not getting checked for existence during the Generation step. This can create issues where you will get a fatal errorDuring class fetch
. I noticed this specifically when working with error exceptions.In the psudo code above, I am referencing the wrong path for the exception (note the extra 's'). When the throw occurs in the beforeException method, it will cause the fatal error
During class fetch
with no other details. Normally I would not bother creating an issue for this, except that I have no warnings in the Generate step indicating that theClass doesn't exist at compile time
. It took me the better part of several hours to understand what was the issue and a lot of commenting out of code sections.