From 4f9399899a2281cc1120782911bc88e16f8d93bc Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Fri, 30 May 2014 20:44:06 +0700 Subject: [PATCH] QA: Docblock improvements and -q parameter for phpdoc --- .travis.yml | 2 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 2 ++ src/PhpWord/Reader/Word2007/Document.php | 1 + src/PhpWord/Shared/Html.php | 4 +++- src/PhpWord/Style/Image.php | 2 ++ src/PhpWord/Style/Paragraph.php | 4 +++- src/PhpWord/Writer/Word2007/Style/Paragraph.php | 7 ++++--- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63165dbd..73dd68ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ script: ## PHPUnit - phpunit -c ./ --coverage-text --coverage-html ./build/coverage ## PHPDocumentor - - vendor/bin/phpdoc.php -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" + - vendor/bin/phpdoc.php -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" after_script: ## PHPDocumentor diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 8f14daed..a7261d6d 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -437,6 +437,7 @@ abstract class AbstractPart * @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader * @param \DOMElement $parentNode * @param array $styleDefs + * @ignoreScrutinizerPatch * @return array */ protected function readStyleDefs(XMLReader $xmlReader, \DOMElement $parentNode = null, $styleDefs = array()) @@ -467,6 +468,7 @@ abstract class AbstractPart * Return style definition based on conversion method * * @param string $method + * @ignoreScrutinizerPatch * @param mixed $attributeValue * @param mixed $expected * @return mixed diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index 80d2dde2..be804531 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -99,6 +99,7 @@ class Document extends AbstractPart * * @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader * @param \DOMElement $domNode + * @ignoreScrutinizerPatch * @return array */ private function readSectionStyle(XMLReader $xmlReader, \DOMElement $domNode) diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index 501d2404..171cfa21 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -242,7 +242,9 @@ class Html $cNodes = $node->childNodes; if (count($cNodes) > 0) { foreach ($cNodes as $cNode) { - self::parseNode($cNode, $newobject, $styles, $data); + if ($newobject instanceof \PhpOffice\PhpWord\Element\AbstractContainer) { + self::parseNode($cNode, $newobject, $styles, $data); + } } } } diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index 1de51870..3798c1a2 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -245,6 +245,7 @@ class Image extends AbstractStyle /** * Set margin top * + * @ignoreScrutinizerPatch * @param int|float $value * @return self */ @@ -268,6 +269,7 @@ class Image extends AbstractStyle /** * Set margin left * + * @ignoreScrutinizerPatch * @param int|float $value * @return self */ diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 1aacd44f..32c7f0f8 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -190,7 +190,7 @@ class Paragraph extends AbstractStyle */ public function getStyleValues() { - return array( + $styles = array( 'name' => $this->getStyleName(), 'basedOn' => $this->getBasedOn(), 'next' => $this->getNext(), @@ -209,6 +209,8 @@ class Paragraph extends AbstractStyle ), 'tabs' => $this->getTabs(), ); + + return $styles; } /** diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 4487aa71..f3287700 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -20,6 +20,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Style; use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style\Alignment as AlignmentStyle; +use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle; /** * Paragraph style writer @@ -71,7 +72,7 @@ class Paragraph extends AbstractStyle private function writeStyle() { $style = $this->getStyle(); - if (!$style instanceof \PhpOffice\PhpWord\Style\Paragraph) { + if (!$style instanceof ParagraphStyle) { return; } $xmlWriter = $this->getXmlWriter(); @@ -114,7 +115,7 @@ class Paragraph extends AbstractStyle * * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter * @param string $name - * @param string $value + * @param mixed $value */ private function writeChildStyle(XMLWriter $xmlWriter, $name, $value) { @@ -131,7 +132,7 @@ class Paragraph extends AbstractStyle * Write tabs * * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param array $tabs + * @param \PhpOffice\PhpWord\Style\Tab[] $tabs */ private function writeTabs(XMLWriter $xmlWriter, $tabs) {