FYI: pitfall: closing curly bracket with comment and no CRLF

Hello all!

From time to time I’ve got a mysterious exception like

PHP Fatal error: Cannot use Doctrine\ORM\Mapping as ORM because the name is already in use

OR

Cannot use TYPO3\\Flow\\Annotations as Flow because the name is already in use

Until today I’ve solved it somehow or other. But the last two days it seems unsolvable.
Now I’ve got it:

My code looked like this:

<?php
namespace abc\def\somewhat;

class xyz {

   ....

} // end class xyz

The editor text ends WITHOUT a CRLF which causes the above errors/exceptions.
Note without that comment, all works fine!

Hope this info helps some others…

Cheers, Frank

Oh, thanks for the info, probably better as an issue, but I will open one. I guess the trick is that if we create proxy classes we append to the current code, and if there is no newline the first line of the proxy class might end up on the last line of your class. This is fine as long as there isn’t a comment obviously.

Hi Christian!

Yes, you are right: the seconde namespace statement is missing in the proxy class. It seems it is interpreted as part of the comment (at the end of my class defintion).

And before closing, FYI:

https://github.com/neos/flow-development-collection/issues/779