Get out of the switch block before placing the final return statement.
if you place
returnat the end of theswitchblock that way, theswitchblock already ends before it gets to thereturnstatement (because of the previous matchingbreakstatements).
The correct CODE will be:
// just in case $summary is not defined out side of the switch block
$summary = '';
switch ( $weather['icon'] ) {
case 'clear-day':
case 'clear-night':
$summary = 'sunny';
break;
case 'wind':
$summary = 'breezy';
break;
case 'rain':
$summary = 'drizzly';
break;
case 'fog':
$summary = 'foggy';
break;
case 'cloudy':
$summary = 'murky';
break;
case 'partly-cloudy-day': case 'partly-cloudy-night':
$summary = 'cloudy';
break;
case 'snow': case 'sleet':
$summary = 'snowy';
break;
default:
$summary = 'beautiful';
break;
} // end switch
return '<span class="weather">'.$summary.'</span>';