Skip to content

Commit 7422bce

Browse files
committed
Another Php8.5 Deprecation
1 parent 6297738 commit 7422bce

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

src/PhpWord/Writer/RTF/Part/Header.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use PhpOffice\PhpWord\Style;
2525
use PhpOffice\PhpWord\Style\Font;
2626
use PhpOffice\PhpWord\Style\Numbering;
27+
use PhpOffice\PhpWord\Style\Paragraph;
2728
use PhpOffice\PhpWord\Style\Table;
2829

2930
/**
@@ -468,6 +469,9 @@ private function registerHeaderItems($style): void
468469
if ($style instanceof Numbering) {
469470
$this->registerList($this->listTable, $style, $defaultFont);
470471
}
472+
if ($style instanceof Paragraph) {
473+
$this->registerBorderColor($style);
474+
}
471475
}
472476

473477
/**

src/PhpWord/Writer/RTF/Style/Border.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,28 @@ private function writeSide($side, $width, $color, $style, $space)
148148
} else {
149149
$content .= $types[$this->type] . substr($side, 0, 1);
150150
}
151-
} else {
152-
return '';
153-
}
154-
155-
if (isset($styles[$style])) {
156-
$content .= $styles[$style];
157-
} else {
158-
$content .= '\brdrs'; // default style
159-
}
160-
$content .= $this->getValueIf($width !== null, '\brdrw' . round($width ?? 0)); // Width
161-
$content .= $this->getValueIf($color !== null, '\brdrcf' . $colorIndex); // Color
162151

163-
// Space
164-
if ($this->type == 'section') {
165-
$space = $space !== null ? $space : '480'; // section default is 480
166-
} elseif ($this->type == 'paragraph') {
167-
if ($side == 'top' || $side == 'bottom') {
168-
$space = $space !== null ? $space : '20'; // paragraph top|bottom default is 20
169-
} elseif ($side == 'left' || $side == 'right') {
170-
$space = $space !== null ? $space : '80'; // paragraph left|rigth default is 80
152+
if (isset($style, $styles[$style])) {
153+
$content .= $styles[$style];
154+
} else {
155+
$content .= '\brdrs'; // default style
156+
}
157+
$content .= $this->getValueIf($width !== null, '\brdrw' . round($width ?? 0)); // Width
158+
$content .= $this->getValueIf($color !== null, '\brdrcf' . $colorIndex); // Color
159+
160+
// Space
161+
if ($this->type == 'section') {
162+
$space = $space !== null ? $space : '480'; // section default is 480
163+
} elseif ($this->type == 'paragraph') {
164+
if ($side == 'top' || $side == 'bottom') {
165+
$space = $space !== null ? $space : '20'; // paragraph top|bottom default is 20
166+
} elseif ($side == 'left' || $side == 'right') {
167+
$space = $space !== null ? $space : '80'; // paragraph left|rigth default is 80
168+
}
171169
}
170+
$content .= $this->getValueIf($space !== null, '\brsp' . round($space ?? 0));
171+
$content .= ' ';
172172
}
173-
$content .= $this->getValueIf($space !== null, '\brsp' . round($space ?? 0));
174-
$content .= ' ';
175173

176174
return $content;
177175
}

0 commit comments

Comments
 (0)