I always get this error if I try to load my site, even though the class does exist.
PHP Fatal error: Uncaught Error: Class 'Company\App\Observer\Frontend\Controller\ActionPredispatch'
app/code/Company/App/etc/frontend/events.xml:
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_predispatch">
<observer name="company_app_observer_frontend_controller_actionpredispatch_controller_action_predispatch"
instance="CompanyAppObserverFrontendControllerActionPredispatch"/>
</event>
</config>
app/code/Company/App/Observer/Frontend/Controller/ActionPredispatch.php:
<?php
declare(strict_types=1);
namespace CompanyAppObserverFrontendController;
class ActionPredispatch implements MagentoFrameworkEventObserverInterface
{
...
}
I tried this:
rm -rf generated/*
php bin/magento setup:di:compile
But I still get the error.