Skip to content

Commit c4ea75c

Browse files
committed
#92 : checkWhiteSpaceBefore {, unless it's in
1 parent be4540c commit c4ea75c

File tree

3 files changed

+755
-720
lines changed

3 files changed

+755
-720
lines changed

RELEASE_NOTES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
===========================
33

44

5+
Version 0.14.8
6+
--------------
7+
* Issue #92 : checkWhiteSpaceBefore "{", unless it's in ${var}
8+
* Issue #89 : False error "The function parameters must match those in its docblock @param" when using local variable tag
9+
510
Version 0.14.7
611
--------------
712
* Issue #81 : Fail to detect private functions with spaces after function (thanks to Hans-Christian Halfbrodt)

src/PHPCheckstyle/PHPCheckstyle.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3730,6 +3730,7 @@ private function _checkVariableVariable($token) {
37303730
/**
37313731
* Check the use of a complex variable ${.
37323732
*
3733+
* Skip the analysis inside the variable.
37333734
* Should be the token T_DOLLAR_OPEN_CURLY_BRACES but can also be T_DOLLAR + T_BRACES_OPEN
37343735
*
37353736
* Called when the current token is a single $.
@@ -3738,17 +3739,14 @@ private function _checkVariableVariable($token) {
37383739
*/
37393740
private function _checkComplexVariable($token) {
37403741
if ($this->tokenizer->checkNextToken(T_BRACES_OPEN)) {
3741-
// We skip the T_BRACES_OPEN and T_BRACES_CLOSE analysis to avoid the creation of a new statement level.
3742-
$valueToken = $this->tokenizer->peekNextValidToken($token->position + 2);
3743-
$closeToken = $this->tokenizer->peekNextValidToken($valueToken->position + 1);
37443742

3745-
if ($closeToken->id === T_BRACES_CLOSE) {
3743+
// Detect the end of the complexe variable
3744+
$closePos = $this->tokenizer->findNextTokenPosition(T_BRACES_CLOSE);
37463745

3747-
$this->tokenizer->setCurrentPosition($valueToken->position);
3746+
if ($closePos !== null) {
37483747

3749-
$this->_processVariable($valueToken->text);
3750-
3751-
$this->tokenizer->setCurrentPosition($closeToken->position + 1);
3748+
// Skip the analysis of the content of the variable.
3749+
$this->tokenizer->setCurrentPosition($closePos + 1);
37523750
}
37533751
}
37543752
}

0 commit comments

Comments
 (0)