Skip to content

Commit 34a9094

Browse files
committed
Upgrade Phpstan
1 parent abe4268 commit 34a9094

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

phpstan.neon.php7.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ parameters:
2020

2121
## <=PHP7.4
2222
-
23-
message: '#Parameter \#1 \$argument of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given.#'
23+
message: '#Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given.#'
2424
path: src/PhpWord/Element/AbstractContainer.php
2525
-
2626
message: '#Parameter \#1 \$function of function call_user_func expects callable\(\): mixed, string given.#'
2727
path: src/PhpWord/Element/Image.php
2828
-
29-
message: '#Parameter \#1 \$argument of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given.#'
29+
message: '#Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class-string<T of object>\|T of object, string given.#'
3030
path: src/PhpWord/IOFactory.php
3131
-
3232
message: '#Parameter \#1 \$function of function call_user_func_array expects callable\(\): mixed,#'
@@ -44,7 +44,7 @@ parameters:
4444
message: '#PHPDoc tag @var with type PhpOffice\\PhpWord\\Style\\AbstractStyle is not subtype of native type #'
4545
path: tests/PhpWordTests/Style/AbstractStyleTest.php
4646
-
47-
message: '#Parameter \#1 \$argument of class ReflectionClass constructor expects class-string<object>\|object, class-string\|false given.#'
47+
message: '#Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class-string<object>\|object, class-string\|false given.#'
4848
path: tests/PhpWordTests/Style/AbstractStyleTest.php
4949
-
5050
message: '#PHPDoc tag @var with type PhpOffice\\PhpWord\\Writer\\Word2007\\Part\\AbstractPart is not subtype of native type #'

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ private function readFormField(XMLReader $xmlReader, array $domNodes, $parent, $
369369
}
370370
$formField->setEntries($listEntries);
371371
if (null !== $formField->getValue()) {
372-
$formField->setText($listEntries[$formField->getValue()]);
372+
/** @var int */
373+
$temp = $formField->getValue();
374+
$formField->setText(
375+
$listEntries[$temp]
376+
);
373377
}
374378

375379
break;

tests/PhpWordTests/Writer/HTML/Element/TableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function testWriteTableBorders(): void
162162
self::assertEquals('tstyle', Helper::getTextContent($xpath, '/html/body/div/table[6]', 'class'));
163163
$style = Helper::getTextContent($xpath, '/html/head/style');
164164
self::assertNotFalse(preg_match('/^[.]tstyle[^\\r\\n]*/m', $style, $matches));
165-
self::assertEquals(".tstyle {table-layout: auto; $cssnone}", $matches[0]);
165+
self::assertEquals(".tstyle {table-layout: auto; $cssnone}", $matches[0] ?? '');
166166
}
167167

168168
public function testWriteTableCellVAlign(): void

tests/PhpWordTests/Writer/HTML/FontTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function testWhiteSpace(): void
275275

276276
$style = Helper::getTextContent($xpath, '/html/head/style');
277277
self::assertNotFalse(preg_match('/^body[^\\r\\n]*/m', $style, $matches));
278-
self::assertEquals('body {font-family: \'Arial\'; font-size: 12pt; color: #000000; white-space: pre-wrap;}', $matches[0]);
278+
self::assertEquals('body {font-family: \'Arial\'; font-size: 12pt; color: #000000; white-space: pre-wrap;}', $matches[0] ?? '');
279279
$prg = preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches);
280280
self::assertNotEmpty($matches);
281281
self::assertNotFalse($prg);

tests/PhpWordTests/Writer/HTML/ParagraphTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testParagraphStyles(): void
5555

5656
$style = Helper::getTextContent($xpath, '/html/head/style');
5757
self::assertNotFalse(preg_match('/^[.]indented[^\\r\\n]*/m', $style, $matches));
58-
self::assertEquals('.indented {margin-left: 0.5in; margin-right: 0.6in;}', $matches[0]);
58+
self::assertEquals('.indented {margin-left: 0.5in; margin-right: 0.6in;}', $matches[0] ?? '');
5959
}
6060

6161
/**
@@ -88,9 +88,9 @@ public function testParagraphAndFontStyles(): void
8888

8989
$style = Helper::getTextContent($xpath, '/html/head/style');
9090
self::assertNotFalse(preg_match('/^[.]indented[^\\r\\n]*/m', $style, $matches));
91-
self::assertEquals('.indented {margin-left: 0.5in; margin-right: 0.6in;}', $matches[0]);
91+
self::assertEquals('.indented {margin-left: 0.5in; margin-right: 0.6in;}', $matches[0] ?? '');
9292
self::assertNotFalse(preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches));
93-
self::assertEquals('.style1 {font-family: \'Courier New\', monospace; font-size: 10pt; white-space: pre-wrap;}', $matches[0]);
93+
self::assertEquals('.style1 {font-family: \'Courier New\', monospace; font-size: 10pt; white-space: pre-wrap;}', $matches[0] ?? '');
9494
}
9595

9696
/**

0 commit comments

Comments
 (0)