Skip to content

Commit 21db432

Browse files
committed
Add semicolon as statement separator in the special annotation check of the Magento2.Security.XssTemplate sniff
1 parent 9091848 commit 21db432

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Magento2/Sniffs/Security/XssTemplateSniff.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ public function process(File $phpcsFile, $stackPtr)
146146
private function findSpecialAnnotation($stackPtr)
147147
{
148148
if ($this->tokens[$stackPtr]['code'] === T_ECHO) {
149-
$startOfStatement = $this->file->findPrevious(T_OPEN_TAG, $stackPtr);
149+
$startOfStatement = $this->file->findPrevious([T_OPEN_TAG, T_SEMICOLON], $stackPtr);
150150
return $this->file->findPrevious(T_COMMENT, $stackPtr, $startOfStatement);
151151
}
152152
if ($this->tokens[$stackPtr]['code'] === T_OPEN_TAG_WITH_ECHO) {
153-
$endOfStatement = $this->file->findNext(T_CLOSE_TAG, $stackPtr);
153+
$endOfStatement = $this->file->findNext([T_CLOSE_TAG, T_SEMICOLON], $stackPtr);
154154
return $this->file->findNext(T_COMMENT, $stackPtr, $endOfStatement);
155155
}
156156
return false;

0 commit comments

Comments
 (0)