old_contents: 'use strict';
  
  /** @typedef {import('postcss').Rule} Rule */
  /** @typedef {import('postcss').AtRule} AtRule */
  
  /**
   * @param {Rule | AtRule} statement
   * @param {{
   * 	noRawBefore?: boolean
   * }} options
   *
   * @returns {string}
   */
  module.exports = function (statement, options = {}) {
  	let result = '';
  	/** @type {Rule | undefined} */
  	let rule; /*?: postcss$rule*/
  	/** @type {AtRule | undefined} */
  	let atRule; /*?: postcss$atRule*/
  
  	if (statement.type === 'rule') {
  		rule = statement;
  	}
  
  	if (statement.type === 'atrule') {
  		atRule = statement;
  	}
  
  	if (!rule && !atRule) {
  		return result;
  	}
  
  	const before = statement.raws.before || '';
  
  	if (!options.noRawBefore) {
  		result += before;
  	}
  
  	if (rule) {
  		result += rule.selector;
  	}
  
  	if (atRule) {
  		result += `@${atRule.name}${atRule.raws.afterName || ''}${atRule.params}`;
  	}
  
  	const between = statement.raws.between;
  
  	if (between !== undefined) {
  		result += between;
  	}
  
  	return result;
  };
  
new_contents: 'use strict';
  
  /** @typedef {import('postcss').Rule} Rule */
  /** @typedef {import('postcss').AtRule} AtRule */
  
  /**
   * @param {Rule | AtRule} statement
   * @returns {string}
   */
  module.exports = function beforeBlockString(statement, { noRawBefore } = { noRawBefore: false }) {
  	let result = '';
  
  	const before = statement.raws.before || '';
  
  	if (!noRawBefore) {
  		result += before;
  	}
  
  	switch (statement.type) {
  		case 'rule':
  			result += statement.selector;
  			break;
  		case 'atrule':
  			result += `@${statement.name}${statement.raws.afterName || ''}${statement.params}`;
  			break;
  		default:
  			return '';
  	}
  
  	result += statement.raws.between || '';
  
  	return result;
  };
  
subject: Refactor `lib/utils/beforeBlockString.js` (#5425)