original_string: private static function isValidUriFragment(?string $fragment): bool
      {
          if ($fragment === null || $fragment === '') {
              return true;
          }
  
          // http://tools.ietf.org/html/rfc3986#section-3.5
          // fragment = *( pchar / "/" / "?" )
          // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
          $pattern = sprintf(
              '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i',
              'a-z0-9\-._~',
              '!$&\'()*+,;=',
              '%[a-f0-9]{2}'
          );
  
          return !!preg_match($pattern, $fragment);
      }
code: private static function isValidUriFragment(?string $fragment): bool
      {
          if ($fragment === null || $fragment === '') {
              return true;
          }
  
          // http://tools.ietf.org/html/rfc3986#section-3.5
          // fragment = *( pchar / "/" / "?" )
          // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
          $pattern = sprintf(
              '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i',
              'a-z0-9\-._~',
              '!$&\'()*+,;=',
              '%[a-f0-9]{2}'
          );
  
          return !!preg_match($pattern, $fragment);
      }
code_tokens: private static function isValidUriFragment ( ? string $ fragment ) : bool { if ( $ fragment === null || $ fragment === '' ) { return true ; } // http://tools.ietf.org/html/rfc3986#section-3.5 // fragment = *( pchar / "/" / "?" ) // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" $ pattern = sprintf ( '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i' , 'a-z0-9\-._~' , '!$&\'()*+,;=' , '%[a-f0-9]{2}' ) ; return ! ! preg_match ( $ pattern , $ fragment ) ; }
docstring: Checks if a URI fragment is valid
  
  @param string|null $fragment The URI fragment
  
  @return bool
docstring_tokens: Checks if a URI fragment is valid