getName() : $property; if (array_key_exists($cacheName, static::$propertiesCache)) { return static::$propertiesCache[$cacheName]; } try { $reflectionMethod = $instance !== null ? new ReflectionMethod($instance, $property) : new ReflectionMethod($property); } catch (ReflectionException $exception) { throw new InvalidArgumentException(sprintf('Method %s does not exist', $property)); } $mandatoryParameters = array_filter( $reflectionMethod->getParameters(), static fn(ReflectionParameter $parameter): bool => ! $parameter->isOptional() ); return static::$propertiesCache[$cacheName] = empty($mandatoryParameters); } }