Skip to content

Commit bcfa1c9

Browse files
Revert "Simplify after PHP 8.4.1 release"
This reverts commit 8da3b58.
1 parent 8da3b58 commit bcfa1c9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Framework/MockObject/Generator/Generator.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use const PHP_EOL;
1313
use const PHP_MAJOR_VERSION;
1414
use const PHP_MINOR_VERSION;
15-
use const PHP_VERSION;
1615
use const PREG_OFFSET_CAPTURE;
1716
use const WSDL_CACHE_NONE;
1817
use function array_merge;
@@ -29,6 +28,7 @@
2928
use function is_array;
3029
use function is_object;
3130
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,7 +42,6 @@
4242
use function strpos;
4343
use function substr;
4444
use function trait_exists;
45-
use function version_compare;
4645
use Exception;
4746
use Iterator;
4847
use IteratorAggregate;
@@ -69,6 +68,7 @@
6968
use ReflectionClass;
7069
use ReflectionMethod;
7170
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 (version_compare('8.4.1', PHP_VERSION, '>')) {
1221+
if (!method_exists(ReflectionProperty::class, 'isFinal')) {
12221222
// @codeCoverageIgnoreStart
12231223
return [];
12241224
// @codeCoverageIgnoreEnd
@@ -1232,6 +1232,12 @@ 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+
12351241
if (!$property->isPublic()) {
12361242
continue;
12371243
}

0 commit comments

Comments
 (0)