Skip to content

Commit ae1da38

Browse files
Revert type hinting.
1 parent 6641662 commit ae1da38

File tree

1 file changed

+81
-35
lines changed

1 file changed

+81
-35
lines changed

src/View/Helper/NumberFormat.php

+81-35
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
namespace Laminas\I18n\View\Helper;
64

75
use Laminas\View\Helper\AbstractHelper;
@@ -23,58 +21,75 @@ class NumberFormat extends AbstractHelper
2321

2422
/**
2523
* The maximum number of decimals to use.
24+
*
25+
* @var int
2626
*/
27-
protected ?int $maxDecimals = null;
27+
protected $maxDecimals;
2828

2929
/**
3030
* The minimum number of decimals to use.
31+
*
32+
* @var int
3133
*/
32-
protected ?int $minDecimals = null;
34+
protected $minDecimals;
3335

3436
/**
3537
* NumberFormat style to use
38+
*
39+
* @var int
3640
*/
37-
protected ?int $formatStyle = null;
41+
protected $formatStyle;
3842

3943
/**
4044
* NumberFormat type to use
45+
*
46+
* @var int
4147
*/
42-
protected ?int $formatType = null;
48+
protected $formatType;
4349

4450
/**
4551
* Formatter instances
4652
*
4753
* @var array<string, NumberFormatter>
4854
*/
49-
protected array $formatters = [];
55+
protected $formatters = [];
5056

5157
/**
5258
* Text attributes.
5359
*
5460
* @var array<int, string>
5561
*/
56-
protected array $textAttributes = [];
62+
protected $textAttributes = [];
5763

5864
/**
5965
* Locale to use instead of the default
66+
*
67+
* @var string
6068
*/
61-
protected ?string $locale = null;
69+
protected $locale;
6270

6371
/**
6472
* Format a number
6573
*
66-
* @param int|float $number
67-
* @param array<int, string> $textAttributes
74+
* @param int|float $number
75+
* @param int|null $formatStyle
76+
* @param int|null $formatType
77+
* @param string|null $locale
78+
* @param int|null $maxDecimals
79+
* @param array<int, string> $textAttributes
80+
* @param int|float $number
81+
* @param int|null $minDecimals
82+
* @return string
6883
*/
6984
public function __invoke(
7085
$number,
71-
?int $formatStyle = null,
72-
?int $formatType = null,
73-
?string $locale = null,
74-
?int $maxDecimals = null,
86+
$formatStyle = null,
87+
$formatType = null,
88+
$locale = null,
89+
$maxDecimals = null,
7590
?array $textAttributes = null,
76-
?int $minDecimals = null
77-
): string {
91+
$minDecimals = null
92+
) {
7893
if (null === $locale) {
7994
$locale = $this->getLocale();
8095
}
@@ -128,17 +143,22 @@ public function __invoke(
128143

129144
/**
130145
* Set format style to use instead of the default
146+
*
147+
* @param int $formatStyle
148+
* @return $this
131149
*/
132-
public function setFormatStyle(int $formatStyle): self
150+
public function setFormatStyle($formatStyle)
133151
{
134-
$this->formatStyle = $formatStyle;
152+
$this->formatStyle = (int) $formatStyle;
135153
return $this;
136154
}
137155

138156
/**
139157
* Get the format style to use
158+
*
159+
* @return int
140160
*/
141-
public function getFormatStyle(): int
161+
public function getFormatStyle()
142162
{
143163
if (null === $this->formatStyle) {
144164
$this->formatStyle = NumberFormatter::DECIMAL;
@@ -149,17 +169,22 @@ public function getFormatStyle(): int
149169

150170
/**
151171
* Set format type to use instead of the default
172+
*
173+
* @param int $formatType
174+
* @return $this
152175
*/
153-
public function setFormatType(?int $formatType): self
176+
public function setFormatType($formatType)
154177
{
155-
$this->formatType = $formatType;
178+
$this->formatType = (int) $formatType;
156179
return $this;
157180
}
158181

159182
/**
160183
* Get the format type to use
184+
*
185+
* @return int
161186
*/
162-
public function getFormatType(): int
187+
public function getFormatType()
163188
{
164189
if (null === $this->formatType) {
165190
$this->formatType = NumberFormatter::TYPE_DEFAULT;
@@ -168,9 +193,12 @@ public function getFormatType(): int
168193
}
169194

170195
/**
171-
* Set number (both min & max) of decimals to use instead of the default.
196+
* Set number of decimals (both min & max) to use instead of the default.
197+
*
198+
* @param int $decimals
199+
* @return $this
172200
*/
173-
public function setDecimals(?int $decimals): self
201+
public function setDecimals($decimals)
174202
{
175203
$this->minDecimals = $decimals;
176204
$this->maxDecimals = $decimals;
@@ -179,59 +207,76 @@ public function setDecimals(?int $decimals): self
179207

180208
/**
181209
* Set the maximum number of decimals to use instead of the default.
210+
*
211+
* @param int $maxDecimals
212+
* @return $this
182213
*/
183-
public function setMaxDecimals(?int $maxDecimals): self
214+
public function setMaxDecimals($maxDecimals)
184215
{
185216
$this->maxDecimals = $maxDecimals;
186217
return $this;
187218
}
188219

189220
/**
190221
* Set the minimum number of decimals to use instead of the default.
222+
*
223+
* @param int $minDecimals
224+
* @return $this
191225
*/
192-
public function setMinDecimals(?int $minDecimals): self
226+
public function setMinDecimals($minDecimals)
193227
{
194228
$this->minDecimals = $minDecimals;
195229
return $this;
196230
}
197231

198232
/**
199233
* Get number of decimals.
234+
*
235+
* @return int
200236
*/
201-
public function getDecimals(): ?int
237+
public function getDecimals()
202238
{
203239
return $this->maxDecimals;
204240
}
205241

206242
/**
207243
* Get the maximum number of decimals.
244+
*
245+
* @return int
208246
*/
209-
public function getMaxDecimals(): ?int
247+
public function getMaxDecimals()
210248
{
211249
return $this->maxDecimals;
212250
}
213251

214252
/**
215253
* Get the minimum number of decimals.
254+
*
255+
* @return int
216256
*/
217-
public function getMinDecimals(): ?int
257+
public function getMinDecimals()
218258
{
219259
return $this->minDecimals;
220260
}
221261

222262
/**
223263
* Set locale to use instead of the default.
264+
*
265+
* @param string $locale
266+
* @return $this
224267
*/
225-
public function setLocale(?string $locale): self
268+
public function setLocale($locale)
226269
{
227-
$this->locale = $locale;
270+
$this->locale = (string) $locale;
228271
return $this;
229272
}
230273

231274
/**
232275
* Get the locale to use
276+
*
277+
* @return string
233278
*/
234-
public function getLocale(): string
279+
public function getLocale()
235280
{
236281
if ($this->locale === null) {
237282
$this->locale = Locale::getDefault();
@@ -243,15 +288,16 @@ public function getLocale(): string
243288
/**
244289
* @return array<int, string>
245290
*/
246-
public function getTextAttributes(): array
291+
public function getTextAttributes()
247292
{
248293
return $this->textAttributes;
249294
}
250295

251296
/**
252297
* @param array<int, string> $textAttributes
298+
* @return $this
253299
*/
254-
public function setTextAttributes(array $textAttributes): self
300+
public function setTextAttributes(array $textAttributes)
255301
{
256302
$this->textAttributes = $textAttributes;
257303
return $this;

0 commit comments

Comments
 (0)