Skip to content

Commit 44a7a51

Browse files
pionldg
authored andcommitted
Factory: object class contains path from root namespace (#117)
1 parent 445e063 commit 44a7a51

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
@@ -272,7 +272,7 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property
272272

273273
public function fromObject(object $obj): Literal
274274
{
275-
return new Literal('new ' . $obj::class . '(/* unknown */)');
275+
return new Literal('new \\' . $obj::class . '(/* unknown */)');
276276
}
277277

278278

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)