Skip to content

Commit

Permalink
Fixed PHPStan & PHPCSFixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Feb 20, 2025
1 parent 779aaff commit a58a808
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/PhpWord/Style/Indentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public function getFirstLineChars(): int
*/
public function setFirstLineChars(int $value): self
{
$this->firstLineChars = $this->setNumericVal($value, $this->firstLineChars);
$this->firstLineChars = $this->setIntVal($value, $this->firstLineChars);

return $this;
}

Expand Down
10 changes: 5 additions & 5 deletions tests/PhpWordTests/Reader/Word2007/StyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,39 +379,39 @@ public static function providerIndentation()
488.00,
10.0,
490.00,
140
140,
];
yield [
'<w:ind w:left="709" w:right="488" w:hanging="10" w:firstLine="490"/>',
709.00,
488.00,
10.0,
490.00,
0
0,
];
yield [
'<w:ind w:hanging="10" w:firstLine="490"/>',
0,
0,
10.0,
490.00,
0
0,
];
yield [
'<w:ind w:left="709"/>',
709.00,
0,
0,
0,
0
0,
];
yield [
'<w:ind w:right="488"/>',
0,
488.00,
0,
0,
0
0,
];
}
}
10 changes: 7 additions & 3 deletions tests/PhpWordTests/Writer/Word2007/Style/IndentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Shared\Html as SharedHtml;
use PhpOffice\PhpWord\Style\Paragraph;
use PhpOffice\PhpWordTests\TestHelperDOCX;

class IndentationTest extends \PHPUnit\Framework\TestCase
Expand All @@ -40,7 +40,9 @@ public function testDefault(): void
Settings::setDefaultRtl(true);
$section = $word->addSection();
$text = $section->addText('AA');
$text->getParagraphStyle()->setIndentation([]);
$paragraphStyle = $text->getParagraphStyle();
self::assertInstanceOf(Paragraph::class, $paragraphStyle);
$paragraphStyle->setIndentation([]);
$doc = TestHelperDOCX::getDocument($word, 'Word2007');

$path = '/w:document/w:body/w:p[1]/w:pPr/w:ind';
Expand All @@ -54,7 +56,9 @@ public function testFirstLineChars(): void
Settings::setDefaultRtl(true);
$section = $word->addSection();
$text = $section->addText('AA');
$text->getParagraphStyle()->setIndentation([
$paragraphStyle = $text->getParagraphStyle();
self::assertInstanceOf(Paragraph::class, $paragraphStyle);
$paragraphStyle->setIndentation([
'firstLineChars' => 1440,
]);
$doc = TestHelperDOCX::getDocument($word, 'Word2007');
Expand Down

0 comments on commit a58a808

Please sign in to comment.