fix phpstan issues
This commit is contained in:
parent
adc1428607
commit
32907215ed
|
|
@ -1,7 +1,7 @@
|
||||||
includes:
|
includes:
|
||||||
- vendor/phpstan/phpstan/conf/config.level1.neon
|
- vendor/phpstan/phpstan/conf/config.level1.neon
|
||||||
parameters:
|
parameters:
|
||||||
memory-limit: 200000
|
memory-limit: 20000000
|
||||||
autoload_directories:
|
autoload_directories:
|
||||||
- tests
|
- tests
|
||||||
autoload_files:
|
autoload_files:
|
||||||
|
|
|
||||||
|
|
@ -61,14 +61,12 @@ class Title extends AbstractElement
|
||||||
*/
|
*/
|
||||||
public function __construct($text, $depth = 1)
|
public function __construct($text, $depth = 1)
|
||||||
{
|
{
|
||||||
if (isset($text)) {
|
if (is_string($text)) {
|
||||||
if (is_string($text)) {
|
$this->text = CommonText::toUTF8($text);
|
||||||
$this->text = CommonText::toUTF8($text);
|
} elseif ($text instanceof TextRun) {
|
||||||
} elseif ($text instanceof TextRun) {
|
$this->text = $text;
|
||||||
$this->text = $text;
|
} else {
|
||||||
} else {
|
throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun');
|
||||||
throw new \InvalidArgumentException('Invalid text, should be a string or a TextRun');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->depth = $depth;
|
$this->depth = $depth;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class Html
|
||||||
$dom = new \DOMDocument();
|
$dom = new \DOMDocument();
|
||||||
$dom->preserveWhiteSpace = $preserveWhiteSpace;
|
$dom->preserveWhiteSpace = $preserveWhiteSpace;
|
||||||
$dom->loadXML($html);
|
$dom->loadXML($html);
|
||||||
self::$xpath = new \DOMXpath($dom);
|
self::$xpath = new \DOMXPath($dom);
|
||||||
$node = $dom->getElementsByTagName('body');
|
$node = $dom->getElementsByTagName('body');
|
||||||
|
|
||||||
self::parseNode($node->item(0), $element);
|
self::parseNode($node->item(0), $element);
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ class Title extends AbstractElement
|
||||||
$xmlWriter->endElement();
|
$xmlWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bookmarkRId = null;
|
||||||
if ($element->getDepth() !== 0) {
|
if ($element->getDepth() !== 0) {
|
||||||
$rId = $element->getRelationId();
|
$rId = $element->getRelationId();
|
||||||
$bookmarkRId = $element->getPhpWord()->addBookmark();
|
$bookmarkRId = $element->getPhpWord()->addBookmark();
|
||||||
|
|
|
||||||
|
|
@ -330,11 +330,11 @@ class Chart extends AbstractPart
|
||||||
$valueAxisTitle = $style->getValueAxisTitle();
|
$valueAxisTitle = $style->getValueAxisTitle();
|
||||||
|
|
||||||
if ($axisType == 'c:catAx') {
|
if ($axisType == 'c:catAx') {
|
||||||
if (isset($categoryAxisTitle)) {
|
if (!is_null($categoryAxisTitle)) {
|
||||||
$this->writeAxisTitle($xmlWriter, $categoryAxisTitle);
|
$this->writeAxisTitle($xmlWriter, $categoryAxisTitle);
|
||||||
}
|
}
|
||||||
} elseif ($axisType == 'c:valAx') {
|
} elseif ($axisType == 'c:valAx') {
|
||||||
if (isset($valueAxisTitle)) {
|
if (!is_null($valueAxisTitle)) {
|
||||||
$this->writeAxisTitle($xmlWriter, $valueAxisTitle);
|
$this->writeAxisTitle($xmlWriter, $valueAxisTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase
|
||||||
$text2->setTrackChange(new TrackChange(TrackChange::DELETED, 'another author', new \DateTime()));
|
$text2->setTrackChange(new TrackChange(TrackChange::DELETED, 'another author', new \DateTime()));
|
||||||
|
|
||||||
$dom = $this->getAsHTML($phpWord);
|
$dom = $this->getAsHTML($phpWord);
|
||||||
$xpath = new \DOMXpath($dom);
|
$xpath = new \DOMXPath($dom);
|
||||||
|
|
||||||
$this->assertTrue($xpath->query('/html/body/p[1]/ins')->length == 1);
|
$this->assertTrue($xpath->query('/html/body/p[1]/ins')->length == 1);
|
||||||
$this->assertTrue($xpath->query('/html/body/p[2]/del')->length == 1);
|
$this->assertTrue($xpath->query('/html/body/p[2]/del')->length == 1);
|
||||||
|
|
@ -94,7 +94,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase
|
||||||
$cell22->addText('second cell');
|
$cell22->addText('second cell');
|
||||||
|
|
||||||
$dom = $this->getAsHTML($phpWord);
|
$dom = $this->getAsHTML($phpWord);
|
||||||
$xpath = new \DOMXpath($dom);
|
$xpath = new \DOMXPath($dom);
|
||||||
|
|
||||||
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1);
|
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1);
|
||||||
$this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent);
|
$this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent);
|
||||||
|
|
@ -123,7 +123,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase
|
||||||
$row3->addCell(500)->addText('third cell being spanned');
|
$row3->addCell(500)->addText('third cell being spanned');
|
||||||
|
|
||||||
$dom = $this->getAsHTML($phpWord);
|
$dom = $this->getAsHTML($phpWord);
|
||||||
$xpath = new \DOMXpath($dom);
|
$xpath = new \DOMXPath($dom);
|
||||||
|
|
||||||
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 2);
|
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 2);
|
||||||
$this->assertEquals('3', $xpath->query('/html/body/table/tr[1]/td[1]')->item(0)->attributes->getNamedItem('rowspan')->textContent);
|
$this->assertEquals('3', $xpath->query('/html/body/table/tr[1]/td[1]')->item(0)->attributes->getNamedItem('rowspan')->textContent);
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ class XmlDocument
|
||||||
private $dom;
|
private $dom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOMXpath object
|
* DOMXPath object
|
||||||
*
|
*
|
||||||
* @var \DOMXpath
|
* @var \DOMXPath
|
||||||
*/
|
*/
|
||||||
private $xpath;
|
private $xpath;
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ class XmlDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $this->xpath) {
|
if (null === $this->xpath) {
|
||||||
$this->xpath = new \DOMXpath($this->dom);
|
$this->xpath = new \DOMXPath($this->dom);
|
||||||
$this->xpath->registerNamespace('w14', 'http://schemas.microsoft.com/office/word/2010/wordml');
|
$this->xpath->registerNamespace('w14', 'http://schemas.microsoft.com/office/word/2010/wordml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue