Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Cannot declare class because the name is already in use

Hello, After a certain merge I started getting the error:

Cannot declare class App\Http\Controllers\MyController because the name is already in use

When I am trying to view a page (blade file)

How can I try to fix that without using Composer commands? Is there a file I can look for that could've been declared twice accidentally during merge?

0 likes
5 replies
Ligonsker's avatar

@AungHtetPaing__ thanks, I just checked - but looks like it's ok in these files, I wonder where else it could be. Maybe somewhere in the composer files

Ligonsker's avatar

@Sinnbeck @aunghtetpaing__ 😭😭😂😂😂 Somehow, the blade file had the Controller code instead of the blade code file, I just didn't notice because I was sure I'm looking at the Controller. How did that happen lol

Please or to participate in this conversation.