Skip to content

Commit f90b6c4

Browse files
Merge branch '11.5'
2 parents c65e8be + bcfa1c9 commit f90b6c4

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
@@ -10,7 +10,6 @@
1010
namespace PHPUnit\Framework\MockObject\Generator;
1111

1212
use const PHP_EOL;
13-
use const PHP_VERSION;
1413
use function array_merge;
1514
use function array_pop;
1615
use function array_unique;
@@ -23,14 +22,14 @@
2322
use function interface_exists;
2423
use function is_array;
2524
use function md5;
25+
use function method_exists;
2626
use function mt_rand;
2727
use function preg_match;
2828
use function serialize;
2929
use function sort;
3030
use function sprintf;
3131
use function substr;
3232
use function trait_exists;
33-
use function version_compare;
3433
use Exception;
3534
use Iterator;
3635
use IteratorAggregate;
@@ -49,6 +48,7 @@
4948
use ReflectionClass;
5049
use ReflectionMethod;
5150
use ReflectionObject;
51+
use ReflectionProperty;
5252
use SebastianBergmann\Type\ReflectionMapper;
5353
use SebastianBergmann\Type\Type;
5454
use Throwable;
@@ -815,7 +815,7 @@ private function configurableMethods(DoubledMethodSet $methods, array $propertie
815815
*/
816816
private function properties(?ReflectionClass $class): array
817817
{
818-
if (version_compare('8.4.1', PHP_VERSION, '>')) {
818+
if (!method_exists(ReflectionProperty::class, 'isFinal')) {
819819
// @codeCoverageIgnoreStart
820820
return [];
821821
// @codeCoverageIgnoreEnd
@@ -829,6 +829,12 @@ private function properties(?ReflectionClass $class): array
829829
$properties = [];
830830

831831
foreach ($class->getProperties() as $property) {
832+
assert(method_exists($property, 'getHook'));
833+
assert(method_exists($property, 'hasHooks'));
834+
assert(method_exists($property, 'hasHook'));
835+
assert(method_exists($property, 'isFinal'));
836+
assert(class_exists(PropertyHookType::class));
837+
832838
if (!$property->isPublic()) {
833839
continue;
834840
}

0 commit comments

Comments
 (0)