mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
add more unit tests and normalize the "__toString" methods
-> fix code style + psalm reported errors
This commit is contained in:
@@ -154,9 +154,15 @@ final class Example implements Tag, Factory\StaticMethod
|
|||||||
$content = (string) $this->content;
|
$content = (string) $this->content;
|
||||||
|
|
||||||
return $filePath
|
return $filePath
|
||||||
. ($startingLine !== '' ? ($filePath !== '' ? ' ' : '') . $startingLine : '')
|
. ($startingLine !== ''
|
||||||
. ($lineCount !== '' ? ($filePath !== '' || $startingLine !== '' ? ' ' : '') . $lineCount : '')
|
? ($filePath !== '' ? ' ' : '') . $startingLine
|
||||||
. ($content !== '' ? ($filePath !== '' || $startingLine !== '' || $lineCount !== '' ? ' ' : '') . $content : '');
|
: '')
|
||||||
|
. ($lineCount !== ''
|
||||||
|
? ($filePath !== '' || $startingLine !== '' ? ' ' : '') . $lineCount
|
||||||
|
: '')
|
||||||
|
. ($content !== ''
|
||||||
|
? ($filePath !== '' || $startingLine !== '' || $lineCount !== '' ? ' ' : '') . $content
|
||||||
|
: '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
foreach ($this->arguments as $argument) {
|
foreach ($this->arguments as $argument) {
|
||||||
$arguments[] = $argument['type'] . ' $' . $argument['name'];
|
$arguments[] = $argument['type'] . ' $' . $argument['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$argumentStr = '(' . implode(', ', $arguments) . ')';
|
$argumentStr = '(' . implode(', ', $arguments) . ')';
|
||||||
|
|
||||||
if ($this->description) {
|
if ($this->description) {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
|||||||
$variableName = '';
|
$variableName = '';
|
||||||
if ($this->variableName) {
|
if ($this->variableName) {
|
||||||
$variableName .= ($this->isReference ? '&' : '') . ($this->isVariadic ? '...' : '');
|
$variableName .= ($this->isReference ? '&' : '') . ($this->isVariadic ? '...' : '');
|
||||||
$variableName .= ($this->variableName ? '$' . $this->variableName : '');
|
$variableName .= '$' . $this->variableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = (string) $this->type;
|
$type = (string) $this->type;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ final class Property extends TagWithType implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->variableName) {
|
if ($this->variableName) {
|
||||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
$variableName = '$' . $this->variableName;
|
||||||
} else {
|
} else {
|
||||||
$variableName = '';
|
$variableName = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->variableName) {
|
if ($this->variableName) {
|
||||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
$variableName = '$' . $this->variableName;
|
||||||
} else {
|
} else {
|
||||||
$variableName = '';
|
$variableName = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->variableName) {
|
if ($this->variableName) {
|
||||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
$variableName = '$' . $this->variableName;
|
||||||
} else {
|
} else {
|
||||||
$variableName = '';
|
$variableName = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
|||||||
$lineCount = $this->lineCount !== null ? '' . $this->lineCount : '';
|
$lineCount = $this->lineCount !== null ? '' . $this->lineCount : '';
|
||||||
|
|
||||||
return $startingLine
|
return $startingLine
|
||||||
. ($lineCount !== '' ? ($startingLine !== '' ? ' ' : '') . $lineCount : '')
|
. ($lineCount !== '' ? ($startingLine || $startingLine === '0' ? ' ' : '') . $lineCount : '')
|
||||||
. ($description !== '' ? ($startingLine !== '' || $lineCount !== '' ? ' ' : '') . $description : '');
|
. ($description !== '' ? ($startingLine || $startingLine === '0' || $lineCount !== '' ? ' ' : '') . $description : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->variableName) {
|
if ($this->variableName) {
|
||||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
$variableName = '$' . $this->variableName;
|
||||||
} else {
|
} else {
|
||||||
$variableName = '';
|
$variableName = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class MethodTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testStringRepresentationIsReturnedWithoutDescription() : void
|
public function testStringRepresentationIsReturnedWithoutDescription() : void
|
||||||
{
|
{
|
||||||
$fixture = new Method('myMethod', [], null, false, new Description(''));
|
$fixture = new Method('myMethod', [], null, false, new Description(''));
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
'void myMethod()',
|
'void myMethod()',
|
||||||
|
|||||||
Reference in New Issue
Block a user