Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 4, 2022
1 parent ef01c62 commit e9387f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/PhpGenerator/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function fromClassReflection(
}

$class->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
$class->setAttributes(self::getAttributes($from));
$class->setAttributes($this->getAttributes($from));
if ($from->getParentClass()) {
$class->setExtends($from->getParentClass()->name);
$class->setImplements(array_diff($class->getImplements(), $from->getParentClass()->getInterfaceNames()));
Expand Down Expand Up @@ -153,7 +153,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
$method->setReturnReference($from->returnsReference());
$method->setVariadic($from->isVariadic());
$method->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
$method->setAttributes(self::getAttributes($from));
$method->setAttributes($this->getAttributes($from));
if ($from->getReturnType() instanceof \ReflectionNamedType) {
$method->setReturnType($from->getReturnType()->getName());
$method->setReturnNullable($from->getReturnType()->allowsNull());
Expand All @@ -179,7 +179,7 @@ public function fromFunctionReflection(\ReflectionFunction $from, bool $withBody
$function->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
}

$function->setAttributes(self::getAttributes($from));
$function->setAttributes($this->getAttributes($from));
if ($from->getReturnType() instanceof \ReflectionNamedType) {
$function->setReturnType($from->getReturnType()->getName());
$function->setReturnNullable($from->getReturnType()->allowsNull());
Expand Down Expand Up @@ -207,8 +207,8 @@ public function fromCallable(callable $from)
{
$ref = Nette\Utils\Callback::toReflection($from);
return $ref instanceof \ReflectionMethod
? self::fromMethodReflection($ref)
: self::fromFunctionReflection($ref);
? $this->fromMethodReflection($ref)
: $this->fromFunctionReflection($ref);
}


Expand Down Expand Up @@ -245,7 +245,7 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
$param->setNullable($param->isNullable() && $param->getDefaultValue() !== null);
}

$param->setAttributes(self::getAttributes($from));
$param->setAttributes($this->getAttributes($from));
return $param;
}

Expand All @@ -257,7 +257,7 @@ public function fromConstantReflection(\ReflectionClassConstant $from): Constant
$const->setVisibility($this->getVisibility($from));
$const->setFinal(PHP_VERSION_ID >= 80100 ? $from->isFinal() : false);
$const->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
$const->setAttributes(self::getAttributes($from));
$const->setAttributes($this->getAttributes($from));
return $const;
}

Expand All @@ -267,7 +267,7 @@ public function fromCaseReflection(\ReflectionClassConstant $from): EnumCase
$const = new EnumCase($from->name);
$const->setValue($from->getValue()->value ?? null);
$const->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
$const->setAttributes(self::getAttributes($from));
$const->setAttributes($this->getAttributes($from));
return $const;
}

Expand Down Expand Up @@ -297,7 +297,7 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property
}

$prop->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
$prop->setAttributes(self::getAttributes($from));
$prop->setAttributes($this->getAttributes($from));
return $prop;
}

Expand Down
18 changes: 9 additions & 9 deletions src/PhpGenerator/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function printFunction(GlobalFunction $function, ?PhpNamespace $namespace
$body = Helpers::simplifyTaggedNames($function->getBody(), $this->namespace);

return Helpers::formatDocComment($function->getComment() . "\n")
. self::printAttributes($function->getAttributes())
. $this->printAttributes($function->getAttributes())
. $line
. $this->printParameters($function, strlen($line) + strlen($returnType) + 2) // 2 = parentheses
. $returnType
Expand All @@ -82,7 +82,7 @@ public function printClosure(Closure $closure, ?PhpNamespace $namespace = null):
: $tmp;
$body = Helpers::simplifyTaggedNames($closure->getBody(), $this->namespace);

return self::printAttributes($closure->getAttributes(), true)
return $this->printAttributes($closure->getAttributes(), true)
. 'function '
. ($closure->getReturnReference() ? '&' : '')
. $this->printParameters($closure)
Expand All @@ -103,7 +103,7 @@ public function printArrowFunction(Closure $closure, ?PhpNamespace $namespace =

$body = Helpers::simplifyTaggedNames($closure->getBody(), $this->namespace);

return self::printAttributes($closure->getAttributes())
return $this->printAttributes($closure->getAttributes())
. 'fn'
. ($closure->getReturnReference() ? '&' : '')
. $this->printParameters($closure)
Expand All @@ -128,7 +128,7 @@ public function printMethod(Method $method, ?PhpNamespace $namespace = null): st
$body = Helpers::simplifyTaggedNames((string) $method->getBody(), $this->namespace);

return Helpers::formatDocComment($method->getComment() . "\n")
. self::printAttributes($method->getAttributes())
. $this->printAttributes($method->getAttributes())
. $line
. $params
. $returnType
Expand Down Expand Up @@ -162,7 +162,7 @@ public function printClass(ClassType $class, ?PhpNamespace $namespace = null): s
$cases = [];
foreach ($class->getCases() as $case) {
$cases[] = Helpers::formatDocComment((string) $case->getComment())
. self::printAttributes($case->getAttributes())
. $this->printAttributes($case->getAttributes())
. 'case ' . $case->getName()
. ($case->getValue() === null ? '' : ' = ' . $this->dump($case->getValue()))
. ";\n";
Expand All @@ -179,7 +179,7 @@ public function printClass(ClassType $class, ?PhpNamespace $namespace = null): s
. 'const ' . $const->getName() . ' = ';

$consts[] = Helpers::formatDocComment((string) $const->getComment())
. self::printAttributes($const->getAttributes())
. $this->printAttributes($const->getAttributes())
. $def
. $this->dump($const->getValue(), strlen($def)) . ";\n";
}
Expand All @@ -196,7 +196,7 @@ public function printClass(ClassType $class, ?PhpNamespace $namespace = null): s
. '$' . $property->getName());

$properties[] = Helpers::formatDocComment((string) $property->getComment())
. self::printAttributes($property->getAttributes())
. $this->printAttributes($property->getAttributes())
. $def
. ($property->getValue() === null && !$property->isInitialized()
? ''
Expand All @@ -220,7 +220,7 @@ public function printClass(ClassType $class, ?PhpNamespace $namespace = null): s

return Strings::normalize(
Helpers::formatDocComment($class->getComment() . "\n")
. self::printAttributes($class->getAttributes())
. $this->printAttributes($class->getAttributes())
. ($class->isAbstract() ? 'abstract ' : '')
. ($class->isFinal() ? 'final ' : '')
. ($class->getName() ? $class->getType() . ' ' . $class->getName() . $enumType . ' ' : '')
Expand Down Expand Up @@ -317,7 +317,7 @@ protected function printParameters($function, int $column = 0): string
$promoted = $param instanceof PromotedParameter ? $param : null;
$params[] =
($promoted ? Helpers::formatDocComment((string) $promoted->getComment()) : '')
. ($attrs = self::printAttributes($param->getAttributes(), true))
. ($attrs = $this->printAttributes($param->getAttributes(), true))
. ($promoted ?
($promoted->getVisibility() ?: 'public')
. ($promoted->isReadOnly() && $type ? ' readonly' : '')
Expand Down

0 comments on commit e9387f9

Please sign in to comment.