Skip to content

Commit d3675a5

Browse files
committed
used reflection property $name
1 parent 8079531 commit d3675a5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/PhpGenerator/Factory.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ public function fromClassReflection(\ReflectionClass $from): ClassType
3838

3939
$class->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
4040
if ($from->getParentClass()) {
41-
$class->setExtends($from->getParentClass()->getName());
41+
$class->setExtends($from->getParentClass()->name);
4242
$class->setImplements(array_diff($class->getImplements(), $from->getParentClass()->getInterfaceNames()));
4343
}
4444
$props = $methods = $consts = [];
4545
foreach ($from->getProperties() as $prop) {
46-
if ($prop->isDefault() && $prop->getDeclaringClass()->getName() === $from->getName()) {
46+
if ($prop->isDefault() && $prop->getDeclaringClass()->name === $from->name) {
4747
$props[] = $this->fromPropertyReflection($prop);
4848
}
4949
}
5050
$class->setProperties($props);
5151
foreach ($from->getMethods() as $method) {
52-
if ($method->getDeclaringClass()->getName() === $from->getName()) {
52+
if ($method->getDeclaringClass()->name === $from->name) {
5353
$methods[] = $this->fromMethodReflection($method);
5454
}
5555
}
@@ -68,7 +68,7 @@ public function fromClassReflection(\ReflectionClass $from): ClassType
6868

6969
public function fromMethodReflection(\ReflectionMethod $from): Method
7070
{
71-
$method = new Method($from->getName());
71+
$method = new Method($from->name);
7272
$method->setParameters(array_map([$this, 'fromParameterReflection'], $from->getParameters()));
7373
$method->setStatic($from->isStatic());
7474
$isInterface = $from->getDeclaringClass()->isInterface();
@@ -93,7 +93,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
9393
/** @return GlobalFunction|Closure */
9494
public function fromFunctionReflection(\ReflectionFunction $from)
9595
{
96-
$function = $from->isClosure() ? new Closure : new GlobalFunction($from->getName());
96+
$function = $from->isClosure() ? new Closure : new GlobalFunction($from->name);
9797
$function->setParameters(array_map([$this, 'fromParameterReflection'], $from->getParameters()));
9898
$function->setReturnReference($from->returnsReference());
9999
$function->setVariadic($from->isVariadic());
@@ -120,7 +120,7 @@ public function fromCallable(callable $from)
120120

121121
public function fromParameterReflection(\ReflectionParameter $from): Parameter
122122
{
123-
$param = new Parameter($from->getName());
123+
$param = new Parameter($from->name);
124124
$param->setReference($from->isPassedByReference());
125125
$param->setType($from->getType() instanceof \ReflectionNamedType ? $from->getType()->getName() : null);
126126
$param->setNullable($from->hasType() && $from->getType()->allowsNull());
@@ -150,7 +150,7 @@ public function fromConstantReflection(\ReflectionClassConstant $from): Constant
150150
public function fromPropertyReflection(\ReflectionProperty $from): Property
151151
{
152152
$defaults = $from->getDeclaringClass()->getDefaultProperties();
153-
$prop = new Property($from->getName());
153+
$prop = new Property($from->name);
154154
$prop->setValue($defaults[$prop->getName()] ?? null);
155155
$prop->setStatic($from->isStatic());
156156
$prop->setVisibility($from->isPrivate()

0 commit comments

Comments
 (0)