Skip to content

Commit

Permalink
DisallowMultiPropertyDefinitionSniff: Fixed possible error
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Mar 27, 2020
1 parent e8c6ce9 commit 465bf4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use function count;
use function sprintf;
use function trim;
use const T_AS;
use const T_COMMA;
use const T_FUNCTION;
use const T_OPEN_SHORT_ARRAY;
Expand Down Expand Up @@ -42,6 +43,11 @@ public function process(File $phpcsFile, $visibilityPointer): void
{
$tokens = $phpcsFile->getTokens();

$asPointer = TokenHelper::findPreviousEffective($phpcsFile, $visibilityPointer - 1);
if ($tokens[$asPointer]['code'] === T_AS) {
return;
}

$propertyPointer = TokenHelper::findNext($phpcsFile, [T_VARIABLE, T_FUNCTION], $visibilityPointer + 1);
if ($propertyPointer === null || $tokens[$propertyPointer]['code'] === T_FUNCTION) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
class Foo
{

use Whatever {
doSomething as public;
}

private $boo = 'boo';

public string $booo = 'booo';
Expand Down

0 comments on commit 465bf4c

Please sign in to comment.