Skip to content

Commit 23bc837

Browse files
committed
Scrutinizer fixes
1 parent 6a460c2 commit 23bc837

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

run_tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/bin/bash
2+
echo "Running composer update"
3+
composer update
24

35
## PHP_CodeSniffer
6+
echo "Running CodeSniffer"
47
./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
58

69
## PHP-CS-Fixer
10+
echo "Running CS Fixer"
711
./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run
812

913
## PHP Mess Detector
14+
echo "Running Mess Detector"
1015
./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
1116

1217
## PHPUnit
13-
./vendor/bin/phpunit -c ./ --no-coverage
18+
echo "Running PHPUnit"
19+
./vendor/bin/phpunit -c ./
1420

src/PhpWord/Element/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Field extends AbstractElement
7474
/**
7575
* Field text
7676
*
77-
* @var TextRun | string
77+
* @var TextRun|string
7878
*/
7979
protected $text;
8080

@@ -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 $text
102102
*/
103103
public function __construct($type = null, $properties = array(), $options = array(), $text = null)
104104
{

src/PhpWord/Element/TrackChange.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TrackChange extends AbstractContainer
3737
/**
3838
* Date
3939
*
40-
* @var DateTime
40+
* @var \DateTime
4141
*/
4242
private $date;
4343

src/PhpWord/Reader/Word2007/Settings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ protected function setZoom(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $
150150
protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOMElement $node)
151151
{
152152
$revisionView = new TrackChangesView();
153-
$revisionView->setMarkup($xmlReader->getAttribute('w:markup', $node));
153+
$revisionView->setMarkup(filter_var($xmlReader->getAttribute('w:markup', $node), FILTER_VALIDATE_BOOLEAN));
154154
$revisionView->setComments($xmlReader->getAttribute('w:comments', $node));
155155
$revisionView->setInsDel($xmlReader->getAttribute('w:insDel', $node));
156-
$revisionView->setFormatting($xmlReader->getAttribute('w:formatting', $node));
157-
$revisionView->setInkAnnotations($xmlReader->getAttribute('w:inkAnnotations', $node));
156+
$revisionView->setFormatting(filter_var($xmlReader->getAttribute('w:formatting', $node), FILTER_VALIDATE_BOOLEAN));
157+
$revisionView->setInkAnnotations(filter_var($xmlReader->getAttribute('w:inkAnnotations', $node), FILTER_VALIDATE_BOOLEAN));
158158
$phpWord->getSettings()->setRevisionView($revisionView);
159159
}
160160
}

src/PhpWord/Shared/AbstractEnum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function values()
4848
/**
4949
* Returns true the value is valid for this enum
5050
*
51-
* @param strign $value
51+
* @param string $value
5252
* @return bool true if value is valid
5353
*/
5454
public static function isValid($value)

src/PhpWord/Shared/ZipArchive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function pclzipGetFromName($filename)
351351
* Returns the name of an entry using its index (emulate \ZipArchive)
352352
*
353353
* @param int $index
354-
* @return string
354+
* @return string|bool
355355
* @since 0.10.0
356356
*/
357357
public function pclzipGetNameIndex($index)

src/PhpWord/Writer/ODText/Element/Text.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
namespace PhpOffice\PhpWord\Writer\ODText\Element;
1919

2020
use PhpOffice\PhpWord\Exception\Exception;
21-
use PhpOffice\PhpWord\Settings;
2221

2322
/**
2423
* Text element writer

0 commit comments

Comments
 (0)