Skip to content

Commit aaaa1c9

Browse files
mbeccatinicolas-grekas
authored andcommitted
Update nullable types for PHP 8.4
1 parent 6a71d4e commit aaaa1c9

20 files changed

+30
-29
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a7548a261ad4bcdb675adceb6604cf1681b1f6e2

src/Intl/Icu/DateFormat/Hour1200Transformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function format(\DateTime $dateTime, int $length): string
2828
return $this->padLeft($hourOfDay, $length);
2929
}
3030

31-
public function normalizeHour(int $hour, string $marker = null): int
31+
public function normalizeHour(int $hour, ?string $marker = null): int
3232
{
3333
if ('PM' === $marker) {
3434
$hour += 12;

src/Intl/Icu/DateFormat/Hour1201Transformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function format(\DateTime $dateTime, int $length): string
2525
return $this->padLeft($dateTime->format('g'), $length);
2626
}
2727

28-
public function normalizeHour(int $hour, string $marker = null): int
28+
public function normalizeHour(int $hour, ?string $marker = null): int
2929
{
3030
if ('PM' !== $marker && 12 === $hour) {
3131
$hour = 0;

src/Intl/Icu/DateFormat/Hour2400Transformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function format(\DateTime $dateTime, int $length): string
2525
return $this->padLeft($dateTime->format('G'), $length);
2626
}
2727

28-
public function normalizeHour(int $hour, string $marker = null): int
28+
public function normalizeHour(int $hour, ?string $marker = null): int
2929
{
3030
if ('AM' === $marker) {
3131
$hour = 0;

src/Intl/Icu/DateFormat/Hour2401Transformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function format(\DateTime $dateTime, int $length): string
2828
return $this->padLeft($hourOfDay, $length);
2929
}
3030

31-
public function normalizeHour(int $hour, string $marker = null): int
31+
public function normalizeHour(int $hour, ?string $marker = null): int
3232
{
3333
if ((null === $marker && 24 === $hour) || 'AM' === $marker) {
3434
$hour = 0;

src/Intl/Icu/DateFormat/HourTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ abstract class HourTransformer extends Transformer
2828
*
2929
* @return int The normalized hour value
3030
*/
31-
abstract public function normalizeHour(int $hour, string $marker = null): int;
31+
abstract public function normalizeHour(int $hour, ?string $marker = null): int;
3232
}

src/Intl/Icu/IntlDateFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function __construct(?string $locale, ?int $dateType, ?int $timeType, $ti
193193
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
194194
* @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
195195
*/
196-
public static function create(?string $locale, ?int $dateType, ?int $timeType, $timezone = null, int $calendar = null, ?string $pattern = '')
196+
public static function create(?string $locale, ?int $dateType, ?int $timeType, $timezone = null, ?int $calendar = null, ?string $pattern = '')
197197
{
198198
return new static($locale, $dateType, $timeType, $timezone, $calendar, $pattern);
199199
}
@@ -276,7 +276,7 @@ public function format($datetime)
276276
*
277277
* @throws MethodNotImplementedException
278278
*/
279-
public static function formatObject($datetime, $format = null, string $locale = null)
279+
public static function formatObject($datetime, $format = null, ?string $locale = null)
280280
{
281281
throw new MethodNotImplementedException(__METHOD__);
282282
}

src/Intl/Icu/Locale.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static function getDefault()
147147
*
148148
* @throws MethodNotImplementedException
149149
*/
150-
public static function getDisplayLanguage(string $locale, string $displayLocale = null)
150+
public static function getDisplayLanguage(string $locale, ?string $displayLocale = null)
151151
{
152152
throw new MethodNotImplementedException(__METHOD__);
153153
}
@@ -161,7 +161,7 @@ public static function getDisplayLanguage(string $locale, string $displayLocale
161161
*
162162
* @throws MethodNotImplementedException
163163
*/
164-
public static function getDisplayName(string $locale, string $displayLocale = null)
164+
public static function getDisplayName(string $locale, ?string $displayLocale = null)
165165
{
166166
throw new MethodNotImplementedException(__METHOD__);
167167
}
@@ -175,7 +175,7 @@ public static function getDisplayName(string $locale, string $displayLocale = nu
175175
*
176176
* @throws MethodNotImplementedException
177177
*/
178-
public static function getDisplayRegion(string $locale, string $displayLocale = null)
178+
public static function getDisplayRegion(string $locale, ?string $displayLocale = null)
179179
{
180180
throw new MethodNotImplementedException(__METHOD__);
181181
}
@@ -189,7 +189,7 @@ public static function getDisplayRegion(string $locale, string $displayLocale =
189189
*
190190
* @throws MethodNotImplementedException
191191
*/
192-
public static function getDisplayScript(string $locale, string $displayLocale = null)
192+
public static function getDisplayScript(string $locale, ?string $displayLocale = null)
193193
{
194194
throw new MethodNotImplementedException(__METHOD__);
195195
}
@@ -203,7 +203,7 @@ public static function getDisplayScript(string $locale, string $displayLocale =
203203
*
204204
* @throws MethodNotImplementedException
205205
*/
206-
public static function getDisplayVariant(string $locale, string $displayLocale = null)
206+
public static function getDisplayVariant(string $locale, ?string $displayLocale = null)
207207
{
208208
throw new MethodNotImplementedException(__METHOD__);
209209
}
@@ -271,7 +271,7 @@ public static function getScript(string $locale)
271271
*
272272
* @throws MethodNotImplementedException
273273
*/
274-
public static function lookup(array $languageTag, string $locale, bool $canonicalize = false, string $defaultLocale = null)
274+
public static function lookup(array $languageTag, string $locale, bool $canonicalize = false, ?string $defaultLocale = null)
275275
{
276276
throw new MethodNotImplementedException(__METHOD__);
277277
}

src/Intl/Icu/NumberFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ abstract class NumberFormatter
254254
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
255255
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
256256
*/
257-
public function __construct(?string $locale = 'en', int $style = null, string $pattern = null)
257+
public function __construct(?string $locale = 'en', ?int $style = null, ?string $pattern = null)
258258
{
259259
if ('en' !== $locale && null !== $locale) {
260260
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported');
@@ -293,7 +293,7 @@ public function __construct(?string $locale = 'en', int $style = null, string $p
293293
* @throws MethodArgumentValueNotImplementedException When the $style is not supported
294294
* @throws MethodArgumentNotImplementedException When the pattern value is different than null
295295
*/
296-
public static function create(?string $locale = 'en', int $style = null, string $pattern = null)
296+
public static function create(?string $locale = 'en', ?int $style = null, ?string $pattern = null)
297297
{
298298
return new static($locale, $style, $pattern);
299299
}

src/Mbstring/Mbstring.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ public static function mb_ord($s, $encoding = null)
827827
return $code;
828828
}
829829

830-
public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null): string
830+
public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string
831831
{
832832
if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) {
833833
throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH');

0 commit comments

Comments
 (0)