Skip to content

Commit ef01c62

Browse files
pionldg
authored andcommitted
Factory: object class contains path from root namespace (#117)
1 parent 6509699 commit ef01c62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/PhpGenerator/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property
304304

305305
public function fromObject(object $obj): Literal
306306
{
307-
return new Literal('new ' . get_class($obj) . '(/* unknown */)');
307+
return new Literal('new \\' . get_class($obj) . '(/* unknown */)');
308308
}
309309

310310

tests/PhpGenerator/expected/ClassType.from.81.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[Attr(new Abc\Attr(/* unknown */))]
1+
#[Attr(new \Abc\Attr(/* unknown */))]
22
class Class11
33
{
44
final public const FOO = 10;
@@ -12,7 +12,7 @@ class Class11
1212
}
1313

1414

15-
public function bar($c = new stdClass(/* unknown */))
15+
public function bar($c = new \stdClass(/* unknown */))
1616
{
1717
}
1818
}

0 commit comments

Comments
 (0)