theme customizer – How to add CSS to head by php through echo self::css();

The tutorial https://iamsteve.me/blog/hero-area-series-wordpress-customizer-with-selective-refresh#customizer-setup gives a method for changing color by WordPress Customizer (Color control). It changes the color through the following code

/**
 * For hooking into `wp_head` mostly to output CSS
 */
public static function output()
{
  echo '<style id="hero-css">';
  echo self::css('.hero', 'background-color', 'hero_background_color');
  echo '</style>';
}

When I do this, I get a 500 error. Am I missing something?