From 09a143fe71334bb599db1833b929b87972bf227d Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Fri, 6 Jun 2014 18:56:09 +0700 Subject: [PATCH] QA: Type check fix for RTF section style and docblock comment fix for AbstractContainer --- src/PhpWord/Element/AbstractContainer.php | 34 +++++++++++------------ src/PhpWord/Writer/RTF/Style/Section.php | 18 ++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index 7afdbb47..701b888c 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -23,23 +23,23 @@ use PhpOffice\PhpWord\PhpWord; /** * Container abstract class * - * @method Text addText($text, $fStyle = null, $pStyle = null) - * @method TextRun addTextRun($pStyle = null) - * @method Link addLink($target, $text = null, $fStyle = null, $pStyle = null) - * @method PreserveText addPreserveText($text, $fStyle = null, $pStyle = null) - * @method void addTextBreak($count = 1, $fStyle = null, $pStyle = null) - * @method ListItem addListItem($text, $depth = 0, $fStyle = null, $listStyle = null, $pStyle = null) - * @method ListItemRun addListItemRun($depth = 0, $listStyle = null, $pStyle = null) - * @method Table addTable($style = null) - * @method Image addImage($source, $style = null, $isWatermark = false) - * @method Object addObject($source, $style = null) - * @method Footnote addFootnote($pStyle = null) - * @method Endnote addEndnote($pStyle = null) - * @method CheckBox addCheckBox($name, $text, $fStyle = null, $pStyle = null) - * @method TextBox addTextBox($style = null) - * @method Field addField($type = null, $properties = array(), $options = array()) - * @method Line addLine($lineStyle = null) - * @method Shape addObject($type, $style = null) + * @method Text addText(string $text, mixed $fStyle = null, mixed $pStyle = null) + * @method TextRun addTextRun(mixed $pStyle = null) + * @method Link addLink(string $target, string $text = null, mixed $fStyle = null, mixed $pStyle = null) + * @method PreserveText addPreserveText(string $text, mixed $fStyle = null, mixed $pStyle = null) + * @method void addTextBreak(int $count = 1, mixed $fStyle = null, mixed $pStyle = null) + * @method ListItem addListItem(string $text, int $depth = 0, mixed $fStyle = null, mixed $listStyle = null, mixed $pStyle = null) + * @method ListItemRun addListItemRun(int $depth = 0, mixed $listStyle = null, mixed $pStyle = null) + * @method Footnote addFootnote(mixed $pStyle = null) + * @method Endnote addEndnote(mixed $pStyle = null) + * @method CheckBox addCheckBox(string $name, $text, mixed $fStyle = null, mixed $pStyle = null) + * @method Table addTable(mixed $style = null) + * @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false) + * @method Object addObject(string $source, mixed $style = null) + * @method TextBox addTextBox(mixed $style = null) + * @method Field addField(string $type = null, array $properties = array(), array $options = array()) + * @method Line addLine(mixed $lineStyle = null) + * @method Shape addObject(string $type, mixed $style = null) * * @since 0.10.0 */ diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index b556e299..4169b630 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -43,16 +43,16 @@ class Section extends AbstractStyle $content .= '\sectd '; // Size & margin - $content .= $this->getValueIf($style->getPageSizeW(), '\pgwsxn' . $style->getPageSizeW()); - $content .= $this->getValueIf($style->getPageSizeH(), '\pghsxn' . $style->getPageSizeH()); + $content .= $this->getValueIf($style->getPageSizeW() !== null, '\pgwsxn' . $style->getPageSizeW()); + $content .= $this->getValueIf($style->getPageSizeH() !== null, '\pghsxn' . $style->getPageSizeH()); $content .= ' '; - $content .= $this->getValueIf($style->getMarginTop(), '\margtsxn' . $style->getMarginTop()); - $content .= $this->getValueIf($style->getMarginRight(), '\margrsxn' . $style->getMarginRight()); - $content .= $this->getValueIf($style->getMarginBottom(), '\margbsxn' . $style->getMarginBottom()); - $content .= $this->getValueIf($style->getMarginLeft(), '\marglsxn' . $style->getMarginLeft()); - $content .= $this->getValueIf($style->getHeaderHeight(), '\headery' . $style->getHeaderHeight()); - $content .= $this->getValueIf($style->getFooterHeight(), '\footery' . $style->getFooterHeight()); - $content .= $this->getValueIf($style->getGutter(), '\guttersxn' . $style->getGutter()); + $content .= $this->getValueIf($style->getMarginTop() !== null, '\margtsxn' . $style->getMarginTop()); + $content .= $this->getValueIf($style->getMarginRight() !== null, '\margrsxn' . $style->getMarginRight()); + $content .= $this->getValueIf($style->getMarginBottom() !== null, '\margbsxn' . $style->getMarginBottom()); + $content .= $this->getValueIf($style->getMarginLeft() !== null, '\marglsxn' . $style->getMarginLeft()); + $content .= $this->getValueIf($style->getHeaderHeight() !== null, '\headery' . $style->getHeaderHeight()); + $content .= $this->getValueIf($style->getFooterHeight() !== null, '\footery' . $style->getFooterHeight()); + $content .= $this->getValueIf($style->getGutter() !== null, '\guttersxn' . $style->getGutter()); $content .= ' '; // Borders