-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error on argument split with default value as array
- Loading branch information
1 parent
2039e38
commit 206ffee
Showing
4 changed files
with
157 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace tests\TokensAnalyzerIntegration; | ||
|
||
use PedroTroller\CS\Fixer\TokensAnalyzer; | ||
use PhpCsFixer\Tokenizer\Tokens; | ||
use tests\TokensAnalyzerIntegration; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class NextComma extends TokensAnalyzerIntegration | ||
{ | ||
public function getCode() | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
namespace TheNamespace; | ||
class TheClass | ||
{ | ||
public function __construct( | ||
public string $theString = 'N/A', | ||
public array $theArray = [1, 2, 3, 4] | ||
) { | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function assertions(TokensAnalyzer $analyzer, Tokens $tokens): void | ||
{ | ||
Assert::eq( | ||
$analyzer->getNextComma( | ||
$this->tokenContaining($tokens, '$theString') | ||
), | ||
$this->tokenContaining($tokens, '$theString') + 5, | ||
); | ||
|
||
Assert::eq( | ||
$analyzer->getNextComma( | ||
$this->tokenContaining($tokens, '$theArray') | ||
), | ||
null, | ||
); | ||
} | ||
} |
Oops, something went wrong.