Skip to content

Commit 0f6fbf2

Browse files
author
hazington
committed
Fixed several CS-Fixer issues
1 parent 050802b commit 0f6fbf2

File tree

4 files changed

+51
-83
lines changed

4 files changed

+51
-83
lines changed

src/PhpWord/Style/TextBox.php

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
1010
*
1111
* @see https://github.com/PHPOffice/PHPWord
12+
*
1213
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1314
*/
1415

@@ -72,19 +73,14 @@ class TextBox extends Image
7273

7374
/**
7475
* Set background color.
75-
*
76-
* @param null|string $value
77-
* @return void
7876
*/
79-
public function setBgColor(string $value = null): void
77+
public function setBgColor(?string $value = null): void
8078
{
8179
$this->bgColor = $value;
8280
}
8381

8482
/**
8583
* Get background color.
86-
*
87-
* @return null|string
8884
*/
8985
public function getBgColor(): ?string
9086
{
@@ -93,19 +89,14 @@ public function getBgColor(): ?string
9389

9490
/**
9591
* Set margin top.
96-
*
97-
* @param null|int $value
98-
* @return void
9992
*/
100-
public function setInnerMarginTop(int $value = null): void
93+
public function setInnerMarginTop(?int $value = null): void
10194
{
10295
$this->innerMarginTop = $value;
10396
}
10497

10598
/**
10699
* Get margin top.
107-
*
108-
* @return null|int
109100
*/
110101
public function getInnerMarginTop(): ?int
111102
{
@@ -114,19 +105,14 @@ public function getInnerMarginTop(): ?int
114105

115106
/**
116107
* Set margin left.
117-
*
118-
* @param null|int $value
119-
* @return void
120108
*/
121-
public function setInnerMarginLeft(int $value = null): void
109+
public function setInnerMarginLeft(?int $value = null): void
122110
{
123111
$this->innerMarginLeft = $value;
124112
}
125113

126114
/**
127115
* Get margin left.
128-
*
129-
* @return null|int
130116
*/
131117
public function getInnerMarginLeft(): ?int
132118
{
@@ -135,19 +121,14 @@ public function getInnerMarginLeft(): ?int
135121

136122
/**
137123
* Set margin right.
138-
*
139-
* @param null|int $value
140-
* @return void
141124
*/
142-
public function setInnerMarginRight(int $value = null): void
125+
public function setInnerMarginRight(?int $value = null): void
143126
{
144127
$this->innerMarginRight = $value;
145128
}
146129

147130
/**
148131
* Get margin right.
149-
*
150-
* @return null|int
151132
*/
152133
public function getInnerMarginRight(): ?int
153134
{
@@ -156,19 +137,14 @@ public function getInnerMarginRight(): ?int
156137

157138
/**
158139
* Set margin bottom.
159-
*
160-
* @param null|int $value
161-
* @return void
162140
*/
163-
public function setInnerMarginBottom(int $value = null): void
141+
public function setInnerMarginBottom(?int $value = null): void
164142
{
165143
$this->innerMarginBottom = $value;
166144
}
167145

168146
/**
169147
* Get margin bottom.
170-
*
171-
* @return null|int
172148
*/
173149
public function getInnerMarginBottom(): ?int
174150
{
@@ -179,9 +155,8 @@ public function getInnerMarginBottom(): ?int
179155
* Set TLRB cell margin.
180156
*
181157
* @param null|int $value Margin in twips
182-
* @return void
183158
*/
184-
public function setInnerMargin(int $value = null): void
159+
public function setInnerMargin(?int $value = null): void
185160
{
186161
$this->setInnerMarginTop($value);
187162
$this->setInnerMarginLeft($value);
@@ -201,8 +176,6 @@ public function getInnerMargin(): array
201176

202177
/**
203178
* Has inner margin?
204-
*
205-
* @return bool
206179
*/
207180
public function hasInnerMargins(): bool
208181
{
@@ -222,38 +195,30 @@ public function hasInnerMargins(): bool
222195
* Set border size.
223196
*
224197
* @param null|int $value Size in points
225-
* @return void
226198
*/
227-
public function setBorderSize(int $value = null): void
199+
public function setBorderSize(?int $value = null): void
228200
{
229201
$this->borderSize = $value;
230202
}
231203

232204
/**
233205
* Get border size.
234-
*
235-
* @return int
236206
*/
237-
public function getBorderSize(): int
207+
public function getBorderSize(): ?int
238208
{
239209
return $this->borderSize;
240210
}
241211

242212
/**
243213
* Set border color.
244-
*
245-
* @param null|string $value
246-
* @return void
247214
*/
248-
public function setBorderColor(string $value = null): void
215+
public function setBorderColor(?string $value = null): void
249216
{
250217
$this->borderColor = $value;
251218
}
252219

253220
/**
254221
* Get border color.
255-
*
256-
* @return null|string
257222
*/
258223
public function getBorderColor(): ?string
259224
{

src/PhpWord/Writer/Word2007/Element/TextBox.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
1010
*
1111
* @see https://github.com/PHPOffice/PHPWord
12+
*
1213
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1314
*/
1415

@@ -30,13 +31,13 @@ public function write(): void
3031
{
3132
$xmlWriter = $this->getXmlWriter();
3233
$element = $this->getElement();
33-
if (! $element instanceof \PhpOffice\PhpWord\Element\TextBox) {
34+
if (!$element instanceof \PhpOffice\PhpWord\Element\TextBox) {
3435
return;
3536
}
3637
$style = $element->getStyle();
3738
$styleWriter = new TextBoxStyleWriter($xmlWriter, $style);
3839

39-
if (! $this->withoutP) {
40+
if (!$this->withoutP) {
4041
$xmlWriter->startElement('w:p');
4142
$styleWriter->writeAlignment();
4243
}

src/PhpWord/Writer/Word2007/Style/TextBox.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
1010
*
1111
* @see https://github.com/PHPOffice/PHPWord
12+
*
1213
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1314
*/
1415

@@ -29,7 +30,7 @@ class TextBox extends Frame
2930
public function writeInnerMargin(): void
3031
{
3132
$style = $this->getStyle();
32-
if (! $style instanceof TextBoxStyle || ! $style->hasInnerMargins()) {
33+
if (!$style instanceof TextBoxStyle || !$style->hasInnerMargins()) {
3334
return;
3435
}
3536

@@ -45,7 +46,7 @@ public function writeInnerMargin(): void
4546
public function writeBorder(): void
4647
{
4748
$style = $this->getStyle();
48-
if (! $style instanceof TextBoxStyle) {
49+
if (!$style instanceof TextBoxStyle) {
4950
return;
5051
}
5152
$xmlWriter = $this->getXmlWriter();

tests/PhpWordTests/Style/TextBoxTest.php

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
1010
*
1111
* @see https://github.com/PHPOffice/PHPWord
12+
*
1213
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1314
*/
1415

@@ -35,24 +36,24 @@ public function testSetGetNormal(): void
3536
$object = new TextBox();
3637

3738
$properties = [
38-
'width' => 200,
39-
'height' => 200,
40-
'alignment' => Jc::START,
41-
'marginTop' => 240,
42-
'marginLeft' => 240,
43-
'wrappingStyle' => 'inline',
44-
'positioning' => 'absolute',
45-
'posHorizontal' => 'center',
46-
'posVertical' => 'top',
47-
'posHorizontalRel' => 'margin',
48-
'posVerticalRel' => 'page',
49-
'innerMarginTop' => '5',
50-
'innerMarginRight' => '5',
39+
'width' => 200,
40+
'height' => 200,
41+
'alignment' => Jc::START,
42+
'marginTop' => 240,
43+
'marginLeft' => 240,
44+
'wrappingStyle' => 'inline',
45+
'positioning' => 'absolute',
46+
'posHorizontal' => 'center',
47+
'posVertical' => 'top',
48+
'posHorizontalRel' => 'margin',
49+
'posVerticalRel' => 'page',
50+
'innerMarginTop' => '5',
51+
'innerMarginRight' => '5',
5152
'innerMarginBottom' => '5',
52-
'innerMarginLeft' => '5',
53-
'borderSize' => '2',
54-
'borderColor' => 'red',
55-
'bgColor' => 'blue',
53+
'innerMarginLeft' => '5',
54+
'borderSize' => '2',
55+
'borderColor' => 'red',
56+
'bgColor' => 'blue',
5657
];
5758
foreach ($properties as $key => $value) {
5859
$set = "set{$key}";
@@ -70,24 +71,24 @@ public function testSetStyleValue(): void
7071
$object = new TextBox();
7172

7273
$properties = [
73-
'width' => 200,
74-
'height' => 200,
75-
'alignment' => Jc::START,
76-
'marginTop' => 240,
77-
'marginLeft' => 240,
78-
'wrappingStyle' => 'inline',
79-
'positioning' => 'absolute',
80-
'posHorizontal' => 'center',
81-
'posVertical' => 'top',
82-
'posHorizontalRel' => 'margin',
83-
'posVerticalRel' => 'page',
84-
'innerMarginTop' => '5',
85-
'innerMarginRight' => '5',
74+
'width' => 200,
75+
'height' => 200,
76+
'alignment' => Jc::START,
77+
'marginTop' => 240,
78+
'marginLeft' => 240,
79+
'wrappingStyle' => 'inline',
80+
'positioning' => 'absolute',
81+
'posHorizontal' => 'center',
82+
'posVertical' => 'top',
83+
'posHorizontalRel' => 'margin',
84+
'posVerticalRel' => 'page',
85+
'innerMarginTop' => '5',
86+
'innerMarginRight' => '5',
8687
'innerMarginBottom' => '5',
87-
'innerMarginLeft' => '5',
88-
'borderSize' => '2',
89-
'borderColor' => 'red',
90-
'bgColor' => 'blue',
88+
'innerMarginLeft' => '5',
89+
'borderSize' => '2',
90+
'borderColor' => 'red',
91+
'bgColor' => 'blue',
9192
];
9293
foreach ($properties as $key => $value) {
9394
$get = "get{$key}";

0 commit comments

Comments
 (0)