@@ -1721,12 +1721,12 @@ describe 'PHP grammar', ->
17211721 expect (tokens[5 ]).toEqual value : ' ?' , scopes : [" source.php" , " meta.function.closure.php" , " keyword.operator.nullable-type.php" ]
17221722 expect (tokens[6 ]).toEqual value : ' Client' , scopes : [" source.php" , " meta.function.closure.php" , " support.class.php" ]
17231723
1724- it ' tokenizes noreturn type' , ->
1725- {tokens } = grammar .tokenizeLine ' function app_exit() : noreturn {}'
1724+ it ' tokenizes never type' , ->
1725+ {tokens } = grammar .tokenizeLine ' function app_exit() : never {}'
17261726
17271727 expect (tokens[0 ]).toEqual value : ' function' , scopes : [' source.php' , ' meta.function.php' , ' storage.type.function.php' ]
17281728 expect (tokens[6 ]).toEqual value : ' :' , scopes : [' source.php' , ' meta.function.php' , ' keyword.operator.return-value.php' ]
1729- expect (tokens[8 ]).toEqual value : ' noreturn ' , scopes : [' source.php' , ' meta.function.php' , ' keyword.other.type.noreturn .php' ]
1729+ expect (tokens[8 ]).toEqual value : ' never ' , scopes : [' source.php' , ' meta.function.php' , ' keyword.other.type.never .php' ]
17301730
17311731 it ' tokenizes closure returning reference' , ->
17321732 {tokens } = grammar .tokenizeLine ' function&() {}'
@@ -2561,6 +2561,29 @@ describe 'PHP grammar', ->
25612561 expect (lines[1 ][3 ]).toEqual value : ' Test' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' support.class.php' ]
25622562 expect (lines[1 ][4 ]).toEqual value : ' description' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
25632563
2564+ it ' should tokenize a single nullable type' , ->
2565+ lines = grammar .tokenizeLines '''
2566+ /**
2567+ *@param ?int description
2568+ '''
2569+
2570+ expect (lines[1 ][1 ]).toEqual value : ' @param' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' keyword.other.phpdoc.php' ]
2571+ expect (lines[1 ][2 ]).toEqual value : ' ' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2572+ expect (lines[1 ][3 ]).toEqual value : ' ?' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.operator.nullable-type.php' ]
2573+ expect (lines[1 ][4 ]).toEqual value : ' int' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.other.type.php' ]
2574+ expect (lines[1 ][5 ]).toEqual value : ' description' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2575+
2576+ lines = grammar .tokenizeLines '''
2577+ /**
2578+ *@param ?Test description
2579+ '''
2580+
2581+ expect (lines[1 ][1 ]).toEqual value : ' @param' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' keyword.other.phpdoc.php' ]
2582+ expect (lines[1 ][2 ]).toEqual value : ' ' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2583+ expect (lines[1 ][3 ]).toEqual value : ' ?' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.operator.nullable-type.php' ]
2584+ expect (lines[1 ][4 ]).toEqual value : ' Test' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' support.class.php' ]
2585+ expect (lines[1 ][5 ]).toEqual value : ' description' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2586+
25642587 it ' should tokenize a single namespaced type' , ->
25652588 lines = grammar .tokenizeLines '''
25662589 /**
@@ -2588,6 +2611,21 @@ describe 'PHP grammar', ->
25882611 expect (lines[1 ][5 ]).toEqual value : ' Class' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' support.class.php' ]
25892612 expect (lines[1 ][6 ]).toEqual value : ' description' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
25902613
2614+ it ' should tokenize multiple nullable types' , ->
2615+ lines = grammar .tokenizeLines '''
2616+ /**
2617+ *@param ?int|?Class description
2618+ '''
2619+
2620+ expect (lines[1 ][1 ]).toEqual value : ' @param' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' keyword.other.phpdoc.php' ]
2621+ expect (lines[1 ][2 ]).toEqual value : ' ' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2622+ expect (lines[1 ][3 ]).toEqual value : ' ?' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.operator.nullable-type.php' ]
2623+ expect (lines[1 ][4 ]).toEqual value : ' int' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.other.type.php' ]
2624+ expect (lines[1 ][5 ]).toEqual value : ' |' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' punctuation.separator.delimiter.php' ]
2625+ expect (lines[1 ][6 ]).toEqual value : ' ?' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' keyword.operator.nullable-type.php' ]
2626+ expect (lines[1 ][7 ]).toEqual value : ' Class' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' , ' meta.other.type.phpdoc.php' , ' support.class.php' ]
2627+ expect (lines[1 ][8 ]).toEqual value : ' description' , scopes : [' source.php' , ' comment.block.documentation.phpdoc.php' ]
2628+
25912629 it ' should tokenize intersection types' , ->
25922630 lines = grammar .tokenizeLines '''
25932631 /**
0 commit comments