mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
NEW Support namespace tokens in ClassInfo::parse_class_spec()
The T_NAME_QUALIFIED and T_NAME_FULLY_QUALIFIED tokens are introduced in PHP 8, and encapsulate theentire FQCN, replacing the previous structure of a group of T_STRINGs and T_NS_SEPARATORs.
This commit is contained in:
parent
af40eee3ad
commit
08010d5933
@ -439,7 +439,13 @@ class ClassInfo
|
|||||||
$tokenName = is_array($token) ? $token[0] : $token;
|
$tokenName = is_array($token) ? $token[0] : $token;
|
||||||
|
|
||||||
// Get the class name
|
// Get the class name
|
||||||
if ($class === null && is_array($token) && $token[0] === T_STRING) {
|
if (\defined('T_NAME_QUALIFIED') && is_array($token) &&
|
||||||
|
($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED)
|
||||||
|
) {
|
||||||
|
// PHP 8 exposes the FQCN as a single T_NAME_QUALIFIED or T_NAME_FULLY_QUALIFIED token
|
||||||
|
$class .= $token[1];
|
||||||
|
$hadNamespace = true;
|
||||||
|
} elseif ($class === null && is_array($token) && $token[0] === T_STRING) {
|
||||||
$class = $token[1];
|
$class = $token[1];
|
||||||
} elseif (is_array($token) && $token[0] === T_NS_SEPARATOR) {
|
} elseif (is_array($token) && $token[0] === T_NS_SEPARATOR) {
|
||||||
$class .= $token[1];
|
$class .= $token[1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user