Php generator cuts entering backslash from extends

Notice: This thread is very old.
Rampus
Member | 39
+
0
-

Php generator cuts entering backslash from extends:

<?php
$class = new  \Nette\PhpGenerator\ClassType;
$class->setExtends('\Aaa\Bbb');
$class->setName('Test');
?>

You will get:

<?php
	class Test extends Aaa\Bbb ...
?>

version <= 2.3.5 :

<?php
	class Test extends \Aaa\Bbb ...
?>

Is it bug or feature?

greeny
Member | 405
+
+2
-

I quess its feature, since you dont have that class in any namespace, the leading backslash is not required. If you add namespace to that class, leading backslash should be there.

Rampus
Member | 39
+
0
-

greeny wrote:

I quess its feature, since you dont have that class in any namespace, the leading backslash is not required. If you add namespace to that class, leading backslash should be there.

I'm using namespace on another place.
So before 2.3.5 it's work.
After 2.3.5 i have to use this construction:

<?php
$ns= new Namespace('NameS');
$class=$ns->addClass('Test')
$class->setExtends('\Aaa\Bbb');
....
?>

Thanx for advice :)