numberOfParameters = $numberOfParameters; } /** * @throws InvalidArgumentException */ public function filter(string $property) : bool { try { $reflectionMethod = new ReflectionMethod($property); } catch (ReflectionException $exception) { throw new InvalidArgumentException(sprintf( 'Method %s does not exist', $property )); } return $reflectionMethod->getNumberOfParameters() === $this->numberOfParameters; } }