mirror of
https://github.com/elyby/php-code-style.git
synced 2024-11-29 10:12:07 +05:30
Fixes #10. Don't count string interpolation as a scope beginning
This commit is contained in:
parent
6f14beec28
commit
2d215dc761
@ -67,8 +67,12 @@ final class BlankLineBeforeReturnFixer extends AbstractFixer implements Whitespa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var Token $backwardToken */
|
||||||
$backwardToken = $tokens[$backwardIndex];
|
$backwardToken = $tokens[$backwardIndex];
|
||||||
if ($backwardToken->getContent() === '{') {
|
/** @var Token $nextToken */
|
||||||
|
$nextToken = $tokens[$backwardIndex + 1];
|
||||||
|
// Exclude string interpolation: "str {$var}"
|
||||||
|
if ($backwardToken->getContent() === '{' && !$nextToken->isGivenKind(T_VARIABLE)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +180,20 @@ return $c;',
|
|||||||
}
|
}
|
||||||
',
|
',
|
||||||
];
|
];
|
||||||
|
yield [
|
||||||
|
'<?php
|
||||||
|
if ($condition) {
|
||||||
|
$a = "Interpolation {$var}.";
|
||||||
|
return true;
|
||||||
|
}',
|
||||||
|
];
|
||||||
|
yield [
|
||||||
|
'<?php
|
||||||
|
if ($condition) {
|
||||||
|
$a = "Deprecated interpolation ${var}.";
|
||||||
|
return true;
|
||||||
|
}',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user