Skip to content

Commit 62a5e1b

Browse files
rodrigoprimojrfnl
andauthored
Apply suggestions from code review
Co-authored-by: Juliette <[email protected]>
1 parent ae6bd69 commit 62a5e1b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,13 @@ private function validateInlineEmbeddedPhp($phpcsFile, $stackPtr, $closeTag)
380380

381381
// Check that there is one, and only one space at the start of the statement.
382382
$leadingSpace = 0;
383-
$isLongOpenTag = $tokens[$stackPtr]['code'] === T_OPEN_TAG
384-
&& stripos($tokens[$stackPtr]['content'], '<?php') === 0;
385-
386-
if ($isLongOpenTag === true) {
383+
$isLongOpenTag = false;
384+
if ($tokens[$stackPtr]['code'] === T_OPEN_TAG
385+
&& stripos($tokens[$stackPtr]['content'], '<?php') === 0
386+
) {
387387
// The long open tag token in a single line tag set always contains a single space after it.
388-
$leadingSpace = 1;
388+
$leadingSpace = 1;
389+
$isLongOpenTag = true;
389390
}
390391

391392
if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {

src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,8 @@ public function getErrorList($testFile='')
198198
18 => 1,
199199
20 => 1,
200200
];
201-
} else {
202-
return [];
203-
}
201+
202+
return [];
204203

205204
default:
206205
return [];

0 commit comments

Comments
 (0)