diff --git a/extensions/php-language-features/src/features/validationProvider.ts b/extensions/php-language-features/src/features/validationProvider.ts index bc8b7d25966..6a494b3231a 100644 --- a/extensions/php-language-features/src/features/validationProvider.ts +++ b/extensions/php-language-features/src/features/validationProvider.ts @@ -112,7 +112,9 @@ export default class PHPValidationProvider { vscode.workspace.onDidOpenTextDocument(this.triggerValidate, this, subscriptions); vscode.workspace.onDidCloseTextDocument((textDocument) => { this.diagnosticCollection!.delete(textDocument.uri); - delete this.delayers![textDocument.uri.toString()]; + if (this.delayers) { + delete this.delayers[textDocument.uri.toString()]; + } }, null, subscriptions); }