Skip to content

Commit

Permalink
add test for fqcn attribute tokenization
Browse files Browse the repository at this point in the history
  • Loading branch information
alekitto committed Mar 19, 2021
1 parent 128a997 commit 2f92a4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Core/Tokenizer/AttributesTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function single_attribute_on_parameter_test(#[ParamAttribute] int $param) {}
/* testMultipleAttributesOnParameter */
function multiple_attributes_on_parameter_test(#[ParamAttribute, AttributeWithParams(/* another comment */ 'foo')] int $param) {}

/* testFqcnAttribute */
#[Boo\QualifiedName, \Foo\FullyQualifiedName('foo')]
function fqcn_attrebute_test() {}

/* testMultilineAttributesOnParameter */
function multiline_attributes_on_parameter_test(#[
AttributeWithParams(
Expand Down
19 changes: 19 additions & 0 deletions tests/Core/Tokenizer/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHP_CodeSniffer\Tests\Core\Tokenizer;

use PHP_CodeSniffer\Tests\Core\AbstractMethodUnitTest;
use PHP_CodeSniffer\Util\Tokens;

class AttributesTest extends AbstractMethodUnitTest
{
Expand Down Expand Up @@ -217,6 +218,24 @@ public function dataAttribute()
T_WHITESPACE,
],
],
[
'/* testFqcnAttribute */',
13,
[
T_STRING,
T_NS_SEPARATOR,
T_STRING,
T_COMMA,
T_WHITESPACE,
T_NS_SEPARATOR,
T_STRING,
T_NS_SEPARATOR,
T_STRING,
T_OPEN_PARENTHESIS,
T_CONSTANT_ENCAPSED_STRING,
T_CLOSE_PARENTHESIS,
],
],
];

}//end dataAttribute()
Expand Down

0 comments on commit 2f92a4d

Please sign in to comment.