Skip to content

Commit

Permalink
Fixed bug #784 : ->trait is seen as a T_TRAIT token
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 24, 2015
1 parent ded79f5 commit e9f730a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ trait bar {
trait baz {

}

$trait = 'foo';
echo $this->trait;
echo Something::$trait;
echo $trait;
1 change: 1 addition & 0 deletions CodeSniffer/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ public function tokenizeString($string, $eolChar='\n')
if ($tokenIsArray === true
&& $token[0] === T_STRING
&& strtolower($token[1]) === 'trait'
&& $tokens[($stackPtr - 1)][0] !== T_OBJECT_OPERATOR
) {
$finalTokens[$newStackPtr] = array(
'content' => $token[1],
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- Fixed bug #784 : $this->trait is seen as a T_TRAIT token
- Fixed bug #786 : Switch indent issue with short array notation
</notes>
<contents>
Expand Down

3 comments on commit e9f730a

@mikesherov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsherwood is there any chance you can tag and release this commit as 2.4.1? This and the short array notation inside case bug are preventing us from upgrading to the 2.4.x line, which is the release that has another fix we've been waiting for. Thanks again for the great project!

@gsherwood
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikesherov I was hoping the PEAR site would be back by now so I could do a proper release (it will be 2.5.0 as I've got some new features in there as well) but it isn't ready yet.

If it isn't back up by Friday, I'll be releasing regardless.

@mikesherov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.