@@ -114,8 +114,6 @@ interface tagType {
114
114
function getTagType (
115
115
tag : Tag ,
116
116
) : tagType | null {
117
- const typeDeclarationsSupport = getMinPHPVersion ( ) ;
118
-
119
117
// https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration
120
118
const allowedTypes : { [ key : string ] : number } = {
121
119
self : 5.0 ,
@@ -134,11 +132,6 @@ function getTagType(
134
132
nullable : false ,
135
133
} ;
136
134
137
- // Type declarations disabled? Bail.
138
- if ( ! typeDeclarationsSupport ) {
139
- return null ;
140
- }
141
-
142
135
// No type info? Bail.
143
136
if ( ! tag . types ) {
144
137
return null ;
@@ -147,7 +140,7 @@ function getTagType(
147
140
const types = [ ...tag . types ] ;
148
141
149
142
// Handle nullable type.
150
- if ( types . length === 2 && typeDeclarationsSupport >= 7.1 ) {
143
+ if ( types . length === 2 ) {
151
144
if ( types [ 0 ] === 'null' ) {
152
145
types . splice ( 0 , 1 ) ;
153
146
typeData . nullable = true ;
@@ -195,7 +188,7 @@ function getTagType(
195
188
}
196
189
197
190
// Check the allowed types, ignoring unknown types such as class and interface names.
198
- if ( allowedTypes [ type ] && ( allowedTypes [ type ] > typeDeclarationsSupport ) ) {
191
+ if ( allowedTypes [ type ] ) {
199
192
return null ;
200
193
}
201
194
@@ -207,29 +200,9 @@ function getTagType(
207
200
function getReturnType (
208
201
tag : Tag ,
209
202
) : tagType | null {
210
- // Return type declarations require PHP 7 or higher.
211
- if ( getMinPHPVersion ( ) < 7 ) {
212
- return null ;
213
- }
214
-
215
203
return getTagType ( tag ) ;
216
204
}
217
205
218
- function getMinPHPVersion ( ) : number {
219
- const typeDeclarationsEnabled : boolean = vscode . workspace . getConfiguration ( extensionName ) . get ( 'typeDeclarations.enable' ) ?? true ;
220
- const typeDeclarationsSupportSetting : string = vscode . workspace . getConfiguration ( extensionName ) . get ( 'typeDeclarations.olderPhpVersionSupport' ) ?? '' ;
221
-
222
- if ( ! typeDeclarationsEnabled ) {
223
- return 0 ;
224
- }
225
-
226
- if ( ! typeDeclarationsSupportSetting || typeDeclarationsSupportSetting === 'None' ) {
227
- return 999 ;
228
- }
229
-
230
- return parseFloat ( typeDeclarationsSupportSetting ) ;
231
- }
232
-
233
206
interface contextualPosition {
234
207
symbol : vscode . DocumentSymbol | null ;
235
208
inNamespace : boolean ;
@@ -380,9 +353,8 @@ export function activate(
380
353
docblockLines . push ( ` * @return ${ params [ 0 ] . types ?. join ( '|' ) || '' } ${ params [ 0 ] . content } ` ) ;
381
354
} else {
382
355
const actionArgsString = snippetArgsString ? ` ${ snippetArgsString } ` : '' ;
383
- returnTypeString = ( getMinPHPVersion ( ) >= 7.1 ) ? ' : void' : '' ;
384
- snippetCallback = `(${ actionArgsString } )${ returnTypeString } {\n\t\${1}\n}` ;
385
- documentationCallback = `(${ docArgsString } )${ returnTypeString } {\n}` ;
356
+ snippetCallback = `(${ actionArgsString } ) : void {\n\t\${1}\n}` ;
357
+ documentationCallback = `(${ docArgsString } ) : void {\n}` ;
386
358
}
387
359
388
360
docblockLines . push ( ' */' ) ;
0 commit comments