Skip to content

Commit

Permalink
Factory: object class contains path from root namespace (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
pionl authored and dg committed Oct 4, 2022
1 parent 6509699 commit ef01c62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PhpGenerator/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property

public function fromObject(object $obj): Literal
{
return new Literal('new ' . get_class($obj) . '(/* unknown */)');
return new Literal('new \\' . get_class($obj) . '(/* unknown */)');
}


Expand Down
4 changes: 2 additions & 2 deletions tests/PhpGenerator/expected/ClassType.from.81.expect
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[Attr(new Abc\Attr(/* unknown */))]
#[Attr(new \Abc\Attr(/* unknown */))]
class Class11
{
final public const FOO = 10;
Expand All @@ -12,7 +12,7 @@ class Class11
}


public function bar($c = new stdClass(/* unknown */))
public function bar($c = new \stdClass(/* unknown */))
{
}
}

0 comments on commit ef01c62

Please sign in to comment.