10
10
namespace PHPUnit \Framework \MockObject \Generator ;
11
11
12
12
use const PHP_EOL ;
13
- use const PHP_VERSION ;
14
13
use function array_merge ;
15
14
use function array_pop ;
16
15
use function array_unique ;
23
22
use function interface_exists ;
24
23
use function is_array ;
25
24
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 ;
34
33
use Exception ;
35
34
use Iterator ;
36
35
use IteratorAggregate ;
49
48
use ReflectionClass ;
50
49
use ReflectionMethod ;
51
50
use ReflectionObject ;
51
+ use ReflectionProperty ;
52
52
use SebastianBergmann \Type \ReflectionMapper ;
53
53
use SebastianBergmann \Type \Type ;
54
54
use Throwable ;
@@ -815,7 +815,7 @@ private function configurableMethods(DoubledMethodSet $methods, array $propertie
815
815
*/
816
816
private function properties (?ReflectionClass $ class ): array
817
817
{
818
- if (version_compare ( ' 8.4.1 ' , PHP_VERSION , ' > ' )) {
818
+ if (! method_exists (ReflectionProperty::class, ' isFinal ' )) {
819
819
// @codeCoverageIgnoreStart
820
820
return [];
821
821
// @codeCoverageIgnoreEnd
@@ -829,6 +829,12 @@ private function properties(?ReflectionClass $class): array
829
829
$ properties = [];
830
830
831
831
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
+
832
838
if (!$ property ->isPublic ()) {
833
839
continue ;
834
840
}
0 commit comments