Skip to content

Commit 163c5e9

Browse files
committed
improved phpDoc
1 parent 290bbb7 commit 163c5e9

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

src/PhpGenerator/Extractor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ private function addEnumCaseToClass(EnumType $class, Node\Stmt\EnumCase $node):
357357
}
358358

359359

360-
private function addCommentAndAttributes($element, Node $node): void
360+
private function addCommentAndAttributes(
361+
PhpFile|ClassLike|Constant|Property|GlobalFunction|Method|Parameter|EnumCase|TraitUse $element,
362+
Node $node,
363+
): void
361364
{
362365
if ($node->getDocComment()) {
363366
$comment = $node->getDocComment()->getReformattedText();

src/PhpGenerator/Parameter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function setType(?string $type): static
5252
}
5353

5454

55+
/** @return ($asObject is true ? ?Type : ?string) */
5556
public function getType(bool $asObject = false): Type|string|null
5657
{
5758
return $asObject && $this->type

src/PhpGenerator/PhpFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getNamespaces(): array
9797
}
9898

9999

100-
/** @return ClassLike[] */
100+
/** @return (ClassType|InterfaceType|TraitType|EnumType)[] */
101101
public function getClasses(): array
102102
{
103103
$classes = [];

src/PhpGenerator/PhpNamespace.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ final class PhpNamespace
5050
self::NameConstant => [],
5151
];
5252

53-
/** @var ClassLike[] */
53+
/** @var (ClassType|InterfaceType|TraitType|EnumType)[] */
5454
private array $classes = [];
5555

5656
/** @var GlobalFunction[] */
@@ -253,7 +253,7 @@ public function simplifyName(string $name, string $of = self::NameNormal): strin
253253
}
254254

255255

256-
public function add(ClassLike $class): static
256+
public function add(ClassType|InterfaceType|TraitType|EnumType $class): static
257257
{
258258
$name = $class->getName();
259259
if ($name === null) {
@@ -327,7 +327,7 @@ public function removeFunction(string $name): static
327327
}
328328

329329

330-
/** @return ClassLike[] */
330+
/** @return (ClassType|InterfaceType|TraitType|EnumType)[] */
331331
public function getClasses(): array
332332
{
333333
$res = [];

src/PhpGenerator/Property.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function setType(?string $type): static
6868
}
6969

7070

71+
/** @return ($asObject is true ? ?Type : ?string) */
7172
public function getType(bool $asObject = false): Type|string|null
7273
{
7374
return $asObject && $this->type

src/PhpGenerator/Traits/FunctionLike.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function setReturnType(?string $type): static
141141
}
142142

143143

144+
/** @return ($asObject is true ? ?Type : ?string) */
144145
public function getReturnType(bool $asObject = false): Type|string|null
145146
{
146147
return $asObject && $this->returnType

0 commit comments

Comments
 (0)