mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47: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;
|
||||
|
||||
return $filePath
|
||||
. ($startingLine !== '' ? ($filePath !== '' ? ' ' : '') . $startingLine : '')
|
||||
. ($lineCount !== '' ? ($filePath !== '' || $startingLine !== '' ? ' ' : '') . $lineCount : '')
|
||||
. ($content !== '' ? ($filePath !== '' || $startingLine !== '' || $lineCount !== '' ? ' ' : '') . $content : '');
|
||||
. ($startingLine !== ''
|
||||
? ($filePath !== '' ? ' ' : '') . $startingLine
|
||||
: '')
|
||||
. ($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) {
|
||||
$arguments[] = $argument['type'] . ' $' . $argument['name'];
|
||||
}
|
||||
|
||||
$argumentStr = '(' . implode(', ', $arguments) . ')';
|
||||
|
||||
if ($this->description) {
|
||||
|
||||
@@ -149,7 +149,7 @@ final class Param extends TagWithType implements Factory\StaticMethod
|
||||
$variableName = '';
|
||||
if ($this->variableName) {
|
||||
$variableName .= ($this->isReference ? '&' : '') . ($this->isVariadic ? '...' : '');
|
||||
$variableName .= ($this->variableName ? '$' . $this->variableName : '');
|
||||
$variableName .= '$' . $this->variableName;
|
||||
}
|
||||
|
||||
$type = (string) $this->type;
|
||||
|
||||
@@ -105,7 +105,7 @@ final class Property extends TagWithType implements Factory\StaticMethod
|
||||
}
|
||||
|
||||
if ($this->variableName) {
|
||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
||||
$variableName = '$' . $this->variableName;
|
||||
} else {
|
||||
$variableName = '';
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod
|
||||
}
|
||||
|
||||
if ($this->variableName) {
|
||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
||||
$variableName = '$' . $this->variableName;
|
||||
} else {
|
||||
$variableName = '';
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod
|
||||
}
|
||||
|
||||
if ($this->variableName) {
|
||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
||||
$variableName = '$' . $this->variableName;
|
||||
} else {
|
||||
$variableName = '';
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
||||
$lineCount = $this->lineCount !== null ? '' . $this->lineCount : '';
|
||||
|
||||
return $startingLine
|
||||
. ($lineCount !== '' ? ($startingLine !== '' ? ' ' : '') . $lineCount : '')
|
||||
. ($description !== '' ? ($startingLine !== '' || $lineCount !== '' ? ' ' : '') . $description : '');
|
||||
. ($lineCount !== '' ? ($startingLine || $startingLine === '0' ? ' ' : '') . $lineCount : '')
|
||||
. ($description !== '' ? ($startingLine || $startingLine === '0' || $lineCount !== '' ? ' ' : '') . $description : '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod
|
||||
}
|
||||
|
||||
if ($this->variableName) {
|
||||
$variableName = ($this->variableName ? '$' . $this->variableName : '');
|
||||
$variableName = '$' . $this->variableName;
|
||||
} else {
|
||||
$variableName = '';
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class MethodTest extends TestCase
|
||||
*/
|
||||
public function testStringRepresentationIsReturnedWithoutDescription() : void
|
||||
{
|
||||
$fixture = new Method('myMethod', [], null, false, new Description(''));
|
||||
$fixture = new Method('myMethod', [], null, false, new Description(''));
|
||||
|
||||
$this->assertSame(
|
||||
'void myMethod()',
|
||||
|
||||
Reference in New Issue
Block a user