10
10
namespace PHPUnit \Framework \MockObject \Generator ;
11
11
12
12
use const PHP_EOL ;
13
+ use const PHP_VERSION ;
13
14
use function array_merge ;
14
15
use function array_pop ;
15
16
use function array_unique ;
22
23
use function interface_exists ;
23
24
use function is_array ;
24
25
use function md5 ;
25
- use function method_exists ;
26
26
use function mt_rand ;
27
27
use function preg_match ;
28
28
use function serialize ;
29
29
use function sort ;
30
30
use function sprintf ;
31
31
use function substr ;
32
32
use function trait_exists ;
33
+ use function version_compare ;
33
34
use Exception ;
34
35
use Iterator ;
35
36
use IteratorAggregate ;
48
49
use ReflectionClass ;
49
50
use ReflectionMethod ;
50
51
use ReflectionObject ;
51
- use ReflectionProperty ;
52
52
use SebastianBergmann \Type \ReflectionMapper ;
53
53
use SebastianBergmann \Type \Type ;
54
54
use Throwable ;
@@ -824,7 +824,7 @@ private function configurableMethods(DoubledMethodSet $methods, array $propertie
824
824
*/
825
825
private function properties (?ReflectionClass $ class ): array
826
826
{
827
- if (! method_exists (ReflectionProperty::class, ' isFinal ' )) {
827
+ if (version_compare ( ' 8.4.1 ' , PHP_VERSION , ' > ' )) {
828
828
// @codeCoverageIgnoreStart
829
829
return [];
830
830
// @codeCoverageIgnoreEnd
@@ -838,12 +838,6 @@ private function properties(?ReflectionClass $class): array
838
838
$ properties = [];
839
839
840
840
foreach ($ class ->getProperties () as $ property ) {
841
- assert (method_exists ($ property , 'getHook ' ));
842
- assert (method_exists ($ property , 'hasHooks ' ));
843
- assert (method_exists ($ property , 'hasHook ' ));
844
- assert (method_exists ($ property , 'isFinal ' ));
845
- assert (class_exists (PropertyHookType::class));
846
-
847
841
if (!$ property ->isPublic ()) {
848
842
continue ;
849
843
}
0 commit comments