Skip to content

Commit

Permalink
Merge pull request #247 from magento-commerce/imported-isaaceindhoven…
Browse files Browse the repository at this point in the history
…-magento-coding-standard-378

[Imported] Add semicolon as statement separator in the special annotation check of the `Magento2.Security.XssTemplate` sniff
  • Loading branch information
sidolov authored Sep 20, 2023
2 parents 6e8b466 + 21db432 commit b7c053f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Magento2/Sniffs/Security/XssTemplateSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ public function process(File $phpcsFile, $stackPtr)
private function findSpecialAnnotation($stackPtr)
{
if ($this->tokens[$stackPtr]['code'] === T_ECHO) {
$startOfStatement = $this->file->findPrevious(T_OPEN_TAG, $stackPtr);
$startOfStatement = $this->file->findPrevious([T_OPEN_TAG, T_SEMICOLON], $stackPtr);
return $this->file->findPrevious(T_COMMENT, $stackPtr, $startOfStatement);
}
if ($this->tokens[$stackPtr]['code'] === T_OPEN_TAG_WITH_ECHO) {
$endOfStatement = $this->file->findNext(T_CLOSE_TAG, $stackPtr);
$endOfStatement = $this->file->findNext([T_CLOSE_TAG, T_SEMICOLON], $stackPtr);
return $this->file->findNext(T_COMMENT, $stackPtr, $endOfStatement);
}
return false;
Expand Down

0 comments on commit b7c053f

Please sign in to comment.