I have a symfony 5 project.
And I faced a problem with autoloading.
I use default autoloading configuration, provided by the framework.
I have class, abstract class and interface defined in the same directory under the same namespace.
The problem is, when I describe my class like:
class MyClass extends MyAbstractClass
class MyAbstractClass implements MyClassInterface
I get autoloading error:
Attempted to load class "MyClass" from namespace "App\Entities".
Did you forget a "use" statement for another namespace?
A line from logs:
Error thrown while running command "myproject:mycommand". Message: "Class 'App\Entities\MyClass' not found" ...
If I use:
class MyClass extends MyAbstractClass
or
class MyClass implements MyClassInterface
or
class MyClass extends MyAbstractClass implements MyClassInterface
then the error is gone - everything works fine.
The error appears only if I use
class MyAbstractClass implements MyClassInterface
How to resolve the issue?
I need to make that abstract class would implement an interface, so any classes that will extend the AbstractClass would be compatible with the interface.
PHP 7.4.1 (cli)