public function getRules(Reflector $reflection): array
    {
        if ($reflection instanceof ReflectionMethod) {
            $key = $reflection->getDeclaringClass()->getName().'::'.$reflection->getName();
        } elseif ($reflection instanceof ReflectionClass) {
            $key = $reflection->getName();
        } elseif ($reflection instanceof ReflectionProperty) {
            $key = $reflection->getDeclaringClass()->getName().'::$'.$reflection->getName();
        } else {
            throw new InvalidArgumentException('Reflection must be an instance of either ReflectionMethod, ReflectionClass or ReflectionProperty.');
        }

        if (!isset($this->cache[$key])) {
            $this->cache[$key] = $this->ruleProvider->getRules($reflection);
        }

        return $this->cache[$key];
    }
public function getRules(Reflector $reflection): array
    {
        if ($reflection instanceof ReflectionMethod) {
            $key = $reflection->getDeclaringClass()->getName().'::'.$reflection->getName();
        } elseif ($reflection instanceof ReflectionClass) {
            $key = $reflection->getName();
        } elseif ($reflection instanceof ReflectionProperty) {
            $key = $reflection->getDeclaringClass()->getName().'::$'.$reflection->getName();
        } else {
            throw new InvalidArgumentException('Reflection must be an instance of either ReflectionMethod, ReflectionClass or ReflectionProperty.');
        }

        if (!isset($this->cache[$key])) {
            $this->cache[$key] = $this->ruleProvider->getRules($reflection);
        }

        return $this->cache[$key];
    }
public function getRules ( Reflector $ reflection ) : array { if ( $ reflection instanceof ReflectionMethod ) { $ key = $ reflection -> getDeclaringClass ( ) -> getName ( ) . '::' . $ reflection -> getName ( ) ; } elseif ( $ reflection instanceof ReflectionClass ) { $ key = $ reflection -> getName ( ) ; } elseif ( $ reflection instanceof ReflectionProperty ) { $ key = $ reflection -> getDeclaringClass ( ) -> getName ( ) . '::$' . $ reflection -> getName ( ) ; } else { throw new InvalidArgumentException ( 'Reflection must be an instance of either ReflectionMethod, ReflectionClass or ReflectionProperty.' ) ; } if ( ! isset ( $ this -> cache [ $ key ] ) ) { $ this -> cache [ $ key ] = $ this -> ruleProvider -> getRules ( $ reflection ) ; } return $ this -> cache [ $ key ] ; }
Returns rules that are required for given reflection.

@return RuleInterface[]
Returns rules that are required for given reflection .