original_string: final private static function guardConstants(array $constants): void
      {
          $duplicates = [];
          foreach ($constants as $value) {
              $names = array_keys($constants, $value, $strict = true);
              if (count($names) > 1) {
                  $duplicates[VarPrinter::toString($value)] = $names;
              }
          }
          if (!empty($duplicates)) {
              $list = array_map(function ($names) use ($constants) {
                  return sprintf('(%s)=%s', implode('|', $names), VarPrinter::toString($constants[$names[0]]));
              }, $duplicates);
              $message = sprintf('Duplicate enum values: %s', implode(', ', $list));
              throw new DomainException($message);
          }
      }
code: final private static function guardConstants(array $constants): void
      {
          $duplicates = [];
          foreach ($constants as $value) {
              $names = array_keys($constants, $value, $strict = true);
              if (count($names) > 1) {
                  $duplicates[VarPrinter::toString($value)] = $names;
              }
          }
          if (!empty($duplicates)) {
              $list = array_map(function ($names) use ($constants) {
                  return sprintf('(%s)=%s', implode('|', $names), VarPrinter::toString($constants[$names[0]]));
              }, $duplicates);
              $message = sprintf('Duplicate enum values: %s', implode(', ', $list));
              throw new DomainException($message);
          }
      }
code_tokens: final private static function guardConstants ( array $ constants ) : void { $ duplicates = [ ] ; foreach ( $ constants as $ value ) { $ names = array_keys ( $ constants , $ value , $ strict = true ) ; if ( count ( $ names ) > 1 ) { $ duplicates [ VarPrinter :: toString ( $ value ) ] = $ names ; } } if ( ! empty ( $ duplicates ) ) { $ list = array_map ( function ( $ names ) use ( $ constants ) { return sprintf ( '(%s)=%s' , implode ( '|' , $ names ) , VarPrinter :: toString ( $ constants [ $ names [ 0 ] ] ) ) ; } , $ duplicates ) ; $ message = sprintf ( 'Duplicate enum values: %s' , implode ( ', ' , $ list ) ) ; throw new DomainException ( $ message ) ; } }
docstring: Validates enum constants
  
  @param array $constants The enum constants
  
  @return void
  
  @throws DomainException When more than one constant has the same value
docstring_tokens: Validates enum constants