Skip to content

Commit 186a3f5

Browse files
committed
improved typehints
1 parent ad8a0f5 commit 186a3f5

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

src/PhpGenerator/Factory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ public function fromCode(string $code): PhpFile
342342
}
343343

344344

345+
/** @return Attribute[] */
345346
private function getAttributes($from): array
346347
{
347348
return array_map(function ($attr) {
@@ -357,7 +358,7 @@ private function getAttributes($from): array
357358
}
358359

359360

360-
private function getVisibility($from): string
361+
private function getVisibility(\ReflectionProperty|\ReflectionMethod|\ReflectionClassConstant $from): string
361362
{
362363
return $from->isPrivate()
363364
? Visibility::Private

src/PhpGenerator/Literal.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Literal
1717
{
1818
/**
1919
* Creates a literal representing the creation of an object using the new operator.
20+
* @param mixed[] $args
2021
*/
2122
public static function new(string $class, array $args = []): self
2223
{

src/PhpGenerator/Method.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ final class Method
3131
private bool $abstract = false;
3232

3333

34+
/**
35+
* @param string|array{object|string, string}|\Closure $method
36+
*/
3437
public static function from(string|array|\Closure $method): static
3538
{
3639
return (new Factory)->fromMethodReflection(Nette\Utils\Callback::toReflection($method));

src/PhpGenerator/PropertyHook.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ public function isAbstract(): bool
7979
}
8080

8181

82-
/** @internal */
82+
/**
83+
* @param Parameter[] $val
84+
* @internal
85+
*/
8386
public function setParameters(array $val): static
8487
{
8588
(function (Parameter ...$val) {})(...$val);
@@ -92,7 +95,10 @@ public function setParameters(array $val): static
9295
}
9396

9497

95-
/** @internal */
98+
/**
99+
* @return Parameter[]
100+
* @internal
101+
*/
96102
public function getParameters(): array
97103
{
98104
return $this->parameters;

src/PhpGenerator/Traits/PropertyLike.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
trait PropertyLike
2323
{
24-
/** @var array{'set' => ?string, 'get' => ?string} */
24+
/** @var array{set: ?string, get: ?string} */
2525
private array $visibility = [PropertyAccessMode::Set => null, PropertyAccessMode::Get => null];
2626
private bool $final = false;
2727
private bool $readOnly = false;

0 commit comments

Comments
 (0)