Skip to content

Commit 47b0218

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Fix typo Fix deprecated libxml_disable_entity_loader Add Tagalog translations for validator messages 94, 95, 96 and 99 PHPUnit's assertContains() performs strict comparisons now. [ClassLoader][Routing] Fix namespace parsing on php 8. Fix deprecated libxml_disable_entity_loader Made reference to PHPUnit\Util\XML::loadfile php5-compatible. [Validator] Add missing translations for german and vietnamese Modernized deprecated PHPUnit assertion calls [Console] The message of "class not found" errors has changed in php 8. The PHPUnit\Util\XML class has been removed in PHPUnit 9.3. [Console] Make sure we pass a numeric array of arguments to call_user_func_array(). [Serializer] Fix that it will never reach DOMNode [Validator] sync translations [VarDumper] Improve previous fix on light array coloration [Cache] Fix #37667
2 parents 08c9a82 + e338796 commit 47b0218

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Loader/AnnotationFileLoader.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ protected function findClass(string $file)
9393
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?', $file));
9494
}
9595

96+
$nsTokens = [T_NS_SEPARATOR => true, T_STRING => true];
97+
if (\defined('T_NAME_QUALIFIED')) {
98+
$nsTokens[T_NAME_QUALIFIED] = true;
99+
}
100+
96101
for ($i = 0; isset($tokens[$i]); ++$i) {
97102
$token = $tokens[$i];
98103

@@ -104,9 +109,9 @@ protected function findClass(string $file)
104109
return $namespace.'\\'.$token[1];
105110
}
106111

107-
if (true === $namespace && T_STRING === $token[0]) {
112+
if (true === $namespace && isset($nsTokens[$token[0]])) {
108113
$namespace = $token[1];
109-
while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], [T_NS_SEPARATOR, T_STRING])) {
114+
while (isset($tokens[++$i][1], $nsTokens[$tokens[$i][0]])) {
110115
$namespace .= $tokens[$i][1];
111116
}
112117
$token = $tokens[$i];

0 commit comments

Comments
 (0)