code: private function checkType(array $valid, $name, $provided)
      {
          foreach ($valid as $check) {
              if (isset(self::$typeMap[$check])) {
                  $fn = self::$typeMap[$check];
                  if ($fn($provided)) {
                      return;
                  }
              } elseif ($provided instanceof $check) {
                  return;
              }
          }
  
          $expected = implode('|', $valid);
          $msg = sprintf(
              'Invalid configuration value provided for "%s". Expected %s, but got %s',
              $name,
              $expected,
              describeType($provided)
          );
          throw new \InvalidArgumentException($msg);
      }
docs: @param array $valid Array of valid types.
  @param $name Name of the configuration option.
  @param $provided Value to check the type of.
  
  @throws \InvalidArgumentException.