| @@ 82-100 (lines=19) @@ | ||
| 79 | $currentToken = count($tokens) - 1; |
|
| 80 | $hasClosingFileComment = false; |
|
| 81 | $isNotAWhitespaceOrAComment = false; |
|
| 82 | while ($currentToken >= 0 |
|
| 83 | && ! $isNotAWhitespaceOrAComment |
|
| 84 | && ! $hasClosingFileComment |
|
| 85 | ) { |
|
| 86 | $token = $tokens[$currentToken]; |
|
| 87 | $tokenCode = $token['code']; |
|
| 88 | if (T_COMMENT === $tokenCode) { |
|
| 89 | $commentString = self::_getCommentContent($token['content']); |
|
| 90 | if (0 === strcmp($commentString, $commentTemplate)) { |
|
| 91 | $hasClosingFileComment = true; |
|
| 92 | } |
|
| 93 | } else if (T_WHITESPACE === $tokenCode) { |
|
| 94 | // Whitespaces are allowed between the closing file comment, |
|
| 95 | // other comments and end of file |
|
| 96 | } else { |
|
| 97 | $isNotAWhitespaceOrAComment = true; |
|
| 98 | } |
|
| 99 | $currentToken--; |
|
| 100 | } |
|
| 101 | ||
| 102 | if ( ! $hasClosingFileComment) { |
|
| 103 | $error = 'No comment block marks the end of file instead of the closing PHP tag. Please add a comment block containing only "' . $commentTemplate . '".'; |
|
| @@ 98-116 (lines=19) @@ | ||
| 95 | $currentToken = count($tokens) - 1; |
|
| 96 | $hasClosingLocationComment = false; |
|
| 97 | $isNotAWhitespaceOrAComment = false; |
|
| 98 | while ($currentToken >= 0 |
|
| 99 | && ! $isNotAWhitespaceOrAComment |
|
| 100 | && ! $hasClosingLocationComment |
|
| 101 | ) { |
|
| 102 | $token = $tokens[$currentToken]; |
|
| 103 | $tokenCode = $token['code']; |
|
| 104 | if (T_COMMENT === $tokenCode) { |
|
| 105 | $commentString = self::_getCommentContent($token['content']); |
|
| 106 | if (0 === strcmp($commentString, $commentTemplate)) { |
|
| 107 | $hasClosingLocationComment = true; |
|
| 108 | } |
|
| 109 | } else if (T_WHITESPACE === $tokenCode) { |
|
| 110 | // Whitespaces are allowed between the closing file comment, |
|
| 111 | //other comments and end of file |
|
| 112 | } else { |
|
| 113 | $isNotAWhitespaceOrAComment = true; |
|
| 114 | } |
|
| 115 | $currentToken--; |
|
| 116 | } |
|
| 117 | ||
| 118 | if ( ! $hasClosingLocationComment) { |
|
| 119 | $error = 'No comment block marks the end of file instead of the closing PHP tag. Please add a comment block containing only "' . $commentTemplate . '".'; |
|