Skip to content

Commit 54042c6

Browse files
committed
cs
1 parent b75a879 commit 54042c6

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

ncs.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@
1111
// use function in Arrays.php, Callback.php, Html.php, Strings.php
1212
'single_import_per_statement' => false,
1313
'ordered_imports' => false,
14-
// Reflection.php
15-
'Nette/statement_indentation' => false,
1614
];

src/Utils/Arrays.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static function flatten(array $array, bool $preserveKeys = false): array
265265
$res = [];
266266
$cb = $preserveKeys
267267
? function ($v, $k) use (&$res): void { $res[$k] = $v; }
268-
: function ($v) use (&$res): void { $res[] = $v; };
268+
: function ($v) use (&$res): void { $res[] = $v; };
269269
array_walk_recursive($array, $cb);
270270
return $res;
271271
}

src/Utils/DateTime.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,9 @@ public static function fromParts(
7676
$s = sprintf('%04d-%02d-%02d %02d:%02d:%02.5F', $year, $month, $day, $hour, $minute, $second);
7777
if (
7878
!checkdate($month, $day, $year)
79-
|| $hour < 0
80-
|| $hour > 23
81-
|| $minute < 0
82-
|| $minute > 59
83-
|| $second < 0
84-
|| $second >= 60
79+
|| $hour < 0 || $hour > 23
80+
|| $minute < 0 || $minute > 59
81+
|| $second < 0 || $second >= 60
8582
) {
8683
throw new Nette\InvalidArgumentException("Invalid date '$s'");
8784
}
@@ -91,11 +88,11 @@ public static function fromParts(
9188

9289

9390
/**
94-
* Returns new DateTime object formatted according to the specified format.
91+
* Returns a new DateTime object formatted according to the specified format.
9592
*/
9693
public static function createFromFormat(
9794
string $format,
98-
string $time,
95+
string $datetime,
9996
string|\DateTimeZone|null $timezone = null,
10097
): static|false
10198
{
@@ -106,7 +103,7 @@ public static function createFromFormat(
106103
$timezone = new \DateTimeZone($timezone);
107104
}
108105

109-
$date = parent::createFromFormat($format, $time, $timezone);
106+
$date = parent::createFromFormat($format, $datetime, $timezone);
110107
return $date ? static::from($date) : false;
111108
}
112109

src/Utils/Finder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function date(string $operator, string|int|\DateTimeInterface|null $date
299299
$operator = $operator ?: '=';
300300
}
301301

302-
$date = DateTime::from($date)->format('U');
302+
$date = DateTime::from($date)->getTimestamp();
303303
return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getMTime(), $operator, $date));
304304
}
305305

src/Utils/Reflection.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ private static function parseUseStatements(string $code, ?string $forClass = nul
240240
case T_CLASS:
241241
case T_INTERFACE:
242242
case T_TRAIT:
243-
case PHP_VERSION_ID < 80100
244-
? T_CLASS
245-
: T_ENUM:
243+
case PHP_VERSION_ID < 80100 ? T_CLASS : T_ENUM:
246244
if ($name = self::fetch($tokens, T_STRING)) {
247245
$class = $namespace . $name;
248246
$classLevel = $level + 1;

0 commit comments

Comments
 (0)