From e9387f99b18025489df760e24c5eefede62aa0ef Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 4 Oct 2022 01:49:13 +0200 Subject: [PATCH] cs --- src/PhpGenerator/Factory.php | 18 +++++++++--------- src/PhpGenerator/Printer.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/PhpGenerator/Factory.php b/src/PhpGenerator/Factory.php index 306153f7..df4eca80 100644 --- a/src/PhpGenerator/Factory.php +++ b/src/PhpGenerator/Factory.php @@ -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())); @@ -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()); @@ -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()); @@ -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); } @@ -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; } @@ -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; } @@ -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; } @@ -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; } diff --git a/src/PhpGenerator/Printer.php b/src/PhpGenerator/Printer.php index ee91969c..eb8239fc 100644 --- a/src/PhpGenerator/Printer.php +++ b/src/PhpGenerator/Printer.php @@ -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 @@ -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) @@ -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) @@ -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 @@ -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"; @@ -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"; } @@ -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() ? '' @@ -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 . ' ' : '') @@ -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' : '')