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="Company\App\Observer\Frontend\Controller\ActionPredispatch"/>
</event>
</config>
app/code/Company/App/Observer/Frontend/Controller/ActionPredispatch.php:
<?php
declare(strict_types=1);
namespace Company\App\Observer\Frontend\Controller;
class ActionPredispatch implements \Magento\Framework\Event\ObserverInterface
{
...
}
I tried this:
rm -rf generated/*
php bin/magento setup:di:compile
But I still get the error.
The module is enabled of course.