Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/routing/Loader/AnnotationFileLoader.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
25 class AnnotationFileLoader extends FileLoader | 25 class AnnotationFileLoader extends FileLoader |
26 { | 26 { |
27 protected $loader; | 27 protected $loader; |
28 | 28 |
29 /** | 29 /** |
30 * Constructor. | |
31 * | |
32 * @param FileLocatorInterface $locator A FileLocator instance | |
33 * @param AnnotationClassLoader $loader An AnnotationClassLoader instance | |
34 * | |
35 * @throws \RuntimeException | 30 * @throws \RuntimeException |
36 */ | 31 */ |
37 public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) | 32 public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) |
38 { | 33 { |
39 if (!function_exists('token_get_all')) { | 34 if (!function_exists('token_get_all')) { |
115 } | 110 } |
116 $token = $tokens[$i]; | 111 $token = $tokens[$i]; |
117 } | 112 } |
118 | 113 |
119 if (T_CLASS === $token[0]) { | 114 if (T_CLASS === $token[0]) { |
120 // Skip usage of ::class constant | 115 // Skip usage of ::class constant and anonymous classes |
121 $isClassConstant = false; | 116 $skipClassToken = false; |
122 for ($j = $i - 1; $j > 0; --$j) { | 117 for ($j = $i - 1; $j > 0; --$j) { |
123 if (!isset($tokens[$j][1])) { | 118 if (!isset($tokens[$j][1])) { |
124 break; | 119 break; |
125 } | 120 } |
126 | 121 |
127 if (T_DOUBLE_COLON === $tokens[$j][0]) { | 122 if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) { |
128 $isClassConstant = true; | 123 $skipClassToken = true; |
129 break; | 124 break; |
130 } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { | 125 } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { |
131 break; | 126 break; |
132 } | 127 } |
133 } | 128 } |
134 | 129 |
135 if (!$isClassConstant) { | 130 if (!$skipClassToken) { |
136 $class = true; | 131 $class = true; |
137 } | 132 } |
138 } | 133 } |
139 | 134 |
140 if (T_NAMESPACE === $token[0]) { | 135 if (T_NAMESPACE === $token[0]) { |