diff --git a/src/Reflection/ReflectionMethod.php b/src/Reflection/ReflectionMethod.php index 69b82b4a8..a4d9999b4 100644 --- a/src/Reflection/ReflectionMethod.php +++ b/src/Reflection/ReflectionMethod.php @@ -427,7 +427,7 @@ private function callStaticMethod(array $args): mixed $implementingClassName = $this->getImplementingClass()->getName(); /** @psalm-suppress InvalidStringClass */ - $closure = Closure::bind(fn (string $implementingClassName, string $_methodName, array $methodArgs): mixed => $implementingClassName::{$_methodName}(...$methodArgs), null, $implementingClassName); + $closure = Closure::bind(static fn (string $implementingClassName, string $_methodName, array $methodArgs): mixed => $implementingClassName::{$_methodName}(...$methodArgs), null, $implementingClassName); assert($closure instanceof Closure); @@ -438,7 +438,7 @@ private function callStaticMethod(array $args): mixed private function callObjectMethod(object $object, array $args): mixed { /** @psalm-suppress MixedMethodCall */ - $closure = Closure::bind(fn (object $object, string $methodName, array $methodArgs): mixed => $object->{$methodName}(...$methodArgs), $object, $this->getImplementingClass()->getName()); + $closure = Closure::bind(static fn (object $object, string $methodName, array $methodArgs): mixed => $object->{$methodName}(...$methodArgs), $object, $this->getImplementingClass()->getName()); assert($closure instanceof Closure); diff --git a/src/Reflection/ReflectionProperty.php b/src/Reflection/ReflectionProperty.php index 52a65f341..f66895cb3 100644 --- a/src/Reflection/ReflectionProperty.php +++ b/src/Reflection/ReflectionProperty.php @@ -460,7 +460,7 @@ public function getValue(object|null $object = null): mixed $instance = $this->assertObject($object); - $closure = Closure::bind(fn (object $instance, string $propertyName): mixed => $instance->{$propertyName}, $instance, $implementingClassName); + $closure = Closure::bind(static fn (object $instance, string $propertyName): mixed => $instance->{$propertyName}, $instance, $implementingClassName); assert($closure instanceof Closure); @@ -494,7 +494,7 @@ public function setValue(mixed $object, mixed $value = null): void $instance = $this->assertObject($object); - $closure = Closure::bind(function (object $instance, string $propertyName, mixed $value): void { + $closure = Closure::bind(static function (object $instance, string $propertyName, mixed $value): void { $instance->{$propertyName} = $value; }, $instance, $implementingClassName);