Every so often in my small Magento 2 experiments, I’ll hit a point where an error like this starts popping up.
Fatal error: Cannot redeclare class PulsetormHelloworldObserversBlock in /path/to/magento/app/code/Pulsestorm/Helloworld/Observers/Block.php on line 4
I’ll scratch my head for a while, wonder what’s going on, and eventually realize it’s this
i.e. I’ve mistyped a namespace name, and when the initial autoloads loads the class file, it won’t have defined the class it’s looking for, and then a second autoloader (Composer’s usually) loads it again, and tries to redefine the same incorrect class.
i.e., Magento wanted the class
but I defined
thanks to the wrong namespace.
Writing this down here so when it happens again Google will jog my memory. I’m sure you kids with you IDEs are laughing.