protected function normalizeKeyword($name)
{
if (is_array($name)) {
foreach ($name as &$value) {
$value = $this->normalizeKeyword($value);
}
return $name;
}
$name = strtolower($name);
switch ($name) {
case 'die':
return 'exit';
case 'include_once':
case 'require':
case 'require_once':
return 'include';
case 'label':
//not a real keyword, only for defining purposes, can't use labels without goto
return 'goto';
case 'print':
//for our purposes print is treated as functionally equivalent to echo
return 'echo';
case 'else':
//no point in using ifs without else
//no point in using ifs without else
case 'elseif':
//no point in using ifs without elseif
return 'if';
case 'case':
return 'switch';
case 'catch':
//no point in using catch without try
//no point in using catch without try
case 'finally':
//no point in using try, catch or finally without try
return 'try';
case 'do':
//no point in using do without while
return 'while';
case 'foreach':
//no point in using foreach without for
return 'for';
case '__halt_compiler':
return 'halt';
case 'alias':
//for consistency with alias and use descriptions
return 'use';
}
return $name;
}