Security update for Core, with self-updated composer
[yaffs-website] / vendor / doctrine / common / lib / Doctrine / Common / Reflection / StaticReflectionParser.php
index c48e9ba73a5e05f69c0843478098bda47ca90e4c..17bcd7c9f0d12771d87ffffbe7995ada655288a2 100644 (file)
@@ -137,70 +137,72 @@ class StaticReflectionParser implements ReflectionProviderInterface
         }
         $tokenParser = new TokenParser($contents);
         $docComment = '';
+        $last_token = false;
+
         while ($token = $tokenParser->next(false)) {
-            if (is_array($token)) {
-                switch ($token[0]) {
-                    case T_USE:
-                        $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement());
-                        break;
-                    case T_DOC_COMMENT:
-                        $docComment = $token[1];
-                        break;
-                    case T_CLASS:
-                        $this->docComment['class'] = $docComment;
-                        $docComment = '';
-                        break;
-                    case T_VAR:
-                    case T_PRIVATE:
-                    case T_PROTECTED:
-                    case T_PUBLIC:
-                        $token = $tokenParser->next();
-                        if ($token[0] === T_VARIABLE) {
-                            $propertyName = substr($token[1], 1);
-                            $this->docComment['property'][$propertyName] = $docComment;
-                            continue 2;
-                        }
-                        if ($token[0] !== T_FUNCTION) {
-                            // For example, it can be T_FINAL.
-                            continue 2;
-                        }
-                        // No break.
-                    case T_FUNCTION:
-                        // The next string after function is the name, but
-                        // there can be & before the function name so find the
-                        // string.
-                        while (($token = $tokenParser->next()) && $token[0] !== T_STRING);
-                        $methodName = $token[1];
-                        $this->docComment['method'][$methodName] = $docComment;
-                        $docComment = '';
-                        break;
-                    case T_EXTENDS:
-                        $this->parentClassName = $tokenParser->parseClass();
-                        $nsPos = strpos($this->parentClassName, '\\');
-                        $fullySpecified = false;
-                        if ($nsPos === 0) {
-                            $fullySpecified = true;
+            if (is_array($token)) {switch ($token[0]) {
+                case T_USE:
+                    $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement());
+                    break;
+                case T_DOC_COMMENT:
+                    $docComment = $token[1];
+                    break;
+                case T_CLASS:
+                    if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM) {$this->docComment['class'] = $docComment;
+                    $docComment = '';}
+                    break;
+                case T_VAR:
+                case T_PRIVATE:
+                case T_PROTECTED:
+                case T_PUBLIC:
+                    $token = $tokenParser->next();
+                    if ($token[0] === T_VARIABLE) {
+                        $propertyName = substr($token[1], 1);
+                        $this->docComment['property'][$propertyName] = $docComment;
+                        continue 2;
+                    }
+                    if ($token[0] !== T_FUNCTION) {
+                        // For example, it can be T_FINAL.
+                        continue 2;
+                    }
+                    // No break.
+                case T_FUNCTION:
+                    // The next string after function is the name, but
+                    // there can be & before the function name so find the
+                    // string.
+                    while (($token = $tokenParser->next()) && $token[0] !== T_STRING);
+                    $methodName = $token[1];
+                    $this->docComment['method'][$methodName] = $docComment;
+                    $docComment = '';
+                    break;
+                case T_EXTENDS:
+                    $this->parentClassName = $tokenParser->parseClass();
+                    $nsPos = strpos($this->parentClassName, '\\');
+                    $fullySpecified = false;
+                    if ($nsPos === 0) {
+                        $fullySpecified = true;
+                    } else {
+                        if ($nsPos) {
+                            $prefix = strtolower(substr($this->parentClassName, 0, $nsPos));
+                            $postfix = substr($this->parentClassName, $nsPos);
                         } else {
-                            if ($nsPos) {
-                                $prefix = strtolower(substr($this->parentClassName, 0, $nsPos));
-                                $postfix = substr($this->parentClassName, $nsPos);
-                            } else {
-                                $prefix = strtolower($this->parentClassName);
-                                $postfix = '';
-                            }
-                            foreach ($this->useStatements as $alias => $use) {
-                                if ($alias == $prefix) {
-                                    $this->parentClassName = '\\' . $use . $postfix;
-                                    $fullySpecified = true;
-                              }
-                            }
+                            $prefix = strtolower($this->parentClassName);
+                            $postfix = '';
                         }
-                        if (!$fullySpecified) {
-                            $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
+                        foreach ($this->useStatements as $alias => $use) {
+                            if ($alias == $prefix) {
+                                $this->parentClassName = '\\' . $use . $postfix;
+                                $fullySpecified = true;
+                          }
                         }
-                        break;
-                }
+                    }
+                    if (!$fullySpecified) {
+                        $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
+                    }
+                    break;}
             }
+
+            $last_token = $token[0];
         }
     }