Skip to content

Commit 277248c

Browse files
authored
Fixes Stylish (#39)
1 parent 7c9b8e9 commit 277248c

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

src/Dates.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class Dates
3131
/**
3232
* Convert to timestamp.
3333
*/
34-
public static function toStamp(\DateTime|int|string $time = null, bool $currentIsDefault = true): int
34+
public static function toStamp(\DateTime|int|string|null $time = null, bool $currentIsDefault = true): int
3535
{
3636
if ($time instanceof \DateTime) {
3737
return (int)$time->format('U');
@@ -51,7 +51,7 @@ public static function toStamp(\DateTime|int|string $time = null, bool $currentI
5151
/**
5252
* Build PHP \DateTime object from mixed input.
5353
*/
54-
public static function factory(mixed $time = null, \DateTimeZone|string $timeZone = null): \DateTime
54+
public static function factory(mixed $time = null, \DateTimeZone|string|null $timeZone = null): \DateTime
5555
{
5656
$timeZone = self::timezone($timeZone);
5757

@@ -68,7 +68,7 @@ public static function factory(mixed $time = null, \DateTimeZone|string $timeZon
6868
/**
6969
* Returns a DateTimeZone object based on the current timezone.
7070
*/
71-
public static function timezone(\DateTimeZone|string $timezone = null): \DateTimeZone
71+
public static function timezone(\DateTimeZone|string|null $timezone = null): \DateTimeZone
7272
{
7373
if ($timezone instanceof \DateTimeZone) {
7474
return $timezone;
@@ -94,7 +94,7 @@ public static function is(?string $date): bool
9494
/**
9595
* Convert time for sql format.
9696
*/
97-
public static function sql(int|string $time = null): string
97+
public static function sql(int|string|null $time = null): string
9898
{
9999
return self::factory($time)->format(self::SQL_FORMAT);
100100
}

src/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public static function trimExtend(string $value): string
247247
/**
248248
* Cleanup array. No empty values.
249249
*/
250-
public static function arr(mixed $value, string|\Closure $filter = null): array
250+
public static function arr(mixed $value, string|\Closure|null $filter = null): array
251251
{
252252
$array = (array)$value;
253253

src/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public static function buildAll(
302302

303303
foreach ($allKeys as $key) {
304304
$strip = 'URL_STRIP_' . \strtoupper($key);
305-
if (($flags & (int)\constant(__CLASS__ . '::' . $strip)) > 0) {
305+
if (($flags & \constant(__CLASS__ . '::' . $strip)) > 0) {
306306
$url->remove($key);
307307
}
308308
}

tests/EmailTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class EmailTest extends PHPUnit
2222
{
2323
/**
24-
* @dataProvider getCheckProvider
24+
* @dataProvider provideCheckCases
2525
* @param mixed $input
2626
* @param mixed $outcome
2727
*/
@@ -40,7 +40,7 @@ public function testCheckWithEmptyEmails($input): void
4040
}
4141

4242
/**
43-
* @dataProvider getDomainsProvider
43+
* @dataProvider provideGetDomainsCases
4444
* @param mixed $input
4545
* @param mixed $outcome
4646
*/
@@ -64,7 +64,7 @@ public function testGetDomainsWithStringParam(): void
6464
}
6565

6666
/**
67-
* @dataProvider getDomainsSortedProvider
67+
* @dataProvider provideGetDomainsInAlphabeticalOrderCases
6868
* @param mixed $input
6969
* @param mixed $outcome
7070
*/
@@ -79,7 +79,7 @@ public function testGetDomainsInAlphabeticalOrderWithOneSizeArray(): void
7979
}
8080

8181
/**
82-
* @dataProvider getGravatarUrlProvider
82+
* @dataProvider provideGetGravatarUrlCases
8383
* @param mixed $input
8484
* @param mixed $expectedHttp
8585
* @param mixed $expectedHttps
@@ -99,7 +99,7 @@ public function testGetGravatarUrlWithEmptyEmails(): void
9999
is(null, Email::getGravatarUrl(''));
100100
}
101101

102-
public function getCheckProvider(): array
102+
public function provideCheckCases(): array
103103
{
104104
return [
105105
[
@@ -128,7 +128,7 @@ public function getCheckProvider(): array
128128
];
129129
}
130130

131-
public function getDomainsProvider(): array
131+
public function provideGetDomainsCases(): array
132132
{
133133
return [
134134
[
@@ -166,7 +166,7 @@ public function getDomainsProvider(): array
166166
];
167167
}
168168

169-
public function getDomainsSortedProvider()
169+
public function provideGetDomainsInAlphabeticalOrderCases()
170170
{
171171
return [
172172
[
@@ -204,7 +204,7 @@ public function getEmptyProvider(): array
204204
return [[[]], [false], [''], [0]];
205205
}
206206

207-
public function getGravatarUrlProvider(): array
207+
public function provideGetGravatarUrlCases(): array
208208
{
209209
return [
210210
0 => [

tests/EnvTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
class EnvTest extends PHPUnit
2626
{
27-
public function dataProvider(): array
27+
public function provideConvertOptionsCases(): array
2828
{
2929
return [
3030
['NULL', Env::VAR_NULL, null],
@@ -53,7 +53,7 @@ public function dataProvider(): array
5353
}
5454

5555
/**
56-
* @dataProvider dataProvider
56+
* @dataProvider provideConvertOptionsCases
5757
* @param mixed $value
5858
* @param int $options
5959
* @param mixed $expected

tests/FilterTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class FilterTest extends PHPUnit
2424
{
2525
/**
26-
* @dataProvider providerInt
26+
* @dataProvider provideIntCases
2727
* @param mixed $exepted
2828
* @param mixed $actual
2929
*/
@@ -32,7 +32,7 @@ public function testInt($exepted, $actual): void
3232
isSame($exepted, Filter::_($actual, 'int'));
3333
}
3434

35-
public function providerInt(): array
35+
public function provideIntCases(): array
3636
{
3737
return [
3838
[0, null],
@@ -56,7 +56,7 @@ public function providerInt(): array
5656
}
5757

5858
/**
59-
* @dataProvider providerFloat
59+
* @dataProvider provideFloatCases
6060
* @param mixed $excepted
6161
* @param mixed $actual
6262
* @param null|mixed $round
@@ -70,7 +70,7 @@ public function testFloat($excepted, $actual, $round = null): void
7070
}
7171
}
7272

73-
public function providerFloat(): array
73+
public function provideFloatCases(): array
7474
{
7575
return [
7676
[0.0, null],
@@ -103,7 +103,7 @@ public function providerFloat(): array
103103
}
104104

105105
/**
106-
* @dataProvider providerBool
106+
* @dataProvider provideBoolCases
107107
* @param mixed $excepted
108108
* @param mixed $actual
109109
*/
@@ -112,7 +112,7 @@ public function testBool($excepted, $actual): void
112112
isSame($excepted, Filter::_($actual, 'bool'));
113113
}
114114

115-
public function providerBool(): array
115+
public function provideBoolCases(): array
116116
{
117117
return [
118118
[true, '1'],

tests/TimerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class TimerTest extends PHPUnit
2525
{
2626
/**
27-
* @dataProvider secondsProvider
27+
* @dataProvider provideSecondsToTimeStringCases
2828
* @param string $string
2929
* @param mixed $seconds
3030
*/
@@ -34,7 +34,7 @@ public function testSecondsToTimeString($string, $seconds): void
3434
}
3535

3636
/**
37-
* @dataProvider milliSecondsProvider
37+
* @dataProvider provideSecondsToTimeStringInMillisecondCases
3838
* @param string $string
3939
* @param mixed $seconds
4040
*/
@@ -53,7 +53,7 @@ public function testTimeSinceStart(): void
5353
isTrue(Timer::timeSinceStart() > 0);
5454
}
5555

56-
public function milliSecondsProvider(): array
56+
public function provideSecondsToTimeStringInMillisecondCases(): array
5757
{
5858
return [
5959
['1 000 ms', 1],
@@ -72,7 +72,7 @@ public function milliSecondsProvider(): array
7272
];
7373
}
7474

75-
public function secondsProvider(): array
75+
public function provideSecondsToTimeStringCases(): array
7676
{
7777
return [
7878
['0 ms', 0],

0 commit comments

Comments
 (0)