Skip to content

Commit 50fc3b9

Browse files
committed
Add has return by reference for function and methods
1 parent 9f030b8 commit 50fc3b9

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

src/phpDocumentor/Reflection/Php/Factory/Function_.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ protected function doCreate(
5454
$object->fqsen,
5555
$this->createDocBlock($object->getDocComment(), $context->getTypeContext()),
5656
new Location($object->getLine()),
57-
(new Type())->fromPhpParser($object->getReturnType())
57+
(new Type())->fromPhpParser($object->getReturnType()),
58+
$object->byRef
5859
);
5960

6061
$file->addFunction($function);

src/phpDocumentor/Reflection/Php/Factory/Method.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ protected function doCreate(
6767
$object->isStatic(),
6868
$object->isFinal(),
6969
new Location($object->getLine()),
70-
(new Type())->fromPhpParser($object->getReturnType())
70+
(new Type())->fromPhpParser($object->getReturnType()),
71+
$object->byRef
7172
);
7273
$methodContainer->addMethod($method);
7374

src/phpDocumentor/Reflection/Php/Function_.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,18 @@ final class Function_ implements Element, MetaDataContainerInterface
4545
/** @var Type */
4646
private $returnType;
4747

48+
/** @var bool */
49+
private $hasReturnByReference;
50+
4851
/**
4952
* Initializes the object.
5053
*/
5154
public function __construct(
5255
Fqsen $fqsen,
5356
?DocBlock $docBlock = null,
5457
?Location $location = null,
55-
?Type $returnType = null
58+
?Type $returnType = null,
59+
bool $hasReturnByReference = null
5660
) {
5761
if ($location === null) {
5862
$location = new Location(-1);
@@ -62,10 +66,11 @@ public function __construct(
6266
$returnType = new Mixed_();
6367
}
6468

65-
$this->fqsen = $fqsen;
66-
$this->docBlock = $docBlock;
67-
$this->location = $location;
68-
$this->returnType = $returnType;
69+
$this->fqsen = $fqsen;
70+
$this->docBlock = $docBlock;
71+
$this->location = $location;
72+
$this->returnType = $returnType;
73+
$this->hasReturnByReference = $hasReturnByReference;
6974
}
7075

7176
/**
@@ -119,4 +124,9 @@ public function getReturnType(): Type
119124
{
120125
return $this->returnType;
121126
}
127+
128+
public function getHasReturnByReference(): bool
129+
{
130+
return $this->hasReturnByReference;
131+
}
122132
}

src/phpDocumentor/Reflection/Php/Method.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ final class Method implements Element, MetaDataContainerInterface
5555
/** @var Type */
5656
private $returnType;
5757

58+
/** @var bool */
59+
private $hasReturnByReference;
60+
5861
/**
5962
* Initializes the all properties.
6063
*
@@ -68,7 +71,8 @@ public function __construct(
6871
bool $static = false,
6972
bool $final = false,
7073
?Location $location = null,
71-
?Type $returnType = null
74+
?Type $returnType = null,
75+
bool $hasReturnByReference = null
7276
) {
7377
$this->fqsen = $fqsen;
7478
$this->visibility = $visibility;
@@ -86,11 +90,12 @@ public function __construct(
8690
$returnType = new Mixed_();
8791
}
8892

89-
$this->abstract = $abstract;
90-
$this->static = $static;
91-
$this->final = $final;
92-
$this->location = $location;
93-
$this->returnType = $returnType;
93+
$this->abstract = $abstract;
94+
$this->static = $static;
95+
$this->final = $final;
96+
$this->location = $location;
97+
$this->returnType = $returnType;
98+
$this->hasReturnByReference = $hasReturnByReference;
9499
}
95100

96101
/**
@@ -185,4 +190,9 @@ public function getReturnType(): Type
185190
{
186191
return $this->returnType;
187192
}
193+
194+
public function getHasReturnByReference(): bool
195+
{
196+
return $this->hasReturnByReference;
197+
}
188198
}

0 commit comments

Comments
 (0)