Skip to content

Commit 98681d3

Browse files
committed
cs
1 parent a73c124 commit 98681d3

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/PhpGenerator/Factory.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function fromClassReflection(
7070
}
7171

7272
$class->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
73-
$class->setAttributes(self::getAttributes($from));
73+
$class->setAttributes($this->getAttributes($from));
7474
if ($from->getParentClass()) {
7575
$class->setExtends($from->getParentClass()->name);
7676
$class->setImplements(array_diff($class->getImplements(), $from->getParentClass()->getInterfaceNames()));
@@ -160,7 +160,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
160160
$method->setReturnReference($from->returnsReference());
161161
$method->setVariadic($from->isVariadic());
162162
$method->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
163-
$method->setAttributes(self::getAttributes($from));
163+
$method->setAttributes($this->getAttributes($from));
164164
$method->setReturnType((string) $from->getReturnType());
165165

166166
return $method;
@@ -177,7 +177,7 @@ public function fromFunctionReflection(\ReflectionFunction $from, bool $withBody
177177
$function->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
178178
}
179179

180-
$function->setAttributes(self::getAttributes($from));
180+
$function->setAttributes($this->getAttributes($from));
181181
$function->setReturnType((string) $from->getReturnType());
182182

183183
if ($withBody) {
@@ -196,8 +196,8 @@ public function fromCallable(callable $from): Method|GlobalFunction|Closure
196196
{
197197
$ref = Nette\Utils\Callback::toReflection($from);
198198
return $ref instanceof \ReflectionMethod
199-
? self::fromMethodReflection($ref)
200-
: self::fromFunctionReflection($ref);
199+
? $this->fromMethodReflection($ref)
200+
: $this->fromFunctionReflection($ref);
201201
}
202202

203203

@@ -226,7 +226,7 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
226226
$param->setNullable($param->isNullable() && $param->getDefaultValue() !== null);
227227
}
228228

229-
$param->setAttributes(self::getAttributes($from));
229+
$param->setAttributes($this->getAttributes($from));
230230
return $param;
231231
}
232232

@@ -238,7 +238,7 @@ public function fromConstantReflection(\ReflectionClassConstant $from): Constant
238238
$const->setVisibility($this->getVisibility($from));
239239
$const->setFinal(PHP_VERSION_ID >= 80100 ? $from->isFinal() : false);
240240
$const->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
241-
$const->setAttributes(self::getAttributes($from));
241+
$const->setAttributes($this->getAttributes($from));
242242
return $const;
243243
}
244244

@@ -248,7 +248,7 @@ public function fromCaseReflection(\ReflectionClassConstant $from): EnumCase
248248
$const = new EnumCase($from->name);
249249
$const->setValue($from->getValue()->value ?? null);
250250
$const->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
251-
$const->setAttributes(self::getAttributes($from));
251+
$const->setAttributes($this->getAttributes($from));
252252
return $const;
253253
}
254254

@@ -265,7 +265,7 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property
265265
$prop->setInitialized($from->hasType() && array_key_exists($prop->getName(), $defaults));
266266
$prop->setReadOnly(PHP_VERSION_ID >= 80100 ? $from->isReadOnly() : false);
267267
$prop->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
268-
$prop->setAttributes(self::getAttributes($from));
268+
$prop->setAttributes($this->getAttributes($from));
269269
return $prop;
270270
}
271271

src/PhpGenerator/Printer.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function printFunction(GlobalFunction $function, ?PhpNamespace $namespace
4949
$body = ltrim(rtrim(Strings::normalize($body)) . "\n");
5050

5151
return $this->printDocComment($function)
52-
. self::printAttributes($function->getAttributes())
52+
. $this->printAttributes($function->getAttributes())
5353
. $line
5454
. $this->printParameters($function, strlen($line) + strlen($returnType) + 2) // 2 = parentheses
5555
. $returnType
@@ -72,7 +72,7 @@ public function printClosure(Closure $closure, ?PhpNamespace $namespace = null):
7272
$body = Helpers::simplifyTaggedNames($closure->getBody(), $this->namespace);
7373
$body = ltrim(rtrim(Strings::normalize($body)) . "\n");
7474

75-
return self::printAttributes($closure->getAttributes(), inline: true)
75+
return $this->printAttributes($closure->getAttributes(), inline: true)
7676
. 'function '
7777
. ($closure->getReturnReference() ? '&' : '')
7878
. $this->printParameters($closure)
@@ -93,7 +93,7 @@ public function printArrowFunction(Closure $closure, ?PhpNamespace $namespace =
9393

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

96-
return self::printAttributes($closure->getAttributes())
96+
return $this->printAttributes($closure->getAttributes())
9797
. 'fn'
9898
. ($closure->getReturnReference() ? '&' : '')
9999
. $this->printParameters($closure)
@@ -120,7 +120,7 @@ public function printMethod(Method $method, ?PhpNamespace $namespace = null, boo
120120
$braceOnNextLine = $this->bracesOnNextLine && !str_contains($params, "\n");
121121

122122
return $this->printDocComment($method)
123-
. self::printAttributes($method->getAttributes())
123+
. $this->printAttributes($method->getAttributes())
124124
. $line
125125
. $params
126126
. $returnType
@@ -159,7 +159,7 @@ public function printClass(
159159
foreach ($class->getCases() as $case) {
160160
$enumType ??= is_scalar($case->getValue()) ? get_debug_type($case->getValue()) : null;
161161
$cases[] = $this->printDocComment($case)
162-
. self::printAttributes($case->getAttributes())
162+
. $this->printAttributes($case->getAttributes())
163163
. 'case ' . $case->getName()
164164
. ($case->getValue() === null ? '' : ' = ' . $this->dump($case->getValue()))
165165
. ";\n";
@@ -174,7 +174,7 @@ public function printClass(
174174
. 'const ' . $const->getName() . ' = ';
175175

176176
$consts[] = $this->printDocComment($const)
177-
. self::printAttributes($const->getAttributes())
177+
. $this->printAttributes($const->getAttributes())
178178
. $def
179179
. $this->dump($const->getValue(), strlen($def)) . ";\n";
180180
}
@@ -205,7 +205,7 @@ public function printClass(
205205
. '$' . $property->getName());
206206

207207
$properties[] = $this->printDocComment($property)
208-
. self::printAttributes($property->getAttributes())
208+
. $this->printAttributes($property->getAttributes())
209209
. $def
210210
. ($property->getValue() === null && !$property->isInitialized()
211211
? ''
@@ -243,7 +243,7 @@ public function printClass(
243243
$line[] = $class->getName() ? null : '{';
244244

245245
return $this->printDocComment($class)
246-
. self::printAttributes($class->getAttributes())
246+
. $this->printAttributes($class->getAttributes())
247247
. implode(' ', array_filter($line))
248248
. ($class->getName() ? "\n{\n" : "\n")
249249
. ($members ? $this->indent(implode("\n", $members)) : '')
@@ -333,7 +333,7 @@ protected function printParameters(Closure|GlobalFunction|Method $function, int
333333
$promoted = $param instanceof PromotedParameter ? $param : null;
334334
$params[] =
335335
($promoted ? $this->printDocComment($promoted) : '')
336-
. ($attrs = self::printAttributes($param->getAttributes(), inline: true))
336+
. ($attrs = $this->printAttributes($param->getAttributes(), inline: true))
337337
. ($promoted ?
338338
($promoted->getVisibility() ?: 'public')
339339
. ($promoted->isReadOnly() && $type ? ' readonly' : '')

0 commit comments

Comments
 (0)