Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aac4411

Browse files
jaapioondrejmirtes
authored andcommitted
Add specialized tags support
Specialized tags are tags including a signle colon.
1 parent 066f9d0 commit aac4411

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

‎src/Lexer/Lexer.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function generateRegexp(): string
146146

147147
self::TOKEN_OPEN_PHPDOC => '/\\*\\*(?=\\s)\\x20?+',
148148
self::TOKEN_CLOSE_PHPDOC => '\\*/',
149-
self::TOKEN_PHPDOC_TAG => '@[a-z][a-z0-9-\\\\]*+',
149+
self::TOKEN_PHPDOC_TAG => '@(?:[a-z][a-z0-9-\\\\]+:)?[a-z][a-z0-9-\\\\]*+',
150150
self::TOKEN_PHPDOC_EOL => '\\r?+\\n[\\x09\\x20]*+(?:\\*(?!/)\\x20?+)?',
151151

152152
self::TOKEN_FLOAT => '(?:-?[0-9]++\\.[0-9]*+(?:e-?[0-9]++)?)|(?:-?[0-9]*+\\.[0-9]++(?:e-?[0-9]++)?)|(?:-?[0-9]++e-?[0-9]++)',

‎tests/PHPStan/Parser/PhpDocParserTest.php‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ protected function setUp(): void
7575

7676
/**
7777
* @dataProvider provideTagsWithNumbers
78+
* @dataProvider provideSpecializedTags
7879
* @dataProvider provideParamTagsData
7980
* @dataProvider provideTypelessParamTagsData
8081
* @dataProvider provideVarTagsData
@@ -4851,6 +4852,22 @@ public function provideParamOutTagsData(): Iterator
48514852
];
48524853
}
48534854

4855+
public function provideSpecializedTags(): Iterator
4856+
{
4857+
yield [
4858+
'Ok specialized tag',
4859+
'/** @special:param this is special */',
4860+
new PhpDocNode([
4861+
new PhpDocTagNode(
4862+
'@special:param',
4863+
new GenericTagValueNode(
4864+
'this is special'
4865+
)
4866+
),
4867+
]),
4868+
];
4869+
}
4870+
48544871
/**
48554872
* @dataProvider dataParseTagValue
48564873
* @param PhpDocNode $expectedPhpDocNode

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /