Fixed several CS-Fixer issues

This commit is contained in:
hazington 2023-01-03 23:44:51 +01:00
parent 050802bdb5
commit 0f6fbf2b11
4 changed files with 51 additions and 83 deletions

View File

@ -9,6 +9,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
* *
* @see https://github.com/PHPOffice/PHPWord * @see https://github.com/PHPOffice/PHPWord
*
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/ */
@ -72,19 +73,14 @@ class TextBox extends Image
/** /**
* Set background color. * Set background color.
*
* @param null|string $value
* @return void
*/ */
public function setBgColor(string $value = null): void public function setBgColor(?string $value = null): void
{ {
$this->bgColor = $value; $this->bgColor = $value;
} }
/** /**
* Get background color. * Get background color.
*
* @return null|string
*/ */
public function getBgColor(): ?string public function getBgColor(): ?string
{ {
@ -93,19 +89,14 @@ class TextBox extends Image
/** /**
* Set margin top. * Set margin top.
*
* @param null|int $value
* @return void
*/ */
public function setInnerMarginTop(int $value = null): void public function setInnerMarginTop(?int $value = null): void
{ {
$this->innerMarginTop = $value; $this->innerMarginTop = $value;
} }
/** /**
* Get margin top. * Get margin top.
*
* @return null|int
*/ */
public function getInnerMarginTop(): ?int public function getInnerMarginTop(): ?int
{ {
@ -114,19 +105,14 @@ class TextBox extends Image
/** /**
* Set margin left. * Set margin left.
*
* @param null|int $value
* @return void
*/ */
public function setInnerMarginLeft(int $value = null): void public function setInnerMarginLeft(?int $value = null): void
{ {
$this->innerMarginLeft = $value; $this->innerMarginLeft = $value;
} }
/** /**
* Get margin left. * Get margin left.
*
* @return null|int
*/ */
public function getInnerMarginLeft(): ?int public function getInnerMarginLeft(): ?int
{ {
@ -135,19 +121,14 @@ class TextBox extends Image
/** /**
* Set margin right. * Set margin right.
*
* @param null|int $value
* @return void
*/ */
public function setInnerMarginRight(int $value = null): void public function setInnerMarginRight(?int $value = null): void
{ {
$this->innerMarginRight = $value; $this->innerMarginRight = $value;
} }
/** /**
* Get margin right. * Get margin right.
*
* @return null|int
*/ */
public function getInnerMarginRight(): ?int public function getInnerMarginRight(): ?int
{ {
@ -156,19 +137,14 @@ class TextBox extends Image
/** /**
* Set margin bottom. * Set margin bottom.
*
* @param null|int $value
* @return void
*/ */
public function setInnerMarginBottom(int $value = null): void public function setInnerMarginBottom(?int $value = null): void
{ {
$this->innerMarginBottom = $value; $this->innerMarginBottom = $value;
} }
/** /**
* Get margin bottom. * Get margin bottom.
*
* @return null|int
*/ */
public function getInnerMarginBottom(): ?int public function getInnerMarginBottom(): ?int
{ {
@ -179,9 +155,8 @@ class TextBox extends Image
* Set TLRB cell margin. * Set TLRB cell margin.
* *
* @param null|int $value Margin in twips * @param null|int $value Margin in twips
* @return void
*/ */
public function setInnerMargin(int $value = null): void public function setInnerMargin(?int $value = null): void
{ {
$this->setInnerMarginTop($value); $this->setInnerMarginTop($value);
$this->setInnerMarginLeft($value); $this->setInnerMarginLeft($value);
@ -201,8 +176,6 @@ class TextBox extends Image
/** /**
* Has inner margin? * Has inner margin?
*
* @return bool
*/ */
public function hasInnerMargins(): bool public function hasInnerMargins(): bool
{ {
@ -222,38 +195,30 @@ class TextBox extends Image
* Set border size. * Set border size.
* *
* @param null|int $value Size in points * @param null|int $value Size in points
* @return void
*/ */
public function setBorderSize(int $value = null): void public function setBorderSize(?int $value = null): void
{ {
$this->borderSize = $value; $this->borderSize = $value;
} }
/** /**
* Get border size. * Get border size.
*
* @return int
*/ */
public function getBorderSize(): int public function getBorderSize(): ?int
{ {
return $this->borderSize; return $this->borderSize;
} }
/** /**
* Set border color. * Set border color.
*
* @param null|string $value
* @return void
*/ */
public function setBorderColor(string $value = null): void public function setBorderColor(?string $value = null): void
{ {
$this->borderColor = $value; $this->borderColor = $value;
} }
/** /**
* Get border color. * Get border color.
*
* @return null|string
*/ */
public function getBorderColor(): ?string public function getBorderColor(): ?string
{ {

View File

@ -9,6 +9,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
* *
* @see https://github.com/PHPOffice/PHPWord * @see https://github.com/PHPOffice/PHPWord
*
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/ */
@ -30,13 +31,13 @@ class TextBox extends Image
{ {
$xmlWriter = $this->getXmlWriter(); $xmlWriter = $this->getXmlWriter();
$element = $this->getElement(); $element = $this->getElement();
if (! $element instanceof \PhpOffice\PhpWord\Element\TextBox) { if (!$element instanceof \PhpOffice\PhpWord\Element\TextBox) {
return; return;
} }
$style = $element->getStyle(); $style = $element->getStyle();
$styleWriter = new TextBoxStyleWriter($xmlWriter, $style); $styleWriter = new TextBoxStyleWriter($xmlWriter, $style);
if (! $this->withoutP) { if (!$this->withoutP) {
$xmlWriter->startElement('w:p'); $xmlWriter->startElement('w:p');
$styleWriter->writeAlignment(); $styleWriter->writeAlignment();
} }

View File

@ -9,6 +9,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
* *
* @see https://github.com/PHPOffice/PHPWord * @see https://github.com/PHPOffice/PHPWord
*
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/ */
@ -29,7 +30,7 @@ class TextBox extends Frame
public function writeInnerMargin(): void public function writeInnerMargin(): void
{ {
$style = $this->getStyle(); $style = $this->getStyle();
if (! $style instanceof TextBoxStyle || ! $style->hasInnerMargins()) { if (!$style instanceof TextBoxStyle || !$style->hasInnerMargins()) {
return; return;
} }
@ -45,7 +46,7 @@ class TextBox extends Frame
public function writeBorder(): void public function writeBorder(): void
{ {
$style = $this->getStyle(); $style = $this->getStyle();
if (! $style instanceof TextBoxStyle) { if (!$style instanceof TextBoxStyle) {
return; return;
} }
$xmlWriter = $this->getXmlWriter(); $xmlWriter = $this->getXmlWriter();

View File

@ -9,6 +9,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
* *
* @see https://github.com/PHPOffice/PHPWord * @see https://github.com/PHPOffice/PHPWord
*
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/ */
@ -35,24 +36,24 @@ class TextBoxTest extends TestCase
$object = new TextBox(); $object = new TextBox();
$properties = [ $properties = [
'width' => 200, 'width' => 200,
'height' => 200, 'height' => 200,
'alignment' => Jc::START, 'alignment' => Jc::START,
'marginTop' => 240, 'marginTop' => 240,
'marginLeft' => 240, 'marginLeft' => 240,
'wrappingStyle' => 'inline', 'wrappingStyle' => 'inline',
'positioning' => 'absolute', 'positioning' => 'absolute',
'posHorizontal' => 'center', 'posHorizontal' => 'center',
'posVertical' => 'top', 'posVertical' => 'top',
'posHorizontalRel' => 'margin', 'posHorizontalRel' => 'margin',
'posVerticalRel' => 'page', 'posVerticalRel' => 'page',
'innerMarginTop' => '5', 'innerMarginTop' => '5',
'innerMarginRight' => '5', 'innerMarginRight' => '5',
'innerMarginBottom' => '5', 'innerMarginBottom' => '5',
'innerMarginLeft' => '5', 'innerMarginLeft' => '5',
'borderSize' => '2', 'borderSize' => '2',
'borderColor' => 'red', 'borderColor' => 'red',
'bgColor' => 'blue', 'bgColor' => 'blue',
]; ];
foreach ($properties as $key => $value) { foreach ($properties as $key => $value) {
$set = "set{$key}"; $set = "set{$key}";
@ -70,24 +71,24 @@ class TextBoxTest extends TestCase
$object = new TextBox(); $object = new TextBox();
$properties = [ $properties = [
'width' => 200, 'width' => 200,
'height' => 200, 'height' => 200,
'alignment' => Jc::START, 'alignment' => Jc::START,
'marginTop' => 240, 'marginTop' => 240,
'marginLeft' => 240, 'marginLeft' => 240,
'wrappingStyle' => 'inline', 'wrappingStyle' => 'inline',
'positioning' => 'absolute', 'positioning' => 'absolute',
'posHorizontal' => 'center', 'posHorizontal' => 'center',
'posVertical' => 'top', 'posVertical' => 'top',
'posHorizontalRel' => 'margin', 'posHorizontalRel' => 'margin',
'posVerticalRel' => 'page', 'posVerticalRel' => 'page',
'innerMarginTop' => '5', 'innerMarginTop' => '5',
'innerMarginRight' => '5', 'innerMarginRight' => '5',
'innerMarginBottom' => '5', 'innerMarginBottom' => '5',
'innerMarginLeft' => '5', 'innerMarginLeft' => '5',
'borderSize' => '2', 'borderSize' => '2',
'borderColor' => 'red', 'borderColor' => 'red',
'bgColor' => 'blue', 'bgColor' => 'blue',
]; ];
foreach ($properties as $key => $value) { foreach ($properties as $key => $value) {
$get = "get{$key}"; $get = "get{$key}";