Skip to content

Commit

Permalink
Fixes Stylish (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis authored Jul 8, 2023
1 parent 7c9b8e9 commit 277248c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/Dates.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class Dates
/**
* Convert to timestamp.
*/
public static function toStamp(\DateTime|int|string $time = null, bool $currentIsDefault = true): int
public static function toStamp(\DateTime|int|string|null $time = null, bool $currentIsDefault = true): int
{
if ($time instanceof \DateTime) {
return (int)$time->format('U');
Expand All @@ -51,7 +51,7 @@ public static function toStamp(\DateTime|int|string $time = null, bool $currentI
/**
* Build PHP \DateTime object from mixed input.
*/
public static function factory(mixed $time = null, \DateTimeZone|string $timeZone = null): \DateTime
public static function factory(mixed $time = null, \DateTimeZone|string|null $timeZone = null): \DateTime
{
$timeZone = self::timezone($timeZone);

Expand All @@ -68,7 +68,7 @@ public static function factory(mixed $time = null, \DateTimeZone|string $timeZon
/**
* Returns a DateTimeZone object based on the current timezone.
*/
public static function timezone(\DateTimeZone|string $timezone = null): \DateTimeZone
public static function timezone(\DateTimeZone|string|null $timezone = null): \DateTimeZone
{
if ($timezone instanceof \DateTimeZone) {
return $timezone;
Expand All @@ -94,7 +94,7 @@ public static function is(?string $date): bool
/**
* Convert time for sql format.
*/
public static function sql(int|string $time = null): string
public static function sql(int|string|null $time = null): string
{
return self::factory($time)->format(self::SQL_FORMAT);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public static function trimExtend(string $value): string
/**
* Cleanup array. No empty values.
*/
public static function arr(mixed $value, string|\Closure $filter = null): array
public static function arr(mixed $value, string|\Closure|null $filter = null): array
{
$array = (array)$value;

Expand Down
2 changes: 1 addition & 1 deletion src/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static function buildAll(

foreach ($allKeys as $key) {
$strip = 'URL_STRIP_' . \strtoupper($key);
if (($flags & (int)\constant(__CLASS__ . '::' . $strip)) > 0) {
if (($flags & \constant(__CLASS__ . '::' . $strip)) > 0) {
$url->remove($key);
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class EmailTest extends PHPUnit
{
/**
* @dataProvider getCheckProvider
* @dataProvider provideCheckCases
* @param mixed $input
* @param mixed $outcome
*/
Expand All @@ -40,7 +40,7 @@ public function testCheckWithEmptyEmails($input): void
}

/**
* @dataProvider getDomainsProvider
* @dataProvider provideGetDomainsCases
* @param mixed $input
* @param mixed $outcome
*/
Expand All @@ -64,7 +64,7 @@ public function testGetDomainsWithStringParam(): void
}

/**
* @dataProvider getDomainsSortedProvider
* @dataProvider provideGetDomainsInAlphabeticalOrderCases
* @param mixed $input
* @param mixed $outcome
*/
Expand All @@ -79,7 +79,7 @@ public function testGetDomainsInAlphabeticalOrderWithOneSizeArray(): void
}

/**
* @dataProvider getGravatarUrlProvider
* @dataProvider provideGetGravatarUrlCases
* @param mixed $input
* @param mixed $expectedHttp
* @param mixed $expectedHttps
Expand All @@ -99,7 +99,7 @@ public function testGetGravatarUrlWithEmptyEmails(): void
is(null, Email::getGravatarUrl(''));
}

public function getCheckProvider(): array
public function provideCheckCases(): array
{
return [
[
Expand Down Expand Up @@ -128,7 +128,7 @@ public function getCheckProvider(): array
];
}

public function getDomainsProvider(): array
public function provideGetDomainsCases(): array
{
return [
[
Expand Down Expand Up @@ -166,7 +166,7 @@ public function getDomainsProvider(): array
];
}

public function getDomainsSortedProvider()
public function provideGetDomainsInAlphabeticalOrderCases()
{
return [
[
Expand Down Expand Up @@ -204,7 +204,7 @@ public function getEmptyProvider(): array
return [[[]], [false], [''], [0]];
}

public function getGravatarUrlProvider(): array
public function provideGetGravatarUrlCases(): array
{
return [
0 => [
Expand Down
4 changes: 2 additions & 2 deletions tests/EnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class EnvTest extends PHPUnit
{
public function dataProvider(): array
public function provideConvertOptionsCases(): array
{
return [
['NULL', Env::VAR_NULL, null],
Expand Down Expand Up @@ -53,7 +53,7 @@ public function dataProvider(): array
}

/**
* @dataProvider dataProvider
* @dataProvider provideConvertOptionsCases
* @param mixed $value
* @param int $options
* @param mixed $expected
Expand Down
12 changes: 6 additions & 6 deletions tests/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class FilterTest extends PHPUnit
{
/**
* @dataProvider providerInt
* @dataProvider provideIntCases
* @param mixed $exepted
* @param mixed $actual
*/
Expand All @@ -32,7 +32,7 @@ public function testInt($exepted, $actual): void
isSame($exepted, Filter::_($actual, 'int'));
}

public function providerInt(): array
public function provideIntCases(): array
{
return [
[0, null],
Expand All @@ -56,7 +56,7 @@ public function providerInt(): array
}

/**
* @dataProvider providerFloat
* @dataProvider provideFloatCases
* @param mixed $excepted
* @param mixed $actual
* @param null|mixed $round
Expand All @@ -70,7 +70,7 @@ public function testFloat($excepted, $actual, $round = null): void
}
}

public function providerFloat(): array
public function provideFloatCases(): array
{
return [
[0.0, null],
Expand Down Expand Up @@ -103,7 +103,7 @@ public function providerFloat(): array
}

/**
* @dataProvider providerBool
* @dataProvider provideBoolCases
* @param mixed $excepted
* @param mixed $actual
*/
Expand All @@ -112,7 +112,7 @@ public function testBool($excepted, $actual): void
isSame($excepted, Filter::_($actual, 'bool'));
}

public function providerBool(): array
public function provideBoolCases(): array
{
return [
[true, '1'],
Expand Down
8 changes: 4 additions & 4 deletions tests/TimerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class TimerTest extends PHPUnit
{
/**
* @dataProvider secondsProvider
* @dataProvider provideSecondsToTimeStringCases
* @param string $string
* @param mixed $seconds
*/
Expand All @@ -34,7 +34,7 @@ public function testSecondsToTimeString($string, $seconds): void
}

/**
* @dataProvider milliSecondsProvider
* @dataProvider provideSecondsToTimeStringInMillisecondCases
* @param string $string
* @param mixed $seconds
*/
Expand All @@ -53,7 +53,7 @@ public function testTimeSinceStart(): void
isTrue(Timer::timeSinceStart() > 0);
}

public function milliSecondsProvider(): array
public function provideSecondsToTimeStringInMillisecondCases(): array
{
return [
['1 000 ms', 1],
Expand All @@ -72,7 +72,7 @@ public function milliSecondsProvider(): array
];
}

public function secondsProvider(): array
public function provideSecondsToTimeStringCases(): array
{
return [
['0 ms', 0],
Expand Down

0 comments on commit 277248c

Please sign in to comment.