From 2f92a4d830a520ed661433e6c01d3a6b251d53e8 Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Tue, 2 Feb 2021 22:41:20 +0100 Subject: [PATCH] add test for fqcn attribute tokenization --- tests/Core/Tokenizer/AttributesTest.inc | 4 ++++ tests/Core/Tokenizer/AttributesTest.php | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/Core/Tokenizer/AttributesTest.inc b/tests/Core/Tokenizer/AttributesTest.inc index 213ff5c1ae..e620ec40cb 100644 --- a/tests/Core/Tokenizer/AttributesTest.inc +++ b/tests/Core/Tokenizer/AttributesTest.inc @@ -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( diff --git a/tests/Core/Tokenizer/AttributesTest.php b/tests/Core/Tokenizer/AttributesTest.php index 48260b1d09..5da1ed523f 100644 --- a/tests/Core/Tokenizer/AttributesTest.php +++ b/tests/Core/Tokenizer/AttributesTest.php @@ -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 { @@ -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()