}
$identifier = $parameters->getChildByIndex(0);
- if ($this->isConstantString($identifier)) {
+ if ($identifier->isConstantString()) {
continue;
}
}
}
- private function isConstantString(XHPASTNode $node) {
- $value = $node->getConcreteString();
-
- switch ($node->getTypeName()) {
- case 'n_HEREDOC':
- if ($value[3] == "'") { // Nowdoc: <<<'EOT'
- return true;
- }
- $value = preg_replace('/^.+\n|\n.*$/', '', $value);
- break;
-
- case 'n_STRING_SCALAR':
- if ($value[0] == "'") {
- return true;
- }
- $value = substr($value, 1, -1);
- break;
-
- case 'n_CONCATENATION_LIST':
- foreach ($node->getChildren() as $child) {
- if ($child->getTypeName() == 'n_OPERATOR') {
- continue;
- }
- if (!$this->isConstantString($child)) {
- return false;
- }
- }
- return true;
-
- default:
- return false;
- }
-
- return preg_match('/^((?>[^$\\\\]*)|\\\\.)*$/s', $value);
- }
-
private function lintArrayCombine($root) {
$function_calls = $root->selectDescendantsOfType('n_FUNCTION_CALL');