[TYPO3-core] Double backslash for namespace
Bernhard Kraft
kraftb at think-open.at
Tue Jun 17 11:07:12 CEST 2014
Hi !
I would like to ask if it is really necessary (according to the CGL) to
have double backslash in namespaces. Whenever the single quote string
style is used it is not necessary regarding PHP syntax.
So:
$someObject = GeneralUtility::makeInstance('TYPO3\CMS\SomeObject');
Would be fully valid. Double backslashes are not required. I guess they
were introduced because the "\" operator is known to be the escape
operator. But in case it is followed by any non-escape character it
won't do anything. Only if combined with special meaning characters like
"\n", "\r", "\x" they will get interpreted - and this also only in
double quoted strings.
So if we stick to single-quoted strings as usual in TYPO3 world it would
be ok to have only one backslash.
greetings,
Bernhard
More information about the TYPO3-team-core
mailing list