original_string: public function setAllowedValues($option, $allowedValues)
      {
          if ($this->locked) {
              throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
          }
  
          if (!isset($this->defined[$option])) {
              throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
          }
  
          $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues];
  
          // Make sure the option is processed
          unset($this->resolved[$option]);
  
          return $this;
      }
code: public function setAllowedValues($option, $allowedValues)
      {
          if ($this->locked) {
              throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
          }
  
          if (!isset($this->defined[$option])) {
              throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
          }
  
          $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues];
  
          // Make sure the option is processed
          unset($this->resolved[$option]);
  
          return $this;
      }
code_tokens: public function setAllowedValues ( $ option , $ allowedValues ) { if ( $ this -> locked ) { throw new AccessException ( 'Allowed values cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not exist. Defined options are: "%s".' , $ option , implode ( '", "' , array_keys ( $ this -> defined ) ) ) ) ; } $ this -> allowedValues [ $ option ] = \ is_array ( $ allowedValues ) ? $ allowedValues : [ $ allowedValues ] ; // Make sure the option is processed unset ( $ this -> resolved [ $ option ] ) ; return $ this ; }
docstring: Sets allowed values for an option.
  
  Instead of passing values, you may also pass a closures with the
  following signature:
  
  function ($value) {
  // return true or false
  }
  
  The closure receives the value as argument and should return true to
  accept the value and false to reject the value.
  
  @param string $option        The option name
  @param mixed  $allowedValues One or more acceptable values/closures
  
  @return $this
  
  @throws UndefinedOptionsException If the option is undefined
  @throws AccessException           If called from a lazy option or normalizer
docstring_tokens: Sets allowed values for an option .