Skip to content

Commit d775d50

Browse files
Merge branch '11.5' into 12.2
2 parents 3b62935 + 765a31e commit d775d50

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ parameters:
5959
- '#Instanceof between .* and .* will always evaluate to true.#'
6060
- '#Strict comparison using !== between .*non-empty-string.* and .* will always evaluate to true.#'
6161
- '#Strict comparison using !== between .*non-falsy-string.* and .* will always evaluate to true.#'
62+
- '#Call to an undefined method ReflectionProperty::.*#'
63+
- '#Access to constant .* on an unknown class PropertyHookType.#'
6264
- identifier: argument.named
6365

6466
includes:

src/Framework/MockObject/Generator/Generator.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PHPUnit\Framework\MockObject\Generator;
1111

1212
use const PHP_EOL;
13+
use const PHP_VERSION;
1314
use function array_merge;
1415
use function array_pop;
1516
use function array_unique;
@@ -22,14 +23,14 @@
2223
use function interface_exists;
2324
use function is_array;
2425
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;
3334
use Exception;
3435
use Iterator;
3536
use IteratorAggregate;
@@ -48,7 +49,6 @@
4849
use ReflectionClass;
4950
use ReflectionMethod;
5051
use ReflectionObject;
51-
use ReflectionProperty;
5252
use SebastianBergmann\Type\ReflectionMapper;
5353
use SebastianBergmann\Type\Type;
5454
use Throwable;
@@ -824,7 +824,7 @@ private function configurableMethods(DoubledMethodSet $methods, array $propertie
824824
*/
825825
private function properties(?ReflectionClass $class): array
826826
{
827-
if (!method_exists(ReflectionProperty::class, 'isFinal')) {
827+
if (version_compare('8.4.1', PHP_VERSION, '>')) {
828828
// @codeCoverageIgnoreStart
829829
return [];
830830
// @codeCoverageIgnoreEnd
@@ -838,12 +838,6 @@ private function properties(?ReflectionClass $class): array
838838
$properties = [];
839839

840840
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-
847841
if (!$property->isPublic()) {
848842
continue;
849843
}

0 commit comments

Comments
 (0)