Skip to content

Commit ca25eba

Browse files
committed
Scrutinizer fixes
1 parent 23bc837 commit ca25eba

File tree

13 files changed

+45
-33
lines changed

13 files changed

+45
-33
lines changed

phpstan.neon

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/config.level1.neon
3+
parameters:
4+
memory-limit: 200000
5+
autoload_directories:
6+
- tests
7+
autoload_files:
8+
- tests/bootstrap.php
9+
excludes_analyse:
10+
- */pclzip.lib.php
11+
- src/PhpWord/Shared/OLERead.php
12+
- src/PhpWord/Reader/MsDoc.php
13+
- src/PhpWord/Writer/PDF/MPDF.php

src/PhpWord/Element/Endnote.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\PhpWord\Style\Paragraph;
21-
2220
/**
2321
* Endnote element
2422
*
@@ -38,6 +36,6 @@ class Endnote extends Footnote
3836
*/
3937
public function __construct($paragraphStyle = null)
4038
{
41-
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
39+
parent::__construct($paragraphStyle);
4240
}
4341
}

src/PhpWord/Element/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Field extends AbstractElement
9898
* @param string $type
9999
* @param array $properties
100100
* @param array $options
101-
* @param TextRun|string $text
101+
* @param TextRun|string|null $text
102102
*/
103103
public function __construct($type = null, $properties = array(), $options = array(), $text = null)
104104
{
@@ -209,7 +209,7 @@ public function getOptions()
209209
* @param string|TextRun $text
210210
*
211211
* @throws \InvalidArgumentException
212-
* @return string|TextRun
212+
* @return null|string|TextRun
213213
*/
214214
public function setText($text)
215215
{

src/PhpWord/Element/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function __construct($source, $style = null, $watermark = false)
137137
$this->setIsWatermark($watermark);
138138
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
139139

140-
$this->checkImage($source);
140+
$this->checkImage();
141141
}
142142

143143
/**

src/PhpWord/Element/ListItemRun.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
namespace PhpOffice\PhpWord\Element;
1919

2020
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
21-
use PhpOffice\PhpWord\Style\Paragraph;
2221

2322
/**
2423
* List item element
@@ -61,7 +60,7 @@ public function __construct($depth = 0, $listStyle = null, $paragraphStyle = nul
6160
} else {
6261
$this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true);
6362
}
64-
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
63+
parent::__construct($paragraphStyle);
6564
}
6665

6766
/**

src/PhpWord/Element/Section.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function getFooters()
142142
/**
143143
* Get the footnote properties
144144
*
145-
* @return \PhpOffice\PhpWord\Element\FooterProperties
145+
* @return FootnoteProperties
146146
*/
147147
public function getFootnotePropoperties()
148148
{

src/PhpWord/Metadata/DocInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public function isCustomPropertySet($propertyName)
410410
* Get a Custom Property Value
411411
*
412412
* @param string $propertyName
413-
* @return string
413+
* @return mixed
414414
*/
415415
public function getCustomPropertyValue($propertyName)
416416
{

src/PhpWord/Shared/PCLZip/pclzip.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3790,7 +3790,7 @@ public function privExtractFileUsingTempFile(&$p_entry, &$p_options)
37903790
}
37913791

37923792
// ----- Write gz file format header
3793-
$v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
3793+
$v_binary_data = pack('va1a1Va1a1', 0x8b1f, chr($p_entry['compression']), chr(0x00), time(), chr(0x00), chr(3));
37943794
@fwrite($v_dest_file, $v_binary_data, 10);
37953795

37963796
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
@@ -4383,7 +4383,7 @@ public function privReadEndCentralDir(&$p_central_dir)
43834383
//$v_bytes = ($v_bytes << 8) | Ord($v_byte);
43844384
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
43854385
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
4386-
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
4386+
$v_bytes = (($v_bytes & 0xFFFFFF) << 8) | ord($v_byte);
43874387

43884388
// ----- Compare the bytes
43894389
if ($v_bytes == 0x504b0506) {

src/PhpWord/Writer/PDF/TCPDF.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class TCPDF extends AbstractRenderer implements WriterInterface
4040
* Save PhpWord to file.
4141
*
4242
* @param string $filename Name of the file to save as
43-
* @return vois
4443
*/
4544
public function save($filename = null)
4645
{
@@ -55,21 +54,21 @@ public function save($filename = null)
5554
$pdf->setFontSubsetting(false);
5655
$pdf->setPrintHeader(false);
5756
$pdf->setPrintFooter(false);
58-
$pdf->addPage();
59-
$pdf->setFont($this->getFont());
57+
$pdf->AddPage();
58+
$pdf->SetFont($this->getFont());
6059
$pdf->writeHTML($this->getContent());
6160

6261
// Write document properties
6362
$phpWord = $this->getPhpWord();
6463
$docProps = $phpWord->getDocInfo();
65-
$pdf->setTitle($docProps->getTitle());
66-
$pdf->setAuthor($docProps->getCreator());
67-
$pdf->setSubject($docProps->getSubject());
68-
$pdf->setKeywords($docProps->getKeywords());
69-
$pdf->setCreator($docProps->getCreator());
64+
$pdf->SetTitle($docProps->getTitle());
65+
$pdf->SetAuthor($docProps->getCreator());
66+
$pdf->SetSubject($docProps->getSubject());
67+
$pdf->SetKeywords($docProps->getKeywords());
68+
$pdf->SetCreator($docProps->getCreator());
7069

7170
// Write to file
72-
fwrite($fileHandle, $pdf->output($filename, 'S'));
71+
fwrite($fileHandle, $pdf->Output($filename, 'S'));
7372

7473
parent::restoreStateAfterSave($fileHandle);
7574
}

src/PhpWord/Writer/Word2007/Element/SDT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private function writeComboBox(XMLWriter $xmlWriter, SDTElement $element)
101101
*/
102102
private function writeDropDownList(XMLWriter $xmlWriter, SDTElement $element)
103103
{
104-
$this->writecomboBox($xmlWriter, $element);
104+
$this->writeComboBox($xmlWriter, $element);
105105
}
106106

107107
/**

0 commit comments

Comments
 (0)