Index: trunk/tools/code-utils/check-vars.php |
— | — | @@ -434,6 +434,7 @@ |
435 | 435 | $this->mInProfilingFunction = false; |
436 | 436 | $this->mAfterProfileOut = 0; |
437 | 437 | $this->mFunctionGlobals = array(); |
| 438 | + $this->mLocalVariableTypes = array(); |
438 | 439 | $currentToken[0] = self::FUNCTION_DEFINITION; |
439 | 440 | $this->mKnownFunctions[] = $this->mClass ? $this->mClass . "::" . $this->mFunction : $this->mFunction; |
440 | 441 | |
— | — | @@ -513,6 +514,8 @@ |
514 | 515 | |
515 | 516 | if ( $lastMeaningfulToken[0] == T_PAAMAYIM_NEKUDOTAYIM ) { |
516 | 517 | /* Class variable. No check for now */ |
| 518 | + } elseif ( $lastMeaningfulToken[0] == T_STRING ) { |
| 519 | + $this->mLocalVariableTypes[ $token[1] ] = $lastMeaningfulToken[0]; |
517 | 520 | } else { |
518 | 521 | if ( isset( $this->mFunctionGlobals[ $token[1] ] ) ) { |
519 | 522 | $this->mFunctionGlobals[ $token[1] ][0] ++; |
— | — | @@ -885,6 +888,10 @@ |
886 | 889 | } |
887 | 890 | if ( $token[1] == '$this' ) |
888 | 891 | return $this->mClass; |
| 892 | + |
| 893 | + if ( isset( $this->mLocalVariableTypes[$token[1]] ) ) |
| 894 | + return $this->mLocalVariableTypes[$token[1]]; |
| 895 | + |
889 | 896 | $name = substr( $token[1], 1 ); |
890 | 897 | } elseif ( ( $token[0] == T_STRING ) || ( $token[0] == self::CLASS_MEMBER ) ) { |
891 | 898 | if ( ( $token[1] == 'self' ) && !isset( $token['base'] ) ) |