Skip to content

Commit 986139f

Browse files
committed
removed old stuff
1 parent 470986e commit 986139f

File tree

9 files changed

+14
-33
lines changed

9 files changed

+14
-33
lines changed

src/Utils/Arrays.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use JetBrains\PhpStorm\Language;
1313
use Nette;
1414
use function array_combine, array_intersect_key, array_is_list, array_key_exists, array_key_first, array_key_last, array_keys, array_reverse, array_search, array_slice, array_walk_recursive, count, func_num_args, in_array, is_array, is_int, is_object, key, preg_split, range;
15-
use const PHP_VERSION_ID, PREG_GREP_INVERT, PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_NO_EMPTY;
15+
use const PREG_GREP_INVERT, PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_NO_EMPTY;
1616

1717

1818
/**
@@ -278,11 +278,7 @@ public static function flatten(array $array, bool $preserveKeys = false): array
278278
*/
279279
public static function isList(mixed $value): bool
280280
{
281-
return is_array($value) && (
282-
PHP_VERSION_ID < 80100
283-
? !$value || array_keys($value) === range(0, count($value) - 1)
284-
: array_is_list($value)
285-
);
281+
return is_array($value) && array_is_list($value);
286282
}
287283

288284

src/Utils/Reflection.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Nette;
1313
use function constant, current, defined, end, explode, file_get_contents, implode, ltrim, next, ord, strrchr, strtolower, substr;
14-
use const PHP_VERSION_ID, T_AS, T_CLASS, T_COMMENT, T_CURLY_OPEN, T_DOC_COMMENT, T_DOLLAR_OPEN_CURLY_BRACES, T_ENUM, T_INTERFACE, T_NAME_FULLY_QUALIFIED, T_NAME_QUALIFIED, T_NAMESPACE, T_NS_SEPARATOR, T_STRING, T_TRAIT, T_USE, T_WHITESPACE, TOKEN_PARSE;
14+
use const T_AS, T_CLASS, T_COMMENT, T_CURLY_OPEN, T_DOC_COMMENT, T_DOLLAR_OPEN_CURLY_BRACES, T_ENUM, T_INTERFACE, T_NAME_FULLY_QUALIFIED, T_NAME_QUALIFIED, T_NAMESPACE, T_NS_SEPARATOR, T_STRING, T_TRAIT, T_USE, T_WHITESPACE, TOKEN_PARSE;
1515

1616

1717
/**
@@ -137,9 +137,7 @@ public static function toString(\Reflector $ref): string
137137
} elseif ($ref instanceof \ReflectionMethod) {
138138
return $ref->getDeclaringClass()->name . '::' . $ref->name . '()';
139139
} elseif ($ref instanceof \ReflectionFunction) {
140-
return PHP_VERSION_ID >= 80200 && $ref->isAnonymous()
141-
? '{closure}()'
142-
: $ref->name . '()';
140+
return $ref->isAnonymous() ? '{closure}()' : $ref->name . '()';
143141
} elseif ($ref instanceof \ReflectionProperty) {
144142
return self::getPropertyDeclaringClass($ref)->name . '::$' . $ref->name;
145143
} elseif ($ref instanceof \ReflectionParameter) {
@@ -241,7 +239,7 @@ private static function parseUseStatements(string $code, ?string $forClass = nul
241239
case T_CLASS:
242240
case T_INTERFACE:
243241
case T_TRAIT:
244-
case PHP_VERSION_ID < 80100 ? T_CLASS : T_ENUM:
242+
case T_ENUM:
245243
if ($name = self::fetch($tokens, T_STRING)) {
246244
$class = $namespace . $name;
247245
$classLevel = $level + 1;

src/Utils/Type.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use Nette;
1313
use function array_map, array_search, array_splice, count, explode, implode, is_a, is_string, strcasecmp, strtolower, substr, trim;
14-
use const PHP_VERSION_ID;
1514

1615

1716
/**
@@ -34,7 +33,7 @@ public static function fromReflection(
3433
): ?self
3534
{
3635
$type = $reflection instanceof \ReflectionFunctionAbstract
37-
? $reflection->getReturnType() ?? (PHP_VERSION_ID >= 80100 && $reflection instanceof \ReflectionMethod ? $reflection->getTentativeReturnType() : null)
36+
? $reflection->getReturnType() ?? ($reflection instanceof \ReflectionMethod ? $reflection->getTentativeReturnType() : null)
3837
: $reflection->getType();
3938

4039
return $type ? self::fromReflectionType($type, $reflection, asObject: true) : null;

tests/Utils/DateTime.from.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Assert::same('1978-01-23 11:40:00', (string) (new DateTime)->setTimestamp(254_40
1919
Assert::same(254_400_000, DateTime::from(254_400_000)->getTimestamp());
2020

2121
Assert::same(time() + 60, (int) DateTime::from(60)->format('U'));
22-
Assert::same(PHP_VERSION_ID < 80100 ? '2050-08-13 11:40:00' : '2050-08-13 12:40:00', (string) DateTime::from(2_544_000_000));
23-
Assert::same(PHP_VERSION_ID < 80100 ? '2050-08-13 11:40:00' : '2050-08-13 12:40:00', (string) (new DateTime)->setTimestamp(2_544_000_000));
22+
Assert::same('2050-08-13 12:40:00', (string) DateTime::from(2_544_000_000));
23+
Assert::same('2050-08-13 12:40:00', (string) (new DateTime)->setTimestamp(2_544_000_000));
2424
Assert::same(is_int(2_544_000_000) ? 2_544_000_000 : '2544000000', DateTime::from(2_544_000_000)->getTimestamp()); // 64 bit
2525

2626
Assert::same('1978-05-05 00:00:00', (string) DateTime::from('1978-05-05'));

tests/Utils/Image.save.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Assert::exception(
9191

9292

9393
test('saving palette-based as WEBP should fail without creating file', function () {
94-
if (!Image::isTypeSupported(Image::WEBP) || PHP_VERSION_ID < 80200) {
94+
if (!Image::isTypeSupported(Image::WEBP)) {
9595
return;
9696
}
9797

tests/Utils/Reflection.expandClassName.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ require __DIR__ . '/../bootstrap.php';
1515
require __DIR__ . '/fixtures.reflection/expandClass.noNamespace.php';
1616
require __DIR__ . '/fixtures.reflection/expandClass.inBracketedNamespace.php';
1717
require __DIR__ . '/fixtures.reflection/expandClass.inNamespace.php';
18+
require __DIR__ . '/fixtures.reflection/expandClass.special.php';
1819

19-
if (PHP_VERSION_ID >= 80100) {
20-
require __DIR__ . '/fixtures.reflection/expandClass.special.php';
21-
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(T::class)));
22-
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(I::class)));
23-
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(E::class)));
24-
}
20+
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(T::class)));
21+
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(I::class)));
22+
Assert::same('A\B', Reflection::expandClassName('C', new ReflectionClass(E::class)));
2523

2624
$rcTest = new ReflectionClass(Test::class);
2725
$rcBTest = new ReflectionClass(BTest::class);

tests/Utils/SmartObject.undeclaredMethod.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ Assert::exception(
131131
Assert::exception(
132132
fn() => $obj->callPrivateParent(),
133133
Nette\MemberAccessException::class,
134-
PHP_VERSION_ID < 80100
135-
? 'Call to undefined static method InterClass::callPrivateParent().' // differs from native error message
136-
: 'Call to undefined method InterClass::callPrivateParent().',
134+
'Call to undefined method InterClass::callPrivateParent().',
137135
);
138136

139137
Assert::exception(

tests/Utils/Type.fromReflection.function.81.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<?php
22

3-
/**
4-
* @phpversion 8.1
5-
*/
6-
73
declare(strict_types=1);
84

95
use Nette\Utils\Type;

tests/Utils/Type.fromReflection.function.82.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<?php
22

3-
/**
4-
* @phpversion 8.2
5-
*/
6-
73
declare(strict_types=1);
84

95
use Nette\Utils\Type;

0 commit comments

Comments
 (0)