fix warnings for undefined tags for $lineStyle (#378)

Under PHP8, this generated warnings. If a tag is not set, it would throw a warning. Because the downstream usage of the $lineStyle can handle undefined entries, it's safe to leave them unset here.

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
zymurgic 2021-07-10 08:06:38 +01:00 committed by GitHub
parent 7f650ee925
commit 7ecf638b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18917,13 +18917,30 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$prevlinewidth = $this->GetLineWidth();
$this->SetLineWidth($hrHeight);
$lineStyle = array(
'color' => $tag['fgcolor'],
'cap' => $tag['style']['cap'],
'join' => $tag['style']['join'],
'dash' => $tag['style']['dash'],
'phase' => $tag['style']['phase'],
);
$lineStyle = array();
if (isset($tag['fgcolor'])) {
$lineStyle['color'] = $tag['fgcolor'];
}
if (isset($tag['fgcolor'])) {
$lineStyle['color'] = $tag['fgcolor'];
}
if (isset($tag['style']['cap'])) {
$lineStyle['cap'] = $tag['style']['cap'];
}
if (isset($tag['style']['join'])) {
$lineStyle['join'] = $tag['style']['join'];
}
if (isset($tag['style']['dash'])) {
$lineStyle['dash'] = $tag['style']['dash'];
}
if (isset($tag['style']['phase'])) {
$lineStyle['phase'] = $tag['style']['phase'];
}
$lineStyle = array_filter($lineStyle);