Is this parameter passed by reference (denoted by &$param).
public isPassedByReference ( ) : boolean | ||
Результат | boolean |
public function formatParameter(ReflectionMethod $method, ReflectionParameter $parameter) { $code = '$' . $parameter->getName(); $text = ''; if ($parameter->isDefaultValueAvailable()) { if ($parameter->isDefaultValueConstant()) { $code .= ' = ' . $parameter->getDefaultValueConstantName(); } $code .= ' = ' . $parameter->getDefaultValueAsString(); } if ($parameter->isPassedByReference()) { $code = '&' . $code; } $doc = $this->getMethodDocBlock($method); $paramTags = $doc->getTagsByName('param'); $type = 'mixed'; /** @var \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $paramTag */ foreach ($paramTags as $paramTag) { if ($paramTag->getVariableName() === '$' . $parameter->getName() && $paramTag->getDescription() !== '') { $text .= ' — ' . $paramTag->getDescription(); $type = $paramTag->getType(); } } return sprintf('%d. `%s` — `%s` %s', $parameter->getPosition() + 1, $code, $type, $text); }
private function assertSameParameterAttributes(\ReflectionParameter $original, ReflectionParameter $stubbed) { $this->assertSame($original->getName(), $stubbed->getName()); $this->assertSame($original->isArray(), $stubbed->isArray()); $this->assertSame($original->isCallable(), $stubbed->isCallable()); //$this->assertSame($original->allowsNull(), $stubbed->allowsNull()); @TODO WTF? $this->assertSame($original->canBePassedByValue(), $stubbed->canBePassedByValue()); $this->assertSame($original->isOptional(), $stubbed->isOptional()); $this->assertSame($original->isPassedByReference(), $stubbed->isPassedByReference()); $this->assertSame($original->isVariadic(), $stubbed->isVariadic()); if ($class = $original->getClass()) { $stubbedClass = $stubbed->getClass(); $this->assertInstanceOf(ReflectionClass::class, $stubbedClass); $this->assertSame($class->getName(), $stubbedClass->getName()); } else { $this->assertNull($stubbed->getClass()); } }
/** * {@inheritDoc} */ public function isPassedByReference() { return $this->betterReflectionParameter->isPassedByReference(); }