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.
*
* @see https://github.com/PHPOffice/PHPWord
*
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
@ -72,19 +73,14 @@ class TextBox extends Image
/**
* 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;
}
/**
* Get background color.
*
* @return null|string
*/
public function getBgColor(): ?string
{
@ -93,19 +89,14 @@ class TextBox extends Image
/**
* 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;
}
/**
* Get margin top.
*
* @return null|int
*/
public function getInnerMarginTop(): ?int
{
@ -114,19 +105,14 @@ class TextBox extends Image
/**
* 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;
}
/**
* Get margin left.
*
* @return null|int
*/
public function getInnerMarginLeft(): ?int
{
@ -135,19 +121,14 @@ class TextBox extends Image
/**
* 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;
}
/**
* Get margin right.
*
* @return null|int
*/
public function getInnerMarginRight(): ?int
{
@ -156,19 +137,14 @@ class TextBox extends Image
/**
* 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;
}
/**
* Get margin bottom.
*
* @return null|int
*/
public function getInnerMarginBottom(): ?int
{
@ -179,9 +155,8 @@ class TextBox extends Image
* Set TLRB cell margin.
*
* @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->setInnerMarginLeft($value);
@ -201,8 +176,6 @@ class TextBox extends Image
/**
* Has inner margin?
*
* @return bool
*/
public function hasInnerMargins(): bool
{
@ -222,38 +195,30 @@ class TextBox extends Image
* Set border size.
*
* @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;
}
/**
* Get border size.
*
* @return int
*/
public function getBorderSize(): int
public function getBorderSize(): ?int
{
return $this->borderSize;
}
/**
* 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;
}
/**
* Get border color.
*
* @return null|string
*/
public function getBorderColor(): ?string
{

View File

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

View File

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

View File

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