Skip to content

Commit 8da3b58

Browse files
Simplify after PHP 8.4.1 release
1 parent 8af2c41 commit 8da3b58

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/Framework/MockObject/Generator/Generator.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use const PHP_EOL;
1313
use const PHP_MAJOR_VERSION;
1414
use const PHP_MINOR_VERSION;
15+
use const PHP_VERSION;
1516
use const PREG_OFFSET_CAPTURE;
1617
use const WSDL_CACHE_NONE;
1718
use function array_merge;
@@ -28,7 +29,6 @@
2829
use function is_array;
2930
use function is_object;
3031
use function md5;
31-
use function method_exists;
3232
use function mt_rand;
3333
use function preg_match;
3434
use function preg_match_all;
@@ -42,6 +42,7 @@
4242
use function strpos;
4343
use function substr;
4444
use function trait_exists;
45+
use function version_compare;
4546
use Exception;
4647
use Iterator;
4748
use IteratorAggregate;
@@ -68,7 +69,6 @@
6869
use ReflectionClass;
6970
use ReflectionMethod;
7071
use ReflectionObject;
71-
use ReflectionProperty;
7272
use SebastianBergmann\Type\ReflectionMapper;
7373
use SebastianBergmann\Type\Type;
7474
use SoapClient;
@@ -1218,7 +1218,7 @@ private function configurableMethods(MockMethodSet $methods, array $propertiesWi
12181218
*/
12191219
private function properties(?ReflectionClass $class): array
12201220
{
1221-
if (!method_exists(ReflectionProperty::class, 'isFinal')) {
1221+
if (version_compare('8.4.1', PHP_VERSION, '>')) {
12221222
// @codeCoverageIgnoreStart
12231223
return [];
12241224
// @codeCoverageIgnoreEnd
@@ -1232,12 +1232,6 @@ private function properties(?ReflectionClass $class): array
12321232
$properties = [];
12331233

12341234
foreach ($class->getProperties() as $property) {
1235-
assert(method_exists($property, 'getHook'));
1236-
assert(method_exists($property, 'hasHooks'));
1237-
assert(method_exists($property, 'hasHook'));
1238-
assert(method_exists($property, 'isFinal'));
1239-
assert(class_exists(PropertyHookType::class));
1240-
12411235
if (!$property->isPublic()) {
12421236
continue;
12431237
}

0 commit comments

Comments
 (0)