Use-statement problem (annotations)

General discussion on Zend Guard / Optimizer

Use-statement problem (annotations)

Postby lansoweb on Mon Nov 19, 2012 1:35 pm

Hi all!
Just to be sure, during the encoding process, are the use-statement removed?
I'm facing a problem with annotations after encoding my code. I have the following class:

namespace Test\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="test")
*/
class Test
{
}

After encoding i get this error:
The annotation "ORM\Entity" in xxx was never imported. Did you maybe forget to add a "use" statement for this annotation?

Following the code in Doctrine/Common/Annotations/DocParser.php to print the use-statements imported from file, it returns just the namespace. Before encoding it returns them all.

If i change the annotation to:
@Doctrine\ORM\Mapping\Entity
it works as expected.

It happens with any level of code optimization. The same happens with ionCube (sorry to bring it here, just tried).

Is there any "hidden" option to not remove the use-statements (thought code optimization=none do the trick, but no) or will i have to rewrite all my code? Any thoughts?

Thanks,
Leandro
lansoweb
 
Posts: 7
Joined: Tue Jun 01, 2010 1:47 pm

Return to Zend Guard / Optimizer

Who is online

Users browsing this forum: No registered users and 5 guests