add more unit tests and normalize the "__toString" methods

-> fix code style + psalm reported errors
This commit is contained in:
Lars Moelleken
2020-09-03 02:38:39 +02:00
parent 4e6d7ecd03
commit 4438ee7955
9 changed files with 18 additions and 11 deletions
+9 -3
View File
@@ -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
: '');
}
/**
+1
View File
@@ -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) {
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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 = '';
}
+1 -1
View File
@@ -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 = '';
}
+1 -1
View File
@@ -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 = '';
}
+2 -2
View File
@@ -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 : '');
}
}
+1 -1
View File
@@ -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 = '';
}